@opentiny/fluent-editor 3.18.3 → 3.19.0-alpha.0
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 +106 -104
- package/index.cjs.js.map +1 -1
- package/index.es.js +217 -133
- package/index.es.js.map +1 -1
- package/package.json +2 -15
package/index.es.js
CHANGED
|
@@ -4854,7 +4854,7 @@ Block$4.blotName = "block";
|
|
|
4854
4854
|
Block$4.tagName = "P";
|
|
4855
4855
|
Block$4.defaultChild = Break$1;
|
|
4856
4856
|
Block$4.allowedChildren = [Break$1, Inline$3, EmbedBlot$1, Text$1];
|
|
4857
|
-
class BlockEmbed extends EmbedBlot$1 {
|
|
4857
|
+
class BlockEmbed$1 extends EmbedBlot$1 {
|
|
4858
4858
|
attach() {
|
|
4859
4859
|
super.attach();
|
|
4860
4860
|
this.attributes = new AttributorStore$1(this.domNode);
|
|
@@ -4895,7 +4895,7 @@ class BlockEmbed extends EmbedBlot$1 {
|
|
|
4895
4895
|
}
|
|
4896
4896
|
}
|
|
4897
4897
|
}
|
|
4898
|
-
BlockEmbed.scope = Scope$1.BLOCK_BLOT;
|
|
4898
|
+
BlockEmbed$1.scope = Scope$1.BLOCK_BLOT;
|
|
4899
4899
|
function blockDelta(blot) {
|
|
4900
4900
|
let filter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4901
4901
|
return blot.descendants(LeafBlot$1).reduce((delta, leaf2) => {
|
|
@@ -5720,7 +5720,7 @@ class Editor {
|
|
|
5720
5720
|
deleteDelta.retain(length);
|
|
5721
5721
|
if (typeof op.insert === "string") {
|
|
5722
5722
|
const text = op.insert;
|
|
5723
|
-
isImplicitNewlineAppended = !text.endsWith("\n") && (scrollLength <= index || !!this.scroll.descendant(BlockEmbed, index)[0]);
|
|
5723
|
+
isImplicitNewlineAppended = !text.endsWith("\n") && (scrollLength <= index || !!this.scroll.descendant(BlockEmbed$1, index)[0]);
|
|
5724
5724
|
this.scroll.insertAt(index, text);
|
|
5725
5725
|
const [line, offset] = this.scroll.line(index);
|
|
5726
5726
|
let formats = deepmerge({}, bubbleFormats(line));
|
|
@@ -5737,7 +5737,7 @@ class Editor {
|
|
|
5737
5737
|
return index;
|
|
5738
5738
|
const isInlineEmbed = this.scroll.query(key, Scope$1.INLINE) != null;
|
|
5739
5739
|
if (isInlineEmbed) {
|
|
5740
|
-
if (scrollLength <= index || !!this.scroll.descendant(BlockEmbed, index)[0]) {
|
|
5740
|
+
if (scrollLength <= index || !!this.scroll.descendant(BlockEmbed$1, index)[0]) {
|
|
5741
5741
|
isImplicitNewlineAppended = true;
|
|
5742
5742
|
}
|
|
5743
5743
|
} else if (index > 0) {
|
|
@@ -6103,7 +6103,7 @@ class Module$5 {
|
|
|
6103
6103
|
}
|
|
6104
6104
|
__publicField(Module$5, "DEFAULTS", {});
|
|
6105
6105
|
const GUARD_TEXT = "\uFEFF";
|
|
6106
|
-
class Embed$
|
|
6106
|
+
class Embed$5 extends EmbedBlot$1 {
|
|
6107
6107
|
constructor(scroll, node) {
|
|
6108
6108
|
super(scroll, node);
|
|
6109
6109
|
this.contentNode = document.createElement("span");
|
|
@@ -6196,7 +6196,7 @@ class Composition {
|
|
|
6196
6196
|
}
|
|
6197
6197
|
handleCompositionStart(event) {
|
|
6198
6198
|
const blot = event.target instanceof Node ? this.scroll.find(event.target, true) : null;
|
|
6199
|
-
if (blot && !(blot instanceof Embed$
|
|
6199
|
+
if (blot && !(blot instanceof Embed$5)) {
|
|
6200
6200
|
this.emitter.emit(Emitter.events.COMPOSITION_BEFORE_START, event);
|
|
6201
6201
|
this.scroll.batchStart();
|
|
6202
6202
|
this.emitter.emit(Emitter.events.COMPOSITION_START, event);
|
|
@@ -6907,7 +6907,7 @@ function shiftRange(range, index, lengthOrSource, source2) {
|
|
|
6907
6907
|
class Container$2 extends ContainerBlot$1 {
|
|
6908
6908
|
}
|
|
6909
6909
|
function isLine$1(blot) {
|
|
6910
|
-
return blot instanceof Block$4 || blot instanceof BlockEmbed;
|
|
6910
|
+
return blot instanceof Block$4 || blot instanceof BlockEmbed$1;
|
|
6911
6911
|
}
|
|
6912
6912
|
function isUpdatable(blot) {
|
|
6913
6913
|
return typeof blot.updateContent === "function";
|
|
@@ -6950,7 +6950,7 @@ class Scroll extends ScrollBlot$1 {
|
|
|
6950
6950
|
const [last] = this.line(index + length);
|
|
6951
6951
|
super.deleteAt(index, length);
|
|
6952
6952
|
if (last != null && first !== last && offset > 0) {
|
|
6953
|
-
if (first instanceof BlockEmbed || last instanceof BlockEmbed) {
|
|
6953
|
+
if (first instanceof BlockEmbed$1 || last instanceof BlockEmbed$1) {
|
|
6954
6954
|
this.optimize();
|
|
6955
6955
|
return;
|
|
6956
6956
|
}
|
|
@@ -7004,7 +7004,7 @@ class Scroll extends ScrollBlot$1 {
|
|
|
7004
7004
|
this.batchStart();
|
|
7005
7005
|
const first = renderBlocks.shift();
|
|
7006
7006
|
if (first) {
|
|
7007
|
-
const shouldInsertNewlineChar = first.type === "block" && (first.delta.length() === 0 || !this.descendant(BlockEmbed, index)[0] && index < this.length());
|
|
7007
|
+
const shouldInsertNewlineChar = first.type === "block" && (first.delta.length() === 0 || !this.descendant(BlockEmbed$1, index)[0] && index < this.length());
|
|
7008
7008
|
const delta2 = first.type === "block" ? first.delta : new Delta$7().insert({
|
|
7009
7009
|
[first.key]: first.value
|
|
7010
7010
|
});
|
|
@@ -7127,7 +7127,7 @@ class Scroll extends ScrollBlot$1 {
|
|
|
7127
7127
|
}
|
|
7128
7128
|
}
|
|
7129
7129
|
updateEmbedAt(index, key, change) {
|
|
7130
|
-
const [blot] = this.descendant((b) => b instanceof BlockEmbed, index);
|
|
7130
|
+
const [blot] = this.descendant((b) => b instanceof BlockEmbed$1, index);
|
|
7131
7131
|
if (blot && blot.statics.blotName === key && isUpdatable(blot)) {
|
|
7132
7132
|
blot.updateContent(change);
|
|
7133
7133
|
}
|
|
@@ -7218,7 +7218,7 @@ __publicField(Scroll, "blotName", "scroll");
|
|
|
7218
7218
|
__publicField(Scroll, "className", "ql-editor");
|
|
7219
7219
|
__publicField(Scroll, "tagName", "DIV");
|
|
7220
7220
|
__publicField(Scroll, "defaultChild", Block$4);
|
|
7221
|
-
__publicField(Scroll, "allowedChildren", [Block$4, BlockEmbed, Container$2]);
|
|
7221
|
+
__publicField(Scroll, "allowedChildren", [Block$4, BlockEmbed$1, Container$2]);
|
|
7222
7222
|
function insertInlineContents(parent, index, inlineContents) {
|
|
7223
7223
|
inlineContents.reduce((index2, op) => {
|
|
7224
7224
|
const length = Delta$8.exports.Op.length(op);
|
|
@@ -8510,7 +8510,7 @@ function matchNewline(node, delta, scroll) {
|
|
|
8510
8510
|
return delta.insert("\n");
|
|
8511
8511
|
}
|
|
8512
8512
|
const match2 = scroll.query(nextSibling);
|
|
8513
|
-
if (match2 && match2.prototype instanceof BlockEmbed) {
|
|
8513
|
+
if (match2 && match2.prototype instanceof BlockEmbed$1) {
|
|
8514
8514
|
return delta.insert("\n");
|
|
8515
8515
|
}
|
|
8516
8516
|
nextSibling = nextSibling.firstChild;
|
|
@@ -8968,11 +8968,11 @@ class UINode extends Module$5 {
|
|
|
8968
8968
|
}
|
|
8969
8969
|
Quill.register({
|
|
8970
8970
|
"blots/block": Block$4,
|
|
8971
|
-
"blots/block/embed": BlockEmbed,
|
|
8971
|
+
"blots/block/embed": BlockEmbed$1,
|
|
8972
8972
|
"blots/break": Break$1,
|
|
8973
8973
|
"blots/container": Container$2,
|
|
8974
8974
|
"blots/cursor": Cursor,
|
|
8975
|
-
"blots/embed": Embed$
|
|
8975
|
+
"blots/embed": Embed$5,
|
|
8976
8976
|
"blots/inline": Inline$3,
|
|
8977
8977
|
"blots/scroll": Scroll,
|
|
8978
8978
|
"blots/text": Text$1,
|
|
@@ -9147,7 +9147,7 @@ class Underline extends Inline$3 {
|
|
|
9147
9147
|
}
|
|
9148
9148
|
__publicField(Underline, "blotName", "underline");
|
|
9149
9149
|
__publicField(Underline, "tagName", "U");
|
|
9150
|
-
class Formula extends Embed$
|
|
9150
|
+
class Formula extends Embed$5 {
|
|
9151
9151
|
static create(value) {
|
|
9152
9152
|
if (window.katex == null) {
|
|
9153
9153
|
throw new Error("Formula module requires KaTeX.");
|
|
@@ -9216,7 +9216,7 @@ class Image extends EmbedBlot$1 {
|
|
|
9216
9216
|
__publicField(Image, "blotName", "image");
|
|
9217
9217
|
__publicField(Image, "tagName", "IMG");
|
|
9218
9218
|
const ATTRIBUTES$5 = ["height", "width"];
|
|
9219
|
-
class Video$1 extends BlockEmbed {
|
|
9219
|
+
class Video$1 extends BlockEmbed$1 {
|
|
9220
9220
|
static create(value) {
|
|
9221
9221
|
const node = super.create(value);
|
|
9222
9222
|
node.setAttribute("frameborder", "0");
|
|
@@ -11186,6 +11186,7 @@ const FULLSCREEN_ICON = `<svg xmlns="http://www.w3.org/2000/svg" class="icon" wi
|
|
|
11186
11186
|
<path fill="#333333" d="M64 384h96V160h224.2V64H64zM639.8 64v96H864v224h96V64zM864 864H639.8v96H960V639.61h-96zM160 639.61H64V960h320.2v-96H160z"/>
|
|
11187
11187
|
</svg>`;
|
|
11188
11188
|
const TRIANGLE_DOWN_ICON = `<i class="icon-triangle-down"></i>`;
|
|
11189
|
+
const FORMAT_PAINTER_ICON = `<svg viewBox="0 0 32 32"><path fill="currentColor" d="M28.83 23.17L23 17.33V13a1 1 0 0 0-.29-.71l-10-10a1 1 0 0 0-1.42 0l-9 9a1 1 0 0 0 0 1.42l10 10A1 1 0 0 0 13 23h4.34l5.83 5.84a4 4 0 0 0 5.66-5.66ZM6 10.41l2.29 2.3l1.42-1.42L7.41 9L9 7.41l4.29 4.3l1.42-1.42L10.41 6L12 4.41L18.59 11L11 18.59L4.41 12Zm21.41 17a2 2 0 0 1-2.82 0l-6.13-6.12a1.8 1.8 0 0 0-.71-.29h-4.34l-1-1L20 12.41l1 1v4.34a1 1 0 0 0 .29.7l6.12 6.14a2 2 0 0 1 0 2.82"/></svg>`;
|
|
11189
11190
|
const Delta$6 = Quill.imports["delta"];
|
|
11190
11191
|
function hexToRgbA(hex) {
|
|
11191
11192
|
let color;
|
|
@@ -11206,7 +11207,9 @@ function imageFileToUrl(imageFile) {
|
|
|
11206
11207
|
resolve(e.target["result"]);
|
|
11207
11208
|
};
|
|
11208
11209
|
reader.onerror = reject;
|
|
11209
|
-
}).catch((
|
|
11210
|
+
}).catch((error2) => {
|
|
11211
|
+
console.error("Error reading file:", error2);
|
|
11212
|
+
});
|
|
11210
11213
|
}
|
|
11211
11214
|
function imageUrlToFile(imageUrl, isErrorImage) {
|
|
11212
11215
|
return new Promise(function(resolve, reject) {
|
|
@@ -11557,7 +11560,8 @@ const ICONS_CONFIG = {
|
|
|
11557
11560
|
fullscreen: FULLSCREEN_ICON,
|
|
11558
11561
|
emoji: EMOJI_ICON,
|
|
11559
11562
|
help: HELP_ICON,
|
|
11560
|
-
screenshot: SCREENSHOT_ICON
|
|
11563
|
+
screenshot: SCREENSHOT_ICON,
|
|
11564
|
+
"format-painter": FORMAT_PAINTER_ICON
|
|
11561
11565
|
};
|
|
11562
11566
|
const TABLE_RIGHT_MENU_CONFIG = {
|
|
11563
11567
|
copyCells: {
|
|
@@ -11806,7 +11810,7 @@ class CustomClipboard extends Clipboard {
|
|
|
11806
11810
|
if (!e.clipboardData) {
|
|
11807
11811
|
e.clipboardData = {
|
|
11808
11812
|
types: "text/plain",
|
|
11809
|
-
setData: (
|
|
11813
|
+
setData: (_type, value) => {
|
|
11810
11814
|
return window["clipboardData"].setData("Text", value);
|
|
11811
11815
|
}
|
|
11812
11816
|
};
|
|
@@ -11991,7 +11995,7 @@ class CustomClipboard extends Clipboard {
|
|
|
11991
11995
|
handlePasteContent(pastedDelta);
|
|
11992
11996
|
}
|
|
11993
11997
|
}
|
|
11994
|
-
} catch (
|
|
11998
|
+
} catch (_e) {
|
|
11995
11999
|
throw new Error("Paste failed.");
|
|
11996
12000
|
}
|
|
11997
12001
|
})();
|
|
@@ -12087,7 +12091,7 @@ class CustomClipboard extends Clipboard {
|
|
|
12087
12091
|
)}`;
|
|
12088
12092
|
imageIndex = index;
|
|
12089
12093
|
file = await imageUrlToFile(newImage || image.src || image);
|
|
12090
|
-
} catch (
|
|
12094
|
+
} catch (_err) {
|
|
12091
12095
|
if (clipboardFiles.length !== 0) {
|
|
12092
12096
|
const clipboardFile = clipboardFiles[0];
|
|
12093
12097
|
const imageType = ((_a = clipboardFile.type) == null ? void 0 : _a.indexOf("image")) === -1 ? "image/png" : clipboardFile.type;
|
|
@@ -12118,7 +12122,7 @@ class CustomClipboard extends Clipboard {
|
|
|
12118
12122
|
}
|
|
12119
12123
|
return true;
|
|
12120
12124
|
});
|
|
12121
|
-
|
|
12125
|
+
const range = {
|
|
12122
12126
|
index: length,
|
|
12123
12127
|
length: 0
|
|
12124
12128
|
};
|
|
@@ -12222,10 +12226,10 @@ function renderStyles(html) {
|
|
|
12222
12226
|
iframe.parentNode.removeChild(iframe);
|
|
12223
12227
|
return convertedString;
|
|
12224
12228
|
}
|
|
12225
|
-
const Embed$
|
|
12229
|
+
const Embed$4 = Quill.imports["blots/embed"];
|
|
12226
12230
|
const Inline$2 = Quill.imports["blots/inline"];
|
|
12227
12231
|
const ATTRIBUTES$4 = ["alt", "height", "width", "image-id"];
|
|
12228
|
-
const _CustomImage = class extends Embed$
|
|
12232
|
+
const _CustomImage = class extends Embed$4 {
|
|
12229
12233
|
static create(value) {
|
|
12230
12234
|
const node = super.create(value);
|
|
12231
12235
|
const url = typeof value === "string" ? value : value.src;
|
|
@@ -12403,7 +12407,7 @@ class CustomResizeAction extends Action {
|
|
|
12403
12407
|
target.setAttribute("height", `${newHeight}`);
|
|
12404
12408
|
this.formatter.update();
|
|
12405
12409
|
};
|
|
12406
|
-
this.onMouseUp = (
|
|
12410
|
+
this.onMouseUp = () => {
|
|
12407
12411
|
this.setCursor("");
|
|
12408
12412
|
document.removeEventListener("mousemove", this.onDrag);
|
|
12409
12413
|
document.removeEventListener("mouseup", this.onMouseUp);
|
|
@@ -12743,7 +12747,7 @@ class CustomImageSpec extends ImageSpec {
|
|
|
12743
12747
|
}
|
|
12744
12748
|
}
|
|
12745
12749
|
}
|
|
12746
|
-
const dontMerge = (
|
|
12750
|
+
const dontMerge = (_destination, source2) => source2;
|
|
12747
12751
|
class BlotFormatter {
|
|
12748
12752
|
constructor(quill, options = {}) {
|
|
12749
12753
|
this.onClick = () => {
|
|
@@ -12922,7 +12926,7 @@ class CustomUploader extends Uploader {
|
|
|
12922
12926
|
});
|
|
12923
12927
|
this.options.handler.call(this, range, uploads, fileFlags, rejectFlags);
|
|
12924
12928
|
}
|
|
12925
|
-
handleUploadFile(range, files,
|
|
12929
|
+
handleUploadFile(range, files, _hasRejectedFile) {
|
|
12926
12930
|
this.insertFileToEditor(range, files[0], {
|
|
12927
12931
|
code: 0,
|
|
12928
12932
|
data: {
|
|
@@ -12948,7 +12952,6 @@ class CustomUploader extends Uploader {
|
|
|
12948
12952
|
handleUploadImage(range, { file, files }, hasRejectedImage) {
|
|
12949
12953
|
if (this.imageUploadToServer) {
|
|
12950
12954
|
const imageEnableMultiUpload = this.enableMultiUpload === true || this.enableMultiUpload["image"];
|
|
12951
|
-
this.editorElem.parentElement.querySelector(".ql-image");
|
|
12952
12955
|
const result = {
|
|
12953
12956
|
file,
|
|
12954
12957
|
data: { files: [file] },
|
|
@@ -13007,14 +13010,14 @@ CustomUploader.DEFAULTS = {
|
|
|
13007
13010
|
function createEmoji(emojiArr) {
|
|
13008
13011
|
const emojiList2 = [];
|
|
13009
13012
|
emojiArr.forEach((emojiItem) => {
|
|
13010
|
-
const [name, unicode, shortname,
|
|
13013
|
+
const [name, unicode, shortname, codeDecimal, category, emojiOrder] = emojiItem;
|
|
13011
13014
|
emojiList2.push({
|
|
13012
13015
|
name,
|
|
13013
13016
|
unicode,
|
|
13014
13017
|
shortname,
|
|
13015
|
-
|
|
13018
|
+
codeDecimal,
|
|
13016
13019
|
category,
|
|
13017
|
-
|
|
13020
|
+
emojiOrder
|
|
13018
13021
|
});
|
|
13019
13022
|
});
|
|
13020
13023
|
return emojiList2;
|
|
@@ -13135,8 +13138,8 @@ const emojiMap = {};
|
|
|
13135
13138
|
emojiList.forEach((emojiListObject) => {
|
|
13136
13139
|
emojiMap[emojiListObject.name] = emojiListObject;
|
|
13137
13140
|
});
|
|
13138
|
-
const Embed$
|
|
13139
|
-
class EmojiBlot extends Embed$
|
|
13141
|
+
const Embed$3 = Quill.imports["blots/embed"];
|
|
13142
|
+
class EmojiBlot extends Embed$3 {
|
|
13140
13143
|
static create(value) {
|
|
13141
13144
|
const node = super.create();
|
|
13142
13145
|
if (typeof value === "object") {
|
|
@@ -13212,7 +13215,7 @@ class ShortNameEmoji extends Module$4 {
|
|
|
13212
13215
|
collapsed: true
|
|
13213
13216
|
}, this.handleArrow.bind(this));
|
|
13214
13217
|
}
|
|
13215
|
-
triggerPicker(range,
|
|
13218
|
+
triggerPicker(range, _context) {
|
|
13216
13219
|
if (this.open) {
|
|
13217
13220
|
return true;
|
|
13218
13221
|
}
|
|
@@ -13258,7 +13261,7 @@ class ShortNameEmoji extends Module$4 {
|
|
|
13258
13261
|
this.close(null);
|
|
13259
13262
|
return;
|
|
13260
13263
|
}
|
|
13261
|
-
} catch (
|
|
13264
|
+
} catch (_e) {
|
|
13262
13265
|
throw new Error("Close failed");
|
|
13263
13266
|
}
|
|
13264
13267
|
this.query = this.query.trim();
|
|
@@ -13298,7 +13301,7 @@ class ShortNameEmoji extends Module$4 {
|
|
|
13298
13301
|
if (evt) {
|
|
13299
13302
|
return;
|
|
13300
13303
|
}
|
|
13301
|
-
} catch (
|
|
13304
|
+
} catch (_e) {
|
|
13302
13305
|
throw new Error("Render failed");
|
|
13303
13306
|
}
|
|
13304
13307
|
while (this.container.firstChild) {
|
|
@@ -13414,7 +13417,6 @@ function makeElement(tag2, attrs, ...children) {
|
|
|
13414
13417
|
});
|
|
13415
13418
|
return elem;
|
|
13416
13419
|
}
|
|
13417
|
-
Quill.imports["delta"];
|
|
13418
13420
|
const Module$3 = Quill.imports["core/module"];
|
|
13419
13421
|
class ToolbarEmoji extends Module$3 {
|
|
13420
13422
|
constructor(quill, options) {
|
|
@@ -13434,54 +13436,54 @@ class ToolbarEmoji extends Module$3 {
|
|
|
13434
13436
|
}
|
|
13435
13437
|
checkPalatteExist() {
|
|
13436
13438
|
const quill = this.quill;
|
|
13437
|
-
|
|
13438
|
-
this.quill.on("text-change", function(
|
|
13439
|
+
fnCheckDialogOpen(quill);
|
|
13440
|
+
this.quill.on("text-change", function(_delta, _oldDelta, source2) {
|
|
13439
13441
|
if (source2 === "user") {
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
+
fnClose();
|
|
13443
|
+
fnUpdateRange(quill);
|
|
13442
13444
|
}
|
|
13443
13445
|
});
|
|
13444
13446
|
}
|
|
13445
13447
|
}
|
|
13446
|
-
function
|
|
13447
|
-
const
|
|
13448
|
+
function fnClose() {
|
|
13449
|
+
const eleEmojiPlate = document.getElementById("emoji-palette");
|
|
13448
13450
|
document.getElementById("emoji-close-div").style.display = "none";
|
|
13449
|
-
if (
|
|
13450
|
-
|
|
13451
|
+
if (eleEmojiPlate) {
|
|
13452
|
+
eleEmojiPlate.remove();
|
|
13451
13453
|
}
|
|
13452
13454
|
}
|
|
13453
|
-
function
|
|
13455
|
+
function fnCheckDialogOpen(quill) {
|
|
13454
13456
|
const elementExists = document.getElementById("emoji-palette");
|
|
13455
13457
|
if (elementExists) {
|
|
13456
13458
|
elementExists.remove();
|
|
13457
13459
|
} else {
|
|
13458
|
-
|
|
13460
|
+
fnShowEmojiPalatte(quill);
|
|
13459
13461
|
}
|
|
13460
13462
|
}
|
|
13461
|
-
function
|
|
13463
|
+
function fnUpdateRange(quill) {
|
|
13462
13464
|
const range = quill.getSelection();
|
|
13463
13465
|
return range;
|
|
13464
13466
|
}
|
|
13465
|
-
function
|
|
13466
|
-
const
|
|
13467
|
+
function fnShowEmojiPalatte(quill) {
|
|
13468
|
+
const eleEmojiArea = document.createElement("div");
|
|
13467
13469
|
const range = quill.getSelection();
|
|
13468
13470
|
const atSignBounds = quill.getBounds(range.index);
|
|
13469
|
-
quill.container.appendChild(
|
|
13471
|
+
quill.container.appendChild(eleEmojiArea);
|
|
13470
13472
|
const containerRect = quill.container.getBoundingClientRect();
|
|
13471
13473
|
const paletteMaxPos = atSignBounds.left + 250;
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
+
eleEmojiArea.id = "emoji-palette";
|
|
13475
|
+
eleEmojiArea.style.top = 10 + atSignBounds.top + atSignBounds.height + containerRect.top + "px";
|
|
13474
13476
|
if (paletteMaxPos > quill.container.offsetWidth) {
|
|
13475
|
-
|
|
13477
|
+
eleEmojiArea.style.left = atSignBounds.left + containerRect.left - 250 + "px";
|
|
13476
13478
|
} else {
|
|
13477
|
-
|
|
13479
|
+
eleEmojiArea.style.left = atSignBounds.left + containerRect.left + "px";
|
|
13478
13480
|
}
|
|
13479
13481
|
const tabToolbar = document.createElement("div");
|
|
13480
13482
|
tabToolbar.id = "tab-toolbar";
|
|
13481
|
-
|
|
13483
|
+
eleEmojiArea.appendChild(tabToolbar);
|
|
13482
13484
|
const panel = document.createElement("div");
|
|
13483
13485
|
panel.id = "tab-panel";
|
|
13484
|
-
|
|
13486
|
+
eleEmojiArea.appendChild(panel);
|
|
13485
13487
|
const emojiType = [
|
|
13486
13488
|
{ "type": "p", "name": "people", "content": '<div class="i-people"></div>' },
|
|
13487
13489
|
{ "type": "n", "name": "nature", "content": '<div class="i-nature"></div>' },
|
|
@@ -13497,7 +13499,7 @@ function fn_showEmojiPalatte(quill) {
|
|
|
13497
13499
|
if (document.getElementById("emoji-close-div") === null) {
|
|
13498
13500
|
const closeDiv = document.createElement("div");
|
|
13499
13501
|
closeDiv.id = "emoji-close-div";
|
|
13500
|
-
closeDiv.addEventListener("click",
|
|
13502
|
+
closeDiv.addEventListener("click", fnClose, false);
|
|
13501
13503
|
document.getElementsByTagName("body")[0].appendChild(closeDiv);
|
|
13502
13504
|
} else {
|
|
13503
13505
|
document.getElementById("emoji-close-div").style.display = "block";
|
|
@@ -13517,22 +13519,22 @@ function fn_showEmojiPalatte(quill) {
|
|
|
13517
13519
|
tab.classList.remove("active");
|
|
13518
13520
|
}
|
|
13519
13521
|
emojiFilter.classList.toggle("active");
|
|
13520
|
-
|
|
13522
|
+
fnUpdateEmojiContainer(emojiFilter, panel, quill);
|
|
13521
13523
|
});
|
|
13522
13524
|
});
|
|
13523
|
-
|
|
13525
|
+
fnEmojiPanelInit(panel, quill);
|
|
13524
13526
|
}
|
|
13525
|
-
function
|
|
13526
|
-
|
|
13527
|
+
function fnEmojiPanelInit(panel, quill) {
|
|
13528
|
+
fnEmojiElementsToPanel("p", panel, quill);
|
|
13527
13529
|
document.querySelector(".filter-people").classList.add("active");
|
|
13528
13530
|
}
|
|
13529
|
-
function
|
|
13531
|
+
function fnEmojiElementsToPanel(_type, panel, quill) {
|
|
13530
13532
|
const result = emojiList;
|
|
13531
13533
|
result.sort(function(a, b) {
|
|
13532
13534
|
return a.emoji_order - b.emoji_order;
|
|
13533
13535
|
});
|
|
13534
13536
|
quill.focus();
|
|
13535
|
-
const range =
|
|
13537
|
+
const range = fnUpdateRange(quill);
|
|
13536
13538
|
result.forEach(function(emoji) {
|
|
13537
13539
|
const span = document.createElement("span");
|
|
13538
13540
|
const t = document.createTextNode(emoji.shortname);
|
|
@@ -13549,22 +13551,22 @@ function fn_emojiElementsToPanel(type, panel, quill) {
|
|
|
13549
13551
|
customButton.addEventListener("click", function() {
|
|
13550
13552
|
quill.insertEmbed(range.index, "emoji", emoji, Quill.sources.USER);
|
|
13551
13553
|
setTimeout(() => quill.setSelection(range.index + 1), 0);
|
|
13552
|
-
|
|
13554
|
+
fnClose();
|
|
13553
13555
|
});
|
|
13554
13556
|
}
|
|
13555
13557
|
});
|
|
13556
13558
|
}
|
|
13557
|
-
function
|
|
13559
|
+
function fnUpdateEmojiContainer(emojiFilter, panel, quill) {
|
|
13558
13560
|
while (panel.firstChild) {
|
|
13559
13561
|
panel.removeChild(panel.firstChild);
|
|
13560
13562
|
}
|
|
13561
13563
|
const type = emojiFilter.dataset.filter;
|
|
13562
|
-
|
|
13564
|
+
fnEmojiElementsToPanel(type, panel, quill);
|
|
13563
13565
|
}
|
|
13564
13566
|
var Emoji = { EmojiBlot, ShortNameEmoji, ToolbarEmoji };
|
|
13565
|
-
const Embed$
|
|
13567
|
+
const Embed$2 = Quill.imports["blots/embed"];
|
|
13566
13568
|
const FILE_ATTRIBUTES = ["id", "title", "size", "lastModified"];
|
|
13567
|
-
class File$1 extends Embed$
|
|
13569
|
+
class File$1 extends Embed$2 {
|
|
13568
13570
|
static create(value) {
|
|
13569
13571
|
const node = super.create(value);
|
|
13570
13572
|
const size = value.size / 1024;
|
|
@@ -13632,12 +13634,12 @@ function compareArray(arr1, arr2) {
|
|
|
13632
13634
|
return true;
|
|
13633
13635
|
}
|
|
13634
13636
|
function compareObject(object1, object2) {
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
+
const o1keys = Object.keys(object1);
|
|
13638
|
+
const o2keys = Object.keys(object2);
|
|
13637
13639
|
if (o2keys.length !== o1keys.length)
|
|
13638
13640
|
return false;
|
|
13639
13641
|
for (let i = 0; i <= o1keys.length - 1; i++) {
|
|
13640
|
-
|
|
13642
|
+
const key = o1keys[i];
|
|
13641
13643
|
if (!o2keys.includes(key))
|
|
13642
13644
|
return false;
|
|
13643
13645
|
if (!compare(object2[key], object1[key]))
|
|
@@ -14034,7 +14036,7 @@ class Tooltip extends BaseTooltip {
|
|
|
14034
14036
|
);
|
|
14035
14037
|
this.root.addEventListener(
|
|
14036
14038
|
"mouseenter",
|
|
14037
|
-
(
|
|
14039
|
+
() => {
|
|
14038
14040
|
this.isHover = true;
|
|
14039
14041
|
},
|
|
14040
14042
|
false
|
|
@@ -14045,16 +14047,16 @@ class Tooltip extends BaseTooltip {
|
|
|
14045
14047
|
window.open(link, "_blank");
|
|
14046
14048
|
event.preventDefault();
|
|
14047
14049
|
});
|
|
14048
|
-
this.root.querySelector('input[type="text"]').addEventListener("focus", (
|
|
14050
|
+
this.root.querySelector('input[type="text"]').addEventListener("focus", () => {
|
|
14049
14051
|
this.isInputFocus = true;
|
|
14050
14052
|
});
|
|
14051
|
-
this.root.querySelector('input[type="text"]').addEventListener("blur", (
|
|
14053
|
+
this.root.querySelector('input[type="text"]').addEventListener("blur", () => {
|
|
14052
14054
|
this.isInputFocus = false;
|
|
14053
14055
|
this.save();
|
|
14054
14056
|
});
|
|
14055
14057
|
this.quill.on(
|
|
14056
14058
|
Emitter.events.SELECTION_CHANGE,
|
|
14057
|
-
(range,
|
|
14059
|
+
(range, _oldRange, source2) => {
|
|
14058
14060
|
if (isNullOrUndefined(range)) {
|
|
14059
14061
|
return;
|
|
14060
14062
|
}
|
|
@@ -14079,7 +14081,7 @@ class Tooltip extends BaseTooltip {
|
|
|
14079
14081
|
);
|
|
14080
14082
|
this.quill.on(
|
|
14081
14083
|
Emitter.events.TEXT_CHANGE,
|
|
14082
|
-
(
|
|
14084
|
+
() => {
|
|
14083
14085
|
const selection = this.quill.getSelection();
|
|
14084
14086
|
const index = selection && selection.index;
|
|
14085
14087
|
setTimeout(() => {
|
|
@@ -14095,7 +14097,10 @@ class Tooltip extends BaseTooltip {
|
|
|
14095
14097
|
);
|
|
14096
14098
|
}
|
|
14097
14099
|
save() {
|
|
14098
|
-
let
|
|
14100
|
+
let value = this.textbox.value;
|
|
14101
|
+
if (!value)
|
|
14102
|
+
return;
|
|
14103
|
+
this.textbox.value = "";
|
|
14099
14104
|
switch (this.root.getAttribute("data-mode")) {
|
|
14100
14105
|
case "link": {
|
|
14101
14106
|
const { scrollTop } = this.quill.root;
|
|
@@ -14119,9 +14124,6 @@ class Tooltip extends BaseTooltip {
|
|
|
14119
14124
|
break;
|
|
14120
14125
|
}
|
|
14121
14126
|
case "formula": {
|
|
14122
|
-
if (!value) {
|
|
14123
|
-
break;
|
|
14124
|
-
}
|
|
14125
14127
|
const range = this.quill.getSelection(true);
|
|
14126
14128
|
if (!isNullOrUndefined(range)) {
|
|
14127
14129
|
const index = range.index + range.length;
|
|
@@ -14138,6 +14140,16 @@ class Tooltip extends BaseTooltip {
|
|
|
14138
14140
|
}
|
|
14139
14141
|
break;
|
|
14140
14142
|
}
|
|
14143
|
+
case "video": {
|
|
14144
|
+
const range = this.quill.getSelection(true);
|
|
14145
|
+
this.quill.insertText(range.index, "\n", Emitter.sources.USER);
|
|
14146
|
+
this.quill.insertEmbed(range.index + 1, "video", { src: value }, Emitter.sources.USER);
|
|
14147
|
+
this.quill.insertText(range.index + 2, "\n", Emitter.sources.USER);
|
|
14148
|
+
this.quill.setSelection(range.index + 3, Emitter.sources.SILENT);
|
|
14149
|
+
this.textbox.value = "";
|
|
14150
|
+
this.hide();
|
|
14151
|
+
break;
|
|
14152
|
+
}
|
|
14141
14153
|
}
|
|
14142
14154
|
}
|
|
14143
14155
|
position(reference) {
|
|
@@ -14225,7 +14237,7 @@ SnowTheme$1.prototype.extendToolbar = function(toolbar) {
|
|
|
14225
14237
|
if (toolbar.container.querySelector(".ql-link")) {
|
|
14226
14238
|
this.quill.keyboard.addBinding(
|
|
14227
14239
|
{ key: "k", shortKey: true },
|
|
14228
|
-
(
|
|
14240
|
+
(_range, context) => {
|
|
14229
14241
|
toolbar.handlers.link.call(toolbar, !context.format.link);
|
|
14230
14242
|
}
|
|
14231
14243
|
);
|
|
@@ -14234,8 +14246,8 @@ SnowTheme$1.prototype.extendToolbar = function(toolbar) {
|
|
|
14234
14246
|
const ON_MENTION_LINK_REMOVE = "mention-link/remove";
|
|
14235
14247
|
const MENTION_CHAR = "mentionChar";
|
|
14236
14248
|
const DEFAULT_MENTION_CHAR = "@";
|
|
14237
|
-
const Embed$
|
|
14238
|
-
class MentionLink extends Embed$
|
|
14249
|
+
const Embed$1 = Quill.imports["blots/embed"];
|
|
14250
|
+
class MentionLink extends Embed$1 {
|
|
14239
14251
|
constructor(scroll, domNode, data) {
|
|
14240
14252
|
super(scroll, domNode, data);
|
|
14241
14253
|
this.mentionData = data;
|
|
@@ -14302,12 +14314,12 @@ class Mention {
|
|
|
14302
14314
|
itemKey: "name",
|
|
14303
14315
|
searchKey: "name",
|
|
14304
14316
|
dataAttributes: ["id"],
|
|
14305
|
-
select(
|
|
14317
|
+
select(_data) {
|
|
14306
14318
|
},
|
|
14307
|
-
remove(
|
|
14319
|
+
remove(_data) {
|
|
14308
14320
|
}
|
|
14309
14321
|
};
|
|
14310
|
-
this.handleTextChange = (
|
|
14322
|
+
this.handleTextChange = (_delta, _oldDelta, source2) => {
|
|
14311
14323
|
setTimeout(() => {
|
|
14312
14324
|
if (Quill.sources.USER === source2) {
|
|
14313
14325
|
const range = this.quill.getSelection();
|
|
@@ -14375,7 +14387,10 @@ class Mention {
|
|
|
14375
14387
|
}
|
|
14376
14388
|
this.options = Object.assign(this.defaultOptions, options);
|
|
14377
14389
|
const container = document.createElement("div");
|
|
14378
|
-
container.classList.add(
|
|
14390
|
+
container.classList.add("ql-mention-list-container");
|
|
14391
|
+
if (this.options.containerClass !== "ql-mention-list-container") {
|
|
14392
|
+
container.classList.add(this.options.containerClass);
|
|
14393
|
+
}
|
|
14379
14394
|
this.mentionListEL = document.createElement("ul");
|
|
14380
14395
|
this.mentionListEL.classList.add(this.options.listClass, this.options.listHideClass);
|
|
14381
14396
|
this.mentionListEL.style.cssText += `
|
|
@@ -14469,11 +14484,11 @@ class Mention {
|
|
|
14469
14484
|
-1
|
|
14470
14485
|
);
|
|
14471
14486
|
}
|
|
14472
|
-
handleMouseClick(
|
|
14487
|
+
handleMouseClick(_itemEl, index) {
|
|
14473
14488
|
this.selectMentionItem(index, true);
|
|
14474
14489
|
this.quill.focus();
|
|
14475
14490
|
}
|
|
14476
|
-
handleMouseEnter(
|
|
14491
|
+
handleMouseEnter(_itemEl, index) {
|
|
14477
14492
|
this.activeMentionIndex = index;
|
|
14478
14493
|
this.highlightMentionItem(index);
|
|
14479
14494
|
}
|
|
@@ -14531,7 +14546,11 @@ class Mention {
|
|
|
14531
14546
|
mentionItemEl.classList.add(this.options.itemActiveClass);
|
|
14532
14547
|
}
|
|
14533
14548
|
const renderResult = this.options.renderMentionItem(mentionItem);
|
|
14534
|
-
|
|
14549
|
+
if (typeof renderResult === "string") {
|
|
14550
|
+
mentionItemEl.insertAdjacentHTML("afterbegin", renderResult);
|
|
14551
|
+
} else {
|
|
14552
|
+
mentionItemEl.insertAdjacentElement("afterbegin", renderResult);
|
|
14553
|
+
}
|
|
14535
14554
|
wrapEl.appendChild(mentionItemEl);
|
|
14536
14555
|
});
|
|
14537
14556
|
this.mentionListEL.innerHTML = wrapEl.innerHTML;
|
|
@@ -14584,8 +14603,8 @@ class Mention {
|
|
|
14584
14603
|
this.quill.setSelection(this.latestMentionCharPos + 1, Quill.sources.API);
|
|
14585
14604
|
}
|
|
14586
14605
|
}
|
|
14587
|
-
const Embed
|
|
14588
|
-
class SoftBreak extends Embed
|
|
14606
|
+
const Embed = Quill.imports["blots/embed"];
|
|
14607
|
+
class SoftBreak extends Embed {
|
|
14589
14608
|
static create() {
|
|
14590
14609
|
const node = super.create();
|
|
14591
14610
|
return node;
|
|
@@ -14618,7 +14637,7 @@ const COL_DEFAULT = {
|
|
|
14618
14637
|
width: 100
|
|
14619
14638
|
};
|
|
14620
14639
|
const CELL_IDENTITY_KEYS = ["row", "cell"];
|
|
14621
|
-
const CELL_ATTRIBUTES = ["rowspan", "colspan"];
|
|
14640
|
+
const CELL_ATTRIBUTES = ["rowspan", "colspan", "cell-bg"];
|
|
14622
14641
|
const CELL_DEFAULT = {
|
|
14623
14642
|
rowspan: 1,
|
|
14624
14643
|
colspan: 1
|
|
@@ -14694,7 +14713,7 @@ class Header extends Block$3 {
|
|
|
14694
14713
|
super.format(name, value);
|
|
14695
14714
|
}
|
|
14696
14715
|
}
|
|
14697
|
-
optimize(
|
|
14716
|
+
optimize(_context) {
|
|
14698
14717
|
const { row, cell, rowspan, colspan } = Header.formats(this.domNode);
|
|
14699
14718
|
if (row && this.parent.statics.blotName !== "table") {
|
|
14700
14719
|
this.wrap("table", {
|
|
@@ -14914,8 +14933,8 @@ const arrayFrom = function(arrayLike, mapFn, thisArg) {
|
|
|
14914
14933
|
"Array.from requires an array-like object - not null or undefined"
|
|
14915
14934
|
);
|
|
14916
14935
|
}
|
|
14917
|
-
|
|
14918
|
-
|
|
14936
|
+
const length = arrayLike.length;
|
|
14937
|
+
const resArray = [];
|
|
14919
14938
|
for (let i = 0; i < length; i++) {
|
|
14920
14939
|
if (typeof mapFn === "function") {
|
|
14921
14940
|
resArray.push(mapFn.call(thisArg, arrayLike[i]));
|
|
@@ -14939,7 +14958,7 @@ class TableCellLine extends Block$1 {
|
|
|
14939
14958
|
const identityMaker = key === "row" ? rowId : cellId;
|
|
14940
14959
|
node.setAttribute(`data-${key}`, value[key] || identityMaker());
|
|
14941
14960
|
});
|
|
14942
|
-
|
|
14961
|
+
CELL_ATTRIBUTES.forEach((attrName) => {
|
|
14943
14962
|
const keyValue = value[attrName] || CELL_DEFAULT[attrName];
|
|
14944
14963
|
keyValue && node.setAttribute(`data-${attrName}`, keyValue);
|
|
14945
14964
|
});
|
|
@@ -14953,7 +14972,7 @@ class TableCellLine extends Block$1 {
|
|
|
14953
14972
|
if (formats["list"]) {
|
|
14954
14973
|
formats["list"] = domNode.classList.item(0);
|
|
14955
14974
|
}
|
|
14956
|
-
return reduceFormats(domNode, formats
|
|
14975
|
+
return reduceFormats(domNode, formats);
|
|
14957
14976
|
}
|
|
14958
14977
|
toggleAttribute(name, value) {
|
|
14959
14978
|
if (value) {
|
|
@@ -15330,11 +15349,11 @@ class TableColGroup extends Container {
|
|
|
15330
15349
|
elementSibling = elementSibling.nextElementSibling;
|
|
15331
15350
|
}
|
|
15332
15351
|
if (colgroupNumber < colSpan) {
|
|
15333
|
-
|
|
15352
|
+
const length = colSpan - colgroupNumber;
|
|
15334
15353
|
for (let i = 0; i < length; i++) {
|
|
15335
|
-
|
|
15354
|
+
const newCol = document.createElement("col");
|
|
15336
15355
|
newCol.width = this.parent.domNode.children[0].children[this.parent.domNode.children[0].children.length - 1].width;
|
|
15337
|
-
|
|
15356
|
+
const newBr = document.createElement("br");
|
|
15338
15357
|
newCol.appendChild(newBr);
|
|
15339
15358
|
this.parent.domNode.children[0].appendChild(newCol);
|
|
15340
15359
|
this.parent.domNode.style.width += newCol.width;
|
|
@@ -15443,7 +15462,7 @@ class TableContainer extends Container {
|
|
|
15443
15462
|
return true;
|
|
15444
15463
|
}
|
|
15445
15464
|
delIndexes.forEach(() => {
|
|
15446
|
-
|
|
15465
|
+
const col = this.colGroup().children.at(delIndexes[0]);
|
|
15447
15466
|
if (!col || this.colGroup().children.at(delIndexes[0]).domNode !== this.colGroup().domNode.children[delIndexes[0]]) {
|
|
15448
15467
|
this.colGroup().domNode.removeChild(this.colGroup().domNode.children[delIndexes[0]]);
|
|
15449
15468
|
} else {
|
|
@@ -15702,7 +15721,7 @@ class TableContainer extends Container {
|
|
|
15702
15721
|
affectedCells.sort(sortFunc);
|
|
15703
15722
|
return affectedCells;
|
|
15704
15723
|
}
|
|
15705
|
-
mergeCells(
|
|
15724
|
+
mergeCells(_compareRect, mergingCells, rowspan, colspan, _editorWrapper) {
|
|
15706
15725
|
const mergedCell = mergingCells.reduce((result, tableCell, index) => {
|
|
15707
15726
|
if (index !== 0) {
|
|
15708
15727
|
if (result) {
|
|
@@ -15859,8 +15878,8 @@ function cellId() {
|
|
|
15859
15878
|
const id = Math.random().toString(36).slice(2, 6);
|
|
15860
15879
|
return `cell-${id}`;
|
|
15861
15880
|
}
|
|
15862
|
-
function reduceFormats(domNode, formats
|
|
15863
|
-
return [...CELL_ATTRIBUTES, ...CELL_IDENTITY_KEYS
|
|
15881
|
+
function reduceFormats(domNode, formats) {
|
|
15882
|
+
return [...CELL_ATTRIBUTES, ...CELL_IDENTITY_KEYS].reduce((tableFormats, attribute) => {
|
|
15864
15883
|
if (domNode.hasAttribute(`data-${attribute}`)) {
|
|
15865
15884
|
tableFormats[attribute] = domNode.getAttribute(`data-${attribute}`) || void 0;
|
|
15866
15885
|
}
|
|
@@ -16456,7 +16475,7 @@ const MENU_ITEMS_DEFAULT = {
|
|
|
16456
16475
|
};
|
|
16457
16476
|
const DEFAULT_CELL_COLORS = ["white", "red", "yellow", "blue"];
|
|
16458
16477
|
const NODE_EVENT_MAP = /* @__PURE__ */ new WeakMap();
|
|
16459
|
-
|
|
16478
|
+
const DEFAULT_COLOR_SUBTITLE = LANG_CONF["subTitleBgColor"];
|
|
16460
16479
|
class TableOperationMenu {
|
|
16461
16480
|
constructor(params, quill, options) {
|
|
16462
16481
|
const betterTableModule = quill.getModule("better-table");
|
|
@@ -16601,7 +16620,7 @@ class TableOperationMenu {
|
|
|
16601
16620
|
tableContainer.emptyCells(selectedTds);
|
|
16602
16621
|
}
|
|
16603
16622
|
}
|
|
16604
|
-
createVirtualTable(selectedTds,
|
|
16623
|
+
createVirtualTable(selectedTds, _operation) {
|
|
16605
16624
|
const virtualTable = document.createElement("table");
|
|
16606
16625
|
virtualTable.style.position = "fixed";
|
|
16607
16626
|
virtualTable.style.top = 0;
|
|
@@ -17258,7 +17277,7 @@ function matchTableCell(node, delta) {
|
|
|
17258
17277
|
}
|
|
17259
17278
|
return delta;
|
|
17260
17279
|
}
|
|
17261
|
-
function matchTableHeader(node, delta,
|
|
17280
|
+
function matchTableHeader(node, delta, _scroll) {
|
|
17262
17281
|
const row = node.parentNode;
|
|
17263
17282
|
const cells = Array.from(row.querySelectorAll("th"));
|
|
17264
17283
|
let rowId$1 = row.dataset.row;
|
|
@@ -17299,7 +17318,7 @@ function matchTableHeader(node, delta, scroll) {
|
|
|
17299
17318
|
return delta;
|
|
17300
17319
|
}
|
|
17301
17320
|
function matchTable(node, delta, scroll) {
|
|
17302
|
-
|
|
17321
|
+
const isWordTable = node.children.length === 1;
|
|
17303
17322
|
if (!(node instanceof Element)) {
|
|
17304
17323
|
return;
|
|
17305
17324
|
}
|
|
@@ -17388,7 +17407,7 @@ function matchTable(node, delta, scroll) {
|
|
|
17388
17407
|
}
|
|
17389
17408
|
return delta;
|
|
17390
17409
|
}
|
|
17391
|
-
function matchTableRow(
|
|
17410
|
+
function matchTableRow(_node, delta) {
|
|
17392
17411
|
if (delta.ops.length === 1 && !delta.ops[0].attributes) {
|
|
17393
17412
|
delta = new Delta$1().insert("\n", { notFilled: true });
|
|
17394
17413
|
}
|
|
@@ -17525,7 +17544,7 @@ class BetterTable extends Module {
|
|
|
17525
17544
|
let tableBlot;
|
|
17526
17545
|
try {
|
|
17527
17546
|
tableBlot = prev.parent.parent.parent.parent;
|
|
17528
|
-
} catch (
|
|
17547
|
+
} catch (_e) {
|
|
17529
17548
|
}
|
|
17530
17549
|
if (tableBlot && tableBlot.domNode !== betterTableModule.table) {
|
|
17531
17550
|
betterTableModule.hideTableTools();
|
|
@@ -17558,7 +17577,7 @@ class BetterTable extends Module {
|
|
|
17558
17577
|
this.hideTableTools();
|
|
17559
17578
|
}
|
|
17560
17579
|
});
|
|
17561
|
-
this.quill.on(Quill.events.SELECTION_CHANGE, (range,
|
|
17580
|
+
this.quill.on(Quill.events.SELECTION_CHANGE, (range, _oldRange, source2) => {
|
|
17562
17581
|
if (!range) {
|
|
17563
17582
|
return;
|
|
17564
17583
|
}
|
|
@@ -17815,7 +17834,7 @@ BetterTable.keyboardBindings = {
|
|
|
17815
17834
|
let tableBlot;
|
|
17816
17835
|
try {
|
|
17817
17836
|
tableBlot = col.parent.parent.parent;
|
|
17818
|
-
} catch (
|
|
17837
|
+
} catch (_e) {
|
|
17819
17838
|
}
|
|
17820
17839
|
if (tableBlot && tableBlot.domNode !== betterTableModule.table) {
|
|
17821
17840
|
betterTableModule.hideTableTools();
|
|
@@ -17851,7 +17870,7 @@ BetterTable.keyboardBindings = {
|
|
|
17851
17870
|
"table-cell-line delete": {
|
|
17852
17871
|
key: "Delete",
|
|
17853
17872
|
format: ["table-cell-line"],
|
|
17854
|
-
handler(range,
|
|
17873
|
+
handler(range, _context) {
|
|
17855
17874
|
const [line] = this.quill.getLine(range.index);
|
|
17856
17875
|
const index = this.quill.getIndex(line);
|
|
17857
17876
|
const length = line.length();
|
|
@@ -50444,7 +50463,7 @@ class Picker {
|
|
|
50444
50463
|
if (option.textContent) {
|
|
50445
50464
|
item.setAttribute("data-label", option.textContent);
|
|
50446
50465
|
}
|
|
50447
|
-
item.addEventListener("click", (
|
|
50466
|
+
item.addEventListener("click", () => {
|
|
50448
50467
|
this.selectItem(item, true);
|
|
50449
50468
|
});
|
|
50450
50469
|
item.addEventListener("keydown", (event) => {
|
|
@@ -50832,24 +50851,23 @@ class BetterToolbar extends Toolbar {
|
|
|
50832
50851
|
this.controls.push([format, input]);
|
|
50833
50852
|
}
|
|
50834
50853
|
}
|
|
50835
|
-
const
|
|
50854
|
+
const BlockEmbed = Quill.imports["blots/block/embed"];
|
|
50836
50855
|
const VIDEO_ATTRIBUTES = ["id", "title", "src"];
|
|
50837
|
-
class Video extends
|
|
50856
|
+
class Video extends BlockEmbed {
|
|
50838
50857
|
static sanitize(url) {
|
|
50839
50858
|
return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
|
|
50840
50859
|
}
|
|
50841
50860
|
static create(value) {
|
|
50842
50861
|
const node = super.create(value);
|
|
50843
|
-
node.setAttribute("contenteditable", false);
|
|
50862
|
+
node.setAttribute("contenteditable", "false");
|
|
50844
50863
|
node.setAttribute("controls", "controls");
|
|
50845
50864
|
VIDEO_ATTRIBUTES.forEach((key) => {
|
|
50846
50865
|
if (value[key]) {
|
|
50847
50866
|
switch (key) {
|
|
50848
|
-
case "src":
|
|
50867
|
+
case "src":
|
|
50849
50868
|
const src = Video.sanitize(value[key]);
|
|
50850
50869
|
node.setAttribute(key, src);
|
|
50851
50870
|
break;
|
|
50852
|
-
}
|
|
50853
50871
|
case "title":
|
|
50854
50872
|
node.setAttribute(key, value[key]);
|
|
50855
50873
|
break;
|
|
@@ -50870,22 +50888,81 @@ class Video extends Embed {
|
|
|
50870
50888
|
});
|
|
50871
50889
|
return formats;
|
|
50872
50890
|
}
|
|
50873
|
-
static formats(domNode) {
|
|
50874
|
-
const formats = {};
|
|
50875
|
-
VIDEO_ATTRIBUTES.forEach((key) => {
|
|
50876
|
-
const value = domNode.getAttribute(key) || domNode.dataset[key];
|
|
50877
|
-
if (value) {
|
|
50878
|
-
formats[key] = value;
|
|
50879
|
-
}
|
|
50880
|
-
});
|
|
50881
|
-
return formats;
|
|
50882
|
-
}
|
|
50883
50891
|
}
|
|
50884
50892
|
Video.blotName = "video";
|
|
50885
50893
|
Video.tagName = "VIDEO";
|
|
50886
50894
|
Video.SANITIZED_URL = "about:blank";
|
|
50887
50895
|
Video.PROTOCOL_WHITELIST = ["http", "https"];
|
|
50888
50896
|
Video.className = "ql-video-item";
|
|
50897
|
+
class FormatPainter {
|
|
50898
|
+
constructor(quill) {
|
|
50899
|
+
this.quill = quill;
|
|
50900
|
+
this.isFormatterLock = false;
|
|
50901
|
+
this.isFormating = false;
|
|
50902
|
+
this.rangeFormat = {};
|
|
50903
|
+
this.btnActive = () => {
|
|
50904
|
+
setTimeout(() => {
|
|
50905
|
+
this.formatterBtn.classList.add("ql-active");
|
|
50906
|
+
}, 0);
|
|
50907
|
+
};
|
|
50908
|
+
this.btnRemoveActive = () => {
|
|
50909
|
+
setTimeout(() => {
|
|
50910
|
+
this.formatterBtn.classList.remove("ql-active");
|
|
50911
|
+
}, 0);
|
|
50912
|
+
};
|
|
50913
|
+
this.bindFormatSelect = () => {
|
|
50914
|
+
const range = this.quill.getSelection();
|
|
50915
|
+
if (range.length === 0)
|
|
50916
|
+
return;
|
|
50917
|
+
this.rangeFormat = this.quill.getFormat(range);
|
|
50918
|
+
this.isFormating = true;
|
|
50919
|
+
this.quill.on(Quill.events.SELECTION_CHANGE, this.formatRange);
|
|
50920
|
+
this.btnActive();
|
|
50921
|
+
};
|
|
50922
|
+
this.unbindFormatSelect = () => {
|
|
50923
|
+
this.quill.off(Quill.events.SELECTION_CHANGE, this.formatRange);
|
|
50924
|
+
this.rangeFormat = void 0;
|
|
50925
|
+
this.btnRemoveActive();
|
|
50926
|
+
this.isFormating = false;
|
|
50927
|
+
this.isFormatterLock = false;
|
|
50928
|
+
};
|
|
50929
|
+
this.formatRange = (range) => {
|
|
50930
|
+
if (!range)
|
|
50931
|
+
return;
|
|
50932
|
+
this.quill.removeFormat(range.index, range.length);
|
|
50933
|
+
for (const format in this.rangeFormat) {
|
|
50934
|
+
this.quill.format(format, this.rangeFormat[format], Quill.sources.USER);
|
|
50935
|
+
}
|
|
50936
|
+
if (!this.isFormatterLock) {
|
|
50937
|
+
this.unbindFormatSelect();
|
|
50938
|
+
} else {
|
|
50939
|
+
this.btnActive();
|
|
50940
|
+
}
|
|
50941
|
+
};
|
|
50942
|
+
this.quill = quill;
|
|
50943
|
+
const toolbar = this.quill.getModule("toolbar");
|
|
50944
|
+
this.formatterBtn = toolbar.container.querySelector(".ql-format-painter");
|
|
50945
|
+
if (toolbar && this.formatterBtn) {
|
|
50946
|
+
this.formatterBtn.addEventListener("dblclick", () => {
|
|
50947
|
+
if (this.isFormatterLock) {
|
|
50948
|
+
this.unbindFormatSelect();
|
|
50949
|
+
return;
|
|
50950
|
+
}
|
|
50951
|
+
this.isFormatterLock = true;
|
|
50952
|
+
this.bindFormatSelect();
|
|
50953
|
+
});
|
|
50954
|
+
this.formatterBtn.addEventListener("click", () => {
|
|
50955
|
+
if (!this.isFormating) {
|
|
50956
|
+
this.bindFormatSelect();
|
|
50957
|
+
} else {
|
|
50958
|
+
this.unbindFormatSelect();
|
|
50959
|
+
}
|
|
50960
|
+
});
|
|
50961
|
+
}
|
|
50962
|
+
}
|
|
50963
|
+
}
|
|
50964
|
+
FormatPainter.toolName = "format-painter";
|
|
50965
|
+
FormatPainter.moduleName = "format-painter";
|
|
50889
50966
|
const registerModules = function() {
|
|
50890
50967
|
const FontClass2 = Quill.imports["formats/font"];
|
|
50891
50968
|
FontClass2.whitelist = FONT_FAMILY_CONFIG;
|
|
@@ -50899,6 +50976,11 @@ const registerModules = function() {
|
|
|
50899
50976
|
const SnowTheme2 = Quill.imports["themes/snow"];
|
|
50900
50977
|
SnowTheme2.DEFAULTS = {
|
|
50901
50978
|
modules: {
|
|
50979
|
+
keyboard: {
|
|
50980
|
+
bindings: {
|
|
50981
|
+
...BetterTable.keyboardBindings
|
|
50982
|
+
}
|
|
50983
|
+
},
|
|
50902
50984
|
toolbar: {
|
|
50903
50985
|
handlers: {
|
|
50904
50986
|
...SnowTheme2.DEFAULTS.modules.toolbar.handlers,
|
|
@@ -50977,7 +51059,8 @@ const registerModules = function() {
|
|
|
50977
51059
|
right: '<i class="icon-text-align-right"></i>'
|
|
50978
51060
|
}
|
|
50979
51061
|
}
|
|
50980
|
-
}
|
|
51062
|
+
},
|
|
51063
|
+
"format-painter": {}
|
|
50981
51064
|
}
|
|
50982
51065
|
};
|
|
50983
51066
|
Quill.register(
|
|
@@ -51000,7 +51083,8 @@ const registerModules = function() {
|
|
|
51000
51083
|
"modules/emoji-toolbar": Emoji.ToolbarEmoji,
|
|
51001
51084
|
"modules/emoji-shortname": Emoji.ShortNameEmoji,
|
|
51002
51085
|
"modules/link": Link,
|
|
51003
|
-
"modules/syntax": CustomSyntax
|
|
51086
|
+
"modules/syntax": CustomSyntax,
|
|
51087
|
+
"modules/format-painter": FormatPainter
|
|
51004
51088
|
},
|
|
51005
51089
|
true
|
|
51006
51090
|
);
|