@zeedhi/zd-richtext-vue 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import Vue from 'vue';
2
- import { VersionService } from '@zeedhi/core';
2
+ import { I18n, VersionService } from '@zeedhi/core';
3
3
  import { PropWatch, ZdComponentRender, setFillHeight, Vuetify } from '@zeedhi/vuetify';
4
4
  import { Component } from 'vue-property-decorator';
5
5
  import { RichText } from '@zeedhi/zd-richtext-common';
@@ -55,14 +55,28 @@ let ZdRichText = class ZdRichText extends ZdComponentRender {
55
55
  OrderedList,
56
56
  ];
57
57
  this.instanceType = RichText;
58
+ this.componentKey = 1;
58
59
  }
59
60
  onKeyDown(event) {
60
61
  this.instance.onKeyDown(this.$el, event.key);
61
62
  }
63
+ changeLanguage() {
64
+ let newLanguage = I18n.instance.language.split('-')[0];
65
+ if (newLanguage === 'pt') {
66
+ newLanguage = 'ptbr';
67
+ }
68
+ this.tiptapVuetifyPlugin.vuetify.framework.lang.current = newLanguage;
69
+ this.componentKey += 1; // force update component render
70
+ }
62
71
  mounted() {
72
+ this.changeLanguage();
63
73
  if (this.instance.fillHeight) {
64
74
  setFillHeight(this.$el);
65
75
  }
76
+ I18n.registerChangeListener(this.changeLanguage);
77
+ }
78
+ destroyed() {
79
+ I18n.unregisterChangeListener(this.changeLanguage);
66
80
  }
67
81
  };
68
82
  __decorate([
@@ -276,6 +290,7 @@ var __vue_render__ = function () {
276
290
  },
277
291
  [
278
292
  _c("tiptap-vuetify", {
293
+ key: _vm.componentKey,
279
294
  attrs: {
280
295
  "output-format": _vm.instance.outputFormat,
281
296
  extensions: _vm.extensions,
@@ -320,7 +335,7 @@ __vue_render__._withStripped = true;
320
335
  /* style */
321
336
  const __vue_inject_styles__ = function (inject) {
322
337
  if (!inject) return
323
- inject("data-v-607b4853_0", { source: ".zd-rich-text button.v-btn {\n color: #ffffff !important;\n}\n.zd-rich-text-content.theme--dark {\n background-color: #383838;\n}\n.zd-rich-text .tiptap-vuetify-editor {\n height: 100%;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar header {\n background-color: var(--v-primary-base);\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
338
+ inject("data-v-1be7bc9e_0", { source: ".zd-rich-text button.v-btn {\n color: #ffffff !important;\n}\n.zd-rich-text-content.theme--dark {\n background-color: #383838;\n}\n.zd-rich-text .tiptap-vuetify-editor {\n height: 100%;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar header {\n background-color: var(--v-primary-base);\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
324
339
 
325
340
  };
326
341
  /* scoped */
@@ -58,14 +58,28 @@
58
58
  OrderedList,
59
59
  ];
60
60
  this.instanceType = zdRichtextCommon.RichText;
61
+ this.componentKey = 1;
61
62
  }
62
63
  onKeyDown(event) {
63
64
  this.instance.onKeyDown(this.$el, event.key);
64
65
  }
66
+ changeLanguage() {
67
+ let newLanguage = core.I18n.instance.language.split('-')[0];
68
+ if (newLanguage === 'pt') {
69
+ newLanguage = 'ptbr';
70
+ }
71
+ this.tiptapVuetifyPlugin.vuetify.framework.lang.current = newLanguage;
72
+ this.componentKey += 1; // force update component render
73
+ }
65
74
  mounted() {
75
+ this.changeLanguage();
66
76
  if (this.instance.fillHeight) {
67
77
  vuetify.setFillHeight(this.$el);
68
78
  }
79
+ core.I18n.registerChangeListener(this.changeLanguage);
80
+ }
81
+ destroyed() {
82
+ core.I18n.unregisterChangeListener(this.changeLanguage);
69
83
  }
70
84
  };
71
85
  __decorate([
@@ -279,6 +293,7 @@
279
293
  },
280
294
  [
281
295
  _c("tiptap-vuetify", {
296
+ key: _vm.componentKey,
282
297
  attrs: {
283
298
  "output-format": _vm.instance.outputFormat,
284
299
  extensions: _vm.extensions,
@@ -323,7 +338,7 @@
323
338
  /* style */
324
339
  const __vue_inject_styles__ = function (inject) {
325
340
  if (!inject) return
326
- inject("data-v-607b4853_0", { source: ".zd-rich-text button.v-btn {\n color: #ffffff !important;\n}\n.zd-rich-text-content.theme--dark {\n background-color: #383838;\n}\n.zd-rich-text .tiptap-vuetify-editor {\n height: 100%;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar header {\n background-color: var(--v-primary-base);\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
341
+ inject("data-v-1be7bc9e_0", { source: ".zd-rich-text button.v-btn {\n color: #ffffff !important;\n}\n.zd-rich-text-content.theme--dark {\n background-color: #383838;\n}\n.zd-rich-text .tiptap-vuetify-editor {\n height: 100%;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar header {\n background-color: var(--v-primary-base);\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
327
342
 
328
343
  };
329
344
  /* scoped */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-richtext-vue",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "RichTextVue by BVR",
5
5
  "main": "dist/rich-text-vue.umd.js",
6
6
  "module": "dist/rich-text-vue.esm.js",
@@ -24,5 +24,5 @@
24
24
  "vue-class-component": "7.2.*",
25
25
  "vue-property-decorator": "9.1.*"
26
26
  },
27
- "gitHead": "ac6a6374b42d111534189e0c8d4e3d1b52266b54"
27
+ "gitHead": "7f117f141fe0b7f61cc45217c9827d791a408705"
28
28
  }
@@ -14,5 +14,8 @@ export default class ZdRichText extends ZdComponentRender {
14
14
  instance: RichText;
15
15
  instanceType: typeof RichText;
16
16
  onKeyDown(event: KeyboardEvent): void;
17
+ componentKey: number;
18
+ changeLanguage(): void;
17
19
  mounted(): void;
20
+ destroyed(): void;
18
21
  }