diff --git a/jupyter_ydoc/ydoc.py b/jupyter_ydoc/ydoc.py index 0063feb..2c81162 100644 --- a/jupyter_ydoc/ydoc.py +++ b/jupyter_ydoc/ydoc.py @@ -39,6 +39,15 @@ def dirty(self, value: bool) -> None: with self._ydoc.begin_transaction() as t: self._ystate.set(t, "dirty", value) + @property + def path(self) -> None: + return self._ystate["path"] + + @path.setter + def path(self, value: str) -> None: + with self._ydoc.begin_transaction() as t: + self._ystate.set(t, "path", value) + @abstractmethod def get(self): pass @@ -184,7 +193,7 @@ def set(self, value): self._ymeta.pop(t, key) if cells_len: self._ycells.delete_range(t, 0, cells_len) - for key in [k for k in self._ystate if k != "dirty"]: + for key in [k for k in self._ystate if k not in ("dirty", "path")]: self._ystate.pop(t, key) # initialize document