@tinymce/tinymce-webcomponent 2.1.0 → 2.1.1-alpha.20250528023959456.shafa5a7cf
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 +9 -9
- package/dist/tinymce-webcomponent.js +0 -500
package/package.json
CHANGED
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"author": "Tiny Technologies",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@ephox/agar": "^
|
|
27
|
-
"@ephox/bedrock-client": "^
|
|
28
|
-
"@ephox/bedrock-server": "^
|
|
26
|
+
"@ephox/agar": "^8.0.1",
|
|
27
|
+
"@ephox/bedrock-client": "^14.1.1",
|
|
28
|
+
"@ephox/bedrock-server": "^14.1.4",
|
|
29
29
|
"@ephox/katamari": "^9.1.5",
|
|
30
30
|
"@ephox/sugar": "^9.2.1",
|
|
31
31
|
"@ephox/swag": "^4.6.0",
|
|
32
32
|
"@tinymce/beehive-flow": "^0.19.0",
|
|
33
33
|
"@tinymce/eslint-plugin": "^2.2.1",
|
|
34
34
|
"@types/esm": "^3.2.0",
|
|
35
|
-
"@types/express": "^
|
|
36
|
-
"@types/node": "^
|
|
35
|
+
"@types/express": "^5.0.0",
|
|
36
|
+
"@types/node": "^22.7.7",
|
|
37
37
|
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
38
38
|
"@typescript-eslint/parser": "^5.48.2",
|
|
39
39
|
"eslint": "^8.32.0",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
42
42
|
"esm": "^3.2.25",
|
|
43
43
|
"express": "^4.18.2",
|
|
44
|
-
"rollup": "^
|
|
45
|
-
"tinymce": "^
|
|
44
|
+
"rollup": "^4.24.0",
|
|
45
|
+
"tinymce": "^7.4.1",
|
|
46
46
|
"ts-loader": "^9.4.2",
|
|
47
47
|
"ts-node": "^10.9.1",
|
|
48
|
-
"typescript": "~5.
|
|
48
|
+
"typescript": "~5.6.3",
|
|
49
49
|
"webpack": "^5.75.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {},
|
|
52
|
-
"version": "2.1.
|
|
52
|
+
"version": "2.1.1-alpha.20250528023959456.shafa5a7cf",
|
|
53
53
|
"name": "@tinymce/tinymce-webcomponent"
|
|
54
54
|
}
|
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const Global = typeof window !== 'undefined' ? window : Function('return this;')();
|
|
5
|
-
|
|
6
|
-
const path = (parts, scope) => {
|
|
7
|
-
let o = scope !== undefined && scope !== null ? scope : Global;
|
|
8
|
-
for (let i = 0; i < parts.length && o !== undefined && o !== null; ++i) {
|
|
9
|
-
o = o[parts[i]];
|
|
10
|
-
}
|
|
11
|
-
return o;
|
|
12
|
-
};
|
|
13
|
-
const resolve = (p, scope) => {
|
|
14
|
-
const parts = p.split('.');
|
|
15
|
-
return path(parts, scope);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const identity = x => {
|
|
19
|
-
return x;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const keys = Object.keys;
|
|
23
|
-
const hasOwnProperty = Object.hasOwnProperty;
|
|
24
|
-
const each = (obj, f) => {
|
|
25
|
-
const props = keys(obj);
|
|
26
|
-
for (let k = 0, len = props.length; k < len; k++) {
|
|
27
|
-
const i = props[k];
|
|
28
|
-
const x = obj[i];
|
|
29
|
-
f(x, i);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
33
|
-
|
|
34
|
-
let unique = 0;
|
|
35
|
-
const generate = prefix => {
|
|
36
|
-
const date = new Date();
|
|
37
|
-
const time = date.getTime();
|
|
38
|
-
const random = Math.floor(Math.random() * 1000000000);
|
|
39
|
-
unique++;
|
|
40
|
-
return prefix + '_' + random + unique + String(time);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const createState = () => ({
|
|
44
|
-
listeners: [],
|
|
45
|
-
scriptId: generate('tiny-script'),
|
|
46
|
-
scriptLoaded: false
|
|
47
|
-
});
|
|
48
|
-
const CreateScriptLoader = () => {
|
|
49
|
-
let state = createState();
|
|
50
|
-
const injectScriptTag = (scriptId, doc, url, callback) => {
|
|
51
|
-
const scriptTag = doc.createElement('script');
|
|
52
|
-
scriptTag.referrerPolicy = 'origin';
|
|
53
|
-
scriptTag.type = 'application/javascript';
|
|
54
|
-
scriptTag.id = scriptId;
|
|
55
|
-
scriptTag.src = url;
|
|
56
|
-
const handler = () => {
|
|
57
|
-
scriptTag.removeEventListener('load', handler);
|
|
58
|
-
callback();
|
|
59
|
-
};
|
|
60
|
-
scriptTag.addEventListener('load', handler);
|
|
61
|
-
if (doc.head) {
|
|
62
|
-
doc.head.appendChild(scriptTag);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const load = (doc, url, callback) => {
|
|
66
|
-
if (state.scriptLoaded) {
|
|
67
|
-
callback();
|
|
68
|
-
} else {
|
|
69
|
-
state.listeners.push(callback);
|
|
70
|
-
if (!doc.getElementById(state.scriptId)) {
|
|
71
|
-
injectScriptTag(state.scriptId, doc, url, () => {
|
|
72
|
-
state.listeners.forEach(fn => fn());
|
|
73
|
-
state.scriptLoaded = true;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const reinitialize = () => {
|
|
79
|
-
state = createState();
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
load,
|
|
83
|
-
reinitialize
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
const ScriptLoader = CreateScriptLoader();
|
|
87
|
-
|
|
88
|
-
var Status;
|
|
89
|
-
(function (Status) {
|
|
90
|
-
Status[Status['Raw'] = 0] = 'Raw';
|
|
91
|
-
Status[Status['Initializing'] = 1] = 'Initializing';
|
|
92
|
-
Status[Status['Ready'] = 2] = 'Ready';
|
|
93
|
-
}(Status || (Status = {})));
|
|
94
|
-
const closestRecursive = (selector, element) => {
|
|
95
|
-
const found = element.closest(selector);
|
|
96
|
-
if (found !== null) {
|
|
97
|
-
return found;
|
|
98
|
-
}
|
|
99
|
-
const next = element.getRootNode().host;
|
|
100
|
-
if (next !== null && next !== undefined) {
|
|
101
|
-
return closestRecursive(selector, next);
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
};
|
|
105
|
-
const isLookupKey = (values, key) => has(values, key);
|
|
106
|
-
const lookup = values => key => isLookupKey(values, key) ? values[key] : key;
|
|
107
|
-
const parseGlobal = resolve;
|
|
108
|
-
const parseString = identity;
|
|
109
|
-
const parseFalseOrString = lookup({ 'false': false });
|
|
110
|
-
const parseBooleanOrString = lookup({
|
|
111
|
-
'true': true,
|
|
112
|
-
'false': false
|
|
113
|
-
});
|
|
114
|
-
const parseNumberOrString = value => /^\d+$/.test(value) ? Number.parseInt(value, 10) : value;
|
|
115
|
-
const configAttributes = {
|
|
116
|
-
setup: parseGlobal,
|
|
117
|
-
statusbar: parseBooleanOrString,
|
|
118
|
-
toolbar: parseFalseOrString,
|
|
119
|
-
menubar: parseFalseOrString,
|
|
120
|
-
plugins: parseString,
|
|
121
|
-
content_css: parseString,
|
|
122
|
-
content_style: parseString,
|
|
123
|
-
width: parseNumberOrString,
|
|
124
|
-
height: parseNumberOrString,
|
|
125
|
-
toolbar_mode: parseString,
|
|
126
|
-
contextmenu: parseFalseOrString,
|
|
127
|
-
quickbars_insert_toolbar: parseFalseOrString,
|
|
128
|
-
quickbars_selection_toolbar: parseFalseOrString,
|
|
129
|
-
powerpaste_word_import: parseString,
|
|
130
|
-
powerpaste_html_import: parseString,
|
|
131
|
-
powerpaste_allow_local_images: parseBooleanOrString,
|
|
132
|
-
resize: parseBooleanOrString,
|
|
133
|
-
skin: parseString,
|
|
134
|
-
skin_url: parseString,
|
|
135
|
-
images_upload_url: parseString,
|
|
136
|
-
images_upload_handler: parseGlobal,
|
|
137
|
-
images_upload_base_path: parseString,
|
|
138
|
-
images_upload_credentials: parseBooleanOrString,
|
|
139
|
-
images_reuse_filename: parseBooleanOrString,
|
|
140
|
-
icons: parseString,
|
|
141
|
-
icons_url: parseString,
|
|
142
|
-
promotion: parseBooleanOrString
|
|
143
|
-
};
|
|
144
|
-
const configRenames = {};
|
|
145
|
-
class TinyMceEditor extends HTMLElement {
|
|
146
|
-
static get formAssociated() {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
static get observedAttributes() {
|
|
150
|
-
const nativeEvents = [
|
|
151
|
-
'on-BeforePaste',
|
|
152
|
-
'on-Blur',
|
|
153
|
-
'on-Click',
|
|
154
|
-
'on-ContextMenu',
|
|
155
|
-
'on-Copy',
|
|
156
|
-
'on-Cut',
|
|
157
|
-
'on-Dblclick',
|
|
158
|
-
'on-Drag',
|
|
159
|
-
'on-DragDrop',
|
|
160
|
-
'on-DragEnd',
|
|
161
|
-
'on-DragGesture',
|
|
162
|
-
'on-DragOver',
|
|
163
|
-
'on-Drop',
|
|
164
|
-
'on-Focus',
|
|
165
|
-
'on-FocusIn',
|
|
166
|
-
'on-FocusOut',
|
|
167
|
-
'on-KeyDown',
|
|
168
|
-
'on-KeyPress',
|
|
169
|
-
'on-KeyUp',
|
|
170
|
-
'on-MouseDown',
|
|
171
|
-
'on-MouseEnter',
|
|
172
|
-
'on-MouseLeave',
|
|
173
|
-
'on-MouseMove',
|
|
174
|
-
'on-MouseOut',
|
|
175
|
-
'on-MouseOver',
|
|
176
|
-
'on-MouseUp',
|
|
177
|
-
'on-Paste',
|
|
178
|
-
'on-SelectionChange'
|
|
179
|
-
];
|
|
180
|
-
const tinyEvents = [
|
|
181
|
-
'on-Activate',
|
|
182
|
-
'on-AddUndo',
|
|
183
|
-
'on-BeforeAddUndo',
|
|
184
|
-
'on-BeforeExecCommand',
|
|
185
|
-
'on-BeforeGetContent',
|
|
186
|
-
'on-BeforeRenderUI',
|
|
187
|
-
'on-BeforeSetContent',
|
|
188
|
-
'on-Change',
|
|
189
|
-
'on-ClearUndos',
|
|
190
|
-
'on-Deactivate',
|
|
191
|
-
'on-Dirty',
|
|
192
|
-
'on-ExecCommand',
|
|
193
|
-
'on-GetContent',
|
|
194
|
-
'on-Hide',
|
|
195
|
-
'on-Init',
|
|
196
|
-
'on-LoadContent',
|
|
197
|
-
'on-NodeChange',
|
|
198
|
-
'on-PostProcess',
|
|
199
|
-
'on-PostRender',
|
|
200
|
-
'on-PreProcess',
|
|
201
|
-
'on-ProgressState',
|
|
202
|
-
'on-Redo',
|
|
203
|
-
'on-Remove',
|
|
204
|
-
'on-Reset',
|
|
205
|
-
'on-SaveContent',
|
|
206
|
-
'on-SetAttrib',
|
|
207
|
-
'on-ObjectResizeStart',
|
|
208
|
-
'on-ObjectResized',
|
|
209
|
-
'on-ObjectSelected',
|
|
210
|
-
'on-SetContent',
|
|
211
|
-
'on-Show',
|
|
212
|
-
'on-Submit',
|
|
213
|
-
'on-Undo',
|
|
214
|
-
'on-VisualAid'
|
|
215
|
-
];
|
|
216
|
-
return [
|
|
217
|
-
'form',
|
|
218
|
-
'readonly',
|
|
219
|
-
'autofocus',
|
|
220
|
-
'placeholder'
|
|
221
|
-
].concat(nativeEvents).concat(tinyEvents);
|
|
222
|
-
}
|
|
223
|
-
constructor() {
|
|
224
|
-
super();
|
|
225
|
-
this._eventAttrHandler = records => {
|
|
226
|
-
records.forEach(record => {
|
|
227
|
-
var _a;
|
|
228
|
-
if (record.type === 'attributes' && record.target === this && ((_a = record.attributeName) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith('on-'))) {
|
|
229
|
-
this._updateEventAttr(record.attributeName, this.getAttribute(record.attributeName));
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
this._formDataHandler = evt => {
|
|
234
|
-
const name = this.name;
|
|
235
|
-
if (name != null) {
|
|
236
|
-
const value = this.value;
|
|
237
|
-
if (value != null) {
|
|
238
|
-
const data = evt.formData;
|
|
239
|
-
data.append(name, value);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
this._status = Status.Raw;
|
|
244
|
-
this._shadowDom = this.attachShadow({ mode: 'open' });
|
|
245
|
-
this._form = null;
|
|
246
|
-
this._eventHandlers = {};
|
|
247
|
-
this._mutationObserver = new MutationObserver(this._eventAttrHandler);
|
|
248
|
-
}
|
|
249
|
-
_updateEventAttr(attrKey, attrValue) {
|
|
250
|
-
const event = attrKey.substring('on-'.length).toLowerCase();
|
|
251
|
-
const resolved = attrValue !== null ? resolve(attrValue) : undefined;
|
|
252
|
-
const handler = typeof resolved === 'function' ? resolved : undefined;
|
|
253
|
-
if (this._eventHandlers[event] !== handler) {
|
|
254
|
-
if (this._editor && this._eventHandlers[event]) {
|
|
255
|
-
this._editor.off(event, this._eventHandlers[event]);
|
|
256
|
-
}
|
|
257
|
-
if (handler) {
|
|
258
|
-
if (this._editor) {
|
|
259
|
-
this._editor.on(event, handler);
|
|
260
|
-
}
|
|
261
|
-
this._eventHandlers[event] = handler;
|
|
262
|
-
} else {
|
|
263
|
-
delete this._eventHandlers[event];
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
_updateForm() {
|
|
268
|
-
if (this.isConnected) {
|
|
269
|
-
const formId = this.getAttribute('form');
|
|
270
|
-
const form = formId !== null ? this.ownerDocument.querySelector('form#' + formId) : closestRecursive('form', this);
|
|
271
|
-
if (this._form !== form) {
|
|
272
|
-
if (this._form !== null) {
|
|
273
|
-
this._form.removeEventListener('formdata', this._formDataHandler);
|
|
274
|
-
}
|
|
275
|
-
this._form = form;
|
|
276
|
-
if (this._form !== null) {
|
|
277
|
-
this._form.addEventListener('formdata', this._formDataHandler);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
if (this._form !== null) {
|
|
282
|
-
this._form.removeEventListener('formdata', this._formDataHandler);
|
|
283
|
-
this._form = null;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
_getTinymce() {
|
|
288
|
-
return Global.tinymce;
|
|
289
|
-
}
|
|
290
|
-
_getConfig() {
|
|
291
|
-
var _a, _b;
|
|
292
|
-
const config = (_b = parseGlobal((_a = this.getAttribute('config')) !== null && _a !== void 0 ? _a : '')) !== null && _b !== void 0 ? _b : {};
|
|
293
|
-
for (let i = 0; i < this.attributes.length; i++) {
|
|
294
|
-
const attr = this.attributes.item(i);
|
|
295
|
-
if (attr !== null) {
|
|
296
|
-
if (has(configAttributes, attr.name)) {
|
|
297
|
-
const prop = has(configRenames, attr.name) ? configRenames[attr.name] : attr.name;
|
|
298
|
-
config[prop] = configAttributes[attr.name](attr.value);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (this.readonly) {
|
|
303
|
-
config.readonly = true;
|
|
304
|
-
}
|
|
305
|
-
if (this.autofocus) {
|
|
306
|
-
config.auto_focus = true;
|
|
307
|
-
}
|
|
308
|
-
delete config.target;
|
|
309
|
-
delete config.selector;
|
|
310
|
-
return config;
|
|
311
|
-
}
|
|
312
|
-
_getEventHandlers() {
|
|
313
|
-
const handlers = {};
|
|
314
|
-
for (let i = 0; i < this.attributes.length; i++) {
|
|
315
|
-
const attr = this.attributes.item(i);
|
|
316
|
-
if (attr !== null) {
|
|
317
|
-
if (attr.name.toLowerCase().startsWith('on-')) {
|
|
318
|
-
const event = attr.name.toLowerCase().substring('on-'.length);
|
|
319
|
-
const handler = resolve(attr.value);
|
|
320
|
-
if (typeof handler === 'function') {
|
|
321
|
-
handlers[event] = handler;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return handlers;
|
|
327
|
-
}
|
|
328
|
-
_doInit() {
|
|
329
|
-
var _a, _b;
|
|
330
|
-
this._status = Status.Initializing;
|
|
331
|
-
const target = document.createElement('textarea');
|
|
332
|
-
target.value = (_a = this.textContent) !== null && _a !== void 0 ? _a : '';
|
|
333
|
-
const attrId = (_b = this.attributes.getNamedItem('id')) === null || _b === void 0 ? void 0 : _b.value;
|
|
334
|
-
if (attrId) {
|
|
335
|
-
target.id = attrId;
|
|
336
|
-
}
|
|
337
|
-
if (this.placeholder !== null) {
|
|
338
|
-
target.placeholder = this.placeholder;
|
|
339
|
-
}
|
|
340
|
-
this._shadowDom.appendChild(target);
|
|
341
|
-
const baseConfig = this._getConfig();
|
|
342
|
-
const conf = Object.assign(Object.assign({}, baseConfig), {
|
|
343
|
-
target,
|
|
344
|
-
setup: editor => {
|
|
345
|
-
this._editor = editor;
|
|
346
|
-
editor.on('init', _e => {
|
|
347
|
-
this._status = Status.Ready;
|
|
348
|
-
});
|
|
349
|
-
editor.on('SwitchMode', _e => {
|
|
350
|
-
this.readonly = this.readonly;
|
|
351
|
-
});
|
|
352
|
-
each(this._eventHandlers, (handler, event) => {
|
|
353
|
-
if (handler !== undefined) {
|
|
354
|
-
editor.on(event, handler);
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
if (typeof baseConfig.setup === 'function') {
|
|
358
|
-
baseConfig.setup(editor);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
this._getTinymce().init(conf);
|
|
363
|
-
}
|
|
364
|
-
_getTinymceSrc() {
|
|
365
|
-
var _a;
|
|
366
|
-
const src = this.getAttribute('src');
|
|
367
|
-
if (src) {
|
|
368
|
-
return src;
|
|
369
|
-
}
|
|
370
|
-
const channel = (_a = this.getAttribute('channel')) !== null && _a !== void 0 ? _a : '6';
|
|
371
|
-
const apiKey = this.hasAttribute('api-key') ? this.getAttribute('api-key') : 'no-api-key';
|
|
372
|
-
return `https://cdn.tiny.cloud/1/${ apiKey }/tinymce/${ channel }/tinymce.min.js`;
|
|
373
|
-
}
|
|
374
|
-
_loadTinyDoInit() {
|
|
375
|
-
if (this._getTinymce()) {
|
|
376
|
-
this._doInit();
|
|
377
|
-
} else {
|
|
378
|
-
ScriptLoader.load(this.ownerDocument, this._getTinymceSrc(), () => this._doInit());
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
attributeChangedCallback(attribute, oldValue, newValue) {
|
|
382
|
-
if (oldValue !== newValue) {
|
|
383
|
-
if (attribute === 'form') {
|
|
384
|
-
this._updateForm();
|
|
385
|
-
} else if (attribute === 'readonly') {
|
|
386
|
-
this.readonly = newValue !== null;
|
|
387
|
-
} else if (attribute === 'autofocus') {
|
|
388
|
-
this.autofocus = newValue !== null;
|
|
389
|
-
} else if (attribute === 'placeholder') {
|
|
390
|
-
this.placeholder = newValue;
|
|
391
|
-
} else if (attribute.toLowerCase().startsWith('on-')) {
|
|
392
|
-
this._updateEventAttr(attribute, newValue);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
connectedCallback() {
|
|
397
|
-
this._eventHandlers = this._getEventHandlers();
|
|
398
|
-
this._mutationObserver.observe(this, {
|
|
399
|
-
attributes: true,
|
|
400
|
-
childList: false,
|
|
401
|
-
subtree: false
|
|
402
|
-
});
|
|
403
|
-
this._updateForm();
|
|
404
|
-
if (this._status === Status.Raw) {
|
|
405
|
-
this._loadTinyDoInit();
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
disconnectedCallback() {
|
|
409
|
-
this._mutationObserver.disconnect();
|
|
410
|
-
this._updateForm();
|
|
411
|
-
}
|
|
412
|
-
get value() {
|
|
413
|
-
var _a, _b;
|
|
414
|
-
return (_b = this._status === Status.Ready ? (_a = this._editor) === null || _a === void 0 ? void 0 : _a.getContent() : undefined) !== null && _b !== void 0 ? _b : null;
|
|
415
|
-
}
|
|
416
|
-
set value(newValue) {
|
|
417
|
-
var _a;
|
|
418
|
-
if (this._status === Status.Ready && newValue != null) {
|
|
419
|
-
(_a = this._editor) === null || _a === void 0 ? void 0 : _a.setContent(newValue);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
get readonly() {
|
|
423
|
-
if (this._editor) {
|
|
424
|
-
return this._editor.mode.get() === 'readonly';
|
|
425
|
-
} else {
|
|
426
|
-
return this.hasAttribute('readonly');
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
set readonly(value) {
|
|
430
|
-
if (value) {
|
|
431
|
-
if (this._editor && this._editor.mode.get() !== 'readonly') {
|
|
432
|
-
this._editor.mode.set('readonly');
|
|
433
|
-
}
|
|
434
|
-
if (!this.hasAttribute('readonly')) {
|
|
435
|
-
this.setAttribute('readonly', '');
|
|
436
|
-
}
|
|
437
|
-
} else {
|
|
438
|
-
if (this._editor && this._editor.mode.get() === 'readonly') {
|
|
439
|
-
this._editor.mode.set('design');
|
|
440
|
-
}
|
|
441
|
-
if (this.hasAttribute('readonly')) {
|
|
442
|
-
this.removeAttribute('readonly');
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
get placeholder() {
|
|
447
|
-
return this.getAttribute('placeholder');
|
|
448
|
-
}
|
|
449
|
-
set placeholder(value) {
|
|
450
|
-
if (this._editor) {
|
|
451
|
-
const target = this._editor.getElement();
|
|
452
|
-
if (target !== null) {
|
|
453
|
-
if (value !== null) {
|
|
454
|
-
target.setAttribute('placeholder', value);
|
|
455
|
-
} else {
|
|
456
|
-
target.removeAttribute('placeholder');
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
if (value !== null) {
|
|
461
|
-
if (this.getAttribute('placeholder') !== value) {
|
|
462
|
-
this.setAttribute('placeholder', value);
|
|
463
|
-
}
|
|
464
|
-
} else {
|
|
465
|
-
if (this.hasAttribute('placeholder')) {
|
|
466
|
-
this.removeAttribute('placeholder');
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
get autofocus() {
|
|
471
|
-
return this.hasAttribute('autofocus');
|
|
472
|
-
}
|
|
473
|
-
set autofocus(value) {
|
|
474
|
-
if (value) {
|
|
475
|
-
if (!this.hasAttribute('autofocus')) {
|
|
476
|
-
this.setAttribute('autofocus', '');
|
|
477
|
-
}
|
|
478
|
-
} else {
|
|
479
|
-
if (this.hasAttribute('autofocus')) {
|
|
480
|
-
this.removeAttribute('autofocus');
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
get form() {
|
|
485
|
-
return this._form;
|
|
486
|
-
}
|
|
487
|
-
get name() {
|
|
488
|
-
return this.getAttribute('name');
|
|
489
|
-
}
|
|
490
|
-
get type() {
|
|
491
|
-
return this.localName;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
var Editor = () => {
|
|
495
|
-
window.customElements.define('tinymce-editor', TinyMceEditor);
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
Editor();
|
|
499
|
-
|
|
500
|
-
})();
|