@seafile/sdoc-editor 1.0.219 → 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 +7 -7
|
@@ -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 => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.221",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"remark-rehype": "11.0.0",
|
|
40
40
|
"remark-stringify": "11.0.0",
|
|
41
41
|
"slugid": "3.2.0",
|
|
42
|
-
"socket.io-client": "4.
|
|
42
|
+
"socket.io-client": "4.8.1",
|
|
43
43
|
"type-of": "2.0.1",
|
|
44
44
|
"unified": "11.0.3",
|
|
45
45
|
"url-join": "4.0.1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"css-minimizer-webpack-plugin": "5.0.1",
|
|
101
101
|
"dotenv": "^10.0.0",
|
|
102
102
|
"dotenv-expand": "^5.1.0",
|
|
103
|
-
"dtable-sdk": "5.0.
|
|
103
|
+
"dtable-sdk": "5.0.6",
|
|
104
104
|
"dtable-utils": "5.0.1",
|
|
105
105
|
"ejs": "3.1.10",
|
|
106
106
|
"eslint": "^8.3.0",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"koa-router": "7.3.0",
|
|
122
122
|
"koa-send": "5.0.1",
|
|
123
123
|
"koa2-cors": "2.0.6",
|
|
124
|
-
"lint-staged": "
|
|
124
|
+
"lint-staged": "15.4.3",
|
|
125
125
|
"mini-css-extract-plugin": "^2.4.5",
|
|
126
126
|
"node-polyfill-webpack-plugin": "2.0.1",
|
|
127
127
|
"postcss": "^8.4.31",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"react-refresh": "^0.11.0",
|
|
142
142
|
"release-it": "17.3.0",
|
|
143
143
|
"resolve": "^1.20.0",
|
|
144
|
-
"resolve-url-loader": "
|
|
144
|
+
"resolve-url-loader": "5.0.0",
|
|
145
145
|
"sass-loader": "^12.3.0",
|
|
146
146
|
"seafile-js": "0.2.235",
|
|
147
147
|
"source-map-loader": "^3.0.0",
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"terser-webpack-plugin": "^5.2.5",
|
|
151
151
|
"url-loader": "^4.1.1",
|
|
152
152
|
"web-vitals": "2.1.4",
|
|
153
|
-
"webpack": "5.
|
|
154
|
-
"webpack-dev-server": "
|
|
153
|
+
"webpack": "5.98.0",
|
|
154
|
+
"webpack-dev-server": "5.2.0",
|
|
155
155
|
"webpack-manifest-plugin": "5.0.0",
|
|
156
156
|
"webpack-merge": "5.8.0",
|
|
157
157
|
"workbox-webpack-plugin": "7.0.0"
|