@tinymce/tinymce-vue 5.1.1 → 5.1.2-feature.20240409071728897.sha7b706fe

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinymce/tinymce-vue",
3
- "version": "5.1.1",
3
+ "version": "5.1.2-feature.20240409071728897.sha7b706fe",
4
4
  "description": "Official TinyMCE Vue 3 Component",
5
5
  "private": false,
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  "devDependencies": {
38
38
  "@babel/core": "^7.20.2",
39
39
  "@ephox/agar": "^7.2.1",
40
- "@ephox/bedrock-client": "^13.0.0",
41
- "@ephox/bedrock-server": "^13.3.0",
40
+ "@ephox/bedrock-client": "^14.1.1",
41
+ "@ephox/bedrock-server": "^14.1.2",
42
42
  "@ephox/katamari": "^9.1.1",
43
43
  "@ephox/sugar": "^9.1.1",
44
44
  "@storybook/addon-actions": "^6.5.13",
@@ -71,6 +71,7 @@
71
71
  "tinymce-4": "npm:tinymce@^4",
72
72
  "tinymce-5": "npm:tinymce@^5",
73
73
  "tinymce-6": "npm:tinymce@^6",
74
+ "tinymce-7": "npm:tinymce@^7",
74
75
  "ts-loader": "^9.4.1",
75
76
  "ts-node": "^10.9.1",
76
77
  "tsconfig-paths-webpack-plugin": "^3.5.2",
@@ -1,378 +0,0 @@
1
- var Editor = (function (vue) {
2
- 'use strict';
3
-
4
- /******************************************************************************
5
- Copyright (c) Microsoft Corporation.
6
-
7
- Permission to use, copy, modify, and/or distribute this software for any
8
- purpose with or without fee is hereby granted.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */
18
-
19
- var __assign = function() {
20
- __assign = Object.assign || function __assign(t) {
21
- for (var s, i = 1, n = arguments.length; i < n; i++) {
22
- s = arguments[i];
23
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
24
- }
25
- return t;
26
- };
27
- return __assign.apply(this, arguments);
28
- };
29
-
30
- /**
31
- * Copyright (c) 2018-present, Ephox, Inc.
32
- *
33
- * This source code is licensed under the Apache 2 license found in the
34
- * LICENSE file in the root directory of this source tree.
35
- *
36
- */
37
- var validEvents = [
38
- 'onActivate',
39
- 'onAddUndo',
40
- 'onBeforeAddUndo',
41
- 'onBeforeExecCommand',
42
- 'onBeforeGetContent',
43
- 'onBeforeRenderUI',
44
- 'onBeforeSetContent',
45
- 'onBeforePaste',
46
- 'onBlur',
47
- 'onChange',
48
- 'onClearUndos',
49
- 'onClick',
50
- 'onContextMenu',
51
- 'onCopy',
52
- 'onCut',
53
- 'onDblclick',
54
- 'onDeactivate',
55
- 'onDirty',
56
- 'onDrag',
57
- 'onDragDrop',
58
- 'onDragEnd',
59
- 'onDragGesture',
60
- 'onDragOver',
61
- 'onDrop',
62
- 'onExecCommand',
63
- 'onFocus',
64
- 'onFocusIn',
65
- 'onFocusOut',
66
- 'onGetContent',
67
- 'onHide',
68
- 'onInit',
69
- 'onKeyDown',
70
- 'onKeyPress',
71
- 'onKeyUp',
72
- 'onLoadContent',
73
- 'onMouseDown',
74
- 'onMouseEnter',
75
- 'onMouseLeave',
76
- 'onMouseMove',
77
- 'onMouseOut',
78
- 'onMouseOver',
79
- 'onMouseUp',
80
- 'onNodeChange',
81
- 'onObjectResizeStart',
82
- 'onObjectResized',
83
- 'onObjectSelected',
84
- 'onPaste',
85
- 'onPostProcess',
86
- 'onPostRender',
87
- 'onPreProcess',
88
- 'onProgressState',
89
- 'onRedo',
90
- 'onRemove',
91
- 'onReset',
92
- 'onSaveContent',
93
- 'onSelectionChange',
94
- 'onSetAttrib',
95
- 'onSetContent',
96
- 'onShow',
97
- 'onSubmit',
98
- 'onUndo',
99
- 'onVisualAid'
100
- ];
101
- var isValidKey = function (key) {
102
- return validEvents.map(function (event) { return event.toLowerCase(); }).indexOf(key.toLowerCase()) !== -1;
103
- };
104
- var bindHandlers = function (initEvent, listeners, editor) {
105
- Object.keys(listeners)
106
- .filter(isValidKey)
107
- .forEach(function (key) {
108
- var handler = listeners[key];
109
- if (typeof handler === 'function') {
110
- if (key === 'onInit') {
111
- handler(initEvent, editor);
112
- }
113
- else {
114
- editor.on(key.substring(2), function (e) { return handler(e, editor); });
115
- }
116
- }
117
- });
118
- };
119
- var bindModelHandlers = function (props, ctx, editor, modelValue) {
120
- var modelEvents = props.modelEvents ? props.modelEvents : null;
121
- var normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(' ') : modelEvents;
122
- vue.watch(modelValue, function (val, prevVal) {
123
- if (editor && typeof val === 'string' && val !== prevVal && val !== editor.getContent({ format: props.outputFormat })) {
124
- editor.setContent(val);
125
- }
126
- });
127
- editor.on(normalizedEvents ? normalizedEvents : 'change input undo redo', function () {
128
- ctx.emit('update:modelValue', editor.getContent({ format: props.outputFormat }));
129
- });
130
- };
131
- var initEditor = function (initEvent, props, ctx, editor, modelValue, content) {
132
- editor.setContent(content());
133
- if (ctx.attrs['onUpdate:modelValue']) {
134
- bindModelHandlers(props, ctx, editor, modelValue);
135
- }
136
- bindHandlers(initEvent, ctx.attrs, editor);
137
- };
138
- var unique = 0;
139
- var uuid = function (prefix) {
140
- var time = Date.now();
141
- var random = Math.floor(Math.random() * 1000000000);
142
- unique++;
143
- return prefix + '_' + random + unique + String(time);
144
- };
145
- var isTextarea = function (element) {
146
- return element !== null && element.tagName.toLowerCase() === 'textarea';
147
- };
148
- var normalizePluginArray = function (plugins) {
149
- if (typeof plugins === 'undefined' || plugins === '') {
150
- return [];
151
- }
152
- return Array.isArray(plugins) ? plugins : plugins.split(' ');
153
- };
154
- var mergePlugins = function (initPlugins, inputPlugins) {
155
- return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
156
- };
157
- var isNullOrUndefined = function (value) {
158
- return value === null || value === undefined;
159
- };
160
-
161
- /**
162
- * Copyright (c) 2018-present, Ephox, Inc.
163
- *
164
- * This source code is licensed under the Apache 2 license found in the
165
- * LICENSE file in the root directory of this source tree.
166
- *
167
- */
168
- var createState = function () { return ({
169
- listeners: [],
170
- scriptId: uuid('tiny-script'),
171
- scriptLoaded: false
172
- }); };
173
- var CreateScriptLoader = function () {
174
- var state = createState();
175
- var injectScriptTag = function (scriptId, doc, url, callback) {
176
- var scriptTag = doc.createElement('script');
177
- scriptTag.referrerPolicy = 'origin';
178
- scriptTag.type = 'application/javascript';
179
- scriptTag.id = scriptId;
180
- scriptTag.src = url;
181
- var handler = function () {
182
- scriptTag.removeEventListener('load', handler);
183
- callback();
184
- };
185
- scriptTag.addEventListener('load', handler);
186
- if (doc.head) {
187
- doc.head.appendChild(scriptTag);
188
- }
189
- };
190
- var load = function (doc, url, callback) {
191
- if (state.scriptLoaded) {
192
- callback();
193
- }
194
- else {
195
- state.listeners.push(callback);
196
- if (!doc.getElementById(state.scriptId)) {
197
- injectScriptTag(state.scriptId, doc, url, function () {
198
- state.listeners.forEach(function (fn) { return fn(); });
199
- state.scriptLoaded = true;
200
- });
201
- }
202
- }
203
- };
204
- // Only to be used by tests.
205
- var reinitialize = function () {
206
- state = createState();
207
- };
208
- return {
209
- load: load,
210
- reinitialize: reinitialize
211
- };
212
- };
213
- var ScriptLoader = CreateScriptLoader();
214
-
215
- /**
216
- * Copyright (c) 2018-present, Ephox, Inc.
217
- *
218
- * This source code is licensed under the Apache 2 license found in the
219
- * LICENSE file in the root directory of this source tree.
220
- *
221
- */
222
- var getGlobal = function () { return (typeof window !== 'undefined' ? window : global); };
223
- var getTinymce = function () {
224
- var global = getGlobal();
225
- return global && global.tinymce ? global.tinymce : null;
226
- };
227
-
228
- var editorProps = {
229
- apiKey: String,
230
- cloudChannel: String,
231
- id: String,
232
- init: Object,
233
- initialValue: String,
234
- inline: Boolean,
235
- modelEvents: [String, Array],
236
- plugins: [String, Array],
237
- tagName: String,
238
- toolbar: [String, Array],
239
- modelValue: String,
240
- disabled: Boolean,
241
- tinymceScriptSrc: String,
242
- outputFormat: {
243
- type: String,
244
- validator: function (prop) { return prop === 'html' || prop === 'text'; }
245
- },
246
- };
247
-
248
- /**
249
- * Copyright (c) 2018-present, Ephox, Inc.
250
- *
251
- * This source code is licensed under the Apache 2 license found in the
252
- * LICENSE file in the root directory of this source tree.
253
- *
254
- */
255
- var renderInline = function (ce, id, elementRef, tagName) {
256
- return ce(tagName ? tagName : 'div', {
257
- id: id,
258
- ref: elementRef
259
- });
260
- };
261
- var renderIframe = function (ce, id, elementRef) {
262
- return ce('textarea', {
263
- id: id,
264
- visibility: 'hidden',
265
- ref: elementRef
266
- });
267
- };
268
- var defaultInitValues = { selector: undefined, target: undefined };
269
- var Editor = vue.defineComponent({
270
- props: editorProps,
271
- setup: function (props, ctx) {
272
- var conf = props.init ? __assign(__assign({}, props.init), defaultInitValues) : __assign({}, defaultInitValues);
273
- var _a = vue.toRefs(props), disabled = _a.disabled, modelValue = _a.modelValue, tagName = _a.tagName;
274
- var element = vue.ref(null);
275
- var vueEditor = null;
276
- var elementId = props.id || uuid('tiny-vue');
277
- var inlineEditor = (props.init && props.init.inline) || props.inline;
278
- var modelBind = !!ctx.attrs['onUpdate:modelValue'];
279
- var mounting = true;
280
- var initialValue = props.initialValue ? props.initialValue : '';
281
- var cache = '';
282
- var getContent = function (isMounting) { return modelBind ?
283
- function () { return ((modelValue === null || modelValue === void 0 ? void 0 : modelValue.value) ? modelValue.value : ''); } :
284
- function () { return isMounting ? initialValue : cache; }; };
285
- var initWrapper = function () {
286
- var content = getContent(mounting);
287
- var finalInit = __assign(__assign({}, conf), { readonly: props.disabled, target: element.value, plugins: mergePlugins(conf.plugins, props.plugins), toolbar: props.toolbar || (conf.toolbar), inline: inlineEditor, setup: function (editor) {
288
- vueEditor = editor;
289
- editor.on('init', function (e) { return initEditor(e, props, ctx, editor, modelValue, content); });
290
- if (typeof conf.setup === 'function') {
291
- conf.setup(editor);
292
- }
293
- } });
294
- if (isTextarea(element.value)) {
295
- element.value.style.visibility = '';
296
- }
297
- getTinymce().init(finalInit);
298
- mounting = false;
299
- };
300
- vue.watch(disabled, function (disable) {
301
- var _a;
302
- if (vueEditor !== null) {
303
- if (typeof ((_a = vueEditor.mode) === null || _a === void 0 ? void 0 : _a.set) === 'function') {
304
- vueEditor.mode.set(disable ? 'readonly' : 'design');
305
- }
306
- else {
307
- vueEditor.setMode(disable ? 'readonly' : 'design');
308
- }
309
- }
310
- });
311
- vue.watch(tagName, function (_) {
312
- var _a;
313
- if (!modelBind) {
314
- cache = vueEditor.getContent();
315
- }
316
- (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
317
- vue.nextTick(function () { return initWrapper(); });
318
- });
319
- vue.onMounted(function () {
320
- if (getTinymce() !== null) {
321
- initWrapper();
322
- }
323
- else if (element.value && element.value.ownerDocument) {
324
- var channel = props.cloudChannel ? props.cloudChannel : '6';
325
- var apiKey = props.apiKey ? props.apiKey : 'no-api-key';
326
- var scriptSrc = isNullOrUndefined(props.tinymceScriptSrc) ?
327
- "https://cdn.tiny.cloud/1/".concat(apiKey, "/tinymce/").concat(channel, "/tinymce.min.js") :
328
- props.tinymceScriptSrc;
329
- ScriptLoader.load(element.value.ownerDocument, scriptSrc, initWrapper);
330
- }
331
- });
332
- vue.onBeforeUnmount(function () {
333
- if (getTinymce() !== null) {
334
- getTinymce().remove(vueEditor);
335
- }
336
- });
337
- if (!inlineEditor) {
338
- vue.onActivated(function () {
339
- if (!mounting) {
340
- initWrapper();
341
- }
342
- });
343
- vue.onDeactivated(function () {
344
- var _a;
345
- if (!modelBind) {
346
- cache = vueEditor.getContent();
347
- }
348
- (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
349
- });
350
- }
351
- var rerender = function (init) {
352
- var _a;
353
- cache = vueEditor.getContent();
354
- (_a = getTinymce()) === null || _a === void 0 ? void 0 : _a.remove(vueEditor);
355
- conf = __assign(__assign(__assign({}, conf), init), defaultInitValues);
356
- vue.nextTick(function () { return initWrapper(); });
357
- };
358
- ctx.expose({
359
- rerender: rerender,
360
- getEditor: function () { return vueEditor; }
361
- });
362
- return function () { return inlineEditor ?
363
- renderInline(vue.h, elementId, element, props.tagName) :
364
- renderIframe(vue.h, elementId, element); };
365
- }
366
- });
367
-
368
- /**
369
- * Copyright (c) 2018-present, Ephox, Inc.
370
- *
371
- * This source code is licensed under the Apache 2 license found in the
372
- * LICENSE file in the root directory of this source tree.
373
- *
374
- */
375
-
376
- return Editor;
377
-
378
- }(Vue));
@@ -1 +0,0 @@
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 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 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}}},D={selector:void 0,target:void 0};return a.defineComponent({props:r,setup:function(u,l){function t(){var n,e,a=(n=v,f?function(){return null!=c&&c.value?c.value:""}:function(){return n?p:g}),t=y(y({},o),{readonly:u.disabled,target:i.value,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=""),m().init(t),v=!1}var o=u.init?y(y({},u.init),D):y({},D),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"],v=!0,p=u.initialValue||"",g="";a.watch(e,function(n){var e;null!==d&&("function"==typeof(null===(e=d.mode)||void 0===e?void 0:e.set)?d.mode.set(n?"readonly":"design"):d.setMode(n?"readonly":"design"))}),a.watch(n,function(n){var e;f||(g=d.getContent()),null!==(e=m())&&void 0!==e&&e.remove(d),a.nextTick(t)}),a.onMounted(function(){var n,e;null!==m()?t():i.value&&i.value.ownerDocument&&(e=u.cloudChannel||"6",n=u.apiKey||"no-api-key",e=null==u.tinymceScriptSrc?"https://cdn.tiny.cloud/1/".concat(n,"/tinymce/").concat(e,"/tinymce.min.js"):u.tinymceScriptSrc,w.load(i.value.ownerDocument,e,t))}),a.onBeforeUnmount(function(){null!==m()&&m().remove(d)}),s||(a.onActivated(function(){v||t()}),a.onDeactivated(function(){var n;f||(g=d.getContent()),null!==(n=m())&&void 0!==n&&n.remove(d)}));return l.expose({rerender:function(n){var e;g=d.getContent(),null!==(e=m())&&void 0!==e&&e.remove(d),o=y(y(y({},o),n),D),a.nextTick(t)},getEditor:function(){return d}}),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);
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright (c) 2018-present, Ephox, Inc.
3
- *
4
- * This source code is licensed under the Apache 2 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- export type CallbackFn = () => void;
9
- export interface IStateObj {
10
- listeners: CallbackFn[];
11
- scriptId: string;
12
- scriptLoaded: boolean;
13
- }
14
- interface ScriptLoader {
15
- load: (doc: Document, url: string, callback: CallbackFn) => void;
16
- reinitialize: () => void;
17
- }
18
- declare const ScriptLoader: ScriptLoader;
19
- export { ScriptLoader };
@@ -1,58 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2018-present, Ephox, Inc.
4
- *
5
- * This source code is licensed under the Apache 2 license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ScriptLoader = void 0;
11
- var Utils_1 = require("./Utils");
12
- var createState = function () { return ({
13
- listeners: [],
14
- scriptId: (0, Utils_1.uuid)('tiny-script'),
15
- scriptLoaded: false
16
- }); };
17
- var CreateScriptLoader = function () {
18
- var state = createState();
19
- var injectScriptTag = function (scriptId, doc, url, callback) {
20
- var scriptTag = doc.createElement('script');
21
- scriptTag.referrerPolicy = 'origin';
22
- scriptTag.type = 'application/javascript';
23
- scriptTag.id = scriptId;
24
- scriptTag.src = url;
25
- var handler = function () {
26
- scriptTag.removeEventListener('load', handler);
27
- callback();
28
- };
29
- scriptTag.addEventListener('load', handler);
30
- if (doc.head) {
31
- doc.head.appendChild(scriptTag);
32
- }
33
- };
34
- var load = function (doc, url, callback) {
35
- if (state.scriptLoaded) {
36
- callback();
37
- }
38
- else {
39
- state.listeners.push(callback);
40
- if (!doc.getElementById(state.scriptId)) {
41
- injectScriptTag(state.scriptId, doc, url, function () {
42
- state.listeners.forEach(function (fn) { return fn(); });
43
- state.scriptLoaded = true;
44
- });
45
- }
46
- }
47
- };
48
- // Only to be used by tests.
49
- var reinitialize = function () {
50
- state = createState();
51
- };
52
- return {
53
- load: load,
54
- reinitialize: reinitialize
55
- };
56
- };
57
- var ScriptLoader = CreateScriptLoader();
58
- exports.ScriptLoader = ScriptLoader;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2018-present, Ephox, Inc.
3
- *
4
- * This source code is licensed under the Apache 2 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- declare const getTinymce: () => any;
9
- export { getTinymce };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2018-present, Ephox, Inc.
4
- *
5
- * This source code is licensed under the Apache 2 license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.getTinymce = void 0;
11
- var getGlobal = function () { return (typeof window !== 'undefined' ? window : global); };
12
- var getTinymce = function () {
13
- var global = getGlobal();
14
- return global && global.tinymce ? global.tinymce : null;
15
- };
16
- exports.getTinymce = getTinymce;
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright (c) 2018-present, Ephox, Inc.
3
- *
4
- * This source code is licensed under the Apache 2 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { Ref, SetupContext } from 'vue';
9
- import { IPropTypes } from './components/EditorPropTypes';
10
- import { Editor as TinyMCEEditor, EditorEvent } from 'tinymce';
11
- declare const isValidKey: (key: string) => boolean;
12
- declare const bindHandlers: (initEvent: EditorEvent<any>, listeners: Record<string, any>, editor: TinyMCEEditor) => void;
13
- declare const bindModelHandlers: (props: IPropTypes, ctx: SetupContext, editor: TinyMCEEditor, modelValue: Ref<any>) => void;
14
- declare const initEditor: (initEvent: EditorEvent<any>, props: IPropTypes, ctx: SetupContext, editor: TinyMCEEditor, modelValue: Ref<any>, content: () => string) => void;
15
- declare const uuid: (prefix: string) => string;
16
- declare const isTextarea: (element: Element | null) => element is HTMLTextAreaElement;
17
- declare const mergePlugins: (initPlugins: string | string[] | undefined, inputPlugins?: string | string[]) => string[];
18
- declare const isNullOrUndefined: (value: any) => value is null | undefined;
19
- export { bindHandlers, bindModelHandlers, initEditor, isValidKey, uuid, isTextarea, mergePlugins, isNullOrUndefined };
@@ -1,142 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2018-present, Ephox, Inc.
4
- *
5
- * This source code is licensed under the Apache 2 license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.isNullOrUndefined = exports.mergePlugins = exports.isTextarea = exports.uuid = exports.isValidKey = exports.initEditor = exports.bindModelHandlers = exports.bindHandlers = void 0;
11
- var vue_1 = require("vue");
12
- var validEvents = [
13
- 'onActivate',
14
- 'onAddUndo',
15
- 'onBeforeAddUndo',
16
- 'onBeforeExecCommand',
17
- 'onBeforeGetContent',
18
- 'onBeforeRenderUI',
19
- 'onBeforeSetContent',
20
- 'onBeforePaste',
21
- 'onBlur',
22
- 'onChange',
23
- 'onClearUndos',
24
- 'onClick',
25
- 'onContextMenu',
26
- 'onCopy',
27
- 'onCut',
28
- 'onDblclick',
29
- 'onDeactivate',
30
- 'onDirty',
31
- 'onDrag',
32
- 'onDragDrop',
33
- 'onDragEnd',
34
- 'onDragGesture',
35
- 'onDragOver',
36
- 'onDrop',
37
- 'onExecCommand',
38
- 'onFocus',
39
- 'onFocusIn',
40
- 'onFocusOut',
41
- 'onGetContent',
42
- 'onHide',
43
- 'onInit',
44
- 'onKeyDown',
45
- 'onKeyPress',
46
- 'onKeyUp',
47
- 'onLoadContent',
48
- 'onMouseDown',
49
- 'onMouseEnter',
50
- 'onMouseLeave',
51
- 'onMouseMove',
52
- 'onMouseOut',
53
- 'onMouseOver',
54
- 'onMouseUp',
55
- 'onNodeChange',
56
- 'onObjectResizeStart',
57
- 'onObjectResized',
58
- 'onObjectSelected',
59
- 'onPaste',
60
- 'onPostProcess',
61
- 'onPostRender',
62
- 'onPreProcess',
63
- 'onProgressState',
64
- 'onRedo',
65
- 'onRemove',
66
- 'onReset',
67
- 'onSaveContent',
68
- 'onSelectionChange',
69
- 'onSetAttrib',
70
- 'onSetContent',
71
- 'onShow',
72
- 'onSubmit',
73
- 'onUndo',
74
- 'onVisualAid'
75
- ];
76
- var isValidKey = function (key) {
77
- return validEvents.map(function (event) { return event.toLowerCase(); }).indexOf(key.toLowerCase()) !== -1;
78
- };
79
- exports.isValidKey = isValidKey;
80
- var bindHandlers = function (initEvent, listeners, editor) {
81
- Object.keys(listeners)
82
- .filter(isValidKey)
83
- .forEach(function (key) {
84
- var handler = listeners[key];
85
- if (typeof handler === 'function') {
86
- if (key === 'onInit') {
87
- handler(initEvent, editor);
88
- }
89
- else {
90
- editor.on(key.substring(2), function (e) { return handler(e, editor); });
91
- }
92
- }
93
- });
94
- };
95
- exports.bindHandlers = bindHandlers;
96
- var bindModelHandlers = function (props, ctx, editor, modelValue) {
97
- var modelEvents = props.modelEvents ? props.modelEvents : null;
98
- var normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(' ') : modelEvents;
99
- (0, vue_1.watch)(modelValue, function (val, prevVal) {
100
- if (editor && typeof val === 'string' && val !== prevVal && val !== editor.getContent({ format: props.outputFormat })) {
101
- editor.setContent(val);
102
- }
103
- });
104
- editor.on(normalizedEvents ? normalizedEvents : 'change input undo redo', function () {
105
- ctx.emit('update:modelValue', editor.getContent({ format: props.outputFormat }));
106
- });
107
- };
108
- exports.bindModelHandlers = bindModelHandlers;
109
- var initEditor = function (initEvent, props, ctx, editor, modelValue, content) {
110
- editor.setContent(content());
111
- if (ctx.attrs['onUpdate:modelValue']) {
112
- bindModelHandlers(props, ctx, editor, modelValue);
113
- }
114
- bindHandlers(initEvent, ctx.attrs, editor);
115
- };
116
- exports.initEditor = initEditor;
117
- var unique = 0;
118
- var uuid = function (prefix) {
119
- var time = Date.now();
120
- var random = Math.floor(Math.random() * 1000000000);
121
- unique++;
122
- return prefix + '_' + random + unique + String(time);
123
- };
124
- exports.uuid = uuid;
125
- var isTextarea = function (element) {
126
- return element !== null && element.tagName.toLowerCase() === 'textarea';
127
- };
128
- exports.isTextarea = isTextarea;
129
- var normalizePluginArray = function (plugins) {
130
- if (typeof plugins === 'undefined' || plugins === '') {
131
- return [];
132
- }
133
- return Array.isArray(plugins) ? plugins : plugins.split(' ');
134
- };
135
- var mergePlugins = function (initPlugins, inputPlugins) {
136
- return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
137
- };
138
- exports.mergePlugins = mergePlugins;
139
- var isNullOrUndefined = function (value) {
140
- return value === null || value === undefined;
141
- };
142
- exports.isNullOrUndefined = isNullOrUndefined;