Skip to content

Commit

Permalink
Add path document attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Oct 24, 2022
1 parent d08ee43 commit 8af6d1c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion jupyter_ydoc/ydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8af6d1c

Please sign in to comment.