From ac6c23bc6e14853032720b87fa4e127ff14c8ba9 Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 7 Sep 2023 14:57:57 +0200 Subject: [PATCH] fix(editorApi): expose save function Signed-off-by: Jonas --- src/components/Editor.vue | 4 ++++ src/editor.js | 4 ++++ src/services/SyncService.js | 1 + 3 files changed, 9 insertions(+) diff --git a/src/components/Editor.vue b/src/components/Editor.vue index 23dd275ee1d..74ea522670e 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -655,6 +655,10 @@ export default { this.emit('delete-image-node', imageUrl) }, + async save() { + await this.$syncService.save() + }, + async close() { if (this.currentSession && this.$syncService) { try { diff --git a/src/editor.js b/src/editor.js index 1294fee980d..001675d6656 100644 --- a/src/editor.js +++ b/src/editor.js @@ -81,6 +81,10 @@ class TextEditorEmbed { return this } + async save() { + return this.#vm.$children[0].save?.() + } + setShowOutline(value) { this.#vm.$set(this.#data, 'showOutlineOutside', value) return this diff --git a/src/services/SyncService.js b/src/services/SyncService.js index 8197ec8c2e9..bfa4c8f3c34 100644 --- a/src/services/SyncService.js +++ b/src/services/SyncService.js @@ -268,6 +268,7 @@ class SyncService { this.autosave.clear() } catch (e) { logger.error('Failed to save document.', { error: e }) + throw e } }