@opentiny/vue-renderless 3.13.1 → 3.14.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/action-sheet/index.js +20 -13
- package/action-sheet/vue.js +8 -7
- package/amount/index.js +100 -25
- package/amount/vue.js +102 -26
- package/anchor/index.js +1 -0
- package/area/index.js +8 -8
- package/area/vue.js +5 -5
- package/async-flowchart/index.js +16 -3
- package/autocomplete/index.js +58 -14
- package/autocomplete/vue.js +40 -12
- package/badge/index.js +12 -0
- package/badge/vue.js +6 -4
- package/breadcrumb/vue.js +3 -1
- package/breadcrumb-item/vue.js +6 -2
- package/button/index.js +5 -1
- package/calendar/index.js +2 -86
- package/calendar-bar/index.js +18 -4
- package/calendar-view/index.js +5 -1
- package/calendar-view/vue.js +16 -3
- package/card-group/vue.js +4 -2
- package/cascader/index.js +86 -34
- package/cascader/vue.js +61 -20
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +36 -23
- package/cascader-mobile/vue.js +6 -0
- package/cascader-node/index.js +13 -1
- package/cascader-node/vue.js +15 -4
- package/cascader-panel/index.js +1 -1
- package/cascader-select/column-index.js +150 -0
- package/cascader-select/column.js +120 -0
- package/cascader-select/index.js +29 -165
- package/cascader-select/usePicker.js +251 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +35 -47
- package/cell/vue.js +2 -1
- package/chart-bar/index.js +2 -3
- package/chart-core/deps/constants.js +43 -43
- package/chart-core/index.js +1 -1
- package/chart-gauge/index.js +2 -2
- package/chart-heatmap/index.js +17 -10
- package/chart-line/index.js +8 -9
- package/chart-tree/index.js +2 -2
- package/chart-waterfall/index.js +4 -6
- package/checkbox/index.js +18 -1
- package/checkbox/vue.js +15 -7
- package/checkbox-group/vue.js +1 -0
- package/col/vue.js +1 -1
- package/collapse/index.js +3 -3
- package/color-select-panel/vue.js +0 -7
- package/column-list-item/index.js +17 -1
- package/column-list-item/vue.js +8 -3
- package/common/date.js +7 -5
- package/common/deps/clickoutside.js +6 -2
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +44 -11
- package/common/deps/resize-event.js +1 -0
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +2 -2
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +38 -20
- package/common/index.js +2 -2
- package/common/runtime.js +1 -1
- package/common/string.js +2 -2
- package/common/type.js +2 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/pattern.js +2 -2
- package/common/validate/rules/range.js +8 -5
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +5 -5
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/util.js +15 -16
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/currency/index.js +74 -7
- package/currency/vue.js +21 -5
- package/date-panel/index.js +16 -0
- package/date-panel/vue.js +8 -2
- package/date-picker-mobile/index.js +12 -0
- package/date-picker-mobile/vue.js +7 -1
- package/date-range/vue.js +14 -6
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +46 -14
- package/dialog-box/vue.js +30 -7
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +27 -5
- package/drawer/vue.js +14 -7
- package/dropdown/index.js +7 -7
- package/dropdown/vue.js +6 -2
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +6 -10
- package/dropdown-item/vue.js +20 -7
- package/dropdown-menu/index.js +20 -7
- package/dropdown-menu/vue.js +4 -3
- package/exception/index.js +2 -7
- package/exception/vue.js +7 -10
- package/fall-menu/index.js +5 -1
- package/fall-menu/vue.js +13 -2
- package/file-upload/index.js +68 -18
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/float-button/index.js +42 -0
- package/float-button/vue.js +101 -0
- package/floating-button/index.js +62 -16
- package/floating-button/vue.js +27 -9
- package/flowchart/index.js +134 -25
- package/flowchart/node.js +13 -4
- package/flowchart/vue.js +16 -4
- package/form/vue.js +8 -0
- package/form-item/index.js +5 -5
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/plugins/export.js +5 -2
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -1
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +81 -20
- package/input/vue.js +44 -18
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/link/vue.js +3 -1
- package/loading/index.js +2 -2
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/menu/index.js +15 -2
- package/menu/vue.js +22 -17
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/modal/index.js +44 -4
- package/modal/vue.js +18 -4
- package/multi-select/index.js +186 -11
- package/multi-select/vue.js +60 -15
- package/multi-select-item/index.js +23 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +46 -12
- package/numeric/vue.js +44 -19
- package/option/index.js +27 -9
- package/option/vue.js +37 -21
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +18 -4
- package/pager/vue.js +16 -5
- package/picker/index.js +258 -49
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/vue.js +3 -0
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +71 -32
- package/popeditor/vue.js +15 -11
- package/popover/index.js +4 -4
- package/popover/vue.js +6 -6
- package/popup/index.js +3 -3
- package/popup/vue.js +5 -5
- package/pull-refresh/index.js +13 -13
- package/pull-refresh/vue.js +5 -4
- package/radio/index.js +0 -17
- package/radio/vue.js +4 -10
- package/rate/index.js +1 -1
- package/rate/vue.js +0 -2
- package/record/index.js +4 -1
- package/rich-text/clipboard.js +54 -0
- package/rich-text/index.js +192 -0
- package/rich-text/module/file-upload.js +107 -0
- package/rich-text/module/image-drop.js +63 -0
- package/rich-text/module/image-upload.js +89 -0
- package/rich-text/options.js +141 -0
- package/rich-text/table-module.js +382 -0
- package/rich-text/vue.js +102 -0
- package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
- package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
- package/scrollbar/index.js +11 -11
- package/scrollbar/vue-bar.js +3 -3
- package/scrollbar/vue.js +5 -5
- package/search/index.js +9 -9
- package/search/vue.js +8 -6
- package/select/index.js +457 -389
- package/select/vue.js +257 -161
- package/select-dropdown/index.js +61 -3
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/selected-box/index.js +2 -0
- package/selected-box/vue.js +6 -3
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +70 -17
- package/slider/vue.js +16 -7
- package/split/index.js +5 -3
- package/split/vue.js +4 -6
- package/standard-list-item/index.js +15 -1
- package/standard-list-item/vue.js +6 -5
- package/steps/index.js +25 -2
- package/steps/slide-bar.js +8 -1
- package/steps/vue.js +15 -3
- package/tab-item-mf/vue.js +14 -8
- package/tab-nav/index.js +30 -5
- package/tab-nav/vue.js +16 -4
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +16 -4
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tabs-mf/wheel.js +1 -0
- package/tag/index.js +1 -1
- package/tag-group/index.js +2 -1
- package/time/index.js +5 -2
- package/time/vue.js +1 -1
- package/time-line/index.js +3 -3
- package/time-line/vue.js +2 -2
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +6 -3
- package/tooltip/vue.js +4 -4
- package/transfer/index.js +20 -22
- package/transfer/vue.js +1 -6
- package/transfer-panel/vue.js +3 -5
- package/tree/index.js +21 -4
- package/tree/vue.js +10 -8
- package/tree-menu/index.js +31 -5
- package/tree-menu/vue.js +28 -15
- package/tree-node/index.js +18 -18
- package/tree-node/vue.js +6 -5
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +1 -1
- package/types/amount.type.d.ts +168 -1
- package/types/area.type.d.ts +134 -1
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +199 -1
- package/types/badge.type.d.ts +3 -1
- package/types/breadcrumb-item.type.d.ts +2 -0
- package/types/breadcrumb.type.d.ts +2 -0
- package/types/button-group.type.d.ts +3 -3
- package/types/button.type.d.ts +4 -0
- package/types/cascader-menu.type.d.ts +3 -4
- package/types/cascader-node.type.d.ts +5 -2
- package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -241
- package/types/cascader.type.d.ts +329 -1
- package/types/checkbox.type.d.ts +9 -3
- package/types/collapse.type.d.ts +20 -3
- package/types/date-picker.type.d.ts +37 -0
- package/types/dialog-box.type.d.ts +13 -3
- package/types/drawer.type.d.ts +133 -1
- package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +1 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +123 -0
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-222799ae.d.ts} +5 -2
- package/types/form.type.d.ts +1 -1
- package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
- package/types/input.type.d.ts +1 -5
- package/types/ip-address.type.d.ts +160 -1
- package/types/link.type.d.ts +6 -3
- package/types/loading.type.d.ts +7 -0
- package/types/milestone.type.d.ts +1 -1
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +29 -2
- package/types/numeric.type.d.ts +41 -10
- package/types/pager.type.d.ts +13 -1
- package/types/picker.type.d.ts +18 -0
- package/types/popconfirm.type.d.ts +86 -1
- package/types/popeditor.type.d.ts +5 -1
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +3 -1
- package/types/radio.type.d.ts +0 -4
- package/types/rate.type.d.ts +236 -1
- package/types/search.type.d.ts +88 -1
- package/types/shared.type.d.ts +1 -1
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slider.type.d.ts +49 -10
- package/types/steps.type.d.ts +15 -4
- package/types/switch.type.d.ts +3 -3
- package/types/tab-bar.type.d.ts +1 -1
- package/types/tab-nav.type.d.ts +7 -2
- package/types/tabs.type.d.ts +9 -1
- package/types/tag-group.type.d.ts +64 -1
- package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/tooltip.type.d.ts +2 -2
- package/types/transfer.type.d.ts +185 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-a29aea50.d.ts} +31 -8
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +146 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +64 -34
- package/upload/vue.js +9 -5
- package/upload-dragger/index.js +22 -20
- package/upload-list/index.js +24 -18
- package/upload-list/vue.js +9 -4
- package/user/index.js +34 -25
- package/user/vue.js +1 -1
- package/user-head/index.js +3 -3
- package/watermark/index.js +11 -0
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
- package/common/deps/modal-queue.js +0 -6
- package/common/deps/requestAnimationFrame.js +0 -25
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
const ImageDrop = function(quill) {
|
|
3
|
+
this.quill = quill;
|
|
4
|
+
this.handleDrop = this.handleDrop.bind(this);
|
|
5
|
+
this.handlePaste = this.handlePaste.bind(this);
|
|
6
|
+
this.quill.root.addEventListener("drop", this.handleDrop, false);
|
|
7
|
+
this.quill.root.addEventListener("paste", this.handlePaste, false);
|
|
8
|
+
};
|
|
9
|
+
ImageDrop.prototype.handleDrop = function(event) {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
if (event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length) {
|
|
12
|
+
if (document.caretRangeFromPoint) {
|
|
13
|
+
const selection = document.getSelection();
|
|
14
|
+
const range = document.caretRangeFromPoint(event.clientX, event.clientY);
|
|
15
|
+
if (selection && range) {
|
|
16
|
+
selection.setBaseAndExtent(range.startContainer, range.startOffset, range.startContainer, range.startOffset);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
this.readFiles(event.dataTransfer.files, this.insert.bind(this));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
ImageDrop.prototype.handlePaste = function(e) {
|
|
23
|
+
if (e.clipboardData && e.clipboardData.items && e.clipboardData.items.length) {
|
|
24
|
+
this.readFiles(
|
|
25
|
+
e.clipboardData.items,
|
|
26
|
+
function(dataUrl) {
|
|
27
|
+
const selection = this.quill.getSelection();
|
|
28
|
+
if (!selection) {
|
|
29
|
+
setTimeout(
|
|
30
|
+
function() {
|
|
31
|
+
this.insert(dataUrl);
|
|
32
|
+
}.bind(this),
|
|
33
|
+
0
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}.bind(this)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
ImageDrop.prototype.insert = function(dataUrl) {
|
|
41
|
+
const index = (this.quill.getSelection() || {}).index || this.quill.getLength();
|
|
42
|
+
this.quill.insertEmbed(index, "image", dataUrl, "user");
|
|
43
|
+
};
|
|
44
|
+
ImageDrop.prototype.readFiles = function(files, callback) {
|
|
45
|
+
;
|
|
46
|
+
[].forEach.call(files, function(file) {
|
|
47
|
+
if (!file.type.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon)/i)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const reader = new FileReader();
|
|
51
|
+
reader.onload = function(e) {
|
|
52
|
+
callback(e.target.result);
|
|
53
|
+
};
|
|
54
|
+
const blob = file.getAsFile ? file.getAsFile() : file;
|
|
55
|
+
if (blob instanceof Blob) {
|
|
56
|
+
reader.readAsDataURL(blob);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var image_drop_default = ImageDrop;
|
|
61
|
+
export {
|
|
62
|
+
image_drop_default as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
import { xss } from "../../common/xss";
|
|
3
|
+
const ImageUpload = function(quill, options) {
|
|
4
|
+
this.quill = quill;
|
|
5
|
+
this.options = options || {};
|
|
6
|
+
this.quill.getModule("toolbar").addHandler("image", this.selectLocalImage.bind(this));
|
|
7
|
+
};
|
|
8
|
+
ImageUpload.prototype.selectLocalImage = function() {
|
|
9
|
+
const input = document.createElement("input");
|
|
10
|
+
input.setAttribute("type", "file");
|
|
11
|
+
input.click();
|
|
12
|
+
input.onchange = function() {
|
|
13
|
+
const file = input.files[0];
|
|
14
|
+
if (/^image\//.test(file.type)) {
|
|
15
|
+
const checkBeforeSend = this.options.checkBeforeSend || this.checkBeforeSend.bind(this);
|
|
16
|
+
checkBeforeSend(file, this.sendToServer.bind(this));
|
|
17
|
+
} else {
|
|
18
|
+
throw new Error("You could only upload images.");
|
|
19
|
+
}
|
|
20
|
+
}.bind(this);
|
|
21
|
+
};
|
|
22
|
+
ImageUpload.prototype.checkBeforeSend = function(file, next) {
|
|
23
|
+
next(file);
|
|
24
|
+
};
|
|
25
|
+
ImageUpload.prototype.sendToServer = function(file) {
|
|
26
|
+
if (this.options.customUploader) {
|
|
27
|
+
this.options.customUploader(
|
|
28
|
+
file,
|
|
29
|
+
function(dataUrl) {
|
|
30
|
+
this.insert(dataUrl);
|
|
31
|
+
}.bind(this)
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
const url = xss.filterUrl(this.options.url);
|
|
35
|
+
const method = this.options.method || "POST";
|
|
36
|
+
const name = this.options.name || "image";
|
|
37
|
+
const headers = this.options.headers || {};
|
|
38
|
+
const callbackOK = this.options.success || this.uploadImageCallbackOK.bind(this);
|
|
39
|
+
const callbackKO = this.options.fail || this.uploadImageCallbackKO.bind(this);
|
|
40
|
+
if (url) {
|
|
41
|
+
const fd = new FormData();
|
|
42
|
+
fd.append(name, file);
|
|
43
|
+
if (this.options.csrf) {
|
|
44
|
+
fd.append(this.options.csrf.token, this.options.csrf.hash);
|
|
45
|
+
}
|
|
46
|
+
const xmlHttpRequest = new XMLHttpRequest();
|
|
47
|
+
xmlHttpRequest.open(method, url, true);
|
|
48
|
+
for (let index in headers) {
|
|
49
|
+
xmlHttpRequest.setRequestHeader(index, headers[index]);
|
|
50
|
+
}
|
|
51
|
+
xmlHttpRequest.onload = function() {
|
|
52
|
+
if (xmlHttpRequest.status === 200 || xmlHttpRequest.status === 201) {
|
|
53
|
+
callbackOK(JSON.parse(xmlHttpRequest.responseText), this.insert.bind(this));
|
|
54
|
+
} else {
|
|
55
|
+
callbackKO({
|
|
56
|
+
code: xmlHttpRequest.status,
|
|
57
|
+
type: xmlHttpRequest.statusText,
|
|
58
|
+
body: xmlHttpRequest.responseText
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}.bind(this);
|
|
62
|
+
if (this.options.withCredentials) {
|
|
63
|
+
xmlHttpRequest.withCredentials = true;
|
|
64
|
+
}
|
|
65
|
+
xmlHttpRequest.send(fd);
|
|
66
|
+
} else {
|
|
67
|
+
const reader = new FileReader();
|
|
68
|
+
reader.onload = function(event) {
|
|
69
|
+
callbackOK(event.target.result, this.insert.bind(this));
|
|
70
|
+
}.bind(this);
|
|
71
|
+
reader.readAsDataURL(file);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
ImageUpload.prototype.insert = function(dataUrl) {
|
|
76
|
+
const index = (this.quill.getSelection() || {}).index || this.quill.getLength();
|
|
77
|
+
this.quill.insertEmbed(index, "image", dataUrl, "user");
|
|
78
|
+
this.quill.setSelection(index + 1);
|
|
79
|
+
};
|
|
80
|
+
ImageUpload.prototype.uploadImageCallbackOK = function(response, next) {
|
|
81
|
+
next(response);
|
|
82
|
+
};
|
|
83
|
+
ImageUpload.prototype.uploadImageCallbackKO = function(error) {
|
|
84
|
+
throw new Error(error);
|
|
85
|
+
};
|
|
86
|
+
var image_upload_default = ImageUpload;
|
|
87
|
+
export {
|
|
88
|
+
image_upload_default as default
|
|
89
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const size = ["small", false, "large", "huge"];
|
|
3
|
+
const underline = ["bold", "italic", "underline", "strike"];
|
|
4
|
+
const media = ["link", "image", "video", "file"];
|
|
5
|
+
const header = [{ header: [1, 2, 3, 4, 5, 6, false] }];
|
|
6
|
+
const script = [{ script: "sub" }, { script: "super" }];
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
theme: "snow",
|
|
9
|
+
boundary: document.body,
|
|
10
|
+
modules: {
|
|
11
|
+
tableModule: true,
|
|
12
|
+
toolbar: {
|
|
13
|
+
container: [
|
|
14
|
+
underline,
|
|
15
|
+
["blockquote", "code-block"],
|
|
16
|
+
[{ header: 1 }, { header: 2 }],
|
|
17
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
18
|
+
script,
|
|
19
|
+
[{ indent: "-1" }, { indent: "+1" }],
|
|
20
|
+
[{ direction: "rtl" }],
|
|
21
|
+
[{ size }],
|
|
22
|
+
header,
|
|
23
|
+
[{ color: [] }, { background: [] }],
|
|
24
|
+
[{ font: [] }],
|
|
25
|
+
[{ align: [] }],
|
|
26
|
+
["clean"],
|
|
27
|
+
media
|
|
28
|
+
],
|
|
29
|
+
handlers: {
|
|
30
|
+
file(value) {
|
|
31
|
+
if (!value) {
|
|
32
|
+
this.quill.format("file", false);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
clipboard: { matchVisual: false }
|
|
38
|
+
},
|
|
39
|
+
placeholder: "Insert text here ...",
|
|
40
|
+
readOnly: false
|
|
41
|
+
};
|
|
42
|
+
const getToolbarTips = (t) => [
|
|
43
|
+
{ Choice: ".ql-bold", title: t("ui.richText.bold") },
|
|
44
|
+
{ Choice: ".ql-italic", title: t("ui.richText.italic") },
|
|
45
|
+
{ Choice: ".ql-underline", title: t("ui.richText.underline") },
|
|
46
|
+
{ Choice: ".ql-header", title: t("ui.richText.header") },
|
|
47
|
+
{ Choice: ".ql-strike", title: t("ui.richText.strike") },
|
|
48
|
+
{ Choice: ".ql-blockquote", title: t("ui.richText.blockquote") },
|
|
49
|
+
{ Choice: ".ql-code-block", title: t("ui.richText.codeBlock") },
|
|
50
|
+
{ Choice: ".ql-size", title: t("ui.richText.size") },
|
|
51
|
+
{ Choice: '.ql-list[value="ordered"]', title: t("ui.richText.listOrdered") },
|
|
52
|
+
{ Choice: '.ql-list[value="bullet"]', title: t("ui.richText.listBullet") },
|
|
53
|
+
{ Choice: '.ql-header[value="1"]', title: t("ui.richText.header1") },
|
|
54
|
+
{ Choice: '.ql-header[value="2"]', title: t("ui.richText.header2") },
|
|
55
|
+
{ Choice: ".ql-align", title: t("ui.richText.align") },
|
|
56
|
+
{ Choice: ".ql-color", title: t("ui.richText.color") },
|
|
57
|
+
{ Choice: ".ql-background", title: t("ui.richText.background") },
|
|
58
|
+
{ Choice: ".ql-image", title: t("ui.richText.image") },
|
|
59
|
+
{ Choice: ".ql-video", title: t("ui.richText.video") },
|
|
60
|
+
{ Choice: ".ql-link", title: t("ui.richText.link") },
|
|
61
|
+
{ Choice: ".ql-formula", title: t("ui.richText.formula") },
|
|
62
|
+
{ Choice: ".ql-clean", title: t("ui.richText.clean") },
|
|
63
|
+
{ Choice: '.ql-indent[value="-1"]', title: t("ui.richText.indent1") },
|
|
64
|
+
{ Choice: '.ql-indent[value="+1"]', title: t("ui.richText.indent2") },
|
|
65
|
+
{
|
|
66
|
+
Choice: ".ql-header .ql-picker-label",
|
|
67
|
+
title: t("ui.richText.pickerLabel")
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
Choice: '.ql-header .ql-picker-item[data-value="1"]',
|
|
71
|
+
title: t("ui.richText.headerPicker1")
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
Choice: '.ql-header .ql-picker-item[data-value="2"]',
|
|
75
|
+
title: t("ui.richText.headerPicker2")
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
Choice: '.ql-header .ql-picker-item[data-value="3"]',
|
|
79
|
+
title: t("ui.richText.headerPicker3")
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
Choice: '.ql-header .ql-picker-item[data-value="4"]',
|
|
83
|
+
title: t("ui.richText.headerPicker4")
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
Choice: '.ql-header .ql-picker-item[data-value="5"]',
|
|
87
|
+
title: t("ui.richText.headerPicker5")
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
Choice: '.ql-header .ql-picker-item[data-value="6"]',
|
|
91
|
+
title: t("ui.richText.headerPicker6")
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
Choice: ".ql-header .ql-picker-item:last-child",
|
|
95
|
+
title: t("ui.richText.normal")
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
Choice: '.ql-size .ql-picker-item[data-value="small"]',
|
|
99
|
+
title: t("ui.richText.sizeSmall")
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
Choice: '.ql-size .ql-picker-item[data-value="large"]',
|
|
103
|
+
title: t("ui.richText.sizeLarge")
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
Choice: '.ql-size .ql-picker-item[data-value="huge"]',
|
|
107
|
+
title: t("ui.richText.sizeHuge")
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
Choice: ".ql-size .ql-picker-item:nth-child(2)",
|
|
111
|
+
title: t("ui.richText.normal")
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
Choice: ".ql-align .ql-picker-item:first-child",
|
|
115
|
+
title: t("ui.richText.alignPicker1")
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
Choice: '.ql-align .ql-picker-item[data-value="center"]',
|
|
119
|
+
title: t("ui.richText.alignPicker2")
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
Choice: '.ql-align .ql-picker-item[data-value="right"]',
|
|
123
|
+
title: t("ui.richText.alignPicker3")
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
Choice: '.ql-align .ql-picker-item[data-value="justify"]',
|
|
127
|
+
title: t("ui.richText.alignPicker4")
|
|
128
|
+
},
|
|
129
|
+
{ Choice: '.ql-script[value="sub"]', title: t("ui.richText.subScript") },
|
|
130
|
+
{ Choice: '.ql-script[value="super"]', title: t("ui.richText.superScript") },
|
|
131
|
+
{
|
|
132
|
+
Choice: '.ql-direction[value="rtl"]',
|
|
133
|
+
title: t("ui.richText.directionRTL")
|
|
134
|
+
},
|
|
135
|
+
{ Choice: ".ql-font", title: t("ui.richText.font") },
|
|
136
|
+
{ Choice: ".ql-file", title: t("ui.richText.file") }
|
|
137
|
+
];
|
|
138
|
+
export {
|
|
139
|
+
defaultOptions,
|
|
140
|
+
getToolbarTips
|
|
141
|
+
};
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { random } from "../common/string";
|
|
3
|
+
import { isNull } from "../common/type";
|
|
4
|
+
function cellName() {
|
|
5
|
+
return random().toString(36).slice(2);
|
|
6
|
+
}
|
|
7
|
+
function addMatcherTable({ _quill, oper }) {
|
|
8
|
+
_quill.clipboard.addMatcher("TABLE", function(node, delta) {
|
|
9
|
+
const id = cellName();
|
|
10
|
+
oper.setTableId(id);
|
|
11
|
+
return delta;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function addMatcherTr({ _quill, oper }) {
|
|
15
|
+
_quill.clipboard.addMatcher("TR", function(node, delta) {
|
|
16
|
+
const id = cellName();
|
|
17
|
+
oper.setRowId(id);
|
|
18
|
+
return delta;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function addMatcherTd({ _quill, oper, Delta }) {
|
|
22
|
+
_quill.clipboard.addMatcher("TD", function(node, delta) {
|
|
23
|
+
const tableId = oper.getTableId();
|
|
24
|
+
const rowId = oper.getRowId();
|
|
25
|
+
const cellId = cellName();
|
|
26
|
+
if (delta.ops.length) {
|
|
27
|
+
const lastOp = delta.ops[delta.ops.length - 1];
|
|
28
|
+
if (typeof lastOp.insert === "string" && !lastOp.insert.endsWith("\n")) {
|
|
29
|
+
lastOp.insert += "\n";
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
delta.insert("\n");
|
|
33
|
+
}
|
|
34
|
+
const attributes = { td: tableId + "|" + rowId + "|" + cellId };
|
|
35
|
+
if (node.rowSpan) {
|
|
36
|
+
attributes.rowSpan = node.rowSpan;
|
|
37
|
+
}
|
|
38
|
+
if (node.colSpan) {
|
|
39
|
+
attributes.colSpan = node.colSpan;
|
|
40
|
+
}
|
|
41
|
+
if (node.width) {
|
|
42
|
+
attributes.width = node.width;
|
|
43
|
+
}
|
|
44
|
+
if (node.height) {
|
|
45
|
+
attributes.height = node.height;
|
|
46
|
+
}
|
|
47
|
+
return delta.compose(new Delta().retain(delta.length(), attributes));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function addMatcher3(_quill) {
|
|
51
|
+
_quill.clipboard.addMatcher(3, function(node, delta) {
|
|
52
|
+
if (["TABLE", "TR"].includes(node.parentNode.tagName)) {
|
|
53
|
+
return { ops: [] };
|
|
54
|
+
} else {
|
|
55
|
+
return delta;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function addMatcherFont(_quill) {
|
|
60
|
+
_quill.clipboard.addMatcher("FONT", function(node, delta) {
|
|
61
|
+
if (node.innerText === "") {
|
|
62
|
+
return { ops: [] };
|
|
63
|
+
} else {
|
|
64
|
+
return delta;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function addMatcher({ qil: _quill, Delta }) {
|
|
69
|
+
let tableId = cellName();
|
|
70
|
+
let rowId = cellName();
|
|
71
|
+
let oper = {
|
|
72
|
+
getTableId() {
|
|
73
|
+
return tableId;
|
|
74
|
+
},
|
|
75
|
+
setTableId(id) {
|
|
76
|
+
tableId = id;
|
|
77
|
+
},
|
|
78
|
+
getRowId() {
|
|
79
|
+
return rowId;
|
|
80
|
+
},
|
|
81
|
+
setRowId(id) {
|
|
82
|
+
rowId = id;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
addMatcherTable({ _quill, oper });
|
|
86
|
+
addMatcherTr({ _quill, oper });
|
|
87
|
+
addMatcherTd({ _quill, oper, Delta });
|
|
88
|
+
addMatcher3(_quill);
|
|
89
|
+
addMatcherFont(_quill);
|
|
90
|
+
}
|
|
91
|
+
let quill = /* @__PURE__ */ Object.create(null);
|
|
92
|
+
function setQuill(q) {
|
|
93
|
+
quill = q;
|
|
94
|
+
}
|
|
95
|
+
function getQuill() {
|
|
96
|
+
return quill;
|
|
97
|
+
}
|
|
98
|
+
function getLeafFromQuill() {
|
|
99
|
+
let q = getQuill();
|
|
100
|
+
return q ? q.getLeaf(q.getSelection().index) : [];
|
|
101
|
+
}
|
|
102
|
+
function provideTableTrick({ Parchment }) {
|
|
103
|
+
class TableTrick {
|
|
104
|
+
static findTd(what) {
|
|
105
|
+
const leaf = getLeafFromQuill();
|
|
106
|
+
let blot = leaf[0];
|
|
107
|
+
while (!isNull(blot) && blot.statics.blotName !== what) {
|
|
108
|
+
blot = blot.parent;
|
|
109
|
+
}
|
|
110
|
+
return blot;
|
|
111
|
+
}
|
|
112
|
+
static appendCol() {
|
|
113
|
+
const td = TableTrick.findTd("td");
|
|
114
|
+
if (td) {
|
|
115
|
+
const table = td.parent.parent;
|
|
116
|
+
const tableId = table.domNode.getAttribute("table_id");
|
|
117
|
+
td.parent.parent.children.forEach(function(tr) {
|
|
118
|
+
const rowId = tr.domNode.getAttribute("row_id");
|
|
119
|
+
const cellId = cellName();
|
|
120
|
+
const tdNew = Parchment.create("td", tableId + "|" + rowId + "|" + cellId);
|
|
121
|
+
tr.appendChild(tdNew);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
static appendRow() {
|
|
126
|
+
const td = TableTrick.findTd("td");
|
|
127
|
+
if (td) {
|
|
128
|
+
const colCount = td.parent.children.length;
|
|
129
|
+
const table = td.parent.parent;
|
|
130
|
+
const newRow = td.parent.clone();
|
|
131
|
+
const tableId = table.domNode.getAttribute("table_id");
|
|
132
|
+
const rowId = cellName();
|
|
133
|
+
newRow.domNode.setAttribute("row_id", rowId);
|
|
134
|
+
for (let i = colCount - 1; i >= 0; i--) {
|
|
135
|
+
const cellId = cellName();
|
|
136
|
+
const tdNew = Parchment.create("td", tableId + "|" + rowId + "|" + cellId);
|
|
137
|
+
newRow.appendChild(tdNew);
|
|
138
|
+
}
|
|
139
|
+
table.appendChild(newRow);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { TableTrick };
|
|
144
|
+
}
|
|
145
|
+
function createTable({ value, Container, Parchment, Scroll }) {
|
|
146
|
+
let node = null;
|
|
147
|
+
const sizes = value.split("_");
|
|
148
|
+
const rowCount = Number.parseInt(sizes[1]);
|
|
149
|
+
const colCount = Number.parseInt(sizes[2]);
|
|
150
|
+
const tableId = cellName();
|
|
151
|
+
const table = Parchment.create("table", tableId);
|
|
152
|
+
for (let ri = 0; ri < rowCount; ri++) {
|
|
153
|
+
const rowId = cellName();
|
|
154
|
+
const tr = Parchment.create("tr", rowId);
|
|
155
|
+
table.appendChild(tr);
|
|
156
|
+
for (let ci = 0; ci < colCount; ci++) {
|
|
157
|
+
const cellId = cellName();
|
|
158
|
+
value = tableId + "|" + rowId + "|" + cellId;
|
|
159
|
+
const td = Parchment.create("td", value);
|
|
160
|
+
const p = Parchment.create("block");
|
|
161
|
+
const br = Parchment.create("break");
|
|
162
|
+
tr.appendChild(td);
|
|
163
|
+
td.appendChild(p);
|
|
164
|
+
p.appendChild(br);
|
|
165
|
+
node = p;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const leaf = getLeafFromQuill();
|
|
169
|
+
let blot = leaf[0];
|
|
170
|
+
let topBranch = null;
|
|
171
|
+
while (!isNull(blot) && !(blot instanceof Container || blot instanceof Scroll)) {
|
|
172
|
+
topBranch = blot;
|
|
173
|
+
blot = blot.parent;
|
|
174
|
+
}
|
|
175
|
+
blot && blot.insertBefore(table, topBranch);
|
|
176
|
+
return node;
|
|
177
|
+
}
|
|
178
|
+
function provideTable({ Container, Parchment, Scroll, TableTrick, TableRow }) {
|
|
179
|
+
class Table extends Container {
|
|
180
|
+
static create(value) {
|
|
181
|
+
if (value === "append-row") {
|
|
182
|
+
return TableTrick.appendRow();
|
|
183
|
+
} else if (value === "append-col") {
|
|
184
|
+
return TableTrick.appendCol();
|
|
185
|
+
} else if (value.includes("newtable_")) {
|
|
186
|
+
return createTable({ value, Container, Parchment, Scroll });
|
|
187
|
+
} else {
|
|
188
|
+
const tagName = "table";
|
|
189
|
+
const node = super.create(tagName);
|
|
190
|
+
node.setAttribute("table_id", value);
|
|
191
|
+
return node;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
optimize() {
|
|
195
|
+
super.optimize();
|
|
196
|
+
const next = this.next;
|
|
197
|
+
if (!isNull(next) && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute("table_id") === this.domNode.getAttribute("table_id")) {
|
|
198
|
+
next.moveChildren(this);
|
|
199
|
+
next.remove();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
Table.blotName = "table";
|
|
204
|
+
Table.tagName = "table";
|
|
205
|
+
Table.scope = Parchment.Scope.BLOCK_BLOT;
|
|
206
|
+
Table.defaultChild = "tr";
|
|
207
|
+
Table.allowedChildren = [TableRow];
|
|
208
|
+
return { Table };
|
|
209
|
+
}
|
|
210
|
+
function provideTableModule({ Container, Parchment, Module, Quill, Scroll, Delta, ContainBlot, TableRow, TableCell }) {
|
|
211
|
+
const { TableTrick } = provideTableTrick({ Parchment });
|
|
212
|
+
const { Table } = provideTable({
|
|
213
|
+
Container,
|
|
214
|
+
Parchment,
|
|
215
|
+
Scroll,
|
|
216
|
+
TableTrick,
|
|
217
|
+
TableRow
|
|
218
|
+
});
|
|
219
|
+
class TableModule extends Module {
|
|
220
|
+
constructor(qil, opt) {
|
|
221
|
+
super(qil, opt);
|
|
222
|
+
addMatcher({ qil, Delta });
|
|
223
|
+
setQuill(qil);
|
|
224
|
+
}
|
|
225
|
+
static register() {
|
|
226
|
+
Quill.register(ContainBlot, true);
|
|
227
|
+
Quill.register(TableRow, true);
|
|
228
|
+
Quill.register(Table, true);
|
|
229
|
+
Quill.register(TableCell, true);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return { TableModule };
|
|
233
|
+
}
|
|
234
|
+
function provideContainBlot({ Container, Parchment, Block, BlockEmbed }) {
|
|
235
|
+
class ContainBlot extends Container {
|
|
236
|
+
static create() {
|
|
237
|
+
return super.create("contain");
|
|
238
|
+
}
|
|
239
|
+
static formats(domNode) {
|
|
240
|
+
return domNode.tagName;
|
|
241
|
+
}
|
|
242
|
+
insertBefore(blot, ref) {
|
|
243
|
+
if (blot.statics.blotName === this.statics.blotName) {
|
|
244
|
+
super.insertBefore(blot.children.head, ref);
|
|
245
|
+
} else {
|
|
246
|
+
super.insertBefore(blot, ref);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
formats() {
|
|
250
|
+
return { [this.statics.blotName]: this.statics.formats(this.domNode) };
|
|
251
|
+
}
|
|
252
|
+
replace(target) {
|
|
253
|
+
if (target.statics.blotName !== this.statics.blotName) {
|
|
254
|
+
const item = Parchment.create(this.statics.defaultChild);
|
|
255
|
+
target.moveChildren(item);
|
|
256
|
+
this.appendChild(item);
|
|
257
|
+
}
|
|
258
|
+
if (isNull(target.parent))
|
|
259
|
+
return;
|
|
260
|
+
super.replace(target);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
ContainBlot.blotName = "contain";
|
|
264
|
+
ContainBlot.tagName = "contain";
|
|
265
|
+
ContainBlot.scope = Parchment.Scope.BLOCK_BLOT;
|
|
266
|
+
ContainBlot.defaultChild = "block";
|
|
267
|
+
ContainBlot.allowedChildren = [Block, BlockEmbed, Container];
|
|
268
|
+
return { ContainBlot };
|
|
269
|
+
}
|
|
270
|
+
function provideTableRow({ Container, Parchment }) {
|
|
271
|
+
class TableRow extends Container {
|
|
272
|
+
static create(value) {
|
|
273
|
+
const node = super.create("tr");
|
|
274
|
+
node.setAttribute("row_id", value);
|
|
275
|
+
return node;
|
|
276
|
+
}
|
|
277
|
+
optimize() {
|
|
278
|
+
super.optimize();
|
|
279
|
+
const next = this.next;
|
|
280
|
+
if (!isNull(next) && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute("row_id") === this.domNode.getAttribute("row_id")) {
|
|
281
|
+
next.moveChildren(this);
|
|
282
|
+
next.remove();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
TableRow.blotName = "tr";
|
|
287
|
+
TableRow.tagName = "tr";
|
|
288
|
+
TableRow.scope = Parchment.Scope.BLOCK_BLOT;
|
|
289
|
+
TableRow.defaultChild = "td";
|
|
290
|
+
return { TableRow };
|
|
291
|
+
}
|
|
292
|
+
function setAttrs({ node, value }) {
|
|
293
|
+
const ids = value.split("|");
|
|
294
|
+
node.setAttribute("table_id", ids[0]);
|
|
295
|
+
node.setAttribute("row_id", ids[1]);
|
|
296
|
+
node.setAttribute("cell_id", ids[2]);
|
|
297
|
+
return node;
|
|
298
|
+
}
|
|
299
|
+
function provideTableCell({ Container, Parchment, Block, BlockEmbed, ContainBlot }) {
|
|
300
|
+
class TableCell extends ContainBlot {
|
|
301
|
+
static create(value) {
|
|
302
|
+
return setAttrs({ node: super.create("td"), value });
|
|
303
|
+
}
|
|
304
|
+
formatAt(index, length, name, value) {
|
|
305
|
+
super.formatAt(index, length, name, value);
|
|
306
|
+
const attrWhitelist = ["colSpan", "rowSpan", "width", "height"];
|
|
307
|
+
attrWhitelist.includes(name) && this.domNode.setAttribute(name, value);
|
|
308
|
+
}
|
|
309
|
+
formats() {
|
|
310
|
+
const domNode = this.domNode;
|
|
311
|
+
const blotName = this.statics.blotName;
|
|
312
|
+
const attr = (domNode2, attr2) => domNode2.getAttribute(attr2);
|
|
313
|
+
return {
|
|
314
|
+
[blotName]: `${attr(domNode, "table_id")}|${attr(domNode, "row_id")}|${attr(domNode, "row_id")}`
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
optimize() {
|
|
318
|
+
super.optimize();
|
|
319
|
+
if (!isNull(this.parent) && this.parent.statics.blotName !== "tr") {
|
|
320
|
+
const mark = Parchment.create("block");
|
|
321
|
+
this.parent.insertBefore(mark, this.next);
|
|
322
|
+
const table = Parchment.create("table", this.domNode.getAttribute("table_id"));
|
|
323
|
+
const tr = Parchment.create("tr", this.domNode.getAttribute("row_id"));
|
|
324
|
+
table.appendChild(tr);
|
|
325
|
+
tr.appendChild(this);
|
|
326
|
+
table.replace(mark);
|
|
327
|
+
}
|
|
328
|
+
if (!isNull(this.next) && this.next.prev === this && this.next.statics.blotName === this.statics.blotName && this.next.domNode.tagName === this.domNode.tagName && this.next.domNode.getAttribute("cell_id") === this.domNode.getAttribute("cell_id")) {
|
|
329
|
+
this.next.moveChildren(this);
|
|
330
|
+
this.next.remove();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
TableCell.blotName = "td";
|
|
335
|
+
TableCell.tagName = "td";
|
|
336
|
+
TableCell.scope = Parchment.Scope.BLOCK_BLOT;
|
|
337
|
+
TableCell.defaultChild = "block";
|
|
338
|
+
TableCell.allowedChildren = [Block, BlockEmbed, Container];
|
|
339
|
+
return { TableCell };
|
|
340
|
+
}
|
|
341
|
+
function tableModule(Quill) {
|
|
342
|
+
const Container = Quill.import("blots/container");
|
|
343
|
+
const Scroll = Quill.import("blots/scroll");
|
|
344
|
+
const Module = Quill.import("core/module");
|
|
345
|
+
const Block = Quill.import("blots/block");
|
|
346
|
+
const Delta = Quill.import("delta");
|
|
347
|
+
const Parchment = Quill.import("parchment");
|
|
348
|
+
const BlockEmbed = Quill.import("blots/block/embed");
|
|
349
|
+
const { ContainBlot } = provideContainBlot({
|
|
350
|
+
Container,
|
|
351
|
+
Parchment,
|
|
352
|
+
Block,
|
|
353
|
+
BlockEmbed
|
|
354
|
+
});
|
|
355
|
+
const { TableRow } = provideTableRow({ Container, Parchment });
|
|
356
|
+
const { TableCell } = provideTableCell({
|
|
357
|
+
Container,
|
|
358
|
+
Parchment,
|
|
359
|
+
Block,
|
|
360
|
+
BlockEmbed,
|
|
361
|
+
ContainBlot
|
|
362
|
+
});
|
|
363
|
+
const params = {
|
|
364
|
+
Container,
|
|
365
|
+
Parchment,
|
|
366
|
+
Module,
|
|
367
|
+
Quill,
|
|
368
|
+
Scroll,
|
|
369
|
+
Delta,
|
|
370
|
+
ContainBlot,
|
|
371
|
+
TableRow,
|
|
372
|
+
TableCell
|
|
373
|
+
};
|
|
374
|
+
const { TableModule } = provideTableModule(params);
|
|
375
|
+
TableRow.allowedChildren = [TableCell];
|
|
376
|
+
Container.order = ["list", "contain", "td", "tr", "table"];
|
|
377
|
+
Quill.register("modules/tableModule", TableModule, true);
|
|
378
|
+
}
|
|
379
|
+
var table_module_default = tableModule;
|
|
380
|
+
export {
|
|
381
|
+
table_module_default as default
|
|
382
|
+
};
|