vue-editify 0.0.47 → 0.0.49
Sign up to get free protection for your applications and to get access to all the features.
- package/examples/App.vue +6 -17
- package/lib/editify.es.js +402 -291
- package/lib/editify.umd.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +2 -2
- package/src/Editify.vue +148 -69
- package/src/components/bussiness/Menu.vue +80 -17
- package/src/components/bussiness/Toolbar.vue +31 -31
- package/src/core/index.js +12 -2
- package/src/icon/iconfont.css +4 -0
- package/src/icon/iconfont.ttf +0 -0
- package/src/icon/iconfont.woff +0 -0
- package/src/index.js +1 -1
- package/src/locale/en_US.js +2 -1
- package/src/locale/zh_CN.js +2 -1
package/lib/editify.es.js
CHANGED
@@ -1722,7 +1722,7 @@ const speech$1 = {
|
|
1722
1722
|
}
|
1723
1723
|
};
|
1724
1724
|
const obj$1 = { number: number$1, data: data$1, element: element$1, event: event$1, common: common$1, color: color$1, file: file$1, string: string$1, platform: platform$1, speech: speech$1 };
|
1725
|
-
const getAttributes = (node)
|
1725
|
+
const getAttributes = function(node) {
|
1726
1726
|
let o = {};
|
1727
1727
|
const length = node.attributes.length;
|
1728
1728
|
for (let i = 0; i < length; i++) {
|
@@ -1733,7 +1733,7 @@ const getAttributes = (node) => {
|
|
1733
1733
|
}
|
1734
1734
|
return o;
|
1735
1735
|
};
|
1736
|
-
const getStyles = (node)
|
1736
|
+
const getStyles = function(node) {
|
1737
1737
|
let o = {};
|
1738
1738
|
if (node.getAttribute("style")) {
|
1739
1739
|
const styles = node.getAttribute("style");
|
@@ -1759,34 +1759,34 @@ const getStyles = (node) => {
|
|
1759
1759
|
}
|
1760
1760
|
return o;
|
1761
1761
|
};
|
1762
|
-
const createUniqueKey = ()
|
1762
|
+
const createUniqueKey = function() {
|
1763
1763
|
let key = obj$1.data.get(window, "data-alex-editor-key") || 0;
|
1764
1764
|
key++;
|
1765
1765
|
obj$1.data.set(window, "data-alex-editor-key", key);
|
1766
1766
|
return key;
|
1767
1767
|
};
|
1768
|
-
const createGuid = ()
|
1768
|
+
const createGuid = function() {
|
1769
1769
|
let key = obj$1.data.get(window, "data-alex-editor-guid") || 0;
|
1770
1770
|
key++;
|
1771
1771
|
obj$1.data.set(window, "data-alex-editor-guid", key);
|
1772
1772
|
return key;
|
1773
1773
|
};
|
1774
|
-
const isSpaceText = (val)
|
1774
|
+
const isSpaceText = function(val) {
|
1775
1775
|
return /^[\uFEFF]+$/g.test(val);
|
1776
1776
|
};
|
1777
|
-
const cloneData = (data2)
|
1777
|
+
const cloneData = function(data2) {
|
1778
1778
|
if (obj$1.common.isObject(data2) || Array.isArray(data2)) {
|
1779
1779
|
return JSON.parse(JSON.stringify(data2));
|
1780
1780
|
}
|
1781
1781
|
return data2;
|
1782
1782
|
};
|
1783
|
-
const isContains = (parentNode, childNode)
|
1783
|
+
const isContains = function(parentNode, childNode) {
|
1784
1784
|
if (childNode.nodeType == 3) {
|
1785
1785
|
return obj$1.element.isContains(parentNode, childNode.parentNode);
|
1786
1786
|
}
|
1787
1787
|
return obj$1.element.isContains(parentNode, childNode);
|
1788
1788
|
};
|
1789
|
-
const blobToBase64 = (blob)
|
1789
|
+
const blobToBase64 = function(blob) {
|
1790
1790
|
return new Promise((resolve) => {
|
1791
1791
|
const fileReader = new FileReader();
|
1792
1792
|
fileReader.onload = (e) => {
|
@@ -1795,7 +1795,7 @@ const blobToBase64 = (blob) => {
|
|
1795
1795
|
fileReader.readAsDataURL(blob);
|
1796
1796
|
});
|
1797
1797
|
};
|
1798
|
-
const canUseClipboard = ()
|
1798
|
+
const canUseClipboard = function() {
|
1799
1799
|
if (!window.ClipboardItem) {
|
1800
1800
|
console.warn("window.ClipboardItem must be obtained in a secure environment, such as localhost, 127.0.0.1, or https, so the editor's copy, paste, and cut functions cannot be used");
|
1801
1801
|
return false;
|
@@ -1806,7 +1806,7 @@ const canUseClipboard = () => {
|
|
1806
1806
|
}
|
1807
1807
|
return true;
|
1808
1808
|
};
|
1809
|
-
const initEditorNode = (node)
|
1809
|
+
const initEditorNode = function(node) {
|
1810
1810
|
if (typeof node == "string" && node) {
|
1811
1811
|
node = document.body.querySelector(node);
|
1812
1812
|
}
|
@@ -1819,7 +1819,7 @@ const initEditorNode = (node) => {
|
|
1819
1819
|
obj$1.data.set(node, "data-alex-editor-init", true);
|
1820
1820
|
return node;
|
1821
1821
|
};
|
1822
|
-
const initEditorOptions = (options)
|
1822
|
+
const initEditorOptions = function(options) {
|
1823
1823
|
let opts = {
|
1824
1824
|
//是否禁用
|
1825
1825
|
disabled: false,
|
@@ -1891,7 +1891,7 @@ const initEditorOptions = (options) => {
|
|
1891
1891
|
}
|
1892
1892
|
return opts;
|
1893
1893
|
};
|
1894
|
-
const queryHasValue = (obj$1$1, name, value)
|
1894
|
+
const queryHasValue = function(obj$1$1, name, value) {
|
1895
1895
|
if (value == null || value == void 0) {
|
1896
1896
|
return obj$1$1.hasOwnProperty(name);
|
1897
1897
|
}
|
@@ -1921,6 +1921,60 @@ const queryHasValue = (obj$1$1, name, value) => {
|
|
1921
1921
|
}
|
1922
1922
|
return ownValue == value;
|
1923
1923
|
};
|
1924
|
+
const getNewFlatData = function(arr) {
|
1925
|
+
const length = arr.length;
|
1926
|
+
let newArr = [];
|
1927
|
+
for (let i = length - 1; i >= 0; i--) {
|
1928
|
+
if (arr[i].element.hasChildren()) {
|
1929
|
+
let allIn = arr[i].element.children.every((child) => {
|
1930
|
+
return newArr.some((item) => {
|
1931
|
+
return item.element.isEqual(child) && !item.offset;
|
1932
|
+
});
|
1933
|
+
});
|
1934
|
+
if (allIn) {
|
1935
|
+
newArr.unshift(arr[i]);
|
1936
|
+
}
|
1937
|
+
} else {
|
1938
|
+
newArr.unshift(arr[i]);
|
1939
|
+
}
|
1940
|
+
}
|
1941
|
+
for (let i = 0; i < newArr.length; i++) {
|
1942
|
+
const element2 = newArr[i].element;
|
1943
|
+
if (!element2.offset && element2.parent) {
|
1944
|
+
const selfIn = newArr.some((item) => {
|
1945
|
+
return item.element.isEqual(element2.parent);
|
1946
|
+
});
|
1947
|
+
const allIn = element2.parent.children.every((child) => {
|
1948
|
+
return newArr.some((item) => {
|
1949
|
+
return item.element.isEqual(child) && !item.offset;
|
1950
|
+
});
|
1951
|
+
});
|
1952
|
+
if (allIn && !selfIn) {
|
1953
|
+
newArr.splice(i, 0, {
|
1954
|
+
element: element2.parent,
|
1955
|
+
offset: false
|
1956
|
+
});
|
1957
|
+
i++;
|
1958
|
+
}
|
1959
|
+
}
|
1960
|
+
}
|
1961
|
+
return newArr;
|
1962
|
+
};
|
1963
|
+
const getNoFlatData = function(arr) {
|
1964
|
+
let noFlat = [];
|
1965
|
+
const length = arr.length;
|
1966
|
+
for (let i = 0; i < length; i++) {
|
1967
|
+
if (arr[i].element.isBlock()) {
|
1968
|
+
noFlat.push(arr[i]);
|
1969
|
+
} else {
|
1970
|
+
const isIn = arr.some((item) => item.element.isEqual(arr[i].element.parent));
|
1971
|
+
if (!isIn) {
|
1972
|
+
noFlat.push(arr[i]);
|
1973
|
+
}
|
1974
|
+
}
|
1975
|
+
}
|
1976
|
+
return noFlat;
|
1977
|
+
};
|
1924
1978
|
const _AlexElement = class _AlexElement2 {
|
1925
1979
|
constructor(type, parsedom, marks, styles, textContent) {
|
1926
1980
|
this.key = createUniqueKey();
|
@@ -3277,15 +3331,15 @@ class AlexEditor {
|
|
3277
3331
|
this.__isInputChinese = false;
|
3278
3332
|
this.__innerSelectionChange = false;
|
3279
3333
|
this.__chineseInputTimer = null;
|
3280
|
-
this.
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3334
|
+
this.__getElementsByRangeData = {
|
3335
|
+
//起点和终点范围内的元素,但是不包含起点和终点所在的元素
|
3336
|
+
default: [],
|
3337
|
+
//起点和终点范围内的元素,但是包含起点和终点所在的元素
|
3284
3338
|
includes: [],
|
3285
|
-
|
3339
|
+
//起点和终点范围内的元素扁平化处理结果,不包含起点和终点所在的元素
|
3286
3340
|
flat: [],
|
3287
|
-
|
3288
|
-
|
3341
|
+
//起点和终点范围内的元素扁平化处理结果,包含起点和终点所在的元素
|
3342
|
+
flatIncludes: []
|
3289
3343
|
};
|
3290
3344
|
this.disabled ? this.setDisabled() : this.setEnabled();
|
3291
3345
|
obj$1.event.on(document, `selectionchange.alex_editor_${this.__guid}`, handleSelectionChange.bind(this));
|
@@ -3436,7 +3490,7 @@ class AlexEditor {
|
|
3436
3490
|
const result = await this.copy(true);
|
3437
3491
|
if (result) {
|
3438
3492
|
if (!this.disabled) {
|
3439
|
-
this.delete();
|
3493
|
+
this.delete(true);
|
3440
3494
|
}
|
3441
3495
|
this.emit("cut", result.text, result.html);
|
3442
3496
|
}
|
@@ -3456,7 +3510,7 @@ class AlexEditor {
|
|
3456
3510
|
if (!this.allowCopy) {
|
3457
3511
|
return;
|
3458
3512
|
}
|
3459
|
-
let result = this.getElementsByRange(
|
3513
|
+
let result = this.getElementsByRange().includes;
|
3460
3514
|
if (result.length == 0) {
|
3461
3515
|
return;
|
3462
3516
|
}
|
@@ -3484,7 +3538,7 @@ class AlexEditor {
|
|
3484
3538
|
/**
|
3485
3539
|
* 根据光标进行删除操作
|
3486
3540
|
*/
|
3487
|
-
delete() {
|
3541
|
+
delete(useCache = false) {
|
3488
3542
|
if (this.disabled) {
|
3489
3543
|
return;
|
3490
3544
|
}
|
@@ -3632,7 +3686,7 @@ class AlexEditor {
|
|
3632
3686
|
}
|
3633
3687
|
}
|
3634
3688
|
} else {
|
3635
|
-
const result = this.getElementsByRange(
|
3689
|
+
const result = this.getElementsByRange(useCache).includes.filter((item) => {
|
3636
3690
|
return !AlexElement.VOID_NODES.includes(item.element.parsedom);
|
3637
3691
|
});
|
3638
3692
|
const anchorInblock = this.range.anchor.element.getInblock();
|
@@ -3750,7 +3804,7 @@ class AlexEditor {
|
|
3750
3804
|
/**
|
3751
3805
|
* 根据光标位置向编辑器内插入文本
|
3752
3806
|
*/
|
3753
|
-
insertText(data2) {
|
3807
|
+
insertText(data2, useCache = false) {
|
3754
3808
|
if (this.disabled) {
|
3755
3809
|
return;
|
3756
3810
|
}
|
@@ -3784,14 +3838,14 @@ class AlexEditor {
|
|
3784
3838
|
this.range.focus.moveToEnd(textEl);
|
3785
3839
|
}
|
3786
3840
|
} else {
|
3787
|
-
this.delete();
|
3841
|
+
this.delete(useCache);
|
3788
3842
|
this.insertText(data2);
|
3789
3843
|
}
|
3790
3844
|
}
|
3791
3845
|
/**
|
3792
3846
|
* 在光标处换行
|
3793
3847
|
*/
|
3794
|
-
insertParagraph() {
|
3848
|
+
insertParagraph(useCache = false) {
|
3795
3849
|
if (this.disabled) {
|
3796
3850
|
return;
|
3797
3851
|
}
|
@@ -3887,7 +3941,7 @@ class AlexEditor {
|
|
3887
3941
|
}
|
3888
3942
|
}
|
3889
3943
|
} else {
|
3890
|
-
this.delete();
|
3944
|
+
this.delete(useCache);
|
3891
3945
|
this.insertParagraph();
|
3892
3946
|
}
|
3893
3947
|
}
|
@@ -3895,7 +3949,7 @@ class AlexEditor {
|
|
3895
3949
|
* 根据光标插入元素
|
3896
3950
|
* cover表示所在根级块或者内部块元素只有换行符时是否覆盖此元素
|
3897
3951
|
*/
|
3898
|
-
insertElement(ele, cover = true) {
|
3952
|
+
insertElement(ele, cover = true, useCache = false) {
|
3899
3953
|
if (this.disabled) {
|
3900
3954
|
return;
|
3901
3955
|
}
|
@@ -4029,7 +4083,7 @@ class AlexEditor {
|
|
4029
4083
|
this.range.anchor.moveToEnd(ele);
|
4030
4084
|
this.range.focus.moveToEnd(ele);
|
4031
4085
|
} else {
|
4032
|
-
this.delete();
|
4086
|
+
this.delete(useCache);
|
4033
4087
|
this.insertElement(ele, cover);
|
4034
4088
|
}
|
4035
4089
|
}
|
@@ -4437,137 +4491,86 @@ class AlexEditor {
|
|
4437
4491
|
/**
|
4438
4492
|
* 获取选区之间的元素
|
4439
4493
|
*/
|
4440
|
-
getElementsByRange(
|
4494
|
+
getElementsByRange(useCache = false) {
|
4495
|
+
if (useCache) {
|
4496
|
+
return this.__getElementsByRangeData;
|
4497
|
+
}
|
4498
|
+
const result = {
|
4499
|
+
//起点和终点范围内的元素,但是不包含起点和终点所在的元素
|
4500
|
+
default: [],
|
4501
|
+
//起点和终点范围内的元素,但是包含起点和终点所在的元素
|
4502
|
+
includes: [],
|
4503
|
+
//起点和终点范围内的元素扁平化处理结果,不包含起点和终点所在的元素
|
4504
|
+
flat: [],
|
4505
|
+
//起点和终点范围内的元素扁平化处理结果,包含起点和终点所在的元素
|
4506
|
+
flatIncludes: []
|
4507
|
+
};
|
4441
4508
|
if (!this.range) {
|
4442
|
-
|
4509
|
+
this.__getElementsByRangeData = result;
|
4510
|
+
return result;
|
4443
4511
|
}
|
4444
4512
|
if (this.range.anchor.isEqual(this.range.focus)) {
|
4445
|
-
|
4446
|
-
|
4447
|
-
if (useCache) {
|
4448
|
-
if (includes && flat) {
|
4449
|
-
return this.__rangeElementsCache.all || [];
|
4450
|
-
}
|
4451
|
-
if (includes) {
|
4452
|
-
return this.__rangeElementsCache.includes || [];
|
4453
|
-
}
|
4454
|
-
if (flat) {
|
4455
|
-
return this.__rangeElementsCache.flat || [];
|
4456
|
-
}
|
4457
|
-
return this.__rangeElementsCache.none || [];
|
4513
|
+
this.__getElementsByRangeData = result;
|
4514
|
+
return result;
|
4458
4515
|
}
|
4459
|
-
const setRangeElementsCache = (result2 = []) => {
|
4460
|
-
if (includes && flat) {
|
4461
|
-
this.__rangeElementsCache.all = result2;
|
4462
|
-
} else if (includes) {
|
4463
|
-
this.__rangeElementsCache.includes = result2;
|
4464
|
-
} else if (flat) {
|
4465
|
-
this.__rangeElementsCache.flat = result2;
|
4466
|
-
} else {
|
4467
|
-
this.__rangeElementsCache.none = result2;
|
4468
|
-
}
|
4469
|
-
return result2;
|
4470
|
-
};
|
4471
4516
|
if (this.range.anchor.element.isEqual(this.range.focus.element)) {
|
4472
|
-
|
4473
|
-
|
4474
|
-
|
4475
|
-
{
|
4476
|
-
element: this.range.anchor.element,
|
4477
|
-
offset: isCover ? false : [this.range.anchor.offset, this.range.focus.offset]
|
4478
|
-
}
|
4479
|
-
]);
|
4480
|
-
}
|
4481
|
-
return setRangeElementsCache();
|
4482
|
-
}
|
4483
|
-
let result = [];
|
4484
|
-
if (includes) {
|
4485
|
-
if (this.range.anchor.offset == 0) {
|
4486
|
-
result.push({
|
4517
|
+
const isCover = this.range.anchor.offset == 0 && this.range.focus.offset == (this.range.anchor.element.isText() ? this.range.anchor.element.textContent.length : 1);
|
4518
|
+
result.includes = [
|
4519
|
+
{
|
4487
4520
|
element: this.range.anchor.element,
|
4488
|
-
offset: false
|
4489
|
-
}
|
4490
|
-
|
4491
|
-
|
4521
|
+
offset: isCover ? false : [this.range.anchor.offset, this.range.focus.offset]
|
4522
|
+
}
|
4523
|
+
];
|
4524
|
+
result.flatIncludes = [
|
4525
|
+
{
|
4492
4526
|
element: this.range.anchor.element,
|
4493
|
-
offset: [this.range.anchor.offset, this.range.
|
4494
|
-
}
|
4495
|
-
|
4527
|
+
offset: isCover ? false : [this.range.anchor.offset, this.range.focus.offset]
|
4528
|
+
}
|
4529
|
+
];
|
4530
|
+
this.__getElementsByRangeData = result;
|
4531
|
+
return result;
|
4532
|
+
}
|
4533
|
+
if (this.range.anchor.offset == 0) {
|
4534
|
+
result.flatIncludes.push({
|
4535
|
+
element: this.range.anchor.element,
|
4536
|
+
offset: false
|
4537
|
+
});
|
4538
|
+
} else if (this.range.anchor.offset < (this.range.anchor.element.isText() ? this.range.anchor.element.textContent.length : 1)) {
|
4539
|
+
result.flatIncludes.push({
|
4540
|
+
element: this.range.anchor.element,
|
4541
|
+
offset: [this.range.anchor.offset, this.range.anchor.element.isText() ? this.range.anchor.element.textContent.length : 1]
|
4542
|
+
});
|
4496
4543
|
}
|
4497
4544
|
const elements = AlexElement.flatElements(this.stack);
|
4498
4545
|
const anchorIndex = elements.findIndex((el) => el.isEqual(this.range.anchor.element));
|
4499
4546
|
const focusIndex = elements.findIndex((el) => el.isEqual(this.range.focus.element));
|
4500
4547
|
for (let i = anchorIndex + 1; i < focusIndex; i++) {
|
4501
|
-
result.push({
|
4548
|
+
result.flatIncludes.push({
|
4549
|
+
element: elements[i],
|
4550
|
+
offset: false
|
4551
|
+
});
|
4552
|
+
result.flat.push({
|
4502
4553
|
element: elements[i],
|
4503
4554
|
offset: false
|
4504
4555
|
});
|
4505
4556
|
}
|
4506
|
-
if (
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
4511
|
-
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4515
|
-
|
4516
|
-
});
|
4517
|
-
}
|
4518
|
-
}
|
4519
|
-
const resLength = result.length;
|
4520
|
-
let newResult = [];
|
4521
|
-
for (let i = resLength - 1; i >= 0; i--) {
|
4522
|
-
if (result[i].element.hasChildren()) {
|
4523
|
-
let allIn = result[i].element.children.every((child) => {
|
4524
|
-
return newResult.some((item) => {
|
4525
|
-
return item.element.isEqual(child) && !item.offset;
|
4526
|
-
});
|
4527
|
-
});
|
4528
|
-
if (allIn) {
|
4529
|
-
newResult.unshift(result[i]);
|
4530
|
-
}
|
4531
|
-
} else {
|
4532
|
-
newResult.unshift(result[i]);
|
4533
|
-
}
|
4534
|
-
}
|
4535
|
-
for (let i = 0; i < newResult.length; i++) {
|
4536
|
-
const element2 = newResult[i].element;
|
4537
|
-
if (!element2.offset && element2.parent) {
|
4538
|
-
const selfIn = newResult.some((item) => {
|
4539
|
-
return item.element.isEqual(element2.parent);
|
4540
|
-
});
|
4541
|
-
const allIn = element2.parent.children.every((child) => {
|
4542
|
-
return newResult.some((item) => {
|
4543
|
-
return item.element.isEqual(child) && !item.offset;
|
4544
|
-
});
|
4545
|
-
});
|
4546
|
-
if (allIn && !selfIn) {
|
4547
|
-
newResult.splice(i, 0, {
|
4548
|
-
element: element2.parent,
|
4549
|
-
offset: false
|
4550
|
-
});
|
4551
|
-
i++;
|
4552
|
-
}
|
4553
|
-
}
|
4554
|
-
}
|
4555
|
-
if (flat) {
|
4556
|
-
return setRangeElementsCache(newResult);
|
4557
|
-
}
|
4558
|
-
let notFlatResult = [];
|
4559
|
-
const length = newResult.length;
|
4560
|
-
for (let i = 0; i < length; i++) {
|
4561
|
-
if (newResult[i].element.isBlock()) {
|
4562
|
-
notFlatResult.push(newResult[i]);
|
4563
|
-
} else {
|
4564
|
-
const isIn = newResult.some((item) => item.element.isEqual(newResult[i].element.parent));
|
4565
|
-
if (!isIn) {
|
4566
|
-
notFlatResult.push(newResult[i]);
|
4567
|
-
}
|
4568
|
-
}
|
4557
|
+
if (this.range.focus.offset == (this.range.focus.element.isText() ? this.range.focus.element.textContent.length : 1)) {
|
4558
|
+
result.flatIncludes.push({
|
4559
|
+
element: this.range.focus.element,
|
4560
|
+
offset: false
|
4561
|
+
});
|
4562
|
+
} else if (this.range.focus.offset > 0) {
|
4563
|
+
result.flatIncludes.push({
|
4564
|
+
element: this.range.focus.element,
|
4565
|
+
offset: [0, this.range.focus.offset]
|
4566
|
+
});
|
4569
4567
|
}
|
4570
|
-
|
4568
|
+
result.flat = getNewFlatData.apply(this, [result.flat]);
|
4569
|
+
result.flatIncludes = getNewFlatData.apply(this, [result.flatIncludes]);
|
4570
|
+
result.default = getNoFlatData.apply(this, [result.flat]);
|
4571
|
+
result.includes = getNoFlatData.apply(this, [result.flatIncludes]);
|
4572
|
+
this.__getElementsByRangeData = result;
|
4573
|
+
return result;
|
4571
4574
|
}
|
4572
4575
|
/**
|
4573
4576
|
* 分割选区选中的元素,会更新光标位置
|
@@ -4576,7 +4579,8 @@ class AlexEditor {
|
|
4576
4579
|
if (!this.range) {
|
4577
4580
|
return [];
|
4578
4581
|
}
|
4579
|
-
const
|
4582
|
+
const key = includes && flat ? "flatIncludes" : includes ? "includes" : flat ? "flat" : "default";
|
4583
|
+
const result = this.getElementsByRange(useCache)[key];
|
4580
4584
|
let elements = [];
|
4581
4585
|
result.forEach((item, index) => {
|
4582
4586
|
if (item.offset) {
|
@@ -4871,7 +4875,7 @@ class AlexEditor {
|
|
4871
4875
|
}
|
4872
4876
|
return false;
|
4873
4877
|
}
|
4874
|
-
let result = this.getElementsByRange(
|
4878
|
+
let result = this.getElementsByRange(useCache).flatIncludes.filter((item) => {
|
4875
4879
|
return item.element.isText();
|
4876
4880
|
});
|
4877
4881
|
if (result.length == 0) {
|
@@ -4993,7 +4997,7 @@ class AlexEditor {
|
|
4993
4997
|
}
|
4994
4998
|
return false;
|
4995
4999
|
}
|
4996
|
-
let result = this.getElementsByRange(
|
5000
|
+
let result = this.getElementsByRange(useCache).flatIncludes.filter((item) => {
|
4997
5001
|
return item.element.isText();
|
4998
5002
|
});
|
4999
5003
|
if (result.length == 0) {
|
@@ -15366,7 +15370,7 @@ const editorProps = {
|
|
15366
15370
|
},
|
15367
15371
|
//编辑内容高度
|
15368
15372
|
height: {
|
15369
|
-
type: String,
|
15373
|
+
type: [String, Boolean],
|
15370
15374
|
default: "600px"
|
15371
15375
|
},
|
15372
15376
|
//是否自适应高度
|
@@ -16156,7 +16160,8 @@ const getMenuConfig = function(editTrans, editLocale) {
|
|
16156
16160
|
video: 24,
|
16157
16161
|
table: 25,
|
16158
16162
|
codeBlock: 26,
|
16159
|
-
sourceView: 27
|
16163
|
+
sourceView: 27,
|
16164
|
+
fullScreen: 28
|
16160
16165
|
},
|
16161
16166
|
//撤销按钮配置
|
16162
16167
|
undo: {
|
@@ -16486,6 +16491,15 @@ const getMenuConfig = function(editTrans, editLocale) {
|
|
16486
16491
|
//右侧边框是否显示
|
16487
16492
|
rightBorder: false
|
16488
16493
|
},
|
16494
|
+
//全屏
|
16495
|
+
fullScreen: {
|
16496
|
+
//是否显示此工具
|
16497
|
+
show: true,
|
16498
|
+
//左侧边框是否显示
|
16499
|
+
leftBorder: false,
|
16500
|
+
//右侧边框是否显示
|
16501
|
+
rightBorder: false
|
16502
|
+
},
|
16489
16503
|
//拓展菜单,每个key表示拓展菜单的唯一名称,value是对象,包含type/title/rightBorder/leftBorder/disabled/active/width/maxHeight/options/value/hideScroll/onLayerShow/onLayerShown/onLayerHidden/onOperate/default/layer/option属性
|
16490
16504
|
extends: {}
|
16491
16505
|
};
|
@@ -17583,8 +17597,8 @@ const _hoisted_4$6 = {
|
|
17583
17597
|
key: 1,
|
17584
17598
|
class: "editify-button-options"
|
17585
17599
|
};
|
17586
|
-
const _hoisted_5$
|
17587
|
-
const _hoisted_6$
|
17600
|
+
const _hoisted_5$5 = ["onClick"];
|
17601
|
+
const _hoisted_6$5 = {
|
17588
17602
|
key: 1,
|
17589
17603
|
class: "editify-button-option-flex"
|
17590
17604
|
};
|
@@ -17655,14 +17669,14 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
17655
17669
|
_ctx.$slots.option ? renderSlot(_ctx.$slots, "option", {
|
17656
17670
|
key: 0,
|
17657
17671
|
item
|
17658
|
-
}, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_6$
|
17672
|
+
}, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_6$5, [
|
17659
17673
|
item.icon ? (openBlock(), createBlock(_component_Icon, {
|
17660
17674
|
key: 0,
|
17661
17675
|
value: item.icon
|
17662
17676
|
}, null, 8, ["value"])) : createCommentVNode("", true),
|
17663
17677
|
createElementVNode("span", null, toDisplayString(item.label), 1)
|
17664
17678
|
]))
|
17665
|
-
], 14, _hoisted_5$
|
17679
|
+
], 14, _hoisted_5$5);
|
17666
17680
|
}), 256))
|
17667
17681
|
]))
|
17668
17682
|
], 4)
|
@@ -17886,7 +17900,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
17886
17900
|
]);
|
17887
17901
|
}
|
17888
17902
|
const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-dc6d3d68"]]);
|
17889
|
-
const
|
17903
|
+
const Toolbar_vue_vue_type_style_index_0_scoped_36dbd332_lang = "";
|
17890
17904
|
const _sfc_main$6 = {
|
17891
17905
|
name: "Toolbar",
|
17892
17906
|
emits: ["update:modelValue"],
|
@@ -18161,80 +18175,80 @@ const _sfc_main$6 = {
|
|
18161
18175
|
methods: {
|
18162
18176
|
//清除格式
|
18163
18177
|
clearFormat() {
|
18164
|
-
this.$parent.formatText();
|
18178
|
+
this.$parent.formatText(true, true);
|
18165
18179
|
},
|
18166
18180
|
//设置背景色
|
18167
18181
|
setBackColor(value) {
|
18168
|
-
this.$parent.setTextStyle("background-color", value);
|
18182
|
+
this.$parent.setTextStyle("background-color", value, true, true);
|
18169
18183
|
this.$refs.backColor.hideLayer();
|
18170
18184
|
},
|
18171
18185
|
//设置前景色
|
18172
18186
|
setForeColor(value) {
|
18173
|
-
this.$parent.setTextStyle("color", value);
|
18187
|
+
this.$parent.setTextStyle("color", value, true, true);
|
18174
18188
|
this.$refs.foreColor.hideLayer();
|
18175
18189
|
},
|
18176
18190
|
//设置行高
|
18177
18191
|
setLineHeight(name, value) {
|
18178
|
-
this.$parent.setLineHeight(value);
|
18192
|
+
this.$parent.setLineHeight(value, true, true);
|
18179
18193
|
},
|
18180
18194
|
//设置字体
|
18181
18195
|
setFontFamily(name, value) {
|
18182
|
-
this.$parent.setTextStyle("font-family", value);
|
18196
|
+
this.$parent.setTextStyle("font-family", value, true, true);
|
18183
18197
|
},
|
18184
18198
|
//设置字号
|
18185
18199
|
setFontSize(name, value) {
|
18186
|
-
this.$parent.setTextStyle("font-size", value);
|
18200
|
+
this.$parent.setTextStyle("font-size", value, true, true);
|
18187
18201
|
},
|
18188
18202
|
//设置上标
|
18189
18203
|
setSuperscript() {
|
18190
|
-
this.$parent.setTextStyle("vertical-align", "super");
|
18204
|
+
this.$parent.setTextStyle("vertical-align", "super", true, true);
|
18191
18205
|
},
|
18192
18206
|
//设置下标
|
18193
18207
|
setSubscript() {
|
18194
|
-
this.$parent.setTextStyle("vertical-align", "sub");
|
18208
|
+
this.$parent.setTextStyle("vertical-align", "sub", true, true);
|
18195
18209
|
},
|
18196
18210
|
//设置行内代码样式
|
18197
18211
|
setCodeStyle() {
|
18198
|
-
this.$parent.setTextMark("data-editify-code", true);
|
18212
|
+
this.$parent.setTextMark("data-editify-code", true, true, true);
|
18199
18213
|
},
|
18200
18214
|
//设置下划线
|
18201
18215
|
setUnderline() {
|
18202
|
-
this.$parent.setTextStyle("text-decoration", "underline");
|
18216
|
+
this.$parent.setTextStyle("text-decoration", "underline", true, true);
|
18203
18217
|
},
|
18204
18218
|
//设置删除线
|
18205
18219
|
setStrikethrough() {
|
18206
|
-
this.$parent.setTextStyle("text-decoration", "line-through");
|
18220
|
+
this.$parent.setTextStyle("text-decoration", "line-through", true, true);
|
18207
18221
|
},
|
18208
18222
|
//设置列表
|
18209
18223
|
setList(name) {
|
18210
|
-
this.$parent.setList(name == "orderList");
|
18224
|
+
this.$parent.setList(name == "orderList", true, true);
|
18211
18225
|
},
|
18212
18226
|
//设置任务列表
|
18213
18227
|
setTask() {
|
18214
|
-
this.$parent.setTask();
|
18228
|
+
this.$parent.setTask(true, true);
|
18215
18229
|
},
|
18216
18230
|
//斜体
|
18217
18231
|
setItalic() {
|
18218
|
-
this.$parent.setTextStyle("font-style", "italic");
|
18232
|
+
this.$parent.setTextStyle("font-style", "italic", true, true);
|
18219
18233
|
},
|
18220
18234
|
//加粗
|
18221
18235
|
setBold() {
|
18222
|
-
this.$parent.setTextStyle("font-weight", "bold");
|
18236
|
+
this.$parent.setTextStyle("font-weight", "bold", true, true);
|
18223
18237
|
},
|
18224
18238
|
//设置标题
|
18225
18239
|
setHeading(name, value) {
|
18226
|
-
this.$parent.setHeading(value);
|
18240
|
+
this.$parent.setHeading(value, true, true);
|
18227
18241
|
},
|
18228
18242
|
//设置对齐方式
|
18229
18243
|
setAlign(name, value) {
|
18230
|
-
this.$parent.setAlign(value);
|
18244
|
+
this.$parent.setAlign(value, true, true);
|
18231
18245
|
},
|
18232
18246
|
//设置视频
|
18233
18247
|
setVideo(prop) {
|
18234
18248
|
if (this.$parent.disabled) {
|
18235
18249
|
return;
|
18236
18250
|
}
|
18237
|
-
const video = this.$parent.getCurrentParsedomElement("video");
|
18251
|
+
const video = this.$parent.getCurrentParsedomElement("video", true);
|
18238
18252
|
if (video) {
|
18239
18253
|
if (this.videoConfig[prop]) {
|
18240
18254
|
delete video.marks[prop];
|
@@ -18251,7 +18265,7 @@ const _sfc_main$6 = {
|
|
18251
18265
|
if (this.$parent.disabled) {
|
18252
18266
|
return;
|
18253
18267
|
}
|
18254
|
-
const element2 = this.$parent.getCurrentParsedomElement("img") || this.$parent.getCurrentParsedomElement("video", true);
|
18268
|
+
const element2 = this.$parent.getCurrentParsedomElement("img", true) || this.$parent.getCurrentParsedomElement("video", true);
|
18255
18269
|
if (element2) {
|
18256
18270
|
const styles = {
|
18257
18271
|
width: value
|
@@ -18277,7 +18291,7 @@ const _sfc_main$6 = {
|
|
18277
18291
|
if (!this.linkConfig.url) {
|
18278
18292
|
return;
|
18279
18293
|
}
|
18280
|
-
const link = this.$parent.getCurrentParsedomElement("a");
|
18294
|
+
const link = this.$parent.getCurrentParsedomElement("a", true);
|
18281
18295
|
if (link) {
|
18282
18296
|
link.marks.href = this.linkConfig.url;
|
18283
18297
|
if (this.linkConfig.newOpen) {
|
@@ -18310,7 +18324,7 @@ const _sfc_main$6 = {
|
|
18310
18324
|
if (this.$parent.disabled) {
|
18311
18325
|
return;
|
18312
18326
|
}
|
18313
|
-
const pre = this.$parent.getCurrentParsedomElement("pre");
|
18327
|
+
const pre = this.$parent.getCurrentParsedomElement("pre", true);
|
18314
18328
|
if (pre) {
|
18315
18329
|
Object.assign(pre.marks, {
|
18316
18330
|
"data-editify-hljs": value
|
@@ -18329,7 +18343,7 @@ const _sfc_main$6 = {
|
|
18329
18343
|
this.$parent.editor.range.anchor.element = this.$parent.editor.range.focus.element;
|
18330
18344
|
this.$parent.editor.range.anchor.offset = this.$parent.editor.range.focus.offset;
|
18331
18345
|
}
|
18332
|
-
const pre = this.$parent.getCurrentParsedomElement("pre");
|
18346
|
+
const pre = this.$parent.getCurrentParsedomElement("pre", true);
|
18333
18347
|
if (pre) {
|
18334
18348
|
const paragraph = new AlexElement("block", AlexElement.BLOCK_NODE, null, null, null);
|
18335
18349
|
const breakEl = new AlexElement("closed", "br", null, null, null);
|
@@ -18355,7 +18369,7 @@ const _sfc_main$6 = {
|
|
18355
18369
|
this.$parent.editor.range.anchor.element = this.$parent.editor.range.focus.element;
|
18356
18370
|
this.$parent.editor.range.anchor.offset = this.$parent.editor.range.focus.offset;
|
18357
18371
|
}
|
18358
|
-
const table = this.$parent.getCurrentParsedomElement("table");
|
18372
|
+
const table = this.$parent.getCurrentParsedomElement("table", true);
|
18359
18373
|
const column = this.$parent.getCurrentParsedomElement("td", true);
|
18360
18374
|
const tbody = this.$parent.getCurrentParsedomElement("tbody", true);
|
18361
18375
|
if (column && table && tbody) {
|
@@ -18396,7 +18410,7 @@ const _sfc_main$6 = {
|
|
18396
18410
|
this.$parent.editor.rangeRender();
|
18397
18411
|
}
|
18398
18412
|
},
|
18399
|
-
|
18413
|
+
//表格前后插入行
|
18400
18414
|
insertTableRow(type = "up") {
|
18401
18415
|
if (this.$parent.disabled) {
|
18402
18416
|
return;
|
@@ -18405,7 +18419,7 @@ const _sfc_main$6 = {
|
|
18405
18419
|
this.$parent.editor.range.anchor.element = this.$parent.editor.range.focus.element;
|
18406
18420
|
this.$parent.editor.range.anchor.offset = this.$parent.editor.range.focus.offset;
|
18407
18421
|
}
|
18408
|
-
const table = this.$parent.getCurrentParsedomElement("table");
|
18422
|
+
const table = this.$parent.getCurrentParsedomElement("table", true);
|
18409
18423
|
const row = this.$parent.getCurrentParsedomElement("tr", true);
|
18410
18424
|
if (table && row) {
|
18411
18425
|
const newRow = row.clone();
|
@@ -18434,7 +18448,7 @@ const _sfc_main$6 = {
|
|
18434
18448
|
if (this.$parent.disabled) {
|
18435
18449
|
return;
|
18436
18450
|
}
|
18437
|
-
const table = this.$parent.getCurrentParsedomElement("table");
|
18451
|
+
const table = this.$parent.getCurrentParsedomElement("table", true);
|
18438
18452
|
if (table) {
|
18439
18453
|
const paragraph = new AlexElement("block", AlexElement.BLOCK_NODE, null, null, null);
|
18440
18454
|
const breakEl = new AlexElement("closed", "br", null, null, null);
|
@@ -18460,12 +18474,12 @@ const _sfc_main$6 = {
|
|
18460
18474
|
this.$parent.editor.range.anchor.element = this.$parent.editor.range.focus.element;
|
18461
18475
|
this.$parent.editor.range.anchor.offset = this.$parent.editor.range.focus.offset;
|
18462
18476
|
}
|
18463
|
-
const table = this.$parent.getCurrentParsedomElement("table");
|
18477
|
+
const table = this.$parent.getCurrentParsedomElement("table", true);
|
18464
18478
|
const row = this.$parent.getCurrentParsedomElement("tr", true);
|
18465
18479
|
if (table && row) {
|
18466
18480
|
const parent = row.parent;
|
18467
18481
|
if (parent.children.length == 1) {
|
18468
|
-
this.$parent.deleteByParsedom("table");
|
18482
|
+
this.$parent.deleteByParsedom("table", true, true);
|
18469
18483
|
return;
|
18470
18484
|
}
|
18471
18485
|
const previousRow = this.$parent.editor.getPreviousElement(row);
|
@@ -18495,14 +18509,14 @@ const _sfc_main$6 = {
|
|
18495
18509
|
this.$parent.editor.range.anchor.element = this.$parent.editor.range.focus.element;
|
18496
18510
|
this.$parent.editor.range.anchor.offset = this.$parent.editor.range.focus.offset;
|
18497
18511
|
}
|
18498
|
-
const column = this.$parent.getCurrentParsedomElement("td");
|
18512
|
+
const column = this.$parent.getCurrentParsedomElement("td", true);
|
18499
18513
|
const tbody = this.$parent.getCurrentParsedomElement("tbody", true);
|
18500
18514
|
const table = this.$parent.getCurrentParsedomElement("table", true);
|
18501
18515
|
if (column && table && tbody) {
|
18502
18516
|
const rows = tbody.children;
|
18503
18517
|
const parent = column.parent;
|
18504
18518
|
if (parent.children.length == 1) {
|
18505
|
-
this.$parent.deleteByParsedom("table", true);
|
18519
|
+
this.$parent.deleteByParsedom("table", true, true);
|
18506
18520
|
return;
|
18507
18521
|
}
|
18508
18522
|
const previousColumn = this.$parent.editor.getPreviousElement(column);
|
@@ -18531,7 +18545,7 @@ const _sfc_main$6 = {
|
|
18531
18545
|
},
|
18532
18546
|
//浮层显示时
|
18533
18547
|
layerShow() {
|
18534
|
-
const result = this.$parent.editor.getElementsByRange(true
|
18548
|
+
const result = this.$parent.editor.getElementsByRange(true).includes;
|
18535
18549
|
if (this.type == "codeBlock") {
|
18536
18550
|
const pre = this.$parent.getCurrentParsedomElement("pre", true);
|
18537
18551
|
if (pre) {
|
@@ -18656,8 +18670,8 @@ const _hoisted_1$6 = {
|
|
18656
18670
|
const _hoisted_2$5 = { class: "editify-toolbar-link-label" };
|
18657
18671
|
const _hoisted_3$5 = ["placeholder"];
|
18658
18672
|
const _hoisted_4$5 = { class: "editify-toolbar-link-footer" };
|
18659
|
-
const _hoisted_5$
|
18660
|
-
const _hoisted_6$
|
18673
|
+
const _hoisted_5$4 = { class: "editify-toolbar-link-operations" };
|
18674
|
+
const _hoisted_6$4 = ["href"];
|
18661
18675
|
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
18662
18676
|
const _component_Checkbox = resolveComponent("Checkbox");
|
18663
18677
|
const _component_Button = resolveComponent("Button");
|
@@ -18706,7 +18720,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
18706
18720
|
color: _ctx.$parent.color,
|
18707
18721
|
size: 10
|
18708
18722
|
}, null, 8, ["onChange", "modelValue", "label", "color"]),
|
18709
|
-
createElementVNode("div", _hoisted_5$
|
18723
|
+
createElementVNode("div", _hoisted_5$4, [
|
18710
18724
|
createElementVNode("span", {
|
18711
18725
|
onClick: _cache[5] || (_cache[5] = (...args) => _ctx.$parent.removeLink && _ctx.$parent.removeLink(...args))
|
18712
18726
|
}, toDisplayString($options.$editTrans("removeLink")), 1),
|
@@ -18714,7 +18728,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
18714
18728
|
href: $data.linkConfig.url,
|
18715
18729
|
target: "_blank",
|
18716
18730
|
style: normalizeStyle({ color: _ctx.$parent.color })
|
18717
|
-
}, toDisplayString($options.$editTrans("viewLink")), 13, _hoisted_6$
|
18731
|
+
}, toDisplayString($options.$editTrans("viewLink")), 13, _hoisted_6$4)
|
18718
18732
|
])
|
18719
18733
|
])
|
18720
18734
|
])) : $props.type == "image" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
@@ -19381,7 +19395,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
19381
19395
|
_: 1
|
19382
19396
|
}, 8, ["modelValue", "node", "onShow", "useRange"]);
|
19383
19397
|
}
|
19384
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-
|
19398
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-36dbd332"]]);
|
19385
19399
|
const InsertLink_vue_vue_type_style_index_0_scoped_e6c3c2ee_lang = "";
|
19386
19400
|
const _sfc_main$5 = {
|
19387
19401
|
name: "InsertLink",
|
@@ -19441,8 +19455,8 @@ const _hoisted_1$5 = { class: "editify-link" };
|
|
19441
19455
|
const _hoisted_2$4 = { class: "editify-link-label" };
|
19442
19456
|
const _hoisted_3$4 = ["placeholder"];
|
19443
19457
|
const _hoisted_4$4 = ["placeholder"];
|
19444
|
-
const _hoisted_5$
|
19445
|
-
const _hoisted_6$
|
19458
|
+
const _hoisted_5$3 = { class: "editify-link-footer" };
|
19459
|
+
const _hoisted_6$3 = { class: "editify-link-operations" };
|
19446
19460
|
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
19447
19461
|
const _component_Checkbox = resolveComponent("Checkbox");
|
19448
19462
|
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
@@ -19475,7 +19489,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
19475
19489
|
{ trim: true }
|
19476
19490
|
]
|
19477
19491
|
]),
|
19478
|
-
createElementVNode("div", _hoisted_5$
|
19492
|
+
createElementVNode("div", _hoisted_5$3, [
|
19479
19493
|
createVNode(_component_Checkbox, {
|
19480
19494
|
modelValue: $data.newOpen,
|
19481
19495
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.newOpen = $event),
|
@@ -19483,7 +19497,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
19483
19497
|
color: $props.color,
|
19484
19498
|
size: 10
|
19485
19499
|
}, null, 8, ["modelValue", "label", "color"]),
|
19486
|
-
createElementVNode("div", _hoisted_6$
|
19500
|
+
createElementVNode("div", _hoisted_6$3, [
|
19487
19501
|
createElementVNode("span", {
|
19488
19502
|
style: normalizeStyle({ color: $props.color }),
|
19489
19503
|
onClick: _cache[7] || (_cache[7] = (...args) => $options.insertLink && $options.insertLink(...args))
|
@@ -19646,11 +19660,11 @@ const _hoisted_3$3 = {
|
|
19646
19660
|
class: "editify-image-remote"
|
19647
19661
|
};
|
19648
19662
|
const _hoisted_4$3 = ["placeholder"];
|
19649
|
-
const _hoisted_5$
|
19663
|
+
const _hoisted_5$2 = {
|
19650
19664
|
key: 1,
|
19651
19665
|
class: "editify-image-upload"
|
19652
19666
|
};
|
19653
|
-
const _hoisted_6$
|
19667
|
+
const _hoisted_6$2 = ["multiple"];
|
19654
19668
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
19655
19669
|
const _component_Icon = resolveComponent("Icon");
|
19656
19670
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
@@ -19692,14 +19706,14 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
19692
19706
|
onClick: _cache[5] || (_cache[5] = (...args) => $options.insertRemoteImage && $options.insertRemoteImage(...args))
|
19693
19707
|
}, toDisplayString($options.$editTrans("insert")), 1)
|
19694
19708
|
], 4)
|
19695
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_5$
|
19709
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_5$2, [
|
19696
19710
|
createVNode(_component_Icon, { value: "upload" }),
|
19697
19711
|
createElementVNode("input", {
|
19698
19712
|
multiple: $props.multiple,
|
19699
19713
|
accept: "image/*",
|
19700
19714
|
onChange: _cache[6] || (_cache[6] = (...args) => $options.selectFile && $options.selectFile(...args)),
|
19701
19715
|
type: "file"
|
19702
|
-
}, null, 40, _hoisted_6$
|
19716
|
+
}, null, 40, _hoisted_6$2)
|
19703
19717
|
]))
|
19704
19718
|
]);
|
19705
19719
|
}
|
@@ -19857,11 +19871,11 @@ const _hoisted_3$2 = {
|
|
19857
19871
|
class: "editify-video-remote"
|
19858
19872
|
};
|
19859
19873
|
const _hoisted_4$2 = ["placeholder"];
|
19860
|
-
const _hoisted_5$
|
19874
|
+
const _hoisted_5$1 = {
|
19861
19875
|
key: 1,
|
19862
19876
|
class: "editify-video-upload"
|
19863
19877
|
};
|
19864
|
-
const _hoisted_6$
|
19878
|
+
const _hoisted_6$1 = ["multiple"];
|
19865
19879
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
19866
19880
|
const _component_Icon = resolveComponent("Icon");
|
19867
19881
|
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
@@ -19903,14 +19917,14 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
19903
19917
|
onClick: _cache[5] || (_cache[5] = (...args) => $options.insertRemoteVideo && $options.insertRemoteVideo(...args))
|
19904
19918
|
}, toDisplayString($options.$editTrans("insert")), 1)
|
19905
19919
|
], 4)
|
19906
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_5$
|
19920
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
19907
19921
|
createVNode(_component_Icon, { value: "upload" }),
|
19908
19922
|
createElementVNode("input", {
|
19909
19923
|
multiple: $props.multiple,
|
19910
19924
|
accept: "video/*",
|
19911
19925
|
onChange: _cache[6] || (_cache[6] = (...args) => $options.selectFile && $options.selectFile(...args)),
|
19912
19926
|
type: "file"
|
19913
|
-
}, null, 40, _hoisted_6$
|
19927
|
+
}, null, 40, _hoisted_6$1)
|
19914
19928
|
]))
|
19915
19929
|
]);
|
19916
19930
|
}
|
@@ -20005,8 +20019,8 @@ const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createEl
|
|
20005
20019
|
const _hoisted_4$1 = [
|
20006
20020
|
_hoisted_3$1
|
20007
20021
|
];
|
20008
|
-
const _hoisted_5
|
20009
|
-
const _hoisted_6
|
20022
|
+
const _hoisted_5 = { class: "editify-table-footer" };
|
20023
|
+
const _hoisted_6 = { key: 0 };
|
20010
20024
|
const _hoisted_7 = { key: 1 };
|
20011
20025
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
20012
20026
|
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
@@ -20023,13 +20037,13 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
20023
20037
|
]);
|
20024
20038
|
}), 256))
|
20025
20039
|
]),
|
20026
|
-
createElementVNode("div", _hoisted_5
|
20027
|
-
$options.specification ? (openBlock(), createElementBlock("span", _hoisted_6
|
20040
|
+
createElementVNode("div", _hoisted_5, [
|
20041
|
+
$options.specification ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString($options.specification.x) + " x " + toDisplayString($options.specification.y), 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString($options.$editTrans("insertTable")), 1))
|
20028
20042
|
])
|
20029
20043
|
]);
|
20030
20044
|
}
|
20031
20045
|
const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-227ede65"]]);
|
20032
|
-
const
|
20046
|
+
const Menu_vue_vue_type_style_index_0_scoped_c952b6ed_lang = "";
|
20033
20047
|
const _sfc_main$1 = {
|
20034
20048
|
name: "Menu",
|
20035
20049
|
props: {
|
@@ -20345,6 +20359,14 @@ const _sfc_main$1 = {
|
|
20345
20359
|
rightBorder: this.config.sourceView.rightBorder,
|
20346
20360
|
active: false,
|
20347
20361
|
disabled: false
|
20362
|
+
},
|
20363
|
+
//全屏按钮配置
|
20364
|
+
fullScreenConfig: {
|
20365
|
+
show: this.config.fullScreen.show,
|
20366
|
+
leftBorder: this.config.fullScreen.leftBorder,
|
20367
|
+
rightBorder: this.config.fullScreen.rightBorder,
|
20368
|
+
active: false,
|
20369
|
+
disabled: false
|
20348
20370
|
}
|
20349
20371
|
};
|
20350
20372
|
},
|
@@ -20361,11 +20383,27 @@ const _sfc_main$1 = {
|
|
20361
20383
|
//菜单是否禁用
|
20362
20384
|
menuDisabled() {
|
20363
20385
|
return (name) => {
|
20364
|
-
if (name == "sourceView") {
|
20386
|
+
if (name == "sourceView" || name == "fullScreen") {
|
20365
20387
|
return false;
|
20366
20388
|
}
|
20367
20389
|
return this.$parent.isSourceView;
|
20368
20390
|
};
|
20391
|
+
},
|
20392
|
+
//菜单模式
|
20393
|
+
menuMode() {
|
20394
|
+
if (this.$parent.isFullScreen || this.$parent.height === true) {
|
20395
|
+
if (this.config.mode == "fixed") {
|
20396
|
+
return "default";
|
20397
|
+
}
|
20398
|
+
}
|
20399
|
+
return this.config.mode;
|
20400
|
+
},
|
20401
|
+
//菜单栏是否显示边框
|
20402
|
+
menuShowBorder() {
|
20403
|
+
if (this.menuMode == "fixed") {
|
20404
|
+
return false;
|
20405
|
+
}
|
20406
|
+
return this.$parent.showBorder;
|
20369
20407
|
}
|
20370
20408
|
},
|
20371
20409
|
components: {
|
@@ -20779,7 +20817,7 @@ const _sfc_main$1 = {
|
|
20779
20817
|
hideScroll: true,
|
20780
20818
|
onLayerShow: () => {
|
20781
20819
|
let text2 = "";
|
20782
|
-
const result = this.$parent.$parent.editor.getElementsByRange(
|
20820
|
+
const result = this.$parent.$parent.editor.getElementsByRange().flatIncludes;
|
20783
20821
|
result.forEach((item) => {
|
20784
20822
|
if (item.element.isText()) {
|
20785
20823
|
if (item.offset) {
|
@@ -20946,6 +20984,22 @@ const _sfc_main$1 = {
|
|
20946
20984
|
() => h(Icon, { value: "source-view" })
|
20947
20985
|
);
|
20948
20986
|
}
|
20987
|
+
if (this.name == "fullScreen" && this.$parent.fullScreenConfig.show) {
|
20988
|
+
return h(
|
20989
|
+
Button,
|
20990
|
+
{
|
20991
|
+
...props,
|
20992
|
+
title: this.$editTrans("fullScreen"),
|
20993
|
+
leftBorder: this.$parent.fullScreenConfig.leftBorder,
|
20994
|
+
rightBorder: this.$parent.fullScreenConfig.rightBorder,
|
20995
|
+
color: this.$parent.color,
|
20996
|
+
disabled: this.$parent.fullScreenConfig.disabled || this.disabled || this.$parent.disabled,
|
20997
|
+
active: this.$parent.fullScreenConfig.active,
|
20998
|
+
onOperate: this.$parent.handleOperate
|
20999
|
+
},
|
21000
|
+
() => h(Icon, { value: "full-screen" })
|
21001
|
+
);
|
21002
|
+
}
|
20949
21003
|
if (obj.common.isObject(this.$parent.config.extends)) {
|
20950
21004
|
const configuration = this.$parent.config.extends[this.name];
|
20951
21005
|
if (configuration) {
|
@@ -21100,14 +21154,18 @@ const _sfc_main$1 = {
|
|
21100
21154
|
if (!this.$parent.isSourceView) {
|
21101
21155
|
this.$parent.editor.rangeRender();
|
21102
21156
|
}
|
21157
|
+
} else if (name == "fullScreen") {
|
21158
|
+
this.$parent.isFullScreen = !this.$parent.isFullScreen;
|
21159
|
+
this.fullScreenConfig.active = this.$parent.isFullScreen;
|
21160
|
+
this.$parent.editor.rangeRender();
|
21103
21161
|
}
|
21104
21162
|
},
|
21105
21163
|
//处理光标更新
|
21106
|
-
handleRangeUpdate() {
|
21164
|
+
handleRangeUpdate(useCache = false) {
|
21107
21165
|
if (this.disabled) {
|
21108
21166
|
return;
|
21109
21167
|
}
|
21110
|
-
const result = this.$parent.editor.getElementsByRange(
|
21168
|
+
const result = this.$parent.editor.getElementsByRange(useCache).includes;
|
21111
21169
|
const hasPreStyle = this.$parent.hasPreStyle(true);
|
21112
21170
|
const hasTable = this.$parent.hasTable(true);
|
21113
21171
|
const hasQuote = this.$parent.hasQuote(true);
|
@@ -21228,6 +21286,7 @@ const _sfc_main$1 = {
|
|
21228
21286
|
this.codeBlockConfig.active = !!this.$parent.getCurrentParsedomElement("pre", true);
|
21229
21287
|
this.codeBlockConfig.disabled = hasTable || hasQuote || extraDisabled("codeBlock");
|
21230
21288
|
this.sourceViewConfig.active = this.$parent.isSourceView;
|
21289
|
+
this.fullScreenConfig.active = this.$parent.isFullScreen;
|
21231
21290
|
}
|
21232
21291
|
}
|
21233
21292
|
};
|
@@ -21235,8 +21294,8 @@ const _hoisted_1$1 = ["data-editify-mode"];
|
|
21235
21294
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
21236
21295
|
const _component_MenuItem = resolveComponent("MenuItem");
|
21237
21296
|
return openBlock(), createElementBlock("div", {
|
21238
|
-
class: normalizeClass(["editify-menu", { border: _ctx.$parent.
|
21239
|
-
"data-editify-mode": $
|
21297
|
+
class: normalizeClass(["editify-menu", { border: $options.menuShowBorder, source: _ctx.$parent.isSourceView && $options.menuMode == "inner", fullscreen: _ctx.$parent.isFullScreen }]),
|
21298
|
+
"data-editify-mode": $options.menuMode,
|
21240
21299
|
style: normalizeStyle($props.config.style || "")
|
21241
21300
|
}, [
|
21242
21301
|
(openBlock(true), createElementBlock(Fragment, null, renderList($options.menuNames, (item) => {
|
@@ -21247,8 +21306,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
21247
21306
|
}), 256))
|
21248
21307
|
], 14, _hoisted_1$1);
|
21249
21308
|
}
|
21250
|
-
const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
21251
|
-
const
|
21309
|
+
const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-c952b6ed"]]);
|
21310
|
+
const Editify_vue_vue_type_style_index_0_scoped_ede8b39b_lang = "";
|
21252
21311
|
const _sfc_main = {
|
21253
21312
|
name: "editify",
|
21254
21313
|
props: { ...editorProps },
|
@@ -21267,6 +21326,8 @@ const _sfc_main = {
|
|
21267
21326
|
isModelChange: false,
|
21268
21327
|
//是否代码视图
|
21269
21328
|
isSourceView: false,
|
21329
|
+
//是否全屏
|
21330
|
+
isFullScreen: false,
|
21270
21331
|
//是否正在输入中文
|
21271
21332
|
isInputChinese: false,
|
21272
21333
|
//表格列宽拖拽记录数据
|
@@ -21288,7 +21349,9 @@ const _sfc_main = {
|
|
21288
21349
|
//rangeUpdate更新延时器
|
21289
21350
|
updateTimer: null,
|
21290
21351
|
//菜单栏是否可以使用标识
|
21291
|
-
canUseMenu: false
|
21352
|
+
canUseMenu: false,
|
21353
|
+
//手动设定的编辑器编辑区域高度
|
21354
|
+
contentHeight: 0
|
21292
21355
|
};
|
21293
21356
|
},
|
21294
21357
|
computed: {
|
@@ -21315,8 +21378,20 @@ const _sfc_main = {
|
|
21315
21378
|
}
|
21316
21379
|
return false;
|
21317
21380
|
},
|
21381
|
+
//是否显示边框
|
21382
|
+
showBorder() {
|
21383
|
+
if (this.isFullScreen) {
|
21384
|
+
return false;
|
21385
|
+
}
|
21386
|
+
return this.border;
|
21387
|
+
},
|
21318
21388
|
//编辑器样式设置
|
21319
21389
|
contentStyle() {
|
21390
|
+
if (this.height === true || this.isFullScreen) {
|
21391
|
+
return {
|
21392
|
+
height: this.contentHeight + "px"
|
21393
|
+
};
|
21394
|
+
}
|
21320
21395
|
return this.autoheight ? { minHeight: this.height } : { height: this.height };
|
21321
21396
|
},
|
21322
21397
|
//最终生效的工具栏配置
|
@@ -21355,6 +21430,21 @@ const _sfc_main = {
|
|
21355
21430
|
this.handleToolbar();
|
21356
21431
|
}
|
21357
21432
|
}
|
21433
|
+
},
|
21434
|
+
//全屏切换
|
21435
|
+
isFullScreen() {
|
21436
|
+
this.$nextTick(() => {
|
21437
|
+
this.setContentHeight();
|
21438
|
+
});
|
21439
|
+
},
|
21440
|
+
//监听height为true
|
21441
|
+
height: {
|
21442
|
+
immediate: true,
|
21443
|
+
handler: function() {
|
21444
|
+
this.$nextTick(() => {
|
21445
|
+
this.setContentHeight();
|
21446
|
+
});
|
21447
|
+
}
|
21358
21448
|
}
|
21359
21449
|
},
|
21360
21450
|
mounted() {
|
@@ -21364,7 +21454,10 @@ const _sfc_main = {
|
|
21364
21454
|
obj.event.on(document.documentElement, `mousemove.editify_${this.uid}`, this.documentMouseMove);
|
21365
21455
|
obj.event.on(document.documentElement, `mouseup.editify_${this.uid}`, this.documentMouseUp);
|
21366
21456
|
obj.event.on(document.documentElement, `click.editify_${this.uid}`, this.documentClick);
|
21367
|
-
obj.event.on(window, `resize.editify_${this.uid}`,
|
21457
|
+
obj.event.on(window, `resize.editify_${this.uid}`, () => {
|
21458
|
+
this.setVideoHeight();
|
21459
|
+
this.setContentHeight();
|
21460
|
+
});
|
21368
21461
|
},
|
21369
21462
|
methods: {
|
21370
21463
|
//初始创建编辑器
|
@@ -21447,13 +21540,13 @@ const _sfc_main = {
|
|
21447
21540
|
removeScroll(this.$refs.content);
|
21448
21541
|
},
|
21449
21542
|
//工具条显示判断
|
21450
|
-
handleToolbar() {
|
21543
|
+
handleToolbar(useCache = false) {
|
21451
21544
|
if (this.disabled || this.isSourceView) {
|
21452
21545
|
return;
|
21453
21546
|
}
|
21454
21547
|
this.hideToolbar();
|
21455
21548
|
this.$nextTick(() => {
|
21456
|
-
const table = this.getCurrentParsedomElement("table",
|
21549
|
+
const table = this.getCurrentParsedomElement("table", useCache);
|
21457
21550
|
const pre = this.getCurrentParsedomElement("pre", true);
|
21458
21551
|
const link = this.getCurrentParsedomElement("a", true);
|
21459
21552
|
const image = this.getCurrentParsedomElement("img", true);
|
@@ -21499,7 +21592,7 @@ const _sfc_main = {
|
|
21499
21592
|
this.toolbarOptions.show = true;
|
21500
21593
|
}
|
21501
21594
|
} else {
|
21502
|
-
const result = this.editor.getElementsByRange(true
|
21595
|
+
const result = this.editor.getElementsByRange(true).flatIncludes.filter((item) => {
|
21503
21596
|
return item.element.isText();
|
21504
21597
|
});
|
21505
21598
|
if (result.length && !this.hasTable(true) && !this.hasPreStyle(true) && !this.hasLink(true) && !this.hasImage(true) && !this.hasVideo(true)) {
|
@@ -21671,7 +21764,7 @@ const _sfc_main = {
|
|
21671
21764
|
if (this.disabled) {
|
21672
21765
|
return;
|
21673
21766
|
}
|
21674
|
-
if (this.border && this.color) {
|
21767
|
+
if (this.border && this.color && !this.isFullScreen) {
|
21675
21768
|
this.$refs.body.style.borderColor = "";
|
21676
21769
|
this.$refs.body.style.boxShadow = "";
|
21677
21770
|
if (this.menuConfig.use) {
|
@@ -21686,7 +21779,7 @@ const _sfc_main = {
|
|
21686
21779
|
if (this.disabled) {
|
21687
21780
|
return;
|
21688
21781
|
}
|
21689
|
-
if (this.border && this.color) {
|
21782
|
+
if (this.border && this.color && !this.isFullScreen) {
|
21690
21783
|
this.$refs.body.style.borderColor = this.color;
|
21691
21784
|
const rgb = obj.color.hex2rgb(this.color);
|
21692
21785
|
if (this.menuConfig.use && this.menuConfig.mode == "inner") {
|
@@ -21753,7 +21846,7 @@ const _sfc_main = {
|
|
21753
21846
|
this.$emit("insertparagraph", this.value);
|
21754
21847
|
},
|
21755
21848
|
//编辑器焦点更新
|
21756
|
-
handleRangeUpdate(
|
21849
|
+
handleRangeUpdate() {
|
21757
21850
|
if (this.disabled) {
|
21758
21851
|
return;
|
21759
21852
|
}
|
@@ -21762,17 +21855,16 @@ const _sfc_main = {
|
|
21762
21855
|
}
|
21763
21856
|
this.updateTimer = setTimeout(() => {
|
21764
21857
|
if (this.toolbarConfig.use || this.menuConfig.use) {
|
21765
|
-
this.editor.getElementsByRange(
|
21766
|
-
this.
|
21767
|
-
|
21768
|
-
|
21769
|
-
this.
|
21770
|
-
|
21771
|
-
|
21772
|
-
this.$refs.menu.handleRangeUpdate();
|
21858
|
+
this.editor.getElementsByRange();
|
21859
|
+
if (this.toolbarConfig.use) {
|
21860
|
+
this.handleToolbar(true);
|
21861
|
+
}
|
21862
|
+
if (this.menuConfig.use) {
|
21863
|
+
this.$refs.menu.handleRangeUpdate(true);
|
21864
|
+
}
|
21773
21865
|
}
|
21774
21866
|
}, 200);
|
21775
|
-
this.$emit("rangeupdate", this.value
|
21867
|
+
this.$emit("rangeupdate", this.value);
|
21776
21868
|
},
|
21777
21869
|
//编辑器复制
|
21778
21870
|
handleCopy(text2, html) {
|
@@ -21787,7 +21879,7 @@ const _sfc_main = {
|
|
21787
21879
|
this.$emit("paste-text", data2);
|
21788
21880
|
},
|
21789
21881
|
//编辑器粘贴html
|
21790
|
-
handlePasteHtml(elements
|
21882
|
+
handlePasteHtml(elements) {
|
21791
21883
|
const keepStyles = Object.assign(pasteKeepData.styles, this.pasteKeepStyles || {});
|
21792
21884
|
const keepMarks = Object.assign(pasteKeepData.marks, this.pasteKeepMarks || {});
|
21793
21885
|
AlexElement.flatElements(elements).forEach((el) => {
|
@@ -21848,6 +21940,22 @@ const _sfc_main = {
|
|
21848
21940
|
video.style.height = video.offsetWidth / this.videoRatio + "px";
|
21849
21941
|
});
|
21850
21942
|
},
|
21943
|
+
//设置编辑器主体高度
|
21944
|
+
setContentHeight() {
|
21945
|
+
if (this.height === true || this.isFullScreen) {
|
21946
|
+
let height = this.$el.offsetHeight;
|
21947
|
+
if (this.menuConfig.use) {
|
21948
|
+
height -= this.$refs.menu.$el.offsetHeight;
|
21949
|
+
}
|
21950
|
+
if (this.showWordLength) {
|
21951
|
+
height -= this.$refs.footer.offsetHeight;
|
21952
|
+
}
|
21953
|
+
if (this.$refs.menu.menuMode == "default") {
|
21954
|
+
height -= 10;
|
21955
|
+
}
|
21956
|
+
this.contentHeight = height - 2;
|
21957
|
+
}
|
21958
|
+
},
|
21851
21959
|
//api:光标设置到文档底部
|
21852
21960
|
collapseToEnd() {
|
21853
21961
|
if (this.disabled) {
|
@@ -21897,7 +22005,7 @@ const _sfc_main = {
|
|
21897
22005
|
if (this.editor.range.anchor.element.isEqual(this.editor.range.focus.element)) {
|
21898
22006
|
return this.getParsedomElementByElement(this.editor.range.anchor.element, parsedom);
|
21899
22007
|
}
|
21900
|
-
const arr = this.editor.getElementsByRange(
|
22008
|
+
const arr = this.editor.getElementsByRange(useCache).includes.map((item) => {
|
21901
22009
|
return this.getParsedomElementByElement(item.element, parsedom);
|
21902
22010
|
});
|
21903
22011
|
let hasNull = arr.some((el) => {
|
@@ -21978,7 +22086,7 @@ const _sfc_main = {
|
|
21978
22086
|
blockToParagraph(block);
|
21979
22087
|
block.parsedom = parsedom;
|
21980
22088
|
} else {
|
21981
|
-
const result = this.editor.getElementsByRange(
|
22089
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
21982
22090
|
result.forEach((el) => {
|
21983
22091
|
if (el.element.isBlock()) {
|
21984
22092
|
blockToParagraph(el.element);
|
@@ -22014,7 +22122,7 @@ const _sfc_main = {
|
|
22014
22122
|
}
|
22015
22123
|
} else {
|
22016
22124
|
let blocks = [];
|
22017
|
-
const result = this.editor.getElementsByRange(
|
22125
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22018
22126
|
result.forEach((item) => {
|
22019
22127
|
const block = item.element.getBlock();
|
22020
22128
|
const exist = blocks.some((el) => block.isEqual(el));
|
@@ -22055,7 +22163,7 @@ const _sfc_main = {
|
|
22055
22163
|
}
|
22056
22164
|
} else {
|
22057
22165
|
let blocks = [];
|
22058
|
-
const result = this.editor.getElementsByRange(
|
22166
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22059
22167
|
result.forEach((item) => {
|
22060
22168
|
const block = item.element.getBlock();
|
22061
22169
|
const exist = blocks.some((el) => block.isEqual(el));
|
@@ -22088,11 +22196,11 @@ const _sfc_main = {
|
|
22088
22196
|
}
|
22089
22197
|
const active = this.queryTextStyle(name, value, useCache);
|
22090
22198
|
if (active) {
|
22091
|
-
this.editor.removeTextStyle([name],
|
22199
|
+
this.editor.removeTextStyle([name], true);
|
22092
22200
|
} else {
|
22093
22201
|
let styles = {};
|
22094
22202
|
styles[name] = value;
|
22095
|
-
this.editor.setTextStyle(styles,
|
22203
|
+
this.editor.setTextStyle(styles, true);
|
22096
22204
|
}
|
22097
22205
|
if (isRender) {
|
22098
22206
|
this.editor.formatElementStack();
|
@@ -22114,11 +22222,11 @@ const _sfc_main = {
|
|
22114
22222
|
}
|
22115
22223
|
const active = this.queryTextMark(name, value, useCache);
|
22116
22224
|
if (active) {
|
22117
|
-
this.editor.removeTextMark([name],
|
22225
|
+
this.editor.removeTextMark([name], true);
|
22118
22226
|
} else {
|
22119
22227
|
let marks = {};
|
22120
22228
|
marks[name] = value;
|
22121
|
-
this.editor.setTextMark(marks,
|
22229
|
+
this.editor.setTextMark(marks, true);
|
22122
22230
|
}
|
22123
22231
|
if (isRender) {
|
22124
22232
|
this.editor.formatElementStack();
|
@@ -22139,7 +22247,7 @@ const _sfc_main = {
|
|
22139
22247
|
return;
|
22140
22248
|
}
|
22141
22249
|
this.editor.removeTextStyle(null, useCache);
|
22142
|
-
this.editor.removeTextMark(null
|
22250
|
+
this.editor.removeTextMark(null);
|
22143
22251
|
if (isRender) {
|
22144
22252
|
this.editor.formatElementStack();
|
22145
22253
|
this.editor.domRender();
|
@@ -22175,7 +22283,7 @@ const _sfc_main = {
|
|
22175
22283
|
}
|
22176
22284
|
}
|
22177
22285
|
} else {
|
22178
|
-
const result = this.editor.getElementsByRange(
|
22286
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22179
22287
|
result.forEach((el) => {
|
22180
22288
|
if (el.element.isBlock() || el.element.isInblock()) {
|
22181
22289
|
if (el.element.hasStyles()) {
|
@@ -22261,7 +22369,7 @@ const _sfc_main = {
|
|
22261
22369
|
}
|
22262
22370
|
} else {
|
22263
22371
|
let blocks = [];
|
22264
|
-
const result = this.editor.getElementsByRange(
|
22372
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22265
22373
|
result.forEach((item) => {
|
22266
22374
|
const block = item.element.getBlock();
|
22267
22375
|
const exist = blocks.some((el) => block.isEqual(el));
|
@@ -22312,7 +22420,7 @@ const _sfc_main = {
|
|
22312
22420
|
}
|
22313
22421
|
}
|
22314
22422
|
} else {
|
22315
|
-
const result = this.editor.getElementsByRange(
|
22423
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22316
22424
|
result.forEach((el) => {
|
22317
22425
|
if (el.element.isBlock() || el.element.isInblock()) {
|
22318
22426
|
if (el.element.hasStyles()) {
|
@@ -22387,7 +22495,7 @@ const _sfc_main = {
|
|
22387
22495
|
fn(block);
|
22388
22496
|
}
|
22389
22497
|
} else {
|
22390
|
-
const result = this.editor.getElementsByRange(
|
22498
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22391
22499
|
result.forEach((item) => {
|
22392
22500
|
const block = item.element.getBlock();
|
22393
22501
|
const inblock = item.element.getInblock();
|
@@ -22432,7 +22540,7 @@ const _sfc_main = {
|
|
22432
22540
|
fn(block);
|
22433
22541
|
}
|
22434
22542
|
} else {
|
22435
|
-
const result = this.editor.getElementsByRange(
|
22543
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22436
22544
|
result.forEach((item) => {
|
22437
22545
|
const block = item.element.getBlock();
|
22438
22546
|
const inblock = item.element.getInblock();
|
@@ -22450,7 +22558,7 @@ const _sfc_main = {
|
|
22450
22558
|
}
|
22451
22559
|
},
|
22452
22560
|
//api:插入图片
|
22453
|
-
insertImage(url2, isRender = true) {
|
22561
|
+
insertImage(url2, isRender = true, useCache = false) {
|
22454
22562
|
if (this.disabled) {
|
22455
22563
|
return;
|
22456
22564
|
}
|
@@ -22469,7 +22577,7 @@ const _sfc_main = {
|
|
22469
22577
|
null,
|
22470
22578
|
null
|
22471
22579
|
);
|
22472
|
-
this.editor.insertElement(image);
|
22580
|
+
this.editor.insertElement(image, true, useCache);
|
22473
22581
|
if (isRender) {
|
22474
22582
|
this.editor.formatElementStack();
|
22475
22583
|
this.editor.domRender();
|
@@ -22477,7 +22585,7 @@ const _sfc_main = {
|
|
22477
22585
|
}
|
22478
22586
|
},
|
22479
22587
|
//api:插入视频
|
22480
|
-
insertVideo(url2, isRender = true) {
|
22588
|
+
insertVideo(url2, isRender = true, useCache = false) {
|
22481
22589
|
if (this.disabled) {
|
22482
22590
|
return;
|
22483
22591
|
}
|
@@ -22496,7 +22604,7 @@ const _sfc_main = {
|
|
22496
22604
|
null,
|
22497
22605
|
null
|
22498
22606
|
);
|
22499
|
-
this.editor.insertElement(video);
|
22607
|
+
this.editor.insertElement(video, true, useCache);
|
22500
22608
|
const leftSpace = AlexElement.getSpaceElement();
|
22501
22609
|
const rightSpace = AlexElement.getSpaceElement();
|
22502
22610
|
this.editor.addElementAfter(rightSpace, video);
|
@@ -22517,7 +22625,7 @@ const _sfc_main = {
|
|
22517
22625
|
if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
|
22518
22626
|
return this.editor.range.anchor.element.isPreStyle();
|
22519
22627
|
}
|
22520
|
-
const result = this.editor.getElementsByRange(
|
22628
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22521
22629
|
return result.some((item) => {
|
22522
22630
|
return item.element.isPreStyle();
|
22523
22631
|
});
|
@@ -22531,7 +22639,7 @@ const _sfc_main = {
|
|
22531
22639
|
const block = this.editor.range.anchor.element.getBlock();
|
22532
22640
|
return block.parsedom == "blockquote";
|
22533
22641
|
}
|
22534
|
-
const result = this.editor.getElementsByRange(
|
22642
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22535
22643
|
return result.some((item) => {
|
22536
22644
|
if (item.element.isBlock()) {
|
22537
22645
|
return item.element.parsedom == "blockquote";
|
@@ -22550,7 +22658,7 @@ const _sfc_main = {
|
|
22550
22658
|
const block = this.editor.range.anchor.element.getBlock();
|
22551
22659
|
return blockIsList(block, ordered);
|
22552
22660
|
}
|
22553
|
-
const result = this.editor.getElementsByRange(
|
22661
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22554
22662
|
return result.some((item) => {
|
22555
22663
|
if (item.element.isBlock()) {
|
22556
22664
|
return blockIsList(item.element, ordered);
|
@@ -22568,7 +22676,7 @@ const _sfc_main = {
|
|
22568
22676
|
if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
|
22569
22677
|
return !!this.getParsedomElementByElement(this.editor.range.anchor.element, "a");
|
22570
22678
|
}
|
22571
|
-
const result = this.editor.getElementsByRange(
|
22679
|
+
const result = this.editor.getElementsByRange(useCache).flatIncludes.filter((item) => {
|
22572
22680
|
return item.element.isText();
|
22573
22681
|
});
|
22574
22682
|
return result.some((item) => {
|
@@ -22584,7 +22692,7 @@ const _sfc_main = {
|
|
22584
22692
|
const block = this.editor.range.anchor.element.getBlock();
|
22585
22693
|
return block.parsedom == "table";
|
22586
22694
|
}
|
22587
|
-
const result = this.editor.getElementsByRange(
|
22695
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22588
22696
|
return result.some((item) => {
|
22589
22697
|
if (item.element.isBlock()) {
|
22590
22698
|
return item.element.parsedom == "table";
|
@@ -22603,7 +22711,7 @@ const _sfc_main = {
|
|
22603
22711
|
const block = this.editor.range.anchor.element.getBlock();
|
22604
22712
|
return blockIsTask(block);
|
22605
22713
|
}
|
22606
|
-
const result = this.editor.getElementsByRange(
|
22714
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22607
22715
|
return result.some((item) => {
|
22608
22716
|
if (item.element.isBlock()) {
|
22609
22717
|
return blockIsTask(item.element);
|
@@ -22621,7 +22729,7 @@ const _sfc_main = {
|
|
22621
22729
|
if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
|
22622
22730
|
return this.editor.range.anchor.element.isClosed() && this.editor.range.anchor.element.parsedom == "img";
|
22623
22731
|
}
|
22624
|
-
const result = this.editor.getElementsByRange(
|
22732
|
+
const result = this.editor.getElementsByRange(useCache).flatIncludes;
|
22625
22733
|
return result.some((item) => {
|
22626
22734
|
return item.element.isClosed() && item.element.parsedom == "img";
|
22627
22735
|
});
|
@@ -22634,7 +22742,7 @@ const _sfc_main = {
|
|
22634
22742
|
if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
|
22635
22743
|
return this.editor.range.anchor.element.isClosed() && this.editor.range.anchor.element.parsedom == "video";
|
22636
22744
|
}
|
22637
|
-
const result = this.editor.getElementsByRange(
|
22745
|
+
const result = this.editor.getElementsByRange(useCache).flatIncludes;
|
22638
22746
|
return result.some((item) => {
|
22639
22747
|
return item.element.isClosed() && item.element.parsedom == "video";
|
22640
22748
|
});
|
@@ -22648,7 +22756,7 @@ const _sfc_main = {
|
|
22648
22756
|
const block = this.editor.range.anchor.element.getBlock();
|
22649
22757
|
return block.parsedom == "blockquote";
|
22650
22758
|
}
|
22651
|
-
const result = this.editor.getElementsByRange(
|
22759
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22652
22760
|
return result.every((item) => {
|
22653
22761
|
if (item.element.isBlock()) {
|
22654
22762
|
return item.element.parsedom == "blockquote";
|
@@ -22667,7 +22775,7 @@ const _sfc_main = {
|
|
22667
22775
|
const block = this.editor.range.anchor.element.getBlock();
|
22668
22776
|
return blockIsList(block, ordered);
|
22669
22777
|
}
|
22670
|
-
const result = this.editor.getElementsByRange(
|
22778
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22671
22779
|
return result.every((item) => {
|
22672
22780
|
if (item.element.isBlock()) {
|
22673
22781
|
return blockIsList(item.element, ordered);
|
@@ -22686,7 +22794,7 @@ const _sfc_main = {
|
|
22686
22794
|
const block = this.editor.range.anchor.element.getBlock();
|
22687
22795
|
return blockIsTask(block);
|
22688
22796
|
}
|
22689
|
-
const result = this.editor.getElementsByRange(
|
22797
|
+
const result = this.editor.getElementsByRange(useCache).includes;
|
22690
22798
|
return result.every((item) => {
|
22691
22799
|
if (item.element.isBlock()) {
|
22692
22800
|
return blockIsTask(item.element);
|
@@ -22697,7 +22805,7 @@ const _sfc_main = {
|
|
22697
22805
|
});
|
22698
22806
|
},
|
22699
22807
|
//api:创建一个空的表格
|
22700
|
-
insertTable(rowLength, colLength, isRender = true) {
|
22808
|
+
insertTable(rowLength, colLength, isRender = true, useCache = false) {
|
22701
22809
|
if (this.disabled) {
|
22702
22810
|
return;
|
22703
22811
|
}
|
@@ -22717,7 +22825,7 @@ const _sfc_main = {
|
|
22717
22825
|
}
|
22718
22826
|
this.editor.addElementTo(row, tbody);
|
22719
22827
|
}
|
22720
|
-
this.editor.insertElement(table);
|
22828
|
+
this.editor.insertElement(table, true, useCache);
|
22721
22829
|
const paragraph = new AlexElement("block", AlexElement.BLOCK_NODE, null, null, null);
|
22722
22830
|
const breakEl = new AlexElement("closed", "br", null, null, null);
|
22723
22831
|
this.editor.addElementTo(breakEl, paragraph);
|
@@ -22764,10 +22872,10 @@ const _sfc_main = {
|
|
22764
22872
|
this.editor.addElementTo(breakEl, paragraph);
|
22765
22873
|
this.editor.addElementAfter(paragraph, block);
|
22766
22874
|
} else {
|
22767
|
-
let result = this.editor.getElementsByRange(true
|
22875
|
+
let result = this.editor.getElementsByRange(true).includes;
|
22768
22876
|
this.editor.range.anchor.moveToStart(result[0].element.getBlock());
|
22769
22877
|
this.editor.range.focus.moveToEnd(result[result.length - 1].element.getBlock());
|
22770
|
-
const res = this.editor.getElementsByRange(true
|
22878
|
+
const res = this.editor.getElementsByRange(true).flatIncludes.filter((el) => el.element.isText());
|
22771
22879
|
const obj2 = {};
|
22772
22880
|
res.forEach((el) => {
|
22773
22881
|
if (obj2[el.element.getBlock().key]) {
|
@@ -22809,14 +22917,14 @@ const _sfc_main = {
|
|
22809
22917
|
}
|
22810
22918
|
},
|
22811
22919
|
//api:插入文本
|
22812
|
-
insertText(text2, isRender = true) {
|
22920
|
+
insertText(text2, isRender = true, useCache = false) {
|
22813
22921
|
if (this.disabled) {
|
22814
22922
|
return;
|
22815
22923
|
}
|
22816
22924
|
if (!this.editor.range) {
|
22817
22925
|
return;
|
22818
22926
|
}
|
22819
|
-
this.editor.insertText(text2);
|
22927
|
+
this.editor.insertText(text2, useCache);
|
22820
22928
|
if (isRender) {
|
22821
22929
|
this.editor.formatElementStack();
|
22822
22930
|
this.editor.domRender();
|
@@ -22824,7 +22932,7 @@ const _sfc_main = {
|
|
22824
22932
|
}
|
22825
22933
|
},
|
22826
22934
|
//api:插入html
|
22827
|
-
insertHtml(html, isRender = true) {
|
22935
|
+
insertHtml(html, isRender = true, useCache = false) {
|
22828
22936
|
if (this.disabled) {
|
22829
22937
|
return;
|
22830
22938
|
}
|
@@ -22833,7 +22941,7 @@ const _sfc_main = {
|
|
22833
22941
|
}
|
22834
22942
|
const elements = this.editor.parseHtml(html);
|
22835
22943
|
for (let i = 0; i < elements.length; i++) {
|
22836
|
-
this.editor.insertElement(elements[i], false);
|
22944
|
+
this.editor.insertElement(elements[i], false, i == 0 ? useCache : false);
|
22837
22945
|
}
|
22838
22946
|
if (isRender) {
|
22839
22947
|
this.editor.formatElementStack();
|
@@ -22849,19 +22957,16 @@ const _sfc_main = {
|
|
22849
22957
|
this.editor.destroy();
|
22850
22958
|
}
|
22851
22959
|
};
|
22852
|
-
const _hoisted_1 =
|
22853
|
-
const _hoisted_2 = ["data-editify-
|
22854
|
-
const _hoisted_3 = ["
|
22855
|
-
const _hoisted_4 =
|
22856
|
-
const _hoisted_5 = {
|
22857
|
-
key: 1,
|
22858
|
-
class: "editify-footer"
|
22859
|
-
};
|
22860
|
-
const _hoisted_6 = { class: "editify-footer-words" };
|
22960
|
+
const _hoisted_1 = ["data-editify-uid"];
|
22961
|
+
const _hoisted_2 = ["data-editify-placeholder"];
|
22962
|
+
const _hoisted_3 = ["value"];
|
22963
|
+
const _hoisted_4 = { class: "editify-footer-words" };
|
22861
22964
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
22862
22965
|
const _component_Menu = resolveComponent("Menu");
|
22863
22966
|
const _component_Toolbar = resolveComponent("Toolbar");
|
22864
|
-
return openBlock(), createElementBlock("div",
|
22967
|
+
return openBlock(), createElementBlock("div", {
|
22968
|
+
class: normalizeClass(["editify", { fullheight: _ctx.height === true && !$data.isFullScreen, fullscreen: $data.isFullScreen }])
|
22969
|
+
}, [
|
22865
22970
|
$options.menuConfig.use ? (openBlock(), createBlock(_component_Menu, {
|
22866
22971
|
key: 0,
|
22867
22972
|
config: $options.menuConfig,
|
@@ -22871,7 +22976,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
22871
22976
|
}, null, 8, ["config", "disabled", "color"])) : createCommentVNode("", true),
|
22872
22977
|
createElementVNode("div", {
|
22873
22978
|
ref: "body",
|
22874
|
-
class: normalizeClass(["editify-body", { border:
|
22979
|
+
class: normalizeClass(["editify-body", { border: $options.showBorder, menu_inner: $options.menuConfig.use && $options.menuConfig.mode == "inner" }]),
|
22875
22980
|
"data-editify-uid": $setup.uid
|
22876
22981
|
}, [
|
22877
22982
|
createElementVNode("div", {
|
@@ -22883,13 +22988,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
22883
22988
|
onCompositionstart: _cache[2] || (_cache[2] = ($event) => $data.isInputChinese = true),
|
22884
22989
|
onCompositionend: _cache[3] || (_cache[3] = ($event) => $data.isInputChinese = false),
|
22885
22990
|
"data-editify-placeholder": _ctx.placeholder
|
22886
|
-
}, null, 46,
|
22991
|
+
}, null, 46, _hoisted_2),
|
22887
22992
|
$data.isSourceView ? (openBlock(), createElementBlock("textarea", {
|
22888
22993
|
key: 0,
|
22889
22994
|
value: $options.value,
|
22890
22995
|
readonly: "",
|
22891
22996
|
class: "editify-source"
|
22892
|
-
}, null, 8,
|
22997
|
+
}, null, 8, _hoisted_3)) : createCommentVNode("", true),
|
22893
22998
|
createVNode(_component_Toolbar, {
|
22894
22999
|
ref: "toolbar",
|
22895
23000
|
modelValue: $data.toolbarOptions.show,
|
@@ -22898,13 +23003,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
22898
23003
|
type: $data.toolbarOptions.type,
|
22899
23004
|
config: $options.toolbarConfig
|
22900
23005
|
}, null, 8, ["modelValue", "node", "type", "config"])
|
22901
|
-
], 10,
|
22902
|
-
_ctx.showWordLength ? (openBlock(), createElementBlock("div",
|
22903
|
-
|
22904
|
-
|
22905
|
-
|
23006
|
+
], 10, _hoisted_1),
|
23007
|
+
_ctx.showWordLength ? (openBlock(), createElementBlock("div", {
|
23008
|
+
key: 1,
|
23009
|
+
class: normalizeClass(["editify-footer", { fullscreen: $data.isFullScreen && !$data.isSourceView }]),
|
23010
|
+
ref: "footer"
|
23011
|
+
}, [
|
23012
|
+
createElementVNode("div", _hoisted_4, toDisplayString($options.$editTrans("totalWordCount")) + toDisplayString($options.textValue.length), 1)
|
23013
|
+
], 2)) : createCommentVNode("", true)
|
23014
|
+
], 2);
|
22906
23015
|
}
|
22907
|
-
const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
23016
|
+
const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ede8b39b"]]);
|
22908
23017
|
const iconfont = "";
|
22909
23018
|
const en_US = {
|
22910
23019
|
textWrapUp: "Up feed",
|
@@ -22989,7 +23098,8 @@ const en_US = {
|
|
22989
23098
|
alignRight: "Align right",
|
22990
23099
|
alignJustify: "Align justify",
|
22991
23100
|
defaultLineHeight: "Default",
|
22992
|
-
auto: "auto"
|
23101
|
+
auto: "auto",
|
23102
|
+
fullScreen: "Full screen"
|
22993
23103
|
};
|
22994
23104
|
const zh_CN = {
|
22995
23105
|
textWrapUp: "向上换行",
|
@@ -23074,7 +23184,8 @@ const zh_CN = {
|
|
23074
23184
|
alignRight: "右对齐",
|
23075
23185
|
alignJustify: "两端对齐",
|
23076
23186
|
defaultLineHeight: "默认行高",
|
23077
|
-
auto: "自适应"
|
23187
|
+
auto: "自适应",
|
23188
|
+
fullScreen: "全屏"
|
23078
23189
|
};
|
23079
23190
|
const translations = {
|
23080
23191
|
zh_CN,
|
@@ -23085,7 +23196,7 @@ const i18n = (locale) => {
|
|
23085
23196
|
return translations[locale][key];
|
23086
23197
|
};
|
23087
23198
|
};
|
23088
|
-
const version = "0.0.
|
23199
|
+
const version = "0.0.49";
|
23089
23200
|
const install = (app, props) => {
|
23090
23201
|
const locale = (props ? props.locale : "zh_CN") || "zh_CN";
|
23091
23202
|
app.provide("$editTrans", i18n(locale));
|