Skip to content

Commit

Permalink
fix: yjs duplicated import issue
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Trovic <[email protected]>
  • Loading branch information
luka-nextcloud committed Jul 17, 2023
1 parent 69e536d commit db21029
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/components/ViewerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
-->

<template>
<Editor :file-id="fileid"
:relative-path="filename"
:active="active"
:autofocus="autofocus"
:share-token="shareToken"
:mime="mime"
:show-outline-outside="showOutlineOutside" />
<div v-if="enabled">
<Editor :file-id="fileid"
:relative-path="filename"
:active="active"
:autofocus="autofocus"
:share-token="shareToken"
:mime="mime"
:show-outline-outside="showOutlineOutside" />
</div>
</template>

<script>
Expand Down Expand Up @@ -68,6 +70,21 @@ export default {
default: false,
},
},
data() {
return {
enabled: false,
}
},
mounted() {
if (!window.richWorkspaceEnabled) {
this.enabled = true
} else {
setTimeout(() => {
window['__ $YJS$ __'] = false
this.enabled = true
}, 1200)
}
},
}
</script>
<style lang="scss" scoped>
Expand Down
2 changes: 2 additions & 0 deletions src/views/RichWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default {
},
mounted() {
if (this.enabled) {
window.richWorkspaceEnabled = true
this.getFileInfo()
}
subscribe('Text::showRichWorkspace', this.showRichWorkspace)
Expand All @@ -105,6 +106,7 @@ export default {

},
beforeDestroy() {
window.richWorkspaceEnabled = false
unsubscribe('Text::showRichWorkspace', this.showRichWorkspace)
unsubscribe('Text::hideRichWorkspace', this.hideRichWorkspace)

Expand Down

0 comments on commit db21029

Please sign in to comment.