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 25, 2022
1 parent d08ee43 commit bc29be1
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.get("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 bc29be1

Please sign in to comment.