@seafile/sdoc-editor 1.0.220 → 1.0.221
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/dist/basic-sdk/extension/plugins/font/helpers.js +7 -0
- package/dist/basic-sdk/extension/plugins/header/render-elem.js +2 -1
- package/dist/basic-sdk/extension/plugins/multi-column/plugin.js +1 -1
- package/dist/basic-sdk/extension/plugins/seatable-column/plugin.js +9 -1
- package/dist/basic-sdk/extension/plugins/seatable-column/render-elem.js +35 -0
- package/dist/basic-sdk/extension/plugins/text-style/helpers.js +1 -1
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +10 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +2 -1
- package/package.json +1 -1
|
@@ -52,6 +52,13 @@ const getFontSize = editor => {
|
|
|
52
52
|
}
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
55
|
+
if (!_slate.Editor.isEditor(n) && _slate.Editor.isVoid(editor, n)) {
|
|
56
|
+
const parentNode = (0, _core.getParentNode)(editor.children, n.id);
|
|
57
|
+
if (!parentNode) return false;
|
|
58
|
+
if ([_constants.TITLE, _constants.SUBTITLE, ..._constants.HEADERS, _constants.CODE_LINE].includes(parentNode.type)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
55
62
|
return false;
|
|
56
63
|
}
|
|
57
64
|
});
|
|
@@ -9,6 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _slate = require("@seafile/slate");
|
|
10
10
|
var _core = require("../../core");
|
|
11
11
|
var _constants = require("../../constants");
|
|
12
|
+
var _helper = require("../paragraph/helper");
|
|
12
13
|
const renderTitle = (props, editor) => {
|
|
13
14
|
const {
|
|
14
15
|
element,
|
|
@@ -69,7 +70,7 @@ const renderHeader = (props, editor) => {
|
|
|
69
70
|
})
|
|
70
71
|
};
|
|
71
72
|
let isShowPlaceHolder = false;
|
|
72
|
-
if (_slate.Node.string(element) === '' && !isComposing) {
|
|
73
|
+
if ((0, _helper.isEmptyNode)(element) && _slate.Node.string(element) === '' && !isComposing) {
|
|
73
74
|
isShowPlaceHolder = true;
|
|
74
75
|
}
|
|
75
76
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
@@ -82,7 +82,7 @@ const withMultiColumn = editor => {
|
|
|
82
82
|
const nextNode = _slate.Editor.next(newEditor);
|
|
83
83
|
const nextColumnIndex = nextNode[1][1];
|
|
84
84
|
const currentMultiColumnEntry = (0, _core.getSelectedNodeEntryByType)(editor, _constants.ELEMENT_TYPE.MULTI_COLUMN);
|
|
85
|
-
if (!currentMultiColumnEntry) return
|
|
85
|
+
if (!currentMultiColumnEntry) return deleteForward(unit);
|
|
86
86
|
const {
|
|
87
87
|
column,
|
|
88
88
|
children: childColumn
|
|
@@ -8,7 +8,8 @@ var _constants = require("../../constants");
|
|
|
8
8
|
const withColumn = editor => {
|
|
9
9
|
const {
|
|
10
10
|
isInline,
|
|
11
|
-
isVoid
|
|
11
|
+
isVoid,
|
|
12
|
+
markableVoid
|
|
12
13
|
} = editor;
|
|
13
14
|
const newEditor = editor;
|
|
14
15
|
newEditor.isInline = element => {
|
|
@@ -25,6 +26,13 @@ const withColumn = editor => {
|
|
|
25
26
|
if (type === _constants.ELEMENT_TYPE.SEATABLE_COLUMN) return true;
|
|
26
27
|
return isVoid(element);
|
|
27
28
|
};
|
|
29
|
+
newEditor.markableVoid = element => {
|
|
30
|
+
const {
|
|
31
|
+
type
|
|
32
|
+
} = element;
|
|
33
|
+
if (type === _constants.ELEMENT_TYPE.SEATABLE_COLUMN) return true;
|
|
34
|
+
return markableVoid(element);
|
|
35
|
+
};
|
|
28
36
|
return newEditor;
|
|
29
37
|
};
|
|
30
38
|
var _default = exports.default = withColumn;
|
|
@@ -36,11 +36,46 @@ const Column = _ref => {
|
|
|
36
36
|
setIsClicked(false);
|
|
37
37
|
}
|
|
38
38
|
}, [isSelected, isReadOnly]);
|
|
39
|
+
const {
|
|
40
|
+
font_size = null,
|
|
41
|
+
font = null,
|
|
42
|
+
bold = null,
|
|
43
|
+
italic = null,
|
|
44
|
+
underline = null,
|
|
45
|
+
color = null,
|
|
46
|
+
highlight_color = null,
|
|
47
|
+
strikethrough = null
|
|
48
|
+
} = element.children[0];
|
|
39
49
|
const style = {
|
|
40
50
|
margin: '0 10px',
|
|
41
51
|
border: '1px solid transparent',
|
|
52
|
+
userSelect: 'none',
|
|
42
53
|
...(isClicked && {
|
|
43
54
|
border: '1px solid red'
|
|
55
|
+
}),
|
|
56
|
+
...(font_size && {
|
|
57
|
+
fontSize: font_size
|
|
58
|
+
}),
|
|
59
|
+
...(font && {
|
|
60
|
+
fontFamily: font
|
|
61
|
+
}),
|
|
62
|
+
...(bold && {
|
|
63
|
+
fontWeight: 600
|
|
64
|
+
}),
|
|
65
|
+
...(italic && {
|
|
66
|
+
fontStyle: 'italic'
|
|
67
|
+
}),
|
|
68
|
+
...(underline && {
|
|
69
|
+
textDecoration: 'underline'
|
|
70
|
+
}),
|
|
71
|
+
...(color && {
|
|
72
|
+
color: color
|
|
73
|
+
}),
|
|
74
|
+
...(highlight_color && {
|
|
75
|
+
backgroundColor: highlight_color
|
|
76
|
+
}),
|
|
77
|
+
...(strikethrough && {
|
|
78
|
+
textDecoration: 'line-through'
|
|
44
79
|
})
|
|
45
80
|
};
|
|
46
81
|
return /*#__PURE__*/_react.default.createElement("span", Object.assign({}, attributes, {
|
|
@@ -16,7 +16,7 @@ const isMenuDisabled = (editor, readonly) => {
|
|
|
16
16
|
match: n => {
|
|
17
17
|
const type = (0, _core.getNodeType)(n);
|
|
18
18
|
if (type === _elementType.CODE_BLOCK) return true; // Code block
|
|
19
|
-
if (_slate.Editor.isVoid(editor, n)) return true; // void node
|
|
19
|
+
if (_slate.Editor.isVoid(editor, n) && (n === null || n === void 0 ? void 0 : n.type) !== _elementType.SEATABLE_COLUMN) return true; // void node
|
|
20
20
|
|
|
21
21
|
return false;
|
|
22
22
|
},
|
|
@@ -49,6 +49,10 @@ const TextStyleMenuList = _ref => {
|
|
|
49
49
|
return (0, _helpers2.isMenuDisabled)(editor, readonly);
|
|
50
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
51
|
}, [editor, readonly]);
|
|
52
|
+
const isSelectedSeaTableColumn = (0, _react.useCallback)(() => {
|
|
53
|
+
const entery = (0, _core.getSelectedNodeByType)(editor, _constants.SEATABLE_COLUMN);
|
|
54
|
+
return !!entery;
|
|
55
|
+
}, [editor]);
|
|
52
56
|
const openLinkDialog = (0, _react.useCallback)(() => {
|
|
53
57
|
const eventBus = _eventBus.default.getInstance();
|
|
54
58
|
eventBus.dispatch(_constants2.INTERNAL_EVENT.INSERT_ELEMENT, {
|
|
@@ -99,11 +103,16 @@ const TextStyleMenuList = _ref => {
|
|
|
99
103
|
}, [editor, selectedFontSize, selectedFontSizeValue]);
|
|
100
104
|
const getTextStyleList = (0, _react.useCallback)(key => {
|
|
101
105
|
return _constants.MENUS_CONFIG_MAP[key].map(item => {
|
|
106
|
+
let disable = isDisabled();
|
|
107
|
+
const disableTypes = [_constants.TEXT_STYLE_MAP.CODE, _constants.TEXT_STYLE_MAP.LINK, _constants.TEXT_STYLE_MAP.SUPERSCRIPT, _constants.TEXT_STYLE_MAP.SUBSCRIPT];
|
|
108
|
+
if (disableTypes.includes(item.type)) {
|
|
109
|
+
disable = isSelectedSeaTableColumn() ? true : disable;
|
|
110
|
+
}
|
|
102
111
|
let itemProps = {
|
|
103
112
|
isRichEditor,
|
|
104
113
|
className,
|
|
105
114
|
ariaLabel: item === null || item === void 0 ? void 0 : item.ariaLabel,
|
|
106
|
-
disabled:
|
|
115
|
+
disabled: disable,
|
|
107
116
|
isActive: isActive(item.type),
|
|
108
117
|
onMouseDown: item.isColor ? () => {} : onMouseDown
|
|
109
118
|
};
|
|
@@ -134,7 +134,8 @@ const isVoidNode = node => {
|
|
|
134
134
|
const isCodeBlock = node.type === _constants.CODE_BLOCK;
|
|
135
135
|
const isCallout = node.type === _constants.CALL_OUT;
|
|
136
136
|
const isSeaTableTable = node.type === _constants.SEATABLE_TABLE;
|
|
137
|
-
|
|
137
|
+
const isSeaTableColumn = node.type === _constants.SEATABLE_COLUMN;
|
|
138
|
+
return _slate.Node.string(node) === '' && !hasImage && !isVideo && !isTable && !isCodeBlock && !isCallout && !isSeaTableTable && !isSeaTableColumn;
|
|
138
139
|
};
|
|
139
140
|
exports.isVoidNode = isVoidNode;
|
|
140
141
|
const isNotSupportTransform = node => {
|