@seafile/seafile-editor 1.0.15 → 1.0.16
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/editors/simple-slate-editor /index.js +6 -3
- package/dist/editors/simple-slate-editor /style.css +1 -0
- package/dist/editors/simple-slate-editor /with-props-editor.js +4 -1
- package/dist/editors/slate-viewer/index.js +9 -6
- package/dist/extension/commons/index.js +2 -1
- package/dist/extension/commons/select/_option.js +32 -0
- package/dist/extension/commons/select/field-setting.js +102 -0
- package/dist/extension/commons/select/index.js +135 -0
- package/dist/extension/commons/select/menu/index.js +4 -0
- package/dist/extension/commons/select/menu/item.js +32 -0
- package/dist/extension/commons/select/menu/menu.js +27 -0
- package/dist/extension/commons/select/menu/style.css +43 -0
- package/dist/extension/commons/select/style.css +149 -0
- package/dist/extension/constants/menus-config.js +6 -1
- package/dist/extension/editor.js +11 -1
- package/dist/extension/index.js +2 -2
- package/dist/extension/plugins/code-block/render-elem/language-selector.js +1 -1
- package/dist/extension/plugins/column/constants/cell-types.js +29 -0
- package/dist/extension/plugins/column/constants/column.js +28 -0
- package/dist/extension/plugins/column/helpers.js +62 -0
- package/dist/extension/plugins/column/index.js +12 -0
- package/dist/extension/plugins/column/menu/index.js +28 -0
- package/dist/extension/plugins/column/model.js +15 -0
- package/dist/extension/plugins/column/plugin.js +24 -0
- package/dist/extension/plugins/column/render-elem.js +101 -0
- package/dist/extension/plugins/index.js +3 -2
- package/dist/extension/render/render-element.js +6 -1
- package/dist/extension/toolbar/header-toolbar/index.js +4 -2
- package/dist/index.js +4 -1
- package/dist/pages/seatable-editor.js +54 -0
- package/dist/pages/seatable-viewer.js +2 -0
- package/dist/slate-convert/html-to-slate/index.js +0 -1
- package/dist/slate-convert/md-to-slate/transform.js +4 -2
- package/dist/slate-convert/slate-to-md/transform.js +9 -1
- package/dist/utils/replace-slate-nodes.js +40 -0
- package/package.json +2 -1
- package/public/media/dtable-font.css +1566 -0
- package/public/media/dtable-fonts/dtable-font.eot +0 -0
- package/public/media/dtable-fonts/dtable-font.svg +793 -0
- package/public/media/dtable-fonts/dtable-font.ttf +0 -0
- package/public/media/dtable-fonts/dtable-font.woff +0 -0
- package/public/media/dtable-fonts/dtable-font.woff2 +0 -0
- package/public/media/seafile-editor-font/iconfont.eot +0 -0
- package/public/media/seafile-editor-font/iconfont.svg +6 -0
- package/public/media/seafile-editor-font/iconfont.ttf +0 -0
- package/public/media/seafile-editor-font/iconfont.woff +0 -0
- package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
- package/public/media/seafile-editor-font.css +19 -7
|
@@ -14,14 +14,16 @@ export default function SimpleSlateEditor(_ref) {
|
|
|
14
14
|
value,
|
|
15
15
|
editorApi,
|
|
16
16
|
onSave,
|
|
17
|
+
columns,
|
|
17
18
|
onContentChanged,
|
|
18
19
|
isSupportFormula
|
|
19
20
|
} = _ref;
|
|
20
21
|
const [slateValue, setSlateValue] = useState(value);
|
|
21
22
|
const editor = useMemo(() => withPropsEditor(baseEditor, {
|
|
22
23
|
editorApi,
|
|
23
|
-
onSave
|
|
24
|
-
|
|
24
|
+
onSave,
|
|
25
|
+
columns
|
|
26
|
+
}), [columns, editorApi, onSave]);
|
|
25
27
|
const eventProxy = useMemo(() => {
|
|
26
28
|
return new EventProxy(editor);
|
|
27
29
|
}, [editor]);
|
|
@@ -69,7 +71,8 @@ export default function SimpleSlateEditor(_ref) {
|
|
|
69
71
|
className: "sf-simple-slate-editor-container"
|
|
70
72
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
71
73
|
editor: editor,
|
|
72
|
-
isSupportFormula: isSupportFormula
|
|
74
|
+
isSupportFormula: isSupportFormula,
|
|
75
|
+
isSupportColumn: !!columns
|
|
73
76
|
}), /*#__PURE__*/React.createElement("div", {
|
|
74
77
|
className: "sf-slate-editor-content"
|
|
75
78
|
}, /*#__PURE__*/React.createElement(Slate, {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
const withPropsEditor = function (editor) {
|
|
2
2
|
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3
|
-
|
|
3
|
+
let newEditor = editor;
|
|
4
4
|
if (props.editorApi) {
|
|
5
5
|
newEditor.api = props.editorApi;
|
|
6
6
|
}
|
|
7
7
|
if (props.onSave) {
|
|
8
8
|
newEditor.onSave = props.onSave;
|
|
9
9
|
}
|
|
10
|
+
if (props.columns) {
|
|
11
|
+
newEditor.columns = props.columns;
|
|
12
|
+
}
|
|
10
13
|
return newEditor;
|
|
11
14
|
};
|
|
12
15
|
export default withPropsEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import { SetNodeToDecorations,
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { SetNodeToDecorations, createSlateEditor, renderElement, renderLeaf, useHighlight } from '../../extension';
|
|
3
3
|
import { Editable, Slate } from 'slate-react';
|
|
4
4
|
import Outline from '../../containers/outline';
|
|
5
5
|
import { ScrollContext } from '../../hooks/use-scroll-context';
|
|
@@ -13,17 +13,20 @@ export default function SlateViewer(_ref) {
|
|
|
13
13
|
scrollRef: externalScrollRef
|
|
14
14
|
} = _ref;
|
|
15
15
|
const scrollRef = useRef(null);
|
|
16
|
+
const editor = useMemo(() => {
|
|
17
|
+
return createSlateEditor();
|
|
18
|
+
}, []);
|
|
16
19
|
const containerScrollRef = externalScrollRef ? externalScrollRef : scrollRef;
|
|
17
|
-
const decorate = useHighlight(
|
|
20
|
+
const decorate = useHighlight(editor);
|
|
18
21
|
|
|
19
22
|
// willUnmount
|
|
20
23
|
useEffect(() => {
|
|
21
24
|
return () => {
|
|
22
|
-
|
|
25
|
+
editor.selection = null;
|
|
23
26
|
};
|
|
24
27
|
});
|
|
25
28
|
return /*#__PURE__*/React.createElement(Slate, {
|
|
26
|
-
editor:
|
|
29
|
+
editor: editor,
|
|
27
30
|
initialValue: value
|
|
28
31
|
}, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
|
|
29
32
|
value: {
|
|
@@ -44,6 +47,6 @@ export default function SlateViewer(_ref) {
|
|
|
44
47
|
}))), isShowOutline && /*#__PURE__*/React.createElement("div", {
|
|
45
48
|
className: "sf-slate-viewer-outline"
|
|
46
49
|
}, /*#__PURE__*/React.createElement(Outline, {
|
|
47
|
-
editor:
|
|
50
|
+
editor: editor
|
|
48
51
|
})))));
|
|
49
52
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
class Option extends React.Component {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
_defineProperty(this, "onClick", event => {
|
|
7
|
+
event.stopPropagation();
|
|
8
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
9
|
+
const {
|
|
10
|
+
option
|
|
11
|
+
} = this.props;
|
|
12
|
+
this.props.onOptionChanged(option);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
const {
|
|
17
|
+
option,
|
|
18
|
+
isActive,
|
|
19
|
+
optionClass
|
|
20
|
+
} = this.props;
|
|
21
|
+
const className = "option-item ".concat(optionClass || '', " ").concat(isActive ? 'active' : '');
|
|
22
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: className,
|
|
24
|
+
onClick: this.onClick
|
|
25
|
+
}, option.iconClass && /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
className: "item-icon ".concat(option.iconClass)
|
|
27
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
28
|
+
className: "label"
|
|
29
|
+
}, option.label));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export default Option;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Menu from './menu';
|
|
4
|
+
import { withTranslation } from 'react-i18next';
|
|
5
|
+
class FieldSetting extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
_defineProperty(this, "onMouseEnter", () => {
|
|
9
|
+
if (!this.props.option) return;
|
|
10
|
+
const container = this.settingRef;
|
|
11
|
+
const {
|
|
12
|
+
height,
|
|
13
|
+
width
|
|
14
|
+
} = container.getBoundingClientRect();
|
|
15
|
+
const position = {
|
|
16
|
+
height,
|
|
17
|
+
width
|
|
18
|
+
};
|
|
19
|
+
this.setState({
|
|
20
|
+
isShowMenu: true,
|
|
21
|
+
position
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
_defineProperty(this, "onMouseLeave", () => {
|
|
25
|
+
this.setState({
|
|
26
|
+
isShowMenu: false
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
_defineProperty(this, "onBoldClick", event => {
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
const {
|
|
32
|
+
option
|
|
33
|
+
} = this.props;
|
|
34
|
+
const newOption = {
|
|
35
|
+
...option,
|
|
36
|
+
bold: !option.bold
|
|
37
|
+
};
|
|
38
|
+
this.props.onUpdateOption(newOption);
|
|
39
|
+
});
|
|
40
|
+
_defineProperty(this, "onItalicClick", event => {
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
const {
|
|
43
|
+
option
|
|
44
|
+
} = this.props;
|
|
45
|
+
const newOption = {
|
|
46
|
+
...option,
|
|
47
|
+
italic: !option.italic
|
|
48
|
+
};
|
|
49
|
+
this.props.onUpdateOption(newOption);
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(this, "setSettingRef", ref => {
|
|
52
|
+
this.settingRef = ref;
|
|
53
|
+
});
|
|
54
|
+
this.state = {
|
|
55
|
+
isShowMenu: false,
|
|
56
|
+
position: {
|
|
57
|
+
top: 0,
|
|
58
|
+
left: 0
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
const {
|
|
64
|
+
option,
|
|
65
|
+
t
|
|
66
|
+
} = this.props;
|
|
67
|
+
const isDisable = !option;
|
|
68
|
+
const {
|
|
69
|
+
bold: isBold,
|
|
70
|
+
italic: isItalic
|
|
71
|
+
} = option || {};
|
|
72
|
+
const {
|
|
73
|
+
isShowMenu
|
|
74
|
+
} = this.state;
|
|
75
|
+
const className = "sf-field-setting ".concat(isDisable ? 'disable' : '', " option-item");
|
|
76
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
77
|
+
ref: this.setSettingRef,
|
|
78
|
+
className: className,
|
|
79
|
+
onMouseEnter: this.onMouseEnter,
|
|
80
|
+
onMouseLeave: this.onMouseLeave
|
|
81
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
className: "iconfont icon-text-style"
|
|
83
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
84
|
+
className: "label"
|
|
85
|
+
}, t('Font_style')), /*#__PURE__*/React.createElement("span", {
|
|
86
|
+
className: "icon-container"
|
|
87
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
88
|
+
className: "iconfont icon-caret-up op-icon"
|
|
89
|
+
})), isShowMenu && /*#__PURE__*/React.createElement(Menu, {
|
|
90
|
+
position: this.state.position
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
92
|
+
iconClass: 'iconfont icon-bold',
|
|
93
|
+
isChecked: isBold,
|
|
94
|
+
onClick: this.onBoldClick
|
|
95
|
+
}, t('bold')), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
96
|
+
iconClass: 'iconfont icon-italic',
|
|
97
|
+
isChecked: isItalic,
|
|
98
|
+
onClick: this.onItalicClick
|
|
99
|
+
}, t('italic'))));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export default withTranslation('seafile-editor')(FieldSetting);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Option from './_option';
|
|
4
|
+
import FieldSetting from './field-setting';
|
|
5
|
+
import './style.css';
|
|
6
|
+
class Select extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
_defineProperty(this, "handleSelector", event => {
|
|
10
|
+
if (this.selector && !this.selector.contains(event.target)) {
|
|
11
|
+
this.setState({
|
|
12
|
+
isShowSelector: false
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
_defineProperty(this, "getCurrentOption", () => {
|
|
17
|
+
const {
|
|
18
|
+
value,
|
|
19
|
+
options
|
|
20
|
+
} = this.props;
|
|
21
|
+
const currentOption = value && options.find(option => option.value === value.value);
|
|
22
|
+
return currentOption;
|
|
23
|
+
});
|
|
24
|
+
_defineProperty(this, "onSelectToggle", event => {
|
|
25
|
+
const {
|
|
26
|
+
isShowSelector
|
|
27
|
+
} = this.state;
|
|
28
|
+
const newValue = !isShowSelector;
|
|
29
|
+
if (newValue) {
|
|
30
|
+
this.dropdownContainerHasInit = false;
|
|
31
|
+
}
|
|
32
|
+
this.setState({
|
|
33
|
+
isShowSelector: newValue
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
_defineProperty(this, "onChange", option => {
|
|
37
|
+
this.setState({
|
|
38
|
+
isShowSelector: false,
|
|
39
|
+
currentOption: option
|
|
40
|
+
});
|
|
41
|
+
this.props.onChange(option);
|
|
42
|
+
});
|
|
43
|
+
_defineProperty(this, "onUpdateOption", option => {
|
|
44
|
+
this.setState({
|
|
45
|
+
currentOption: option
|
|
46
|
+
});
|
|
47
|
+
this.props.onChange(option);
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(this, "setContainerRef", ref => {
|
|
50
|
+
this.dropdownContainer = ref;
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(this, "setSelectorRef", ref => {
|
|
53
|
+
this.selector = ref;
|
|
54
|
+
});
|
|
55
|
+
this.state = {
|
|
56
|
+
isShowSelector: false,
|
|
57
|
+
currentOption: this.getCurrentOption()
|
|
58
|
+
};
|
|
59
|
+
this.dropdownContainerHasInit = false;
|
|
60
|
+
}
|
|
61
|
+
componentDidMount() {
|
|
62
|
+
document.addEventListener('click', this.handleSelector);
|
|
63
|
+
}
|
|
64
|
+
componentWillUnmount() {
|
|
65
|
+
document.removeEventListener('click', this.handleSelector);
|
|
66
|
+
}
|
|
67
|
+
componentDidUpdate() {
|
|
68
|
+
const {
|
|
69
|
+
options
|
|
70
|
+
} = this.props;
|
|
71
|
+
const {
|
|
72
|
+
currentOption
|
|
73
|
+
} = this.state;
|
|
74
|
+
const activeIndex = currentOption && options.findIndex(option => option.value === currentOption.value);
|
|
75
|
+
if (activeIndex > -1) {
|
|
76
|
+
const scrollTop = 48 + (activeIndex + 1) * 32 - 150;
|
|
77
|
+
if (scrollTop < 0) return;
|
|
78
|
+
if (this.dropdownContainer && !this.dropdownContainerHasInit) {
|
|
79
|
+
this.dropdownContainerHasInit = true;
|
|
80
|
+
this.dropdownContainer.scrollTop = scrollTop;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
const {
|
|
86
|
+
selectClass,
|
|
87
|
+
optionClass,
|
|
88
|
+
isSelected,
|
|
89
|
+
options,
|
|
90
|
+
placeholder
|
|
91
|
+
} = this.props;
|
|
92
|
+
const {
|
|
93
|
+
currentOption,
|
|
94
|
+
isShowSelector
|
|
95
|
+
} = this.state;
|
|
96
|
+
const isActive = isShowSelector || isSelected;
|
|
97
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
ref: this.setSelectorRef,
|
|
99
|
+
className: "select-container ".concat(selectClass || '')
|
|
100
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
className: "control-container ".concat(isActive ? 'active' : ''),
|
|
102
|
+
onClick: this.onSelectToggle
|
|
103
|
+
}, !currentOption && /*#__PURE__*/React.createElement("span", {
|
|
104
|
+
className: "label placeholder"
|
|
105
|
+
}, placeholder), currentOption && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
106
|
+
className: "control-icon ".concat(currentOption.iconClass)
|
|
107
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
108
|
+
className: "control-label"
|
|
109
|
+
}, currentOption.label)), /*#__PURE__*/React.createElement("span", {
|
|
110
|
+
className: "operation"
|
|
111
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
112
|
+
className: "iconfont icon-drop-down arrow"
|
|
113
|
+
}))), isShowSelector && /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
className: "select-popover"
|
|
115
|
+
}, /*#__PURE__*/React.createElement(FieldSetting, {
|
|
116
|
+
option: currentOption,
|
|
117
|
+
onUpdateOption: this.onUpdateOption
|
|
118
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
119
|
+
className: "option-item-divider"
|
|
120
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
121
|
+
className: "option-item-wrapper",
|
|
122
|
+
ref: this.setContainerRef
|
|
123
|
+
}, options.map(option => {
|
|
124
|
+
const isActive = option.value === (currentOption && currentOption.value);
|
|
125
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
126
|
+
key: option.value,
|
|
127
|
+
optionClass: optionClass,
|
|
128
|
+
isActive: isActive,
|
|
129
|
+
option: option,
|
|
130
|
+
onOptionChanged: this.onChange
|
|
131
|
+
});
|
|
132
|
+
}))));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export default Select;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './style.css';
|
|
4
|
+
class MenuItem extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
_defineProperty(this, "onClick", e => {
|
|
8
|
+
this.props.onClick(e);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
const {
|
|
13
|
+
children,
|
|
14
|
+
itemClass,
|
|
15
|
+
iconClass,
|
|
16
|
+
isChecked
|
|
17
|
+
} = this.props;
|
|
18
|
+
const containerClass = "sf-menu-item ".concat(itemClass || '');
|
|
19
|
+
const itemIconClass = "menu-item-icon ".concat(iconClass || '');
|
|
20
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: containerClass,
|
|
22
|
+
onClick: this.onClick
|
|
23
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
24
|
+
className: itemIconClass
|
|
25
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
className: "menu-item-name"
|
|
27
|
+
}, children), isChecked && /*#__PURE__*/React.createElement("span", {
|
|
28
|
+
className: "iconfont icon-check-mark"
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export default MenuItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
class Menu extends React.Component {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
_defineProperty(this, "getStyle", () => {
|
|
7
|
+
const {
|
|
8
|
+
position
|
|
9
|
+
} = this.props;
|
|
10
|
+
const {
|
|
11
|
+
width
|
|
12
|
+
} = position;
|
|
13
|
+
return {
|
|
14
|
+
marginLeft: width - 10,
|
|
15
|
+
marginTop: '30px'
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
const style = this.getStyle();
|
|
21
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
22
|
+
className: "sf-menu-container",
|
|
23
|
+
style: style
|
|
24
|
+
}, this.props.children);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default Menu;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.sf-menu-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 150px;
|
|
6
|
+
padding: 8px 0;
|
|
7
|
+
min-width: 80px;
|
|
8
|
+
overflow-y: auto;
|
|
9
|
+
overflow-x: hidden;
|
|
10
|
+
border: 1px solid #e5e5e5;
|
|
11
|
+
box-shadow: 0 4px 10px #eee;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
background: #fff;
|
|
14
|
+
color: #333;
|
|
15
|
+
z-index: 1080;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sf-menu-container .sf-menu-item {
|
|
19
|
+
height: 32px;
|
|
20
|
+
line-height: 32px;
|
|
21
|
+
display: flex;
|
|
22
|
+
padding: 0 10px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
position: relative;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sf-menu-container .sf-menu-item:hover {
|
|
28
|
+
background-color: #f5f5f5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sf-menu-container .sf-menu-item .menu-item-icon {
|
|
32
|
+
margin-right: 5px;
|
|
33
|
+
color: #aaa;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sf-menu-container .sf-menu-item .icon-check-mark {
|
|
37
|
+
position: absolute;
|
|
38
|
+
right: 10px;
|
|
39
|
+
height: 32px;
|
|
40
|
+
line-height: 32px;
|
|
41
|
+
font-size: 13px;
|
|
42
|
+
color: #aaa;
|
|
43
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
.select-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
margin: 0 5px;
|
|
5
|
+
font-weight: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.select-container .control-container {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
border: 1px solid #ccc;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
padding: 0 10px;
|
|
15
|
+
height: 24px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
line-height: 1.5;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.select-container .control-container.active,
|
|
23
|
+
.select-container .control-container:hover {
|
|
24
|
+
border: 1px solid #3C88FD;
|
|
25
|
+
box-shadow: 0 0 0 2px rgb(70 127 207 / 25%);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.select-container .control-container .placeholder {
|
|
29
|
+
color: #BFBFBF;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.select-container .control-container .control-icon {
|
|
33
|
+
font-size: 13px;
|
|
34
|
+
color: rgb(170, 170, 170);
|
|
35
|
+
cursor: default;
|
|
36
|
+
margin-right: 5px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.select-container .control-container .operation {
|
|
40
|
+
margin-left: 8px;
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.select-container .control-container .arrow {
|
|
47
|
+
color: #949494;
|
|
48
|
+
display: inline-block;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
transform: scale(.8);
|
|
51
|
+
transition: all .1s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.select-container .control-container .arrow:hover {
|
|
55
|
+
color: #666;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.select-container .select-popover {
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 0;
|
|
61
|
+
display: flex;
|
|
62
|
+
min-width: 80px;
|
|
63
|
+
max-height: 265px;
|
|
64
|
+
margin-top: 4px;
|
|
65
|
+
padding: 8px 0;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
border: 1px solid #e5e5e5;
|
|
68
|
+
box-shadow: 0 4px 10px #eee;
|
|
69
|
+
border-radius: 4px;
|
|
70
|
+
background: #fff;
|
|
71
|
+
z-index: 10;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.select-popover .option-item-divider {
|
|
75
|
+
margin-top: 8px;
|
|
76
|
+
border-top: 1px solid #EFEFEF;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.select-popover .sf-field-setting {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
position: relative;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.select-popover .sf-field-setting .icon-container {
|
|
86
|
+
position: absolute;
|
|
87
|
+
right: 10px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.select-popover .sf-field-setting .icon-text-style {
|
|
94
|
+
font-size: 14px;
|
|
95
|
+
color: #aaa;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.select-popover .sf-field-setting .op-icon {
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
transform: rotate(90deg);
|
|
101
|
+
color: #aaa;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.select-popover .option-item-wrapper {
|
|
105
|
+
flex: 1;
|
|
106
|
+
min-height: 0;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
overflow: auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.select-popover .option-item {
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
min-width: 80px;
|
|
116
|
+
height: 32px;
|
|
117
|
+
padding: 0 12px;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
overflow-wrap: normal;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.select-popover .option-item:hover {
|
|
124
|
+
background-color: #F5F5F5;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.select-popover .option-item.active {
|
|
128
|
+
background-color: #39A0FF;
|
|
129
|
+
color: #fff;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.select-popover .option-item.disable {
|
|
133
|
+
color: #aaa;
|
|
134
|
+
cursor: default;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.select-popover .option-item .item-icon {
|
|
138
|
+
font-size: 14px;
|
|
139
|
+
color: rgb(170, 170, 170);
|
|
140
|
+
cursor: default;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.select-popover .option-item.active .item-icon {
|
|
144
|
+
color: #fff;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.select-popover .option-item .label {
|
|
148
|
+
margin: 0 5px;
|
|
149
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BLOCKQUOTE, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, TABLE, LINK, IMAGE, FORMULA } from './element-types';
|
|
1
|
+
import { BLOCKQUOTE, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, TABLE, LINK, IMAGE, FORMULA, COLUMN } from './element-types';
|
|
2
2
|
const BOLD = 'bold';
|
|
3
3
|
const ITALIC = 'italic';
|
|
4
4
|
const UNDERLINE = 'underline';
|
|
@@ -130,5 +130,10 @@ export const MENUS_CONFIG_MAP = {
|
|
|
130
130
|
id: "seafile_".concat(CLEAR_FORMAT),
|
|
131
131
|
iconClass: 'iconfont icon-clear-format',
|
|
132
132
|
text: 'Clear_format'
|
|
133
|
+
},
|
|
134
|
+
[COLUMN]: {
|
|
135
|
+
id: "seafile_".concat(COLUMN),
|
|
136
|
+
iconClass: 'iconfont icon-choose-column',
|
|
137
|
+
text: 'Insert_column'
|
|
133
138
|
}
|
|
134
139
|
};
|
package/dist/extension/editor.js
CHANGED
|
@@ -9,4 +9,14 @@ const baseEditor = Plugins.reduce((editor, pluginItem) => {
|
|
|
9
9
|
}
|
|
10
10
|
return editor;
|
|
11
11
|
}, withHistory(withReact(createEditor())));
|
|
12
|
-
|
|
12
|
+
const createSlateEditor = () => {
|
|
13
|
+
const editor = Plugins.reduce((editor, pluginItem) => {
|
|
14
|
+
const withPlugin = pluginItem.editorPlugin;
|
|
15
|
+
if (withPlugin) {
|
|
16
|
+
return withPlugin(editor);
|
|
17
|
+
}
|
|
18
|
+
return editor;
|
|
19
|
+
}, withHistory(withReact(createEditor())));
|
|
20
|
+
return editor;
|
|
21
|
+
};
|
|
22
|
+
export { baseEditor, createSlateEditor };
|
package/dist/extension/index.js
CHANGED
|
@@ -4,5 +4,5 @@ import { useHighlight, SetNodeToDecorations } from './highlight';
|
|
|
4
4
|
import renderElement from './render/render-element';
|
|
5
5
|
import renderLeaf from './render/render-leaf';
|
|
6
6
|
import { Toolbar } from './toolbar';
|
|
7
|
-
import baseEditor from './editor';
|
|
8
|
-
export { ELementTypes, isEmptyParagraph, renderElement, renderLeaf, Toolbar, baseEditor, useHighlight, SetNodeToDecorations };
|
|
7
|
+
import { baseEditor, createSlateEditor } from './editor';
|
|
8
|
+
export { ELementTypes, isEmptyParagraph, renderElement, renderLeaf, Toolbar, baseEditor, createSlateEditor, useHighlight, SetNodeToDecorations };
|
|
@@ -22,7 +22,7 @@ const LanguageSelector = _ref => {
|
|
|
22
22
|
return /*#__PURE__*/React.createElement("select", {
|
|
23
23
|
name: "language",
|
|
24
24
|
className: "sf-lang-selector",
|
|
25
|
-
value: lang,
|
|
25
|
+
value: lang || '',
|
|
26
26
|
onChange: e => handleLangSelectorChange(e.target.value)
|
|
27
27
|
}, langOptions);
|
|
28
28
|
};
|