diff options
author | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-05-31 22:15:50 +0300 |
---|---|---|
committer | Jonas <jonas@freesources.org> | 2022-07-06 14:45:54 +0300 |
commit | cbe5ae4861f07f00e74ca3f1ad9fb9948bb23dd5 (patch) | |
tree | de180f2b5e114a6d796914b8872b3ce3ea664e45 | |
parent | 6313ca0d3956608f573241b2f721ab33beba258c (diff) |
🧑💻 (#2462): proxy some sync service events
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
-rw-r--r-- | src/components/EditorWrapper.vue | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index 1a3a9b532..c9b9aff78 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -372,6 +372,7 @@ export default { .on('error', this.onError) .on('stateChange', this.onStateChange) .on('idle', this.onIdle) + .on('save', this.onSave) }, unlistenSyncServiceEvents() { @@ -383,6 +384,7 @@ export default { .off('error', this.onError) .off('stateChange', this.onStateChange) .off('idle', this.onIdle) + .off('save', this.onSave) }, resolveUseThisVersion() { @@ -630,6 +632,9 @@ export default { }) this.$syncService.state = this.$editor.state this.updateLastSavedStatus() + this.$nextTick(() => { + this.$emit('sync-service:sync') + }) } catch (e) { console.error('Failed to update steps in collaboration plugin', e) // TODO: we should recreate the editing session when this happens @@ -639,6 +644,11 @@ export default { onError({ type, data }) { this.$editor.setOptions({ editable: false }) + + this.$nextTick(() => { + this.$emit('sync-service:error') + }) + if (type === ERROR_TYPE.SAVE_COLLISSION && (!this.syncError || this.syncError.type !== ERROR_TYPE.SAVE_COLLISSION)) { this.contentLoaded = true this.syncError = { @@ -667,6 +677,7 @@ export default { this.$editor.commands.focus() } this.$emit('ready') + // TODO: remove $parent access this.$parent.$emit('ready', true) } if (Object.prototype.hasOwnProperty.call(state, 'dirty')) { @@ -679,6 +690,16 @@ export default { this.idle = true this.readOnly = true this.$editor.setOptions({ editable: !this.readOnly }) + + this.$nextTick(() => { + this.$emit('sync-service:idle') + }) + }, + + onSave() { + this.$nextTick(() => { + this.$emit('sync-service:save') + }) }, async close() { |