Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
881ce5b
chore(migrate): useEditorMixin to useEditor composable
max-nextcloud Jun 16, 2025
8d998f0
chore(migrate): setContent mixin...
max-nextcloud Jun 17, 2025
13a5ce1
chore(migrate): to useEditorFlags composable
max-nextcloud Jun 18, 2025
d958a4d
chore(cleanup): fix small review remarks
max-nextcloud Jun 18, 2025
b0790dc
chore(migrate): use.find instead of deprecated .contains
max-nextcloud Jun 19, 2025
8b4e635
enh(editor): store session in separate extension
max-nextcloud Jun 20, 2025
9d3cc87
chore(refactor): configure mention in rich text extension
max-nextcloud Jun 20, 2025
c4f863f
chore(types): collaborationCursor extension to typescript
max-nextcloud Jun 20, 2025
354ad41
chore(simplify): rely on updateUser command
max-nextcloud Jun 20, 2025
022e483
chore(simplify): replace computed fileExtension with temp
max-nextcloud Jun 20, 2025
0809c8e
enh(code): start to load syntax highlighting during setup
max-nextcloud Jun 20, 2025
b326875
chore(refactor): load editor in mounted
max-nextcloud Jun 20, 2025
3e5cfd8
chore(refactor): create editor in created instead of mounted
max-nextcloud Jun 26, 2025
ab26032
chore(refactor): create ydoc in setup
max-nextcloud Jun 26, 2025
2831462
fix(character-count): always provide the current editors doc
max-nextcloud Jun 26, 2025
d7df4c0
fix(character-count): use the NcActionTexts name prop
max-nextcloud Jun 26, 2025
e24d90a
fix(loading): only show main container when content loaded
max-nextcloud Jun 26, 2025
0d5f4f7
fix(mention): use shallowRef for connection
max-nextcloud Jun 27, 2025
057a682
fix(load): create initial YjsState with dir
max-nextcloud Jun 27, 2025
fae62fc
chore(refactor): extract useEditor into its own file
max-nextcloud Jun 28, 2025
17f0d62
chore(refactor): extract useEditorFlags into its own file
max-nextcloud Jun 28, 2025
90b1d84
test(RichTextReader): basic test
max-nextcloud Jun 28, 2025
fabc79e
test(RichTextReader): update content
max-nextcloud Jun 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(refactor): create ydoc in setup
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Jun 28, 2025
commit ab260329130a8837478c2e6649bf6c276f004382
21 changes: 11 additions & 10 deletions src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export default {
const maxWidth = Math.floor(value) - 36
el.value.style.setProperty('--widget-full-width', `${maxWidth}px`)
})
const ydoc = new Doc()
const hasConnectionIssue = ref(false)
const { delayed: requireReconnect } = useDelayedFlag(hasConnectionIssue)
const { editor } = provideEditor()
Expand All @@ -257,6 +258,7 @@ export default {
isRichWorkspace,
language,
lowlightLoaded,
ydoc,
}
},

Expand Down Expand Up @@ -378,9 +380,8 @@ export default {
exposeForDebugging(this)
},
created() {
this.$ydoc = new Doc()
// The following can be useful for debugging ydoc updates
// this.$ydoc.on('update', function(update, origin, doc, tr) {
// this.ydoc.on('update', function(update, origin, doc, tr) {
// console.debug('ydoc update', update, origin, doc, tr)
// Y.logUpdate(update)
// });
Expand All @@ -391,7 +392,7 @@ export default {
this.initSession()
const extensions = [
Autofocus.configure({ fileId: this.fileId }),
Collaboration.configure({ document: this.$ydoc }),
Collaboration.configure({ document: this.ydoc }),
CollaborationCursor.configure({ provider: this.$providers[0] }),
Session,
]
Expand Down Expand Up @@ -447,13 +448,13 @@ export default {
)
: (content) =>
serializePlainText(content ?? this.editor?.state.doc),
getDocumentState: () => getDocumentState(this.$ydoc),
getDocumentState: () => getDocumentState(this.ydoc),
})

this.listenSyncServiceEvents()

const syncServiceProvider = createSyncServiceProvider({
ydoc: this.$ydoc,
ydoc: this.ydoc,
syncService: this.$syncService,
fileId: this.fileId,
initialSession: this.initialSession,
Expand Down Expand Up @@ -591,7 +592,7 @@ export default {
this.lowlightLoaded.then(() => {
this.$syncService.startSync()
if (!documentState) {
setInitialYjsState(this.$ydoc, documentSource, {
setInitialYjsState(this.ydoc, documentSource, {
isRichEditor: this.isRichEditor,
})
}
Expand All @@ -606,7 +607,7 @@ export default {
? session.displayName
: session?.guestName || t('text', 'Guest'),
color: session?.color,
clientId: this.$ydoc.clientID,
clientId: this.ydoc.clientID,
}
this.editor.commands.setSession(this.currentSession)
this.editor.commands.updateUser(user)
Expand Down Expand Up @@ -842,12 +843,12 @@ export default {
const yjsData = {
fileId: this.fileId,
filePath: this.relativePath,
clientId: this.$ydoc.clientID,
pendingStructs: this.$ydoc.store.pendingStructs,
clientId: this.ydoc.clientID,
pendingStructs: this.ydoc.store.pendingStructs,
clientVectors: [],
documentState: this.$syncService?.getDocumentState(),
}
for (const client of this.$ydoc.store.clients.values()) {
for (const client of this.ydoc.store.clients.values()) {
yjsData.clientVectors.push(client.at(-1).id)
}

Expand Down