@seafile/sdoc-editor 1.0.86 → 1.0.87
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.
|
@@ -23,8 +23,7 @@ const withCallout = editor => {
|
|
|
23
23
|
insertFragment,
|
|
24
24
|
deleteBackward,
|
|
25
25
|
onHotKeyDown,
|
|
26
|
-
insertData
|
|
27
|
-
onCopy
|
|
26
|
+
insertData
|
|
28
27
|
} = editor;
|
|
29
28
|
const newEditor = editor;
|
|
30
29
|
newEditor.deleteBackward = unit => {
|
|
@@ -112,7 +111,6 @@ const withCallout = editor => {
|
|
|
112
111
|
if ((0, _helper.getCalloutEntry)(editor)) {
|
|
113
112
|
event.stopPropagation();
|
|
114
113
|
}
|
|
115
|
-
return onCopy(event);
|
|
116
114
|
};
|
|
117
115
|
return newEditor;
|
|
118
116
|
};
|
|
@@ -67,10 +67,10 @@ const withLink = editor => {
|
|
|
67
67
|
// Paste into link
|
|
68
68
|
if ((0, _core.getSelectedNodeByType)(newEditor, _constants.LINK)) {
|
|
69
69
|
const fragments = data.slice(0).filter(item => _slate.Node.string(item).length !== 0);
|
|
70
|
-
// Prevent list
|
|
71
|
-
if (fragments.some(item => [_constants.ORDERED_LIST, _constants.UNORDERED_LIST].includes(item.type)))
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// Prevent fragments containing list blocks
|
|
71
|
+
if (fragments.length > 1 && fragments.some(item => [_constants.ORDERED_LIST, _constants.UNORDERED_LIST].includes(item.type))) return;
|
|
72
|
+
// Prevent multiple list-items in a single list block
|
|
73
|
+
if (fragments.length === 1 && [_constants.ORDERED_LIST, _constants.UNORDERED_LIST].includes(fragments[0].type) && fragments[0].children.length > 1) return;
|
|
74
74
|
}
|
|
75
75
|
return insertFragment(data);
|
|
76
76
|
};
|
|
@@ -12,7 +12,6 @@ var _insertFragmentList = require("./insert-fragment-list");
|
|
|
12
12
|
var _shortcut = require("./shortcut");
|
|
13
13
|
var _core = require("../../../core");
|
|
14
14
|
var _constants = require("../../../constants");
|
|
15
|
-
var _helpers = require("../../../toolbar/side-toolbar/helpers");
|
|
16
15
|
var _transforms = require("../transforms");
|
|
17
16
|
var _queries = require("../queries");
|
|
18
17
|
var _removeListItem = require("../transforms/remove-list-item");
|
|
@@ -136,22 +135,6 @@ const withList = editor => {
|
|
|
136
135
|
if (isPreventInsert) return;
|
|
137
136
|
return insertText(text);
|
|
138
137
|
};
|
|
139
|
-
newEditor.onCopy = event => {
|
|
140
|
-
const path = _slate.Editor.path(newEditor, newEditor.selection, {
|
|
141
|
-
edge: 'start'
|
|
142
|
-
});
|
|
143
|
-
if ((0, _helpers.isList)(newEditor, path)) {
|
|
144
|
-
event.stopPropagation();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
newEditor.cut = event => {
|
|
148
|
-
const path = _slate.Editor.path(newEditor, newEditor.selection, {
|
|
149
|
-
edge: 'start'
|
|
150
|
-
});
|
|
151
|
-
if ((0, _helpers.isList)(newEditor, path)) {
|
|
152
|
-
event.stopPropagation();
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
138
|
return newEditor;
|
|
156
139
|
};
|
|
157
140
|
var _default = exports.default = withList;
|
|
@@ -27,7 +27,6 @@ const withTable = editor => {
|
|
|
27
27
|
getFragment,
|
|
28
28
|
setFragmentData,
|
|
29
29
|
insertFragment,
|
|
30
|
-
cut,
|
|
31
30
|
deleteFragment
|
|
32
31
|
} = editor;
|
|
33
32
|
const newEditor = editor;
|
|
@@ -376,7 +375,6 @@ const withTable = editor => {
|
|
|
376
375
|
}
|
|
377
376
|
return;
|
|
378
377
|
}
|
|
379
|
-
return cut(event);
|
|
380
378
|
};
|
|
381
379
|
|
|
382
380
|
// copy insert text
|