@wangeditor-next/core 1.4.2 → 1.5.1
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/CHANGELOG.md +27 -0
- package/dist/index.esm.js +15 -17
- package/dist/index.js +15 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.5.1](https://github.com/cycleccc/wangEditor/compare/@wangeditor-next/core@1.5.0...@wangeditor-next/core@1.5.1) (2024-07-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* remove extra lists when pasting Feishu doc lists ([2c242eb](https://github.com/cycleccc/wangEditor/commit/2c242eb32f388e56a9711af51cd250fe4d61edce))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.5.0](https://github.com/cycleccc/wangEditor/compare/@wangeditor-next/core@1.4.2...@wangeditor-next/core@1.5.0) (2024-07-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* lint —fix & test tuning ([26c254b](https://github.com/cycleccc/wangEditor/commit/26c254bbc5b1736bb636766f2fbf1c67e5815a38))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* Table add merge / split cell ([dac7bbc](https://github.com/cycleccc/wangEditor/commit/dac7bbc168b89ddb37cf49d8952d5b1ef6648519))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [1.4.2](https://github.com/cycleccc/wangEditor/compare/@wangeditor-next/core@1.4.1...@wangeditor-next/core@1.4.2) (2024-07-08)
|
|
7
34
|
|
|
8
35
|
|
package/dist/index.esm.js
CHANGED
|
@@ -968,9 +968,14 @@ var DomEditor = {
|
|
|
968
968
|
}
|
|
969
969
|
return (
|
|
970
970
|
// 祖先节点中包括 data-slate-editor 属性,即 textarea
|
|
971
|
-
targetEl.closest("[data-slate-editor]") === editorEl &&
|
|
971
|
+
(targetEl.closest("[data-slate-editor]") === editorEl &&
|
|
972
972
|
// 通过参数 editable 控制开启是否验证是可编辑元素或零宽字符
|
|
973
|
-
|
|
973
|
+
// 补全 data-slate-string 可参考本文代码
|
|
974
|
+
//(data-slate-zero-width、data-slate-string)判断一起出现,唯独此处欠缺,补全
|
|
975
|
+
(!editable ||
|
|
976
|
+
targetEl.isContentEditable ||
|
|
977
|
+
!!targetEl.getAttribute('data-slate-zero-width'))) ||
|
|
978
|
+
!!targetEl.getAttribute('data-slate-string'));
|
|
974
979
|
},
|
|
975
980
|
/**
|
|
976
981
|
* Find a native DOM range from a Slate `range`.
|
|
@@ -2742,7 +2747,7 @@ var withContent = function (editor) {
|
|
|
2742
2747
|
div.setAttribute('hidden', 'true');
|
|
2743
2748
|
document.body.appendChild(div);
|
|
2744
2749
|
var insertedElemNum = 0; // 记录插入 elem 的数量 ( textNode 不算 )
|
|
2745
|
-
domNodes.forEach(function (n) {
|
|
2750
|
+
domNodes.forEach(function (n, index) {
|
|
2746
2751
|
var nodeType = n.nodeType, nodeName = n.nodeName, _a = n.textContent, textContent = _a === void 0 ? '' : _a;
|
|
2747
2752
|
// ------ Text node ------
|
|
2748
2753
|
if (nodeType === NodeType.TEXT_NODE) {
|
|
@@ -2796,8 +2801,13 @@ var withContent = function (editor) {
|
|
|
2796
2801
|
var display = window.getComputedStyle(el).display;
|
|
2797
2802
|
if (!DomEditor.isSelectedEmptyParagraph(e)) {
|
|
2798
2803
|
// 当前不是空行,且 非 inline - 则换行
|
|
2799
|
-
if (display.indexOf('inline') < 0)
|
|
2804
|
+
if (display.indexOf('inline') < 0) {
|
|
2805
|
+
var el_1 = domNodes[index - 1];
|
|
2806
|
+
if (el_1.matches('ul:not([data-w-e-type]),ol:not([data-w-e-type])')) {
|
|
2807
|
+
e.insertBreak(); // 列表项,需要插入空行
|
|
2808
|
+
}
|
|
2800
2809
|
e.insertBreak();
|
|
2810
|
+
}
|
|
2801
2811
|
}
|
|
2802
2812
|
e.dangerouslyInsertHtml(el.innerHTML, true); // 继续插入子内容
|
|
2803
2813
|
});
|
|
@@ -4606,9 +4616,6 @@ function DOMSelectionToEditor(textarea, editor) {
|
|
|
4606
4616
|
});
|
|
4607
4617
|
Transforms.select(editor, range);
|
|
4608
4618
|
}
|
|
4609
|
-
else {
|
|
4610
|
-
Transforms.deselect(editor);
|
|
4611
|
-
}
|
|
4612
4619
|
}
|
|
4613
4620
|
|
|
4614
4621
|
/**
|
|
@@ -4864,16 +4871,7 @@ function handleCompositionStart(e, textarea, editor) {
|
|
|
4864
4871
|
editorSelectionToDOM(textarea, editor, true);
|
|
4865
4872
|
});
|
|
4866
4873
|
}
|
|
4867
|
-
if (selection && Range.isCollapsed(selection)) {
|
|
4868
|
-
// 记录下 dom text ,以便触发 maxLength 时使用
|
|
4869
|
-
var domRange = DomEditor.toDOMRange(editor, selection);
|
|
4870
|
-
var startContainer = domRange.startContainer;
|
|
4871
|
-
var curText = startContainer.textContent || '';
|
|
4872
|
-
EDITOR_TO_TEXT.set(editor, curText);
|
|
4873
|
-
// 记录下 dom range startContainer
|
|
4874
|
-
EDITOR_TO_START_CONTAINER.set(editor, startContainer);
|
|
4875
|
-
}
|
|
4876
|
-
if (selection && Range.isExpanded(selection)) {
|
|
4874
|
+
if (selection && (Range.isExpanded(selection) || Range.isCollapsed(selection))) {
|
|
4877
4875
|
// 记录下 dom text ,以便触发 maxLength 时使用
|
|
4878
4876
|
var domRange = DomEditor.toDOMRange(editor, selection);
|
|
4879
4877
|
var startContainer = domRange.startContainer;
|
package/dist/index.js
CHANGED
|
@@ -989,9 +989,14 @@
|
|
|
989
989
|
}
|
|
990
990
|
return (
|
|
991
991
|
// 祖先节点中包括 data-slate-editor 属性,即 textarea
|
|
992
|
-
targetEl.closest("[data-slate-editor]") === editorEl &&
|
|
992
|
+
(targetEl.closest("[data-slate-editor]") === editorEl &&
|
|
993
993
|
// 通过参数 editable 控制开启是否验证是可编辑元素或零宽字符
|
|
994
|
-
|
|
994
|
+
// 补全 data-slate-string 可参考本文代码
|
|
995
|
+
//(data-slate-zero-width、data-slate-string)判断一起出现,唯独此处欠缺,补全
|
|
996
|
+
(!editable ||
|
|
997
|
+
targetEl.isContentEditable ||
|
|
998
|
+
!!targetEl.getAttribute('data-slate-zero-width'))) ||
|
|
999
|
+
!!targetEl.getAttribute('data-slate-string'));
|
|
995
1000
|
},
|
|
996
1001
|
/**
|
|
997
1002
|
* Find a native DOM range from a Slate `range`.
|
|
@@ -2763,7 +2768,7 @@
|
|
|
2763
2768
|
div.setAttribute('hidden', 'true');
|
|
2764
2769
|
document.body.appendChild(div);
|
|
2765
2770
|
var insertedElemNum = 0; // 记录插入 elem 的数量 ( textNode 不算 )
|
|
2766
|
-
domNodes.forEach(function (n) {
|
|
2771
|
+
domNodes.forEach(function (n, index) {
|
|
2767
2772
|
var nodeType = n.nodeType, nodeName = n.nodeName, _a = n.textContent, textContent = _a === void 0 ? '' : _a;
|
|
2768
2773
|
// ------ Text node ------
|
|
2769
2774
|
if (nodeType === NodeType.TEXT_NODE) {
|
|
@@ -2817,8 +2822,13 @@
|
|
|
2817
2822
|
var display = window.getComputedStyle(el).display;
|
|
2818
2823
|
if (!DomEditor.isSelectedEmptyParagraph(e)) {
|
|
2819
2824
|
// 当前不是空行,且 非 inline - 则换行
|
|
2820
|
-
if (display.indexOf('inline') < 0)
|
|
2825
|
+
if (display.indexOf('inline') < 0) {
|
|
2826
|
+
var el_1 = domNodes[index - 1];
|
|
2827
|
+
if (el_1.matches('ul:not([data-w-e-type]),ol:not([data-w-e-type])')) {
|
|
2828
|
+
e.insertBreak(); // 列表项,需要插入空行
|
|
2829
|
+
}
|
|
2821
2830
|
e.insertBreak();
|
|
2831
|
+
}
|
|
2822
2832
|
}
|
|
2823
2833
|
e.dangerouslyInsertHtml(el.innerHTML, true); // 继续插入子内容
|
|
2824
2834
|
});
|
|
@@ -4649,9 +4659,6 @@
|
|
|
4649
4659
|
});
|
|
4650
4660
|
slate.Transforms.select(editor, range);
|
|
4651
4661
|
}
|
|
4652
|
-
else {
|
|
4653
|
-
slate.Transforms.deselect(editor);
|
|
4654
|
-
}
|
|
4655
4662
|
}
|
|
4656
4663
|
|
|
4657
4664
|
/**
|
|
@@ -4907,16 +4914,7 @@
|
|
|
4907
4914
|
editorSelectionToDOM(textarea, editor, true);
|
|
4908
4915
|
});
|
|
4909
4916
|
}
|
|
4910
|
-
if (selection && slate.Range.isCollapsed(selection)) {
|
|
4911
|
-
// 记录下 dom text ,以便触发 maxLength 时使用
|
|
4912
|
-
var domRange = DomEditor.toDOMRange(editor, selection);
|
|
4913
|
-
var startContainer = domRange.startContainer;
|
|
4914
|
-
var curText = startContainer.textContent || '';
|
|
4915
|
-
EDITOR_TO_TEXT.set(editor, curText);
|
|
4916
|
-
// 记录下 dom range startContainer
|
|
4917
|
-
EDITOR_TO_START_CONTAINER.set(editor, startContainer);
|
|
4918
|
-
}
|
|
4919
|
-
if (selection && slate.Range.isExpanded(selection)) {
|
|
4917
|
+
if (selection && (slate.Range.isExpanded(selection) || slate.Range.isCollapsed(selection))) {
|
|
4920
4918
|
// 记录下 dom text ,以便触发 maxLength 时使用
|
|
4921
4919
|
var domRange = DomEditor.toDOMRange(editor, selection);
|
|
4922
4920
|
var startContainer = domRange.startContainer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "wangEditor core",
|
|
5
5
|
"author": "cycleccc <2991205548@qq.com>",
|
|
6
6
|
"contributors": [],
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/is-hotkey": "^0.1.2"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "5d55ac379a7f66a17894d7a7e224a76bca2642c7"
|
|
70
70
|
}
|