@tinymce/tinymce-vue 4.0.5 → 4.0.6-feature.20220209063005537.sha2579744

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 4.0.6 - TBD
8
+ ### Added
9
+ - Exposed method `rerender(initObject)` to change the editor configuration
10
+ - Watcher for tag name
11
+
7
12
  ## 4.0.5 - 2021-11-22
8
13
  ### Added
9
14
  - Correct proptypes
@@ -268,7 +268,8 @@ var Editor = (function (vue) {
268
268
  var Editor = vue.defineComponent({
269
269
  props: editorProps,
270
270
  setup: function (props, ctx) {
271
- var _a = vue.toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue;
271
+ var conf = props.init ? __assign({}, props.init) : {};
272
+ var _a = vue.toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue, tagName = _a.tagName;
272
273
  var element = vue.ref(null);
273
274
  var vueEditor = null;
274
275
  var elementId = props.id || uuid('tiny-vue');
@@ -282,11 +283,11 @@ var Editor = (function (vue) {
282
283
  function () { return isMounting ? initialValue : cache; }; };
283
284
  var initWrapper = function () {
284
285
  var content = getContent(mounting);
285
- var finalInit = __assign(__assign({}, props.init), { readonly: props.disabled, selector: "#" + elementId, plugins: mergePlugins(props.init && props.init.plugins, props.plugins), toolbar: props.toolbar || (props.init && props.init.toolbar), inline: inlineEditor, setup: function (editor) {
286
+ var finalInit = __assign(__assign({}, conf), { readonly: props.disabled, selector: "#" + elementId, plugins: mergePlugins(conf.plugins, props.plugins), toolbar: props.toolbar || (conf.toolbar), inline: inlineEditor, setup: function (editor) {
286
287
  vueEditor = editor;
287
288
  editor.on('init', function (e) { return initEditor(e, props, ctx, editor, modelValue, content); });
288
- if (props.init && typeof props.init.setup === 'function') {
289
- props.init.setup(editor);
289
+ if (typeof conf.setup === 'function') {
290
+ conf.setup(editor);
290
291
  }
291
292
  } });
292
293
  if (isTextarea(element.value)) {
@@ -300,6 +301,14 @@ var Editor = (function (vue) {
300
301
  vueEditor.setMode(disable ? 'readonly' : 'design');
301
302
  }
302
303
  });
304
+ vue.watch(tagName, function (tagName) {
305
+ var _a;
306
+ if (!modelBind) {
307
+ cache = vueEditor.getContent();
308
+ }
309
+ (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
310
+ vue.nextTick(function () { return initWrapper(); });
311
+ });
303
312
  vue.onMounted(function () {
304
313
  if (getTinymce() !== null) {
305
314
  initWrapper();
@@ -332,6 +341,16 @@ var Editor = (function (vue) {
332
341
  (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
333
342
  });
334
343
  }
344
+ var rerender = function (init) {
345
+ var _a;
346
+ cache = vueEditor.getContent();
347
+ (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
348
+ conf = __assign(__assign({}, conf), init);
349
+ vue.nextTick(function () { return initWrapper(); });
350
+ };
351
+ ctx.expose({
352
+ rerender: rerender
353
+ });
335
354
  return function () { return inlineEditor ?
336
355
  renderInline(vue.h, elementId, element, props.tagName) :
337
356
  renderIframe(vue.h, elementId, element); };
@@ -1 +1 @@
1
- var Editor=function(a){"use strict";function n(n){return-1!==e.map(function(n){return n.toLowerCase()}).indexOf(n.toLowerCase())}function t(){return{listeners:[],scriptId:S("tiny-script"),scriptLoaded:!1}}function m(){var n="undefined"!=typeof window?window:global;return n&&n.tinymce?n.tinymce:null}var o,y=function(){return(y=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)},e=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],g=function(e,o,i){Object.keys(o).filter(n).forEach(function(n){var t=o[n];"function"==typeof t&&("onInit"===n?t(e,i):i.on(n.substring(2),function(n){return t(n,i)}))})},C=function(e,n,o,t){var i=e.modelEvents||null,i=Array.isArray(i)?i.join(" "):i;a.watch(t,function(n,t){o&&"string"==typeof n&&n!==t&&n!==o.getContent({format:e.outputFormat})&&o.setContent(n)}),o.on(i||"change input undo redo",function(){n.emit("update:modelValue",o.getContent({format:e.outputFormat}))})},i=0,S=function(n){var t=Date.now();return n+"_"+Math.floor(1e9*Math.random())+ ++i+String(t)},h=function(n){return void 0===n||""===n?[]:Array.isArray(n)?n:n.split(" ")},b=(o=t(),{load:function(n,t,e){o.scriptLoaded?e():(o.listeners.push(e),n.getElementById(o.scriptId)||function(n,t,e,o){var i=t.createElement("script");i.referrerPolicy="origin",i.type="application/javascript",i.id=n,i.src=e;function r(){i.removeEventListener("load",r),o()}i.addEventListener("load",r),t.head&&t.head.appendChild(i)}(o.scriptId,n,t,function(){o.listeners.forEach(function(n){return n()}),o.scriptLoaded=!0}))},reinitialize:function(){o=t()}}),r={apiKey:String,cloudChannel:String,id:String,init:Object,initialValue:String,inline:Boolean,modelEvents:[String,Array],plugins:[String,Array],tagName:String,toolbar:[String,Array],modelValue:String,disabled:Boolean,tinymceScriptSrc:String,outputFormat:{type:String,validator:function(n){return"html"===n||"text"===n}}};return a.defineComponent({props:r,setup:function(u,l){function e(){var n,t,a=(n=f,d?function(){return null!=c&&c.value?c.value:""}:function(){return n?p:v}),e=y(y({},u.init),{readonly:u.disabled,selector:"#"+r,plugins:(e=u.init&&u.init.plugins,t=u.plugins,h(e).concat(h(t))),toolbar:u.toolbar||u.init&&u.init.toolbar,inline:s,setup:function(r){(i=r).on("init",function(n){return t=n,e=u,o=l,i=c,(n=r).setContent(a()),o.attrs["onUpdate:modelValue"]&&C(e,o,n,i),void g(t,o.attrs,n);var t,e,o,i}),u.init&&"function"==typeof u.init.setup&&u.init.setup(r)}});null!==(t=o.value)&&"textarea"===t.tagName.toLowerCase()&&(o.value.style.visibility=""),m().init(e),f=!1}var n=a.toRefs(u),t=n.disabled,c=n.modelValue,o=a.ref(null),i=null,r=u.id||S("tiny-vue"),s=u.init&&u.init.inline||u.inline,d=!!l.attrs["onUpdate:modelValue"],f=!0,p=u.initialValue||"",v="";return a.watch(t,function(n){null!==i&&i.setMode(n?"readonly":"design")}),a.onMounted(function(){var n,t;null!==m()?e():o.value&&o.value.ownerDocument&&(t=u.cloudChannel||"5",n=u.apiKey||"no-api-key",t=null==u.tinymceScriptSrc?"https://cdn.tiny.cloud/1/"+n+"/tinymce/"+t+"/tinymce.min.js":u.tinymceScriptSrc,b.load(o.value.ownerDocument,t,e))}),a.onBeforeUnmount(function(){null!==m()&&m().remove(i)}),s||(a.onActivated(function(){f||e()}),a.onDeactivated(function(){var n;d||(v=i.getContent()),null!==(n=m())&&void 0!==n&&n.remove(i)})),function(){return s?(n=a.h,t=o,e=u.tagName,n(e||"div",{id:r,ref:t})):(0,a.h)("textarea",{id:r,visibility:"hidden",ref:o});var n,t,e}}})}(Vue);
1
+ var Editor=function(a){"use strict";function n(n){return-1!==t.map(function(n){return n.toLowerCase()}).indexOf(n.toLowerCase())}function e(){return{listeners:[],scriptId:h("tiny-script"),scriptLoaded:!1}}function g(){var n="undefined"!=typeof window?window:global;return n&&n.tinymce?n.tinymce:null}var o,y=function(){return(y=Object.assign||function(n){for(var e,t=1,o=arguments.length;t<o;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}).apply(this,arguments)},t=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],C=function(t,o,i){Object.keys(o).filter(n).forEach(function(n){var e=o[n];"function"==typeof e&&("onInit"===n?e(t,i):i.on(n.substring(2),function(n){return e(n,i)}))})},S=function(t,n,o,e){var i=t.modelEvents||null,i=Array.isArray(i)?i.join(" "):i;a.watch(e,function(n,e){o&&"string"==typeof n&&n!==e&&n!==o.getContent({format:t.outputFormat})&&o.setContent(n)}),o.on(i||"change input undo redo",function(){n.emit("update:modelValue",o.getContent({format:t.outputFormat}))})},i=0,h=function(n){var e=Date.now();return n+"_"+Math.floor(1e9*Math.random())+ ++i+String(e)},b=function(n){return void 0===n||""===n?[]:Array.isArray(n)?n:n.split(" ")},w=(o=e(),{load:function(n,e,t){o.scriptLoaded?t():(o.listeners.push(t),n.getElementById(o.scriptId)||function(n,e,t,o){var i=e.createElement("script");i.referrerPolicy="origin",i.type="application/javascript",i.id=n,i.src=t;function r(){i.removeEventListener("load",r),o()}i.addEventListener("load",r),e.head&&e.head.appendChild(i)}(o.scriptId,n,e,function(){o.listeners.forEach(function(n){return n()}),o.scriptLoaded=!0}))},reinitialize:function(){o=e()}}),r={apiKey:String,cloudChannel:String,id:String,init:Object,initialValue:String,inline:Boolean,modelEvents:[String,Array],plugins:[String,Array],tagName:String,toolbar:[String,Array],modelValue:String,disabled:Boolean,tinymceScriptSrc:String,outputFormat:{type:String,validator:function(n){return"html"===n||"text"===n}}};return a.defineComponent({props:r,setup:function(u,l){function t(){var n,e,a=(n=p,f?function(){return null!=c&&c.value?c.value:""}:function(){return n?v:m}),t=y(y({},o),{readonly:u.disabled,selector:"#"+r,plugins:(t=o.plugins,e=u.plugins,b(t).concat(b(e))),toolbar:u.toolbar||o.toolbar,inline:s,setup:function(r){(d=r).on("init",function(n){return e=n,t=u,o=l,i=c,(n=r).setContent(a()),o.attrs["onUpdate:modelValue"]&&S(t,o,n,i),void C(e,o.attrs,n);var e,t,o,i}),"function"==typeof o.setup&&o.setup(r)}});null!==(e=i.value)&&"textarea"===e.tagName.toLowerCase()&&(i.value.style.visibility=""),g().init(t),p=!1}var o=u.init?y({},u.init):{},n=a.toRefs(u),e=n.disabled,c=n.modelValue,n=n.tagName,i=a.ref(null),d=null,r=u.id||h("tiny-vue"),s=u.init&&u.init.inline||u.inline,f=!!l.attrs["onUpdate:modelValue"],p=!0,v=u.initialValue||"",m="";a.watch(e,function(n){null!==d&&d.setMode(n?"readonly":"design")}),a.watch(n,function(n){var e;f||(m=d.getContent()),null!==(e=g())&&void 0!==e&&e.remove(d),a.nextTick(t)}),a.onMounted(function(){var n,e;null!==g()?t():i.value&&i.value.ownerDocument&&(e=u.cloudChannel||"5",n=u.apiKey||"no-api-key",e=null==u.tinymceScriptSrc?"https://cdn.tiny.cloud/1/"+n+"/tinymce/"+e+"/tinymce.min.js":u.tinymceScriptSrc,w.load(i.value.ownerDocument,e,t))}),a.onBeforeUnmount(function(){null!==g()&&g().remove(d)}),s||(a.onActivated(function(){p||t()}),a.onDeactivated(function(){var n;f||(m=d.getContent()),null!==(n=g())&&void 0!==n&&n.remove(d)}));return l.expose({rerender:function(n){var e;m=d.getContent(),null!==(e=g())&&void 0!==e&&e.remove(d),o=y(y({},o),n),a.nextTick(t)}}),function(){return s?(n=a.h,e=i,t=u.tagName,n(t||"div",{id:r,ref:e})):(0,a.h)("textarea",{id:r,visibility:"hidden",ref:i});var n,e,t}}})}(Vue);
@@ -5,37 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export declare const Editor: import("vue").DefineComponent<import("./EditorPropTypes").CopyProps<import("./EditorPropTypes").IPropTypes>, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
9
- apiKey?: unknown;
10
- cloudChannel?: unknown;
11
- id?: unknown;
12
- init?: unknown;
13
- initialValue?: unknown;
14
- outputFormat?: unknown;
15
- inline?: unknown;
16
- modelEvents?: unknown;
17
- plugins?: unknown;
18
- tagName?: unknown;
19
- toolbar?: unknown;
20
- modelValue?: unknown;
21
- disabled?: unknown;
22
- tinymceScriptSrc?: unknown;
23
- } & {
24
- apiKey: any;
25
- cloudChannel: any;
26
- id: any;
27
- init: any;
28
- initialValue: any;
29
- outputFormat: any;
30
- inline: any;
31
- modelEvents: any;
32
- plugins: any;
33
- tagName: any;
34
- toolbar: any;
35
- modelValue: any;
36
- disabled: any;
37
- tinymceScriptSrc: any;
38
- } & {}> & {}, {
8
+ export declare const Editor: import("vue").DefineComponent<import("./EditorPropTypes").CopyProps<import("./EditorPropTypes").IPropTypes>, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./EditorPropTypes").CopyProps<import("./EditorPropTypes").IPropTypes>>>, {
39
9
  apiKey: any;
40
10
  cloudChannel: any;
41
11
  id: any;
@@ -40,7 +40,8 @@ var renderIframe = function (ce, id, elementRef) {
40
40
  exports.Editor = vue_1.defineComponent({
41
41
  props: EditorPropTypes_1.editorProps,
42
42
  setup: function (props, ctx) {
43
- var _a = vue_1.toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue;
43
+ var conf = props.init ? __assign({}, props.init) : {};
44
+ var _a = vue_1.toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue, tagName = _a.tagName;
44
45
  var element = vue_1.ref(null);
45
46
  var vueEditor = null;
46
47
  var elementId = props.id || Utils_1.uuid('tiny-vue');
@@ -54,11 +55,11 @@ exports.Editor = vue_1.defineComponent({
54
55
  function () { return isMounting ? initialValue : cache; }; };
55
56
  var initWrapper = function () {
56
57
  var content = getContent(mounting);
57
- var finalInit = __assign(__assign({}, props.init), { readonly: props.disabled, selector: "#" + elementId, plugins: Utils_1.mergePlugins(props.init && props.init.plugins, props.plugins), toolbar: props.toolbar || (props.init && props.init.toolbar), inline: inlineEditor, setup: function (editor) {
58
+ var finalInit = __assign(__assign({}, conf), { readonly: props.disabled, selector: "#" + elementId, plugins: Utils_1.mergePlugins(conf.plugins, props.plugins), toolbar: props.toolbar || (conf.toolbar), inline: inlineEditor, setup: function (editor) {
58
59
  vueEditor = editor;
59
60
  editor.on('init', function (e) { return Utils_1.initEditor(e, props, ctx, editor, modelValue, content); });
60
- if (props.init && typeof props.init.setup === 'function') {
61
- props.init.setup(editor);
61
+ if (typeof conf.setup === 'function') {
62
+ conf.setup(editor);
62
63
  }
63
64
  } });
64
65
  if (Utils_1.isTextarea(element.value)) {
@@ -72,6 +73,14 @@ exports.Editor = vue_1.defineComponent({
72
73
  vueEditor.setMode(disable ? 'readonly' : 'design');
73
74
  }
74
75
  });
76
+ vue_1.watch(tagName, function (tagName) {
77
+ var _a;
78
+ if (!modelBind) {
79
+ cache = vueEditor.getContent();
80
+ }
81
+ (_a = TinyMCE_1.getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
82
+ vue_1.nextTick(function () { return initWrapper(); });
83
+ });
75
84
  vue_1.onMounted(function () {
76
85
  if (TinyMCE_1.getTinymce() !== null) {
77
86
  initWrapper();
@@ -104,6 +113,16 @@ exports.Editor = vue_1.defineComponent({
104
113
  (_a = TinyMCE_1.getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
105
114
  });
106
115
  }
116
+ var rerender = function (init) {
117
+ var _a;
118
+ cache = vueEditor.getContent();
119
+ (_a = TinyMCE_1.getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
120
+ conf = __assign(__assign({}, conf), init);
121
+ vue_1.nextTick(function () { return initWrapper(); });
122
+ };
123
+ ctx.expose({
124
+ rerender: rerender
125
+ });
107
126
  return function () { return inlineEditor ?
108
127
  renderInline(vue_1.h, elementId, element, props.tagName) :
109
128
  renderIframe(vue_1.h, elementId, element); };
@@ -5,37 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export declare const Editor: import("vue").DefineComponent<import("./EditorPropTypes").CopyProps<import("./EditorPropTypes").IPropTypes>, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
9
- apiKey?: unknown;
10
- cloudChannel?: unknown;
11
- id?: unknown;
12
- init?: unknown;
13
- initialValue?: unknown;
14
- outputFormat?: unknown;
15
- inline?: unknown;
16
- modelEvents?: unknown;
17
- plugins?: unknown;
18
- tagName?: unknown;
19
- toolbar?: unknown;
20
- modelValue?: unknown;
21
- disabled?: unknown;
22
- tinymceScriptSrc?: unknown;
23
- } & {
24
- apiKey: any;
25
- cloudChannel: any;
26
- id: any;
27
- init: any;
28
- initialValue: any;
29
- outputFormat: any;
30
- inline: any;
31
- modelEvents: any;
32
- plugins: any;
33
- tagName: any;
34
- toolbar: any;
35
- modelValue: any;
36
- disabled: any;
37
- tinymceScriptSrc: any;
38
- } & {}> & {}, {
8
+ export declare const Editor: import("vue").DefineComponent<import("./EditorPropTypes").CopyProps<import("./EditorPropTypes").IPropTypes>, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./EditorPropTypes").CopyProps<import("./EditorPropTypes").IPropTypes>>>, {
39
9
  apiKey: any;
40
10
  cloudChannel: any;
41
11
  id: any;
@@ -20,7 +20,7 @@ import { ScriptLoader } from '../ScriptLoader';
20
20
  import { getTinymce } from '../TinyMCE';
21
21
  import { isTextarea, mergePlugins, uuid, isNullOrUndefined, initEditor } from '../Utils';
22
22
  import { editorProps } from './EditorPropTypes';
23
- import { h, defineComponent, onMounted, ref, toRefs, watch, onBeforeUnmount, onActivated, onDeactivated } from 'vue';
23
+ import { h, defineComponent, onMounted, ref, toRefs, nextTick, watch, onBeforeUnmount, onActivated, onDeactivated } from 'vue';
24
24
  var renderInline = function (ce, id, elementRef, tagName) {
25
25
  return ce(tagName ? tagName : 'div', {
26
26
  id: id,
@@ -37,7 +37,8 @@ var renderIframe = function (ce, id, elementRef) {
37
37
  export var Editor = defineComponent({
38
38
  props: editorProps,
39
39
  setup: function (props, ctx) {
40
- var _a = toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue;
40
+ var conf = props.init ? __assign({}, props.init) : {};
41
+ var _a = toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue, tagName = _a.tagName;
41
42
  var element = ref(null);
42
43
  var vueEditor = null;
43
44
  var elementId = props.id || uuid('tiny-vue');
@@ -51,11 +52,11 @@ export var Editor = defineComponent({
51
52
  function () { return isMounting ? initialValue : cache; }; };
52
53
  var initWrapper = function () {
53
54
  var content = getContent(mounting);
54
- var finalInit = __assign(__assign({}, props.init), { readonly: props.disabled, selector: "#" + elementId, plugins: mergePlugins(props.init && props.init.plugins, props.plugins), toolbar: props.toolbar || (props.init && props.init.toolbar), inline: inlineEditor, setup: function (editor) {
55
+ var finalInit = __assign(__assign({}, conf), { readonly: props.disabled, selector: "#" + elementId, plugins: mergePlugins(conf.plugins, props.plugins), toolbar: props.toolbar || (conf.toolbar), inline: inlineEditor, setup: function (editor) {
55
56
  vueEditor = editor;
56
57
  editor.on('init', function (e) { return initEditor(e, props, ctx, editor, modelValue, content); });
57
- if (props.init && typeof props.init.setup === 'function') {
58
- props.init.setup(editor);
58
+ if (typeof conf.setup === 'function') {
59
+ conf.setup(editor);
59
60
  }
60
61
  } });
61
62
  if (isTextarea(element.value)) {
@@ -69,6 +70,14 @@ export var Editor = defineComponent({
69
70
  vueEditor.setMode(disable ? 'readonly' : 'design');
70
71
  }
71
72
  });
73
+ watch(tagName, function (tagName) {
74
+ var _a;
75
+ if (!modelBind) {
76
+ cache = vueEditor.getContent();
77
+ }
78
+ (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
79
+ nextTick(function () { return initWrapper(); });
80
+ });
72
81
  onMounted(function () {
73
82
  if (getTinymce() !== null) {
74
83
  initWrapper();
@@ -101,6 +110,16 @@ export var Editor = defineComponent({
101
110
  (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
102
111
  });
103
112
  }
113
+ var rerender = function (init) {
114
+ var _a;
115
+ cache = vueEditor.getContent();
116
+ (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
117
+ conf = __assign(__assign({}, conf), init);
118
+ nextTick(function () { return initWrapper(); });
119
+ };
120
+ ctx.expose({
121
+ rerender: rerender
122
+ });
104
123
  return function () { return inlineEditor ?
105
124
  renderInline(h, elementId, element, props.tagName) :
106
125
  renderIframe(h, elementId, element); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinymce/tinymce-vue",
3
- "version": "4.0.5",
3
+ "version": "4.0.6-feature.20220209063005537.sha2579744",
4
4
  "description": "Official TinyMCE Vue 3 Component",
5
5
  "private": false,
6
6
  "repository": {
@@ -41,18 +41,19 @@
41
41
  "@ephox/bedrock-server": "^11.3.1",
42
42
  "@ephox/katamari": "^7.2.1",
43
43
  "@ephox/sugar": "^7.1.3",
44
- "@storybook/addon-actions": "^6.4.0-alpha.9",
45
- "@storybook/addon-essentials": "^6.4.0-alpha.9",
46
- "@storybook/addon-links": "^6.4.0-alpha.9",
44
+ "@storybook/addon-actions": "^6.4.18",
45
+ "@storybook/addon-essentials": "^6.4.18",
46
+ "@storybook/addon-links": "^6.4.18",
47
47
  "@storybook/addon-notes": "^5.3.21",
48
48
  "@storybook/storybook-deployer": "^2.8.10",
49
- "@storybook/vue3": "^6.4.0-alpha.9",
49
+ "@storybook/vue3": "^6.4.18",
50
50
  "@tinymce/beehive-flow": "^0.17.0",
51
51
  "@tinymce/eslint-plugin": "^1.9.1",
52
52
  "@tinymce/miniature": "^3.2.0",
53
53
  "@types/node": "^16.7.1",
54
- "@vue/compiler-sfc": "^3.0.0",
55
- "babel-loader": "^8.0.5",
54
+ "@vitejs/plugin-vue": "^2.1.0",
55
+ "@vue/compiler-sfc": "^3.2.29",
56
+ "babel-loader": "^8.2.3",
56
57
  "babel-preset-vue": "^2.0.2",
57
58
  "babel-register": "^6.26.0",
58
59
  "css-loader": "^6.2.0",
@@ -67,12 +68,13 @@
67
68
  "rollup-plugin-uglify": "^6.0.0",
68
69
  "tinymce-4": "npm:tinymce@^4",
69
70
  "tinymce-5": "npm:tinymce@^5",
70
- "ts-loader": "^9.2.5",
71
+ "ts-loader": "^9.2.6",
71
72
  "ts-node": "^10.2.1",
72
- "tsconfig-paths-webpack-plugin": "^3.5.1",
73
+ "tsconfig-paths-webpack-plugin": "^3.5.2",
73
74
  "typescript": "^4.3.5",
74
- "vite": "^2.5.1",
75
- "vue": "^3.0.0",
75
+ "vite": "^2.7.13",
76
+ "vue": "^3.2.5",
77
+ "vue-cli-plugin-storybook": "^2.1.0",
76
78
  "vue-loader": "^15.2.1",
77
79
  "vue-router": "^4.0.0-beta.13",
78
80
  "vue-template-compiler": "^2.6.14",