@opentiny/fluent-editor 3.18.2 → 3.18.4
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/README.md +43 -11
- package/index.cjs.js +7 -7
- package/index.cjs.js.map +1 -1
- package/index.es.js +102 -91
- package/index.es.js.map +1 -1
- package/package.json +2 -15
package/index.es.js
CHANGED
|
@@ -11206,7 +11206,9 @@ function imageFileToUrl(imageFile) {
|
|
|
11206
11206
|
resolve(e.target["result"]);
|
|
11207
11207
|
};
|
|
11208
11208
|
reader.onerror = reject;
|
|
11209
|
-
}).catch((
|
|
11209
|
+
}).catch((error2) => {
|
|
11210
|
+
console.error("Error reading file:", error2);
|
|
11211
|
+
});
|
|
11210
11212
|
}
|
|
11211
11213
|
function imageUrlToFile(imageUrl, isErrorImage) {
|
|
11212
11214
|
return new Promise(function(resolve, reject) {
|
|
@@ -11806,7 +11808,7 @@ class CustomClipboard extends Clipboard {
|
|
|
11806
11808
|
if (!e.clipboardData) {
|
|
11807
11809
|
e.clipboardData = {
|
|
11808
11810
|
types: "text/plain",
|
|
11809
|
-
setData: (
|
|
11811
|
+
setData: (_type, value) => {
|
|
11810
11812
|
return window["clipboardData"].setData("Text", value);
|
|
11811
11813
|
}
|
|
11812
11814
|
};
|
|
@@ -11991,7 +11993,7 @@ class CustomClipboard extends Clipboard {
|
|
|
11991
11993
|
handlePasteContent(pastedDelta);
|
|
11992
11994
|
}
|
|
11993
11995
|
}
|
|
11994
|
-
} catch (
|
|
11996
|
+
} catch (_e) {
|
|
11995
11997
|
throw new Error("Paste failed.");
|
|
11996
11998
|
}
|
|
11997
11999
|
})();
|
|
@@ -12087,7 +12089,7 @@ class CustomClipboard extends Clipboard {
|
|
|
12087
12089
|
)}`;
|
|
12088
12090
|
imageIndex = index;
|
|
12089
12091
|
file = await imageUrlToFile(newImage || image.src || image);
|
|
12090
|
-
} catch (
|
|
12092
|
+
} catch (_err) {
|
|
12091
12093
|
if (clipboardFiles.length !== 0) {
|
|
12092
12094
|
const clipboardFile = clipboardFiles[0];
|
|
12093
12095
|
const imageType = ((_a = clipboardFile.type) == null ? void 0 : _a.indexOf("image")) === -1 ? "image/png" : clipboardFile.type;
|
|
@@ -12118,7 +12120,7 @@ class CustomClipboard extends Clipboard {
|
|
|
12118
12120
|
}
|
|
12119
12121
|
return true;
|
|
12120
12122
|
});
|
|
12121
|
-
|
|
12123
|
+
const range = {
|
|
12122
12124
|
index: length,
|
|
12123
12125
|
length: 0
|
|
12124
12126
|
};
|
|
@@ -12403,7 +12405,7 @@ class CustomResizeAction extends Action {
|
|
|
12403
12405
|
target.setAttribute("height", `${newHeight}`);
|
|
12404
12406
|
this.formatter.update();
|
|
12405
12407
|
};
|
|
12406
|
-
this.onMouseUp = (
|
|
12408
|
+
this.onMouseUp = () => {
|
|
12407
12409
|
this.setCursor("");
|
|
12408
12410
|
document.removeEventListener("mousemove", this.onDrag);
|
|
12409
12411
|
document.removeEventListener("mouseup", this.onMouseUp);
|
|
@@ -12743,7 +12745,7 @@ class CustomImageSpec extends ImageSpec {
|
|
|
12743
12745
|
}
|
|
12744
12746
|
}
|
|
12745
12747
|
}
|
|
12746
|
-
const dontMerge = (
|
|
12748
|
+
const dontMerge = (_destination, source2) => source2;
|
|
12747
12749
|
class BlotFormatter {
|
|
12748
12750
|
constructor(quill, options = {}) {
|
|
12749
12751
|
this.onClick = () => {
|
|
@@ -12922,7 +12924,7 @@ class CustomUploader extends Uploader {
|
|
|
12922
12924
|
});
|
|
12923
12925
|
this.options.handler.call(this, range, uploads, fileFlags, rejectFlags);
|
|
12924
12926
|
}
|
|
12925
|
-
handleUploadFile(range, files,
|
|
12927
|
+
handleUploadFile(range, files, _hasRejectedFile) {
|
|
12926
12928
|
this.insertFileToEditor(range, files[0], {
|
|
12927
12929
|
code: 0,
|
|
12928
12930
|
data: {
|
|
@@ -12948,7 +12950,6 @@ class CustomUploader extends Uploader {
|
|
|
12948
12950
|
handleUploadImage(range, { file, files }, hasRejectedImage) {
|
|
12949
12951
|
if (this.imageUploadToServer) {
|
|
12950
12952
|
const imageEnableMultiUpload = this.enableMultiUpload === true || this.enableMultiUpload["image"];
|
|
12951
|
-
this.editorElem.parentElement.querySelector(".ql-image");
|
|
12952
12953
|
const result = {
|
|
12953
12954
|
file,
|
|
12954
12955
|
data: { files: [file] },
|
|
@@ -13007,14 +13008,14 @@ CustomUploader.DEFAULTS = {
|
|
|
13007
13008
|
function createEmoji(emojiArr) {
|
|
13008
13009
|
const emojiList2 = [];
|
|
13009
13010
|
emojiArr.forEach((emojiItem) => {
|
|
13010
|
-
const [name, unicode, shortname,
|
|
13011
|
+
const [name, unicode, shortname, codeDecimal, category, emojiOrder] = emojiItem;
|
|
13011
13012
|
emojiList2.push({
|
|
13012
13013
|
name,
|
|
13013
13014
|
unicode,
|
|
13014
13015
|
shortname,
|
|
13015
|
-
|
|
13016
|
+
codeDecimal,
|
|
13016
13017
|
category,
|
|
13017
|
-
|
|
13018
|
+
emojiOrder
|
|
13018
13019
|
});
|
|
13019
13020
|
});
|
|
13020
13021
|
return emojiList2;
|
|
@@ -13212,7 +13213,7 @@ class ShortNameEmoji extends Module$4 {
|
|
|
13212
13213
|
collapsed: true
|
|
13213
13214
|
}, this.handleArrow.bind(this));
|
|
13214
13215
|
}
|
|
13215
|
-
triggerPicker(range,
|
|
13216
|
+
triggerPicker(range, _context) {
|
|
13216
13217
|
if (this.open) {
|
|
13217
13218
|
return true;
|
|
13218
13219
|
}
|
|
@@ -13258,7 +13259,7 @@ class ShortNameEmoji extends Module$4 {
|
|
|
13258
13259
|
this.close(null);
|
|
13259
13260
|
return;
|
|
13260
13261
|
}
|
|
13261
|
-
} catch (
|
|
13262
|
+
} catch (_e) {
|
|
13262
13263
|
throw new Error("Close failed");
|
|
13263
13264
|
}
|
|
13264
13265
|
this.query = this.query.trim();
|
|
@@ -13298,7 +13299,7 @@ class ShortNameEmoji extends Module$4 {
|
|
|
13298
13299
|
if (evt) {
|
|
13299
13300
|
return;
|
|
13300
13301
|
}
|
|
13301
|
-
} catch (
|
|
13302
|
+
} catch (_e) {
|
|
13302
13303
|
throw new Error("Render failed");
|
|
13303
13304
|
}
|
|
13304
13305
|
while (this.container.firstChild) {
|
|
@@ -13414,7 +13415,6 @@ function makeElement(tag2, attrs, ...children) {
|
|
|
13414
13415
|
});
|
|
13415
13416
|
return elem;
|
|
13416
13417
|
}
|
|
13417
|
-
Quill.imports["delta"];
|
|
13418
13418
|
const Module$3 = Quill.imports["core/module"];
|
|
13419
13419
|
class ToolbarEmoji extends Module$3 {
|
|
13420
13420
|
constructor(quill, options) {
|
|
@@ -13434,54 +13434,54 @@ class ToolbarEmoji extends Module$3 {
|
|
|
13434
13434
|
}
|
|
13435
13435
|
checkPalatteExist() {
|
|
13436
13436
|
const quill = this.quill;
|
|
13437
|
-
|
|
13438
|
-
this.quill.on("text-change", function(
|
|
13437
|
+
fnCheckDialogOpen(quill);
|
|
13438
|
+
this.quill.on("text-change", function(_delta, _oldDelta, source2) {
|
|
13439
13439
|
if (source2 === "user") {
|
|
13440
|
-
|
|
13441
|
-
|
|
13440
|
+
fnClose();
|
|
13441
|
+
fnUpdateRange(quill);
|
|
13442
13442
|
}
|
|
13443
13443
|
});
|
|
13444
13444
|
}
|
|
13445
13445
|
}
|
|
13446
|
-
function
|
|
13447
|
-
const
|
|
13446
|
+
function fnClose() {
|
|
13447
|
+
const eleEmojiPlate = document.getElementById("emoji-palette");
|
|
13448
13448
|
document.getElementById("emoji-close-div").style.display = "none";
|
|
13449
|
-
if (
|
|
13450
|
-
|
|
13449
|
+
if (eleEmojiPlate) {
|
|
13450
|
+
eleEmojiPlate.remove();
|
|
13451
13451
|
}
|
|
13452
13452
|
}
|
|
13453
|
-
function
|
|
13453
|
+
function fnCheckDialogOpen(quill) {
|
|
13454
13454
|
const elementExists = document.getElementById("emoji-palette");
|
|
13455
13455
|
if (elementExists) {
|
|
13456
13456
|
elementExists.remove();
|
|
13457
13457
|
} else {
|
|
13458
|
-
|
|
13458
|
+
fnShowEmojiPalatte(quill);
|
|
13459
13459
|
}
|
|
13460
13460
|
}
|
|
13461
|
-
function
|
|
13461
|
+
function fnUpdateRange(quill) {
|
|
13462
13462
|
const range = quill.getSelection();
|
|
13463
13463
|
return range;
|
|
13464
13464
|
}
|
|
13465
|
-
function
|
|
13466
|
-
const
|
|
13465
|
+
function fnShowEmojiPalatte(quill) {
|
|
13466
|
+
const eleEmojiArea = document.createElement("div");
|
|
13467
13467
|
const range = quill.getSelection();
|
|
13468
13468
|
const atSignBounds = quill.getBounds(range.index);
|
|
13469
|
-
quill.container.appendChild(
|
|
13469
|
+
quill.container.appendChild(eleEmojiArea);
|
|
13470
13470
|
const containerRect = quill.container.getBoundingClientRect();
|
|
13471
13471
|
const paletteMaxPos = atSignBounds.left + 250;
|
|
13472
|
-
|
|
13473
|
-
|
|
13472
|
+
eleEmojiArea.id = "emoji-palette";
|
|
13473
|
+
eleEmojiArea.style.top = 10 + atSignBounds.top + atSignBounds.height + containerRect.top + "px";
|
|
13474
13474
|
if (paletteMaxPos > quill.container.offsetWidth) {
|
|
13475
|
-
|
|
13475
|
+
eleEmojiArea.style.left = atSignBounds.left + containerRect.left - 250 + "px";
|
|
13476
13476
|
} else {
|
|
13477
|
-
|
|
13477
|
+
eleEmojiArea.style.left = atSignBounds.left + containerRect.left + "px";
|
|
13478
13478
|
}
|
|
13479
13479
|
const tabToolbar = document.createElement("div");
|
|
13480
13480
|
tabToolbar.id = "tab-toolbar";
|
|
13481
|
-
|
|
13481
|
+
eleEmojiArea.appendChild(tabToolbar);
|
|
13482
13482
|
const panel = document.createElement("div");
|
|
13483
13483
|
panel.id = "tab-panel";
|
|
13484
|
-
|
|
13484
|
+
eleEmojiArea.appendChild(panel);
|
|
13485
13485
|
const emojiType = [
|
|
13486
13486
|
{ "type": "p", "name": "people", "content": '<div class="i-people"></div>' },
|
|
13487
13487
|
{ "type": "n", "name": "nature", "content": '<div class="i-nature"></div>' },
|
|
@@ -13497,7 +13497,7 @@ function fn_showEmojiPalatte(quill) {
|
|
|
13497
13497
|
if (document.getElementById("emoji-close-div") === null) {
|
|
13498
13498
|
const closeDiv = document.createElement("div");
|
|
13499
13499
|
closeDiv.id = "emoji-close-div";
|
|
13500
|
-
closeDiv.addEventListener("click",
|
|
13500
|
+
closeDiv.addEventListener("click", fnClose, false);
|
|
13501
13501
|
document.getElementsByTagName("body")[0].appendChild(closeDiv);
|
|
13502
13502
|
} else {
|
|
13503
13503
|
document.getElementById("emoji-close-div").style.display = "block";
|
|
@@ -13517,22 +13517,22 @@ function fn_showEmojiPalatte(quill) {
|
|
|
13517
13517
|
tab.classList.remove("active");
|
|
13518
13518
|
}
|
|
13519
13519
|
emojiFilter.classList.toggle("active");
|
|
13520
|
-
|
|
13520
|
+
fnUpdateEmojiContainer(emojiFilter, panel, quill);
|
|
13521
13521
|
});
|
|
13522
13522
|
});
|
|
13523
|
-
|
|
13523
|
+
fnEmojiPanelInit(panel, quill);
|
|
13524
13524
|
}
|
|
13525
|
-
function
|
|
13526
|
-
|
|
13525
|
+
function fnEmojiPanelInit(panel, quill) {
|
|
13526
|
+
fnEmojiElementsToPanel("p", panel, quill);
|
|
13527
13527
|
document.querySelector(".filter-people").classList.add("active");
|
|
13528
13528
|
}
|
|
13529
|
-
function
|
|
13529
|
+
function fnEmojiElementsToPanel(_type, panel, quill) {
|
|
13530
13530
|
const result = emojiList;
|
|
13531
13531
|
result.sort(function(a, b) {
|
|
13532
13532
|
return a.emoji_order - b.emoji_order;
|
|
13533
13533
|
});
|
|
13534
13534
|
quill.focus();
|
|
13535
|
-
const range =
|
|
13535
|
+
const range = fnUpdateRange(quill);
|
|
13536
13536
|
result.forEach(function(emoji) {
|
|
13537
13537
|
const span = document.createElement("span");
|
|
13538
13538
|
const t = document.createTextNode(emoji.shortname);
|
|
@@ -13549,17 +13549,17 @@ function fn_emojiElementsToPanel(type, panel, quill) {
|
|
|
13549
13549
|
customButton.addEventListener("click", function() {
|
|
13550
13550
|
quill.insertEmbed(range.index, "emoji", emoji, Quill.sources.USER);
|
|
13551
13551
|
setTimeout(() => quill.setSelection(range.index + 1), 0);
|
|
13552
|
-
|
|
13552
|
+
fnClose();
|
|
13553
13553
|
});
|
|
13554
13554
|
}
|
|
13555
13555
|
});
|
|
13556
13556
|
}
|
|
13557
|
-
function
|
|
13557
|
+
function fnUpdateEmojiContainer(emojiFilter, panel, quill) {
|
|
13558
13558
|
while (panel.firstChild) {
|
|
13559
13559
|
panel.removeChild(panel.firstChild);
|
|
13560
13560
|
}
|
|
13561
13561
|
const type = emojiFilter.dataset.filter;
|
|
13562
|
-
|
|
13562
|
+
fnEmojiElementsToPanel(type, panel, quill);
|
|
13563
13563
|
}
|
|
13564
13564
|
var Emoji = { EmojiBlot, ShortNameEmoji, ToolbarEmoji };
|
|
13565
13565
|
const Embed$3 = Quill.imports["blots/embed"];
|
|
@@ -13632,12 +13632,12 @@ function compareArray(arr1, arr2) {
|
|
|
13632
13632
|
return true;
|
|
13633
13633
|
}
|
|
13634
13634
|
function compareObject(object1, object2) {
|
|
13635
|
-
|
|
13636
|
-
|
|
13635
|
+
const o1keys = Object.keys(object1);
|
|
13636
|
+
const o2keys = Object.keys(object2);
|
|
13637
13637
|
if (o2keys.length !== o1keys.length)
|
|
13638
13638
|
return false;
|
|
13639
13639
|
for (let i = 0; i <= o1keys.length - 1; i++) {
|
|
13640
|
-
|
|
13640
|
+
const key = o1keys[i];
|
|
13641
13641
|
if (!o2keys.includes(key))
|
|
13642
13642
|
return false;
|
|
13643
13643
|
if (!compare(object2[key], object1[key]))
|
|
@@ -14034,7 +14034,7 @@ class Tooltip extends BaseTooltip {
|
|
|
14034
14034
|
);
|
|
14035
14035
|
this.root.addEventListener(
|
|
14036
14036
|
"mouseenter",
|
|
14037
|
-
(
|
|
14037
|
+
() => {
|
|
14038
14038
|
this.isHover = true;
|
|
14039
14039
|
},
|
|
14040
14040
|
false
|
|
@@ -14045,16 +14045,16 @@ class Tooltip extends BaseTooltip {
|
|
|
14045
14045
|
window.open(link, "_blank");
|
|
14046
14046
|
event.preventDefault();
|
|
14047
14047
|
});
|
|
14048
|
-
this.root.querySelector('input[type="text"]').addEventListener("focus", (
|
|
14048
|
+
this.root.querySelector('input[type="text"]').addEventListener("focus", () => {
|
|
14049
14049
|
this.isInputFocus = true;
|
|
14050
14050
|
});
|
|
14051
|
-
this.root.querySelector('input[type="text"]').addEventListener("blur", (
|
|
14051
|
+
this.root.querySelector('input[type="text"]').addEventListener("blur", () => {
|
|
14052
14052
|
this.isInputFocus = false;
|
|
14053
14053
|
this.save();
|
|
14054
14054
|
});
|
|
14055
14055
|
this.quill.on(
|
|
14056
14056
|
Emitter.events.SELECTION_CHANGE,
|
|
14057
|
-
(range,
|
|
14057
|
+
(range, _oldRange, source2) => {
|
|
14058
14058
|
if (isNullOrUndefined(range)) {
|
|
14059
14059
|
return;
|
|
14060
14060
|
}
|
|
@@ -14079,7 +14079,7 @@ class Tooltip extends BaseTooltip {
|
|
|
14079
14079
|
);
|
|
14080
14080
|
this.quill.on(
|
|
14081
14081
|
Emitter.events.TEXT_CHANGE,
|
|
14082
|
-
(
|
|
14082
|
+
() => {
|
|
14083
14083
|
const selection = this.quill.getSelection();
|
|
14084
14084
|
const index = selection && selection.index;
|
|
14085
14085
|
setTimeout(() => {
|
|
@@ -14225,7 +14225,7 @@ SnowTheme$1.prototype.extendToolbar = function(toolbar) {
|
|
|
14225
14225
|
if (toolbar.container.querySelector(".ql-link")) {
|
|
14226
14226
|
this.quill.keyboard.addBinding(
|
|
14227
14227
|
{ key: "k", shortKey: true },
|
|
14228
|
-
(
|
|
14228
|
+
(_range, context) => {
|
|
14229
14229
|
toolbar.handlers.link.call(toolbar, !context.format.link);
|
|
14230
14230
|
}
|
|
14231
14231
|
);
|
|
@@ -14302,12 +14302,12 @@ class Mention {
|
|
|
14302
14302
|
itemKey: "name",
|
|
14303
14303
|
searchKey: "name",
|
|
14304
14304
|
dataAttributes: ["id"],
|
|
14305
|
-
select(
|
|
14305
|
+
select(_data) {
|
|
14306
14306
|
},
|
|
14307
|
-
remove(
|
|
14307
|
+
remove(_data) {
|
|
14308
14308
|
}
|
|
14309
14309
|
};
|
|
14310
|
-
this.handleTextChange = (
|
|
14310
|
+
this.handleTextChange = (_delta, _oldDelta, source2) => {
|
|
14311
14311
|
setTimeout(() => {
|
|
14312
14312
|
if (Quill.sources.USER === source2) {
|
|
14313
14313
|
const range = this.quill.getSelection();
|
|
@@ -14375,7 +14375,10 @@ class Mention {
|
|
|
14375
14375
|
}
|
|
14376
14376
|
this.options = Object.assign(this.defaultOptions, options);
|
|
14377
14377
|
const container = document.createElement("div");
|
|
14378
|
-
container.classList.add(
|
|
14378
|
+
container.classList.add("ql-mention-list-container");
|
|
14379
|
+
if (this.options.containerClass !== "ql-mention-list-container") {
|
|
14380
|
+
container.classList.add(this.options.containerClass);
|
|
14381
|
+
}
|
|
14379
14382
|
this.mentionListEL = document.createElement("ul");
|
|
14380
14383
|
this.mentionListEL.classList.add(this.options.listClass, this.options.listHideClass);
|
|
14381
14384
|
this.mentionListEL.style.cssText += `
|
|
@@ -14469,11 +14472,11 @@ class Mention {
|
|
|
14469
14472
|
-1
|
|
14470
14473
|
);
|
|
14471
14474
|
}
|
|
14472
|
-
handleMouseClick(
|
|
14475
|
+
handleMouseClick(_itemEl, index) {
|
|
14473
14476
|
this.selectMentionItem(index, true);
|
|
14474
14477
|
this.quill.focus();
|
|
14475
14478
|
}
|
|
14476
|
-
handleMouseEnter(
|
|
14479
|
+
handleMouseEnter(_itemEl, index) {
|
|
14477
14480
|
this.activeMentionIndex = index;
|
|
14478
14481
|
this.highlightMentionItem(index);
|
|
14479
14482
|
}
|
|
@@ -14531,7 +14534,11 @@ class Mention {
|
|
|
14531
14534
|
mentionItemEl.classList.add(this.options.itemActiveClass);
|
|
14532
14535
|
}
|
|
14533
14536
|
const renderResult = this.options.renderMentionItem(mentionItem);
|
|
14534
|
-
|
|
14537
|
+
if (typeof renderResult === "string") {
|
|
14538
|
+
mentionItemEl.insertAdjacentHTML("afterbegin", renderResult);
|
|
14539
|
+
} else {
|
|
14540
|
+
mentionItemEl.insertAdjacentElement("afterbegin", renderResult);
|
|
14541
|
+
}
|
|
14535
14542
|
wrapEl.appendChild(mentionItemEl);
|
|
14536
14543
|
});
|
|
14537
14544
|
this.mentionListEL.innerHTML = wrapEl.innerHTML;
|
|
@@ -14618,7 +14625,7 @@ const COL_DEFAULT = {
|
|
|
14618
14625
|
width: 100
|
|
14619
14626
|
};
|
|
14620
14627
|
const CELL_IDENTITY_KEYS = ["row", "cell"];
|
|
14621
|
-
const CELL_ATTRIBUTES = ["rowspan", "colspan"];
|
|
14628
|
+
const CELL_ATTRIBUTES = ["rowspan", "colspan", "cell-bg"];
|
|
14622
14629
|
const CELL_DEFAULT = {
|
|
14623
14630
|
rowspan: 1,
|
|
14624
14631
|
colspan: 1
|
|
@@ -14694,7 +14701,7 @@ class Header extends Block$3 {
|
|
|
14694
14701
|
super.format(name, value);
|
|
14695
14702
|
}
|
|
14696
14703
|
}
|
|
14697
|
-
optimize(
|
|
14704
|
+
optimize(_context) {
|
|
14698
14705
|
const { row, cell, rowspan, colspan } = Header.formats(this.domNode);
|
|
14699
14706
|
if (row && this.parent.statics.blotName !== "table") {
|
|
14700
14707
|
this.wrap("table", {
|
|
@@ -14914,8 +14921,8 @@ const arrayFrom = function(arrayLike, mapFn, thisArg) {
|
|
|
14914
14921
|
"Array.from requires an array-like object - not null or undefined"
|
|
14915
14922
|
);
|
|
14916
14923
|
}
|
|
14917
|
-
|
|
14918
|
-
|
|
14924
|
+
const length = arrayLike.length;
|
|
14925
|
+
const resArray = [];
|
|
14919
14926
|
for (let i = 0; i < length; i++) {
|
|
14920
14927
|
if (typeof mapFn === "function") {
|
|
14921
14928
|
resArray.push(mapFn.call(thisArg, arrayLike[i]));
|
|
@@ -14940,7 +14947,8 @@ class TableCellLine extends Block$1 {
|
|
|
14940
14947
|
node.setAttribute(`data-${key}`, value[key] || identityMaker());
|
|
14941
14948
|
});
|
|
14942
14949
|
CELL_ATTRIBUTES.forEach((attrName) => {
|
|
14943
|
-
|
|
14950
|
+
const keyValue = value[attrName] || CELL_DEFAULT[attrName];
|
|
14951
|
+
keyValue && node.setAttribute(`data-${attrName}`, keyValue);
|
|
14944
14952
|
});
|
|
14945
14953
|
if (value.height) {
|
|
14946
14954
|
node.setAttribute("height", value.height);
|
|
@@ -14999,22 +15007,22 @@ class TableCellLine extends Block$1 {
|
|
|
14999
15007
|
switch (true) {
|
|
15000
15008
|
case name === "cell-bg": {
|
|
15001
15009
|
this.toggleAttribute("data-cell-bg", value);
|
|
15002
|
-
this.formatChildren(name, value);
|
|
15003
15010
|
}
|
|
15004
15011
|
}
|
|
15005
15012
|
}
|
|
15006
15013
|
optimize(context) {
|
|
15007
15014
|
super.optimize(context);
|
|
15008
|
-
const { row, cell, rowspan, colspan } = this.domNode.dataset;
|
|
15015
|
+
const { row, cell, rowspan, colspan, cellBg } = this.domNode.dataset;
|
|
15009
15016
|
const formats = TableCellLine.formats(this.domNode);
|
|
15010
15017
|
const parentFormats = this.parent.formats();
|
|
15011
15018
|
if (this.statics.requiredContainer && !(this.parent instanceof this.statics.requiredContainer)) {
|
|
15012
|
-
this.wrap(this.statics.requiredContainer.blotName, { row, cell, rowspan, colspan });
|
|
15019
|
+
this.wrap(this.statics.requiredContainer.blotName, { row, cell, rowspan, colspan, cellBg });
|
|
15013
15020
|
} else if (!compare(formats, parentFormats)) {
|
|
15014
15021
|
this.parent.format("row", formats.row);
|
|
15015
15022
|
this.parent.format("cell", formats.cell);
|
|
15016
15023
|
this.parent.format("rowspan", formats.rowspan);
|
|
15017
15024
|
this.parent.format("colspan", formats.colspan);
|
|
15025
|
+
formats["cell-bg"] && this.parent.setCellBg(formats["cell-bg"]);
|
|
15018
15026
|
}
|
|
15019
15027
|
const parentHeight = this.domNode.getAttribute("height");
|
|
15020
15028
|
if (parentHeight) {
|
|
@@ -15108,6 +15116,13 @@ class TableCell extends Container {
|
|
|
15108
15116
|
child.format(name, value);
|
|
15109
15117
|
});
|
|
15110
15118
|
}
|
|
15119
|
+
setCellBg(value) {
|
|
15120
|
+
if (value) {
|
|
15121
|
+
this.domNode.style.backgroundColor = value;
|
|
15122
|
+
} else {
|
|
15123
|
+
this.domNode.style.backgroundColor = "initial";
|
|
15124
|
+
}
|
|
15125
|
+
}
|
|
15111
15126
|
format(name, value) {
|
|
15112
15127
|
const quill = Quill.find(this.scroll.domNode.parentNode);
|
|
15113
15128
|
switch (true) {
|
|
@@ -15137,11 +15152,7 @@ class TableCell extends Container {
|
|
|
15137
15152
|
this.toggleAttribute("data-cell-bg", value);
|
|
15138
15153
|
this.toggleAttribute("data-parent-bg", value);
|
|
15139
15154
|
this.formatChildren(name, value);
|
|
15140
|
-
|
|
15141
|
-
this.domNode.style.backgroundColor = value;
|
|
15142
|
-
} else {
|
|
15143
|
-
this.domNode.style.backgroundColor = "initial";
|
|
15144
|
-
}
|
|
15155
|
+
this.setCellBg(value);
|
|
15145
15156
|
}
|
|
15146
15157
|
}
|
|
15147
15158
|
}
|
|
@@ -15326,11 +15337,11 @@ class TableColGroup extends Container {
|
|
|
15326
15337
|
elementSibling = elementSibling.nextElementSibling;
|
|
15327
15338
|
}
|
|
15328
15339
|
if (colgroupNumber < colSpan) {
|
|
15329
|
-
|
|
15340
|
+
const length = colSpan - colgroupNumber;
|
|
15330
15341
|
for (let i = 0; i < length; i++) {
|
|
15331
|
-
|
|
15342
|
+
const newCol = document.createElement("col");
|
|
15332
15343
|
newCol.width = this.parent.domNode.children[0].children[this.parent.domNode.children[0].children.length - 1].width;
|
|
15333
|
-
|
|
15344
|
+
const newBr = document.createElement("br");
|
|
15334
15345
|
newCol.appendChild(newBr);
|
|
15335
15346
|
this.parent.domNode.children[0].appendChild(newCol);
|
|
15336
15347
|
this.parent.domNode.style.width += newCol.width;
|
|
@@ -15439,7 +15450,7 @@ class TableContainer extends Container {
|
|
|
15439
15450
|
return true;
|
|
15440
15451
|
}
|
|
15441
15452
|
delIndexes.forEach(() => {
|
|
15442
|
-
|
|
15453
|
+
const col = this.colGroup().children.at(delIndexes[0]);
|
|
15443
15454
|
if (!col || this.colGroup().children.at(delIndexes[0]).domNode !== this.colGroup().domNode.children[delIndexes[0]]) {
|
|
15444
15455
|
this.colGroup().domNode.removeChild(this.colGroup().domNode.children[delIndexes[0]]);
|
|
15445
15456
|
} else {
|
|
@@ -15698,7 +15709,7 @@ class TableContainer extends Container {
|
|
|
15698
15709
|
affectedCells.sort(sortFunc);
|
|
15699
15710
|
return affectedCells;
|
|
15700
15711
|
}
|
|
15701
|
-
mergeCells(
|
|
15712
|
+
mergeCells(_compareRect, mergingCells, rowspan, colspan, _editorWrapper) {
|
|
15702
15713
|
const mergedCell = mergingCells.reduce((result, tableCell, index) => {
|
|
15703
15714
|
if (index !== 0) {
|
|
15704
15715
|
if (result) {
|
|
@@ -15856,7 +15867,7 @@ function cellId() {
|
|
|
15856
15867
|
return `cell-${id}`;
|
|
15857
15868
|
}
|
|
15858
15869
|
function reduceFormats(domNode, formats) {
|
|
15859
|
-
return CELL_ATTRIBUTES
|
|
15870
|
+
return [...CELL_ATTRIBUTES, ...CELL_IDENTITY_KEYS].reduce((tableFormats, attribute) => {
|
|
15860
15871
|
if (domNode.hasAttribute(`data-${attribute}`)) {
|
|
15861
15872
|
tableFormats[attribute] = domNode.getAttribute(`data-${attribute}`) || void 0;
|
|
15862
15873
|
}
|
|
@@ -16452,7 +16463,7 @@ const MENU_ITEMS_DEFAULT = {
|
|
|
16452
16463
|
};
|
|
16453
16464
|
const DEFAULT_CELL_COLORS = ["white", "red", "yellow", "blue"];
|
|
16454
16465
|
const NODE_EVENT_MAP = /* @__PURE__ */ new WeakMap();
|
|
16455
|
-
|
|
16466
|
+
const DEFAULT_COLOR_SUBTITLE = LANG_CONF["subTitleBgColor"];
|
|
16456
16467
|
class TableOperationMenu {
|
|
16457
16468
|
constructor(params, quill, options) {
|
|
16458
16469
|
const betterTableModule = quill.getModule("better-table");
|
|
@@ -16597,7 +16608,7 @@ class TableOperationMenu {
|
|
|
16597
16608
|
tableContainer.emptyCells(selectedTds);
|
|
16598
16609
|
}
|
|
16599
16610
|
}
|
|
16600
|
-
createVirtualTable(selectedTds,
|
|
16611
|
+
createVirtualTable(selectedTds, _operation) {
|
|
16601
16612
|
const virtualTable = document.createElement("table");
|
|
16602
16613
|
virtualTable.style.position = "fixed";
|
|
16603
16614
|
virtualTable.style.top = 0;
|
|
@@ -17254,7 +17265,7 @@ function matchTableCell(node, delta) {
|
|
|
17254
17265
|
}
|
|
17255
17266
|
return delta;
|
|
17256
17267
|
}
|
|
17257
|
-
function matchTableHeader(node, delta,
|
|
17268
|
+
function matchTableHeader(node, delta, _scroll) {
|
|
17258
17269
|
const row = node.parentNode;
|
|
17259
17270
|
const cells = Array.from(row.querySelectorAll("th"));
|
|
17260
17271
|
let rowId$1 = row.dataset.row;
|
|
@@ -17295,7 +17306,7 @@ function matchTableHeader(node, delta, scroll) {
|
|
|
17295
17306
|
return delta;
|
|
17296
17307
|
}
|
|
17297
17308
|
function matchTable(node, delta, scroll) {
|
|
17298
|
-
|
|
17309
|
+
const isWordTable = node.children.length === 1;
|
|
17299
17310
|
if (!(node instanceof Element)) {
|
|
17300
17311
|
return;
|
|
17301
17312
|
}
|
|
@@ -17384,7 +17395,7 @@ function matchTable(node, delta, scroll) {
|
|
|
17384
17395
|
}
|
|
17385
17396
|
return delta;
|
|
17386
17397
|
}
|
|
17387
|
-
function matchTableRow(
|
|
17398
|
+
function matchTableRow(_node, delta) {
|
|
17388
17399
|
if (delta.ops.length === 1 && !delta.ops[0].attributes) {
|
|
17389
17400
|
delta = new Delta$1().insert("\n", { notFilled: true });
|
|
17390
17401
|
}
|
|
@@ -17521,7 +17532,7 @@ class BetterTable extends Module {
|
|
|
17521
17532
|
let tableBlot;
|
|
17522
17533
|
try {
|
|
17523
17534
|
tableBlot = prev.parent.parent.parent.parent;
|
|
17524
|
-
} catch (
|
|
17535
|
+
} catch (_e) {
|
|
17525
17536
|
}
|
|
17526
17537
|
if (tableBlot && tableBlot.domNode !== betterTableModule.table) {
|
|
17527
17538
|
betterTableModule.hideTableTools();
|
|
@@ -17554,7 +17565,7 @@ class BetterTable extends Module {
|
|
|
17554
17565
|
this.hideTableTools();
|
|
17555
17566
|
}
|
|
17556
17567
|
});
|
|
17557
|
-
this.quill.on(Quill.events.SELECTION_CHANGE, (range,
|
|
17568
|
+
this.quill.on(Quill.events.SELECTION_CHANGE, (range, _oldRange, source2) => {
|
|
17558
17569
|
if (!range) {
|
|
17559
17570
|
return;
|
|
17560
17571
|
}
|
|
@@ -17811,7 +17822,7 @@ BetterTable.keyboardBindings = {
|
|
|
17811
17822
|
let tableBlot;
|
|
17812
17823
|
try {
|
|
17813
17824
|
tableBlot = col.parent.parent.parent;
|
|
17814
|
-
} catch (
|
|
17825
|
+
} catch (_e) {
|
|
17815
17826
|
}
|
|
17816
17827
|
if (tableBlot && tableBlot.domNode !== betterTableModule.table) {
|
|
17817
17828
|
betterTableModule.hideTableTools();
|
|
@@ -17847,7 +17858,7 @@ BetterTable.keyboardBindings = {
|
|
|
17847
17858
|
"table-cell-line delete": {
|
|
17848
17859
|
key: "Delete",
|
|
17849
17860
|
format: ["table-cell-line"],
|
|
17850
|
-
handler(range,
|
|
17861
|
+
handler(range, _context) {
|
|
17851
17862
|
const [line] = this.quill.getLine(range.index);
|
|
17852
17863
|
const index = this.quill.getIndex(line);
|
|
17853
17864
|
const length = line.length();
|
|
@@ -50440,7 +50451,7 @@ class Picker {
|
|
|
50440
50451
|
if (option.textContent) {
|
|
50441
50452
|
item.setAttribute("data-label", option.textContent);
|
|
50442
50453
|
}
|
|
50443
|
-
item.addEventListener("click", (
|
|
50454
|
+
item.addEventListener("click", () => {
|
|
50444
50455
|
this.selectItem(item, true);
|
|
50445
50456
|
});
|
|
50446
50457
|
item.addEventListener("keydown", (event) => {
|