suneditor 2.44.8 → 2.44.10
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/LICENSE.txt +20 -20
- package/README.md +1585 -1585
- package/dist/suneditor.min.js +2 -2
- package/package.json +71 -71
- package/src/assets/css/suneditor-contents.css +556 -556
- package/src/assets/css/suneditor.css +0 -0
- package/src/assets/defaultIcons.js +103 -103
- package/src/lang/Lang.d.ts +143 -143
- package/src/lang/ckb.d.ts +4 -4
- package/src/lang/ckb.js +187 -187
- package/src/lang/da.d.ts +4 -4
- package/src/lang/da.js +191 -191
- package/src/lang/de.d.ts +4 -4
- package/src/lang/de.js +187 -187
- package/src/lang/en.d.ts +4 -4
- package/src/lang/en.js +187 -187
- package/src/lang/es.d.ts +4 -4
- package/src/lang/es.js +187 -187
- package/src/lang/fr.d.ts +4 -4
- package/src/lang/fr.js +188 -188
- package/src/lang/he.d.ts +4 -4
- package/src/lang/he.js +188 -188
- package/src/lang/index.d.ts +22 -22
- package/src/lang/index.js +25 -25
- package/src/lang/it.d.ts +4 -4
- package/src/lang/it.js +188 -188
- package/src/lang/ja.d.ts +4 -4
- package/src/lang/ja.js +187 -187
- package/src/lang/ko.d.ts +4 -4
- package/src/lang/ko.js +187 -187
- package/src/lang/lv.d.ts +4 -4
- package/src/lang/lv.js +187 -187
- package/src/lang/nl.d.ts +4 -4
- package/src/lang/nl.js +187 -187
- package/src/lang/pl.d.ts +4 -4
- package/src/lang/pl.js +187 -187
- package/src/lang/pt_br.d.ts +4 -4
- package/src/lang/pt_br.js +189 -189
- package/src/lang/ro.d.ts +4 -4
- package/src/lang/ro.js +187 -187
- package/src/lang/ru.d.ts +4 -4
- package/src/lang/ru.js +187 -187
- package/src/lang/se.d.ts +4 -4
- package/src/lang/se.js +191 -191
- package/src/lang/ua.d.ts +5 -5
- package/src/lang/ua.js +188 -188
- package/src/lang/ur.d.ts +4 -4
- package/src/lang/ur.js +187 -187
- package/src/lang/zh_cn.d.ts +4 -4
- package/src/lang/zh_cn.js +187 -187
- package/src/lib/constructor.js +1 -1
- package/src/lib/context.d.ts +42 -42
- package/src/lib/context.js +0 -0
- package/src/lib/core.d.ts +1101 -1101
- package/src/lib/core.js +144 -95
- package/src/lib/history.d.ts +48 -48
- package/src/lib/history.js +218 -218
- package/src/lib/util.d.ts +677 -677
- package/src/lib/util.js +9 -11
- package/src/options.d.ts +608 -608
- package/src/plugins/CommandPlugin.d.ts +7 -7
- package/src/plugins/DialogPlugin.d.ts +19 -19
- package/src/plugins/FileBrowserPlugin.d.ts +29 -29
- package/src/plugins/Module.d.ts +14 -14
- package/src/plugins/Plugin.d.ts +41 -41
- package/src/plugins/SubmenuPlugin.d.ts +7 -7
- package/src/plugins/command/blockquote.d.ts +4 -4
- package/src/plugins/command/blockquote.js +46 -46
- package/src/plugins/dialog/audio.d.ts +4 -4
- package/src/plugins/dialog/audio.js +556 -556
- package/src/plugins/dialog/image.d.ts +4 -4
- package/src/plugins/dialog/image.js +1122 -1122
- package/src/plugins/dialog/link.d.ts +4 -4
- package/src/plugins/dialog/link.js +223 -223
- package/src/plugins/dialog/math.d.ts +4 -4
- package/src/plugins/dialog/math.js +294 -294
- package/src/plugins/dialog/mention.d.ts +5 -5
- package/src/plugins/dialog/mention.js +242 -242
- package/src/plugins/dialog/video.d.ts +4 -4
- package/src/plugins/dialog/video.js +983 -983
- package/src/plugins/fileBrowser/imageGallery.d.ts +4 -4
- package/src/plugins/fileBrowser/imageGallery.js +63 -63
- package/src/plugins/index.d.ts +79 -79
- package/src/plugins/index.js +32 -32
- package/src/plugins/modules/_anchor.js +461 -461
- package/src/plugins/modules/_colorPicker.d.ts +59 -59
- package/src/plugins/modules/_colorPicker.js +0 -0
- package/src/plugins/modules/_notice.d.ts +20 -20
- package/src/plugins/modules/_notice.js +72 -72
- package/src/plugins/modules/_selectMenu.js +118 -118
- package/src/plugins/modules/component.d.ts +24 -24
- package/src/plugins/modules/component.js +82 -82
- package/src/plugins/modules/dialog.d.ts +27 -27
- package/src/plugins/modules/dialog.js +174 -174
- package/src/plugins/modules/fileBrowser.d.ts +41 -41
- package/src/plugins/modules/fileBrowser.js +373 -373
- package/src/plugins/modules/fileManager.d.ts +66 -66
- package/src/plugins/modules/fileManager.js +325 -325
- package/src/plugins/modules/index.d.ts +10 -10
- package/src/plugins/modules/index.js +8 -8
- package/src/plugins/modules/resizing.d.ts +153 -153
- package/src/plugins/modules/resizing.js +895 -895
- package/src/plugins/submenu/align.d.ts +4 -4
- package/src/plugins/submenu/align.js +160 -160
- package/src/plugins/submenu/font.d.ts +4 -4
- package/src/plugins/submenu/font.js +120 -120
- package/src/plugins/submenu/fontColor.d.ts +4 -4
- package/src/plugins/submenu/fontColor.js +0 -0
- package/src/plugins/submenu/fontSize.d.ts +4 -4
- package/src/plugins/submenu/fontSize.js +112 -112
- package/src/plugins/submenu/formatBlock.d.ts +4 -4
- package/src/plugins/submenu/formatBlock.js +273 -273
- package/src/plugins/submenu/hiliteColor.d.ts +4 -4
- package/src/plugins/submenu/hiliteColor.js +0 -0
- package/src/plugins/submenu/horizontalRule.d.ts +4 -4
- package/src/plugins/submenu/horizontalRule.js +98 -98
- package/src/plugins/submenu/lineHeight.d.ts +4 -4
- package/src/plugins/submenu/lineHeight.js +104 -104
- package/src/plugins/submenu/list.d.ts +4 -4
- package/src/plugins/submenu/list.js +456 -456
- package/src/plugins/submenu/paragraphStyle.d.ts +4 -4
- package/src/plugins/submenu/paragraphStyle.js +135 -135
- package/src/plugins/submenu/table.d.ts +4 -4
- package/src/plugins/submenu/template.d.ts +4 -4
- package/src/plugins/submenu/template.js +71 -71
- package/src/plugins/submenu/textStyle.d.ts +4 -4
- package/src/plugins/submenu/textStyle.js +167 -167
- package/src/suneditor.d.ts +9 -9
- package/src/suneditor.js +75 -75
- package/src/suneditor_build.js +17 -17
package/src/lib/core.js
CHANGED
|
@@ -2134,6 +2134,21 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2134
2134
|
this._resetRangeToTextNode();
|
|
2135
2135
|
|
|
2136
2136
|
const range = this.getRange();
|
|
2137
|
+
const isStartEdge = range.startOffset === 0;
|
|
2138
|
+
const isEndEdge = core.isEdgePoint(range.endContainer, range.endOffset);
|
|
2139
|
+
let prevContainer = null;
|
|
2140
|
+
let startPrevEl = null;
|
|
2141
|
+
let endNextEl = null;
|
|
2142
|
+
if (isStartEdge) {
|
|
2143
|
+
startPrevEl = util.getFormatElement(range.startContainer);
|
|
2144
|
+
prevContainer = startPrevEl.previousElementSibling;
|
|
2145
|
+
startPrevEl = startPrevEl ? prevContainer : startPrevEl;
|
|
2146
|
+
}
|
|
2147
|
+
if (isEndEdge) {
|
|
2148
|
+
endNextEl = util.getFormatElement(range.endContainer);
|
|
2149
|
+
endNextEl = endNextEl ? endNextEl.nextElementSibling : endNextEl;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2137
2152
|
let container, offset = 0;
|
|
2138
2153
|
let startCon = range.startContainer;
|
|
2139
2154
|
let endCon = range.endContainer;
|
|
@@ -2269,6 +2284,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2269
2284
|
offset = container.textContent.length;
|
|
2270
2285
|
} else {
|
|
2271
2286
|
container = endCon && endCon.parentNode ? endCon : startCon && startCon.parentNode ? startCon : (range.endContainer || range.startContainer);
|
|
2287
|
+
offset = (!isStartEdge && !isEndEdge) ? offset : isEndEdge ? container.textContent.length : 0;
|
|
2272
2288
|
}
|
|
2273
2289
|
|
|
2274
2290
|
if (!util.isWysiwygDiv(container) && container.childNodes.length === 0) {
|
|
@@ -2276,6 +2292,16 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2276
2292
|
if (rc) container = rc.sc || rc.ec || context.element.wysiwyg;
|
|
2277
2293
|
}
|
|
2278
2294
|
|
|
2295
|
+
if (!util.getFormatElement(container) && !(startCon && startCon.parentNode)) {
|
|
2296
|
+
if (endNextEl) {
|
|
2297
|
+
container = endNextEl;
|
|
2298
|
+
offset = 0;
|
|
2299
|
+
} else if (startPrevEl) {
|
|
2300
|
+
container = startPrevEl;
|
|
2301
|
+
offset = 1;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2279
2305
|
// set range
|
|
2280
2306
|
this.setRange(container, offset, container, offset);
|
|
2281
2307
|
// history stack
|
|
@@ -2284,7 +2310,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2284
2310
|
return {
|
|
2285
2311
|
container: container,
|
|
2286
2312
|
offset: offset,
|
|
2287
|
-
prevContainer:
|
|
2313
|
+
prevContainer: prevContainer
|
|
2288
2314
|
};
|
|
2289
2315
|
},
|
|
2290
2316
|
|
|
@@ -6222,14 +6248,16 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6222
6248
|
this.history.reset(true);
|
|
6223
6249
|
|
|
6224
6250
|
_w.setTimeout(function () {
|
|
6251
|
+
if (typeof core._resourcesStateChange !== 'function') return;
|
|
6252
|
+
|
|
6225
6253
|
// observer
|
|
6226
6254
|
if (event._resizeObserver) event._resizeObserver.observe(context.element.wysiwygFrame);
|
|
6227
6255
|
if (event._toolbarObserver) event._toolbarObserver.observe(context.element._toolbarShadow);
|
|
6228
6256
|
// resource state
|
|
6229
|
-
|
|
6257
|
+
core._resourcesStateChange();
|
|
6230
6258
|
// user event
|
|
6231
6259
|
if (typeof functions.onload === 'function') functions.onload(core, reload);
|
|
6232
|
-
}
|
|
6260
|
+
});
|
|
6233
6261
|
},
|
|
6234
6262
|
|
|
6235
6263
|
/**
|
|
@@ -6482,6 +6510,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6482
6510
|
|
|
6483
6511
|
onMouseDown_wysiwyg: function (e) {
|
|
6484
6512
|
if (core.isReadOnly || util.isNonEditable(context.element.wysiwyg)) return;
|
|
6513
|
+
_w.setTimeout(core._editorRange.bind(core));
|
|
6485
6514
|
|
|
6486
6515
|
// user event
|
|
6487
6516
|
if (typeof functions.onMouseDown === 'function' && functions.onMouseDown(e, core) === false) return;
|
|
@@ -6544,7 +6573,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6544
6573
|
}
|
|
6545
6574
|
}
|
|
6546
6575
|
|
|
6547
|
-
_w.setTimeout(core._editorRange.bind(core));
|
|
6548
6576
|
core._editorRange();
|
|
6549
6577
|
|
|
6550
6578
|
const selectionNode = core.getSelectionNode();
|
|
@@ -7315,6 +7343,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7315
7343
|
if (!shift) {
|
|
7316
7344
|
const formatEndEdge = core._isEdgeFormat(range.endContainer, range.endOffset, 'end');
|
|
7317
7345
|
const formatStartEdge = core._isEdgeFormat(range.startContainer, range.startOffset, 'start');
|
|
7346
|
+
|
|
7318
7347
|
// add default format line
|
|
7319
7348
|
if (formatEndEdge && (/^H[1-6]$/i.test(formatEl.nodeName) || /^HR$/i.test(formatEl.nodeName))) {
|
|
7320
7349
|
e.preventDefault();
|
|
@@ -7333,66 +7362,48 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7333
7362
|
temp = !temp ? newFormat.firstChild : temp.appendChild(newFormat.firstChild);
|
|
7334
7363
|
core.setRange(temp, 0, temp, 0);
|
|
7335
7364
|
break;
|
|
7336
|
-
}
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
core.setRange(focusBR, 1, focusBR, 1);
|
|
7365
|
+
} else if (rangeEl && formatEl && !util.isCell(rangeEl) && !/^FIGCAPTION$/i.test(rangeEl.nodeName)) {
|
|
7366
|
+
const range = core.getRange();
|
|
7367
|
+
if(core.isEdgePoint(range.endContainer, range.endOffset) && util.isList(selectionNode.nextSibling)) {
|
|
7368
|
+
e.preventDefault();
|
|
7369
|
+
const newEl = util.createElement('LI');
|
|
7370
|
+
const br = util.createElement('BR');
|
|
7371
|
+
newEl.appendChild(br);
|
|
7372
|
+
|
|
7373
|
+
formatEl.parentNode.insertBefore(newEl, formatEl.nextElementSibling);
|
|
7374
|
+
newEl.appendChild(selectionNode.nextSibling);
|
|
7375
|
+
|
|
7376
|
+
core.setRange(br, 1, br, 1);
|
|
7377
|
+
break;
|
|
7350
7378
|
}
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
if (isMultiLine) {
|
|
7366
|
-
newEl = util.getFormatElement(r.container, null);
|
|
7367
|
-
|
|
7368
|
-
if (!r.prevContainer) {
|
|
7369
|
-
const newFormat = formatEl.cloneNode(false);
|
|
7370
|
-
newFormat.innerHTML = '<br>';
|
|
7371
|
-
newEl.parentNode.insertBefore(newFormat, newEl);
|
|
7372
|
-
} else if (newEl !== formatEl && newEl.nextElementSibling === formatEl) {
|
|
7373
|
-
newEl = formatEl;
|
|
7379
|
+
|
|
7380
|
+
if ((range.commonAncestorContainer.nodeType === 3 ? !range.commonAncestorContainer.nextElementSibling : true) && util.onlyZeroWidthSpace(formatEl.innerText.trim()) && !util.isListCell(formatEl.nextElementSibling)) {
|
|
7381
|
+
e.preventDefault();
|
|
7382
|
+
let newEl = null;
|
|
7383
|
+
|
|
7384
|
+
if (util.isListCell(rangeEl.parentNode)) {
|
|
7385
|
+
rangeEl = formatEl.parentNode.parentNode.parentNode;
|
|
7386
|
+
newEl = util.splitElement(formatEl, null, util.getElementDepth(formatEl) - 2);
|
|
7387
|
+
if (!newEl) {
|
|
7388
|
+
const newListCell = util.createElement('LI');
|
|
7389
|
+
newListCell.innerHTML = '<br>';
|
|
7390
|
+
util.copyTagAttributes(newListCell, formatEl, options.lineAttrReset);
|
|
7391
|
+
rangeEl.insertBefore(newListCell, newEl);
|
|
7392
|
+
newEl = newListCell;
|
|
7374
7393
|
}
|
|
7375
7394
|
} else {
|
|
7376
|
-
|
|
7395
|
+
const newFormat = util.isCell(rangeEl.parentNode) ? 'DIV' : util.isList(rangeEl.parentNode) ? 'LI' : (util.isFormatElement(rangeEl.nextElementSibling) && !util.isRangeFormatElement(rangeEl.nextElementSibling)) ? rangeEl.nextElementSibling.nodeName : (util.isFormatElement(rangeEl.previousElementSibling) && !util.isRangeFormatElement(rangeEl.previousElementSibling)) ? rangeEl.previousElementSibling.nodeName : options.defaultTag;
|
|
7396
|
+
newEl = util.createElement(newFormat);
|
|
7397
|
+
util.copyTagAttributes(newEl, formatEl, options.lineAttrReset);
|
|
7398
|
+
const edge = core.detachRangeFormatElement(rangeEl, [formatEl], null, true, true);
|
|
7399
|
+
edge.cc.insertBefore(newEl, edge.ec);
|
|
7377
7400
|
}
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
const resetAttr = options.lineAttrReset;
|
|
7384
|
-
const attrs = newEl.attributes;
|
|
7385
|
-
let i = 0;
|
|
7386
|
-
while (attrs[i]) {
|
|
7387
|
-
if (resetAttr && resetAttr.indexOf(attrs[i].name.toLowerCase()) > -1) {
|
|
7388
|
-
i++;
|
|
7389
|
-
continue;
|
|
7390
|
-
}
|
|
7391
|
-
newEl.removeAttribute(attrs[i].name);
|
|
7401
|
+
|
|
7402
|
+
newEl.innerHTML = '<br>';
|
|
7403
|
+
util.removeItemAllParents(formatEl, null, null);
|
|
7404
|
+
core.setRange(newEl, 1, newEl, 1);
|
|
7405
|
+
break;
|
|
7392
7406
|
}
|
|
7393
|
-
core.setRange(newEl.firstChild, 0, newEl.firstChild, 0);
|
|
7394
|
-
|
|
7395
|
-
break;
|
|
7396
7407
|
}
|
|
7397
7408
|
|
|
7398
7409
|
if (freeFormatEl) {
|
|
@@ -7438,52 +7449,90 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7438
7449
|
event._onShortcutKey = true;
|
|
7439
7450
|
break;
|
|
7440
7451
|
}
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
if (rangeEl && formatEl && !util.isCell(rangeEl) && !/^FIGCAPTION$/i.test(rangeEl.nodeName)) {
|
|
7446
|
-
const range = core.getRange();
|
|
7447
|
-
if(core.isEdgePoint(range.endContainer, range.endOffset) && util.isList(selectionNode.nextSibling)) {
|
|
7452
|
+
|
|
7453
|
+
// set format attrs - edge
|
|
7454
|
+
if (range.collapsed && (formatStartEdge || formatEndEdge)) {
|
|
7448
7455
|
e.preventDefault();
|
|
7449
|
-
const
|
|
7450
|
-
const
|
|
7451
|
-
|
|
7456
|
+
const focusBR = util.createElement('BR');
|
|
7457
|
+
const newFormat = util.createElement(formatEl.nodeName);
|
|
7458
|
+
newFormat.appendChild(focusBR);
|
|
7452
7459
|
|
|
7453
|
-
|
|
7454
|
-
|
|
7460
|
+
util.copyTagAttributes(newFormat, formatEl, options.lineAttrReset);
|
|
7461
|
+
|
|
7462
|
+
formatEl.parentNode.insertBefore(newFormat, formatStartEdge ? formatEl : formatEl.nextElementSibling);
|
|
7463
|
+
if (formatEndEdge) {
|
|
7464
|
+
core.setRange(focusBR, 1, focusBR, 1);
|
|
7465
|
+
}
|
|
7455
7466
|
|
|
7456
|
-
core.setRange(br, 1, br, 1);
|
|
7457
7467
|
break;
|
|
7458
7468
|
}
|
|
7469
|
+
|
|
7470
|
+
if (formatEl) {
|
|
7471
|
+
e.stopPropagation();
|
|
7459
7472
|
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7473
|
+
let newEl;
|
|
7474
|
+
let offset = 0;
|
|
7475
|
+
if (!range.collapsed) {
|
|
7476
|
+
const isMultiLine = util.getFormatElement(range.startContainer, null) !== util.getFormatElement(range.endContainer, null);
|
|
7477
|
+
const newFormat = formatEl.cloneNode(false);
|
|
7478
|
+
newFormat.innerHTML = '<br>';
|
|
7479
|
+
const r = core.removeNode();
|
|
7480
|
+
newEl = util.getFormatElement(r.container, null);
|
|
7467
7481
|
if (!newEl) {
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7482
|
+
if (util.isWysiwygDiv(r.container)) {
|
|
7483
|
+
e.preventDefault();
|
|
7484
|
+
context.element.wysiwyg.appendChild(newFormat);
|
|
7485
|
+
newEl = newFormat;
|
|
7486
|
+
util.copyTagAttributes(newEl, formatEl, options.lineAttrReset);
|
|
7487
|
+
core.setRange(newEl, offset, newEl, offset);
|
|
7488
|
+
}
|
|
7489
|
+
break;
|
|
7490
|
+
}
|
|
7491
|
+
|
|
7492
|
+
const innerRange = util.getRangeFormatElement(r.container);
|
|
7493
|
+
newEl = newEl.contains(innerRange) ? util.getChildElement(innerRange, util.getFormatElement.bind(util)) : newEl;
|
|
7494
|
+
if (isMultiLine) {
|
|
7495
|
+
if (formatEndEdge && !formatStartEdge) {
|
|
7496
|
+
newEl.parentNode.insertBefore(newFormat, (!r.prevContainer || r.container === r.prevContainer) ? newEl.nextElementSibling : newEl);
|
|
7497
|
+
newEl = newFormat;
|
|
7498
|
+
offset = 0;
|
|
7499
|
+
} else {
|
|
7500
|
+
offset = r.offset;
|
|
7501
|
+
if (formatStartEdge) {
|
|
7502
|
+
const tempEl = newEl.parentNode.insertBefore(newFormat, newEl);
|
|
7503
|
+
if (formatEndEdge) {
|
|
7504
|
+
newEl = tempEl;
|
|
7505
|
+
offset = 0;
|
|
7506
|
+
}
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
} else {
|
|
7510
|
+
if (formatEndEdge && formatStartEdge) {
|
|
7511
|
+
newEl.parentNode.insertBefore(newFormat, (r.prevContainer && r.container === r.prevContainer) ? newEl.nextElementSibling : newEl);
|
|
7512
|
+
newEl = newFormat;
|
|
7513
|
+
offset = 0;
|
|
7514
|
+
} else {
|
|
7515
|
+
newEl = util.splitElement(r.container, r.offset, util.getElementDepth(formatEl));
|
|
7516
|
+
}
|
|
7472
7517
|
}
|
|
7473
7518
|
} else {
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7519
|
+
if (util.onlyZeroWidthSpace(formatEl)) {
|
|
7520
|
+
newEl = core.appendFormatTag(formatEl, formatEl.cloneNode(false));
|
|
7521
|
+
} else {
|
|
7522
|
+
newEl = util.splitElement(range.endContainer, range.endOffset, util.getElementDepth(formatEl));
|
|
7523
|
+
}
|
|
7478
7524
|
}
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
util.
|
|
7482
|
-
core.setRange(newEl,
|
|
7525
|
+
|
|
7526
|
+
e.preventDefault();
|
|
7527
|
+
util.copyTagAttributes(newEl, formatEl, options.lineAttrReset);
|
|
7528
|
+
core.setRange(newEl, offset, newEl, offset);
|
|
7529
|
+
|
|
7483
7530
|
break;
|
|
7484
7531
|
}
|
|
7485
7532
|
}
|
|
7486
7533
|
|
|
7534
|
+
if (selectRange) break;
|
|
7535
|
+
|
|
7487
7536
|
if (rangeEl && util.getParentElement(rangeEl, 'FIGCAPTION') && util.getParentElement(rangeEl, util.isList)) {
|
|
7488
7537
|
e.preventDefault();
|
|
7489
7538
|
formatEl = core.appendFormatTag(formatEl, null);
|
|
@@ -8134,10 +8183,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8134
8183
|
context.element.lineBreaker_t.addEventListener('mousedown', event._lineBreakerBind.t, false);
|
|
8135
8184
|
context.element.lineBreaker_b.addEventListener('mousedown', event._lineBreakerBind.b, false);
|
|
8136
8185
|
|
|
8137
|
-
/** Events are registered
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
}
|
|
8186
|
+
/** Events are registered mobile. */
|
|
8187
|
+
eventWysiwyg.addEventListener('touchstart', event.onMouseDown_wysiwyg, {passive: true, useCapture: false});
|
|
8188
|
+
eventWysiwyg.addEventListener('touchend', event.onClick_wysiwyg, {passive: true, useCapture: false});
|
|
8141
8189
|
|
|
8142
8190
|
/** code view area auto line */
|
|
8143
8191
|
if (options.height === 'auto' && !options.codeMirrorEditor) {
|
|
@@ -8194,6 +8242,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8194
8242
|
event._lineBreakerBind = null;
|
|
8195
8243
|
|
|
8196
8244
|
eventWysiwyg.removeEventListener('touchstart', event.onMouseDown_wysiwyg, {passive: true, useCapture: false});
|
|
8245
|
+
eventWysiwyg.removeEventListener('touchend', event.onClick_wysiwyg, {passive: true, useCapture: false});
|
|
8197
8246
|
eventWysiwyg.removeEventListener('focus', event.onFocus_wysiwyg);
|
|
8198
8247
|
eventWysiwyg.removeEventListener('blur', event.onBlur_wysiwyg);
|
|
8199
8248
|
|
package/src/lib/history.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Core } from "./core";
|
|
2
|
-
|
|
3
|
-
export interface History {
|
|
4
|
-
/**
|
|
5
|
-
* @description History stack
|
|
6
|
-
*/
|
|
7
|
-
stack: any[];
|
|
8
|
-
/**
|
|
9
|
-
* @description Saving the current status to the history object stack
|
|
10
|
-
* If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds
|
|
11
|
-
* If the function is called again with the "delay" argument true before it is saved, the delay time is renewal
|
|
12
|
-
* You can specify the delay time by sending a number.
|
|
13
|
-
* @param {Boolean} delay If true, Add stack without delay time.
|
|
14
|
-
*/
|
|
15
|
-
push: (delay: boolean | number) => void;
|
|
16
|
-
/**
|
|
17
|
-
* @description Undo function
|
|
18
|
-
*/
|
|
19
|
-
undo: () => void;
|
|
20
|
-
/**
|
|
21
|
-
* @description Redo function
|
|
22
|
-
*/
|
|
23
|
-
redo: () => void;
|
|
24
|
-
/**
|
|
25
|
-
* @description Go to the history stack for that index.
|
|
26
|
-
* If "index" is -1, go to the last stack
|
|
27
|
-
* @param {Number} index Stack index
|
|
28
|
-
*/
|
|
29
|
-
go: (index: number) => void;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @description Get the current history stack index.
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
getCurrentIndex: () => number;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @description Reset the history object
|
|
39
|
-
*/
|
|
40
|
-
reset: (ignoreChangeEvent: any) => void;
|
|
41
|
-
/**
|
|
42
|
-
* @description Remove all stacks and remove the timeout function.
|
|
43
|
-
* @private
|
|
44
|
-
*/
|
|
45
|
-
_destroy: () => void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default function _default(core: Core, change: any): History;
|
|
1
|
+
import { Core } from "./core";
|
|
2
|
+
|
|
3
|
+
export interface History {
|
|
4
|
+
/**
|
|
5
|
+
* @description History stack
|
|
6
|
+
*/
|
|
7
|
+
stack: any[];
|
|
8
|
+
/**
|
|
9
|
+
* @description Saving the current status to the history object stack
|
|
10
|
+
* If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds
|
|
11
|
+
* If the function is called again with the "delay" argument true before it is saved, the delay time is renewal
|
|
12
|
+
* You can specify the delay time by sending a number.
|
|
13
|
+
* @param {Boolean} delay If true, Add stack without delay time.
|
|
14
|
+
*/
|
|
15
|
+
push: (delay: boolean | number) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @description Undo function
|
|
18
|
+
*/
|
|
19
|
+
undo: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* @description Redo function
|
|
22
|
+
*/
|
|
23
|
+
redo: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* @description Go to the history stack for that index.
|
|
26
|
+
* If "index" is -1, go to the last stack
|
|
27
|
+
* @param {Number} index Stack index
|
|
28
|
+
*/
|
|
29
|
+
go: (index: number) => void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Get the current history stack index.
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
getCurrentIndex: () => number;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description Reset the history object
|
|
39
|
+
*/
|
|
40
|
+
reset: (ignoreChangeEvent: any) => void;
|
|
41
|
+
/**
|
|
42
|
+
* @description Remove all stacks and remove the timeout function.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
_destroy: () => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function _default(core: Core, change: any): History;
|