|
|
@ -24,6 +24,7 @@ |
|
|
|
cur_tab_deregister_on_save, |
|
|
|
cur_tab_deregister_on_save, |
|
|
|
cur_tab_branch_class |
|
|
|
cur_tab_branch_class |
|
|
|
} from "../tab"; |
|
|
|
} from "../tab"; |
|
|
|
|
|
|
|
import { t } from "svelte-i18n"; |
|
|
|
|
|
|
|
|
|
|
|
import * as Y from 'yjs' |
|
|
|
import * as Y from 'yjs' |
|
|
|
// @ts-ignore |
|
|
|
// @ts-ignore |
|
|
@ -38,6 +39,8 @@ |
|
|
|
const ydoc = new Y.Doc() |
|
|
|
const ydoc = new Y.Doc() |
|
|
|
const yxml = ydoc.getXmlFragment('ng') |
|
|
|
const yxml = ydoc.getXmlFragment('ng') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let view; |
|
|
|
|
|
|
|
|
|
|
|
ydoc.on('update', async (update, origin) => { |
|
|
|
ydoc.on('update', async (update, origin) => { |
|
|
|
console.log(update,origin); |
|
|
|
console.log(update,origin); |
|
|
|
if (!origin.local) { |
|
|
|
if (!origin.local) { |
|
|
@ -82,6 +85,8 @@ |
|
|
|
for (const h of history) { |
|
|
|
for (const h of history) { |
|
|
|
Y.applyUpdate(ydoc, h.YXml, {local:true}) |
|
|
|
Y.applyUpdate(ydoc, h.YXml, {local:true}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
view.focus() |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
onDestroy(()=>{ |
|
|
|
onDestroy(()=>{ |
|
|
@ -94,6 +99,8 @@ |
|
|
|
className="prosemirror-editor" |
|
|
|
className="prosemirror-editor" |
|
|
|
{editorState} |
|
|
|
{editorState} |
|
|
|
debounceChangeEventsInterval=2000 |
|
|
|
debounceChangeEventsInterval=2000 |
|
|
|
|
|
|
|
placeholder={$t("doc.type_your_text_here")} |
|
|
|
|
|
|
|
bind:view={view} |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |