From 97a374fd8453213a71b56f211d09b3d389c304a5 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Tue, 28 May 2019 12:46:52 -0300 Subject: [PATCH] Fix placeholder text not translating bug - tiptap-extensions are not reactive - we must call a method to change them dynamically - emit changeLanguage event, which is listened for by the Editor component, which then calls a method to set the emptyNodeText of tiptap --- webapp/components/Editor/index.vue | 8 ++++++++ webapp/components/LocaleSwitch.vue | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/webapp/components/Editor/index.vue b/webapp/components/Editor/index.vue index ac1391a42..ca6ee4779 100644 --- a/webapp/components/Editor/index.vue +++ b/webapp/components/Editor/index.vue @@ -327,10 +327,18 @@ export default { }, }, }, + mounted() { + this.$root.$on('changeLanguage', () => { + this.changePlaceHolderText() + }) + }, beforeDestroy() { this.editor.destroy() }, methods: { + changePlaceHolderText() { + this.editor.extensions.options.placeholder.emptyNodeText = this.$t('editor.placeholder') + }, // navigate to the previous item // if it's the first item, navigate to the last one upHandler() { diff --git a/webapp/components/LocaleSwitch.vue b/webapp/components/LocaleSwitch.vue index a00f38109..840990c19 100644 --- a/webapp/components/LocaleSwitch.vue +++ b/webapp/components/LocaleSwitch.vue @@ -14,7 +14,8 @@ {{ current.code.toUpperCase() }} + /> + {{ current.code.toUpperCase() }}