@seafile/sdoc-editor 3.0.161 → 3.0.162
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.
|
@@ -7,14 +7,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
9
|
var _slate = require("@seafile/slate");
|
|
10
|
+
var _isHotkey = _interopRequireDefault(require("is-hotkey"));
|
|
10
11
|
var _constants = require("../../constants");
|
|
11
12
|
var _core = require("../../core");
|
|
12
13
|
var _helpers = require("./helpers");
|
|
13
14
|
var withBlockquote = function withBlockquote(editor) {
|
|
14
15
|
var insertBreak = editor.insertBreak,
|
|
15
16
|
deleteBackward = editor.deleteBackward,
|
|
16
|
-
insertFragment = editor.insertFragment
|
|
17
|
+
insertFragment = editor.insertFragment,
|
|
18
|
+
handleTab = editor.handleTab;
|
|
17
19
|
var newEditor = editor;
|
|
20
|
+
newEditor.handleTab = function (event) {
|
|
21
|
+
var quoteBlockEntry = (0, _core.getSelectedNodeEntryByType)(newEditor, _constants.BLOCKQUOTE);
|
|
22
|
+
if (!quoteBlockEntry) {
|
|
23
|
+
return handleTab && handleTab(event);
|
|
24
|
+
}
|
|
25
|
+
var listItemEntry = (0, _core.getSelectedNodeEntryByType)(newEditor, _constants.LIST_ITEM);
|
|
26
|
+
if (listItemEntry) {
|
|
27
|
+
return handleTab && handleTab(event);
|
|
28
|
+
}
|
|
29
|
+
if ((0, _isHotkey["default"])('tab', event) || (0, _isHotkey["default"])('shift+tab', event)) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return handleTab && handleTab(event);
|
|
34
|
+
};
|
|
18
35
|
newEditor.insertBreak = function () {
|
|
19
36
|
var selection = editor.selection;
|
|
20
37
|
if (selection == null) return insertBreak();
|
|
@@ -88,7 +88,17 @@ var withCallout = function withCallout(editor) {
|
|
|
88
88
|
var eventBus = _eventBus["default"].getInstance();
|
|
89
89
|
eventBus.dispatch(_constants.INTERNAL_EVENT.CLOSE_CALLOUT_COLOR_PICKER);
|
|
90
90
|
if ((0, _isHotkey["default"])('tab', event) || (0, _isHotkey["default"])('shift+tab', event)) {
|
|
91
|
-
|
|
91
|
+
var listItemEntry = _slate.Editor.above(newEditor, {
|
|
92
|
+
at: newEditor.selection,
|
|
93
|
+
match: function match(n) {
|
|
94
|
+
return n.type === _constants2.LIST_ITEM;
|
|
95
|
+
},
|
|
96
|
+
mode: 'lowest'
|
|
97
|
+
});
|
|
98
|
+
if (!listItemEntry) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
92
102
|
newEditor.handleTab && newEditor.handleTab(event);
|
|
93
103
|
return true;
|
|
94
104
|
}
|
|
@@ -122,11 +122,11 @@ var withList = function withList(editor) {
|
|
|
122
122
|
};
|
|
123
123
|
newEditor.handleTab = function (event) {
|
|
124
124
|
if (!newEditor.selection) {
|
|
125
|
-
handleTab && handleTab();
|
|
125
|
+
handleTab && handleTab(event);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
if ((0, _onTabHandle.onTabHandle)(newEditor, event)) return;
|
|
129
|
-
handleTab && handleTab();
|
|
129
|
+
handleTab && handleTab(event);
|
|
130
130
|
};
|
|
131
131
|
newEditor.insertFragment = (0, _insertFragmentList.insertFragmentList)(newEditor);
|
|
132
132
|
newEditor.normalizeNode = (0, _normalizeList.normalizeList)(editor);
|
|
@@ -29,6 +29,16 @@ var withParagraph = function withParagraph(editor) {
|
|
|
29
29
|
handleTab && handleTab(event);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
+
var excludedParent = _slate.Editor.above(newEditor, {
|
|
33
|
+
at: selection,
|
|
34
|
+
match: function match(n) {
|
|
35
|
+
return [_constants.LIST_ITEM, _constants.BLOCKQUOTE].includes(n.type);
|
|
36
|
+
},
|
|
37
|
+
mode: 'lowest'
|
|
38
|
+
});
|
|
39
|
+
if (excludedParent) {
|
|
40
|
+
return handleTab && handleTab(event);
|
|
41
|
+
}
|
|
32
42
|
var _Editor$nodes = _slate.Editor.nodes(newEditor, {
|
|
33
43
|
at: selection,
|
|
34
44
|
match: function match(n) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.162",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "e799288b08d797747a7c810596964b8619de28a0"
|
|
76
76
|
}
|