From 507928730a897606f574022f33534cfc58b9a3ac Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 22 Mar 2020 18:58:27 -0400 Subject: [PATCH] feat: editor save conflict localization --- client/components/editor.vue | 4 +- .../components/editor/ckeditor/conflict.vue | 129 ++++++++++++++++++ client/components/editor/editor-ckeditor.vue | 18 ++- client/components/editor/editor-code.vue | 8 ++ .../editor/editor-modal-conflict.vue | 42 +++--- .../editor/editor-modal-unsaved.vue | 2 +- 6 files changed, 180 insertions(+), 23 deletions(-) create mode 100644 client/components/editor/ckeditor/conflict.vue diff --git a/client/components/editor.vue b/client/components/editor.vue index bc72daa2..1062a77c 100644 --- a/client/components/editor.vue +++ b/client/components/editor.vue @@ -203,7 +203,7 @@ export default { window.onbeforeunload = () => { if (!this.exitConfirmed && this.initContentParsed !== this.$store.get('editor/content')) { - return 'You have unsaved edits. Are you sure you want to leave the editor?' + return this.$t('editor:unsavedWarning') } else { return undefined } @@ -291,7 +291,7 @@ export default { }) if (_.get(conflictResp, 'data.pages.checkConflicts', false)) { this.$root.$emit('saveConflict') - throw new Error('Save conflict! Another user has already modified this page.') + throw new Error(this.$t('editor:conflict.warning')) } let resp = await this.$apollo.mutate({ diff --git a/client/components/editor/ckeditor/conflict.vue b/client/components/editor/ckeditor/conflict.vue new file mode 100644 index 00000000..a550b0f9 --- /dev/null +++ b/client/components/editor/ckeditor/conflict.vue @@ -0,0 +1,129 @@ + + + diff --git a/client/components/editor/editor-ckeditor.vue b/client/components/editor/editor-ckeditor.vue index abe34d7e..f08d5606 100644 --- a/client/components/editor/editor-ckeditor.vue +++ b/client/components/editor/editor-ckeditor.vue @@ -9,15 +9,20 @@ v-spacer .caption Visual Editor v-spacer - .caption {{stats.characters}} Chars, {{stats.words}} Words + .caption {{$t('editor:ckeditor.stats', { chars: stats.characters, words: stats.words })}} + editor-conflict(v-model='isConflict', v-if='isConflict')