Skip to content

Commit 6dcc9ec

Browse files
Merge pull request #81 from jupyter-server/path
Add path document attribute
2 parents fb09c48 + bc29be1 commit 6dcc9ec

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

jupyter_ydoc/ydoc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ def dirty(self, value: bool) -> None:
3939
with self._ydoc.begin_transaction() as t:
4040
self._ystate.set(t, "dirty", value)
4141

42+
@property
43+
def path(self) -> None:
44+
return self._ystate.get("path")
45+
46+
@path.setter
47+
def path(self, value: str) -> None:
48+
with self._ydoc.begin_transaction() as t:
49+
self._ystate.set(t, "path", value)
50+
4251
@abstractmethod
4352
def get(self):
4453
pass
@@ -185,7 +194,7 @@ def set(self, value):
185194
self._ymeta.pop(t, key)
186195
if cells_len:
187196
self._ycells.delete_range(t, 0, cells_len)
188-
for key in [k for k in self._ystate if k != "dirty"]:
197+
for key in [k for k in self._ystate if k not in ("dirty", "path")]:
189198
self._ystate.pop(t, key)
190199

191200
# initialize document

0 commit comments

Comments
 (0)