@seafile/seafile-editor 1.0.84 → 1.0.85-beta1
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 → simple-slate-editor/index.js} +35 -12
- package/dist/extension/commons/expand-editor-menu.js +28 -0
- package/dist/extension/commons/index.js +15 -1
- package/dist/extension/commons/menu/menu.css +5 -1
- package/dist/extension/commons/more-menu/index.css +28 -0
- package/dist/extension/commons/more-menu/index.js +46 -0
- package/dist/extension/constants/menus-config.js +13 -1
- package/dist/extension/editor.js +8 -1
- package/dist/extension/index.js +12 -0
- package/dist/extension/toolbar/index.js +8 -1
- package/dist/extension/toolbar/inline-toolbar/index.css +40 -0
- package/dist/extension/toolbar/inline-toolbar/index.js +85 -0
- package/dist/index.js +7 -0
- package/dist/pages/longtext-inline-editor/ClickOutside/index.js +86 -0
- package/dist/pages/longtext-inline-editor/editor.js +135 -0
- package/dist/pages/longtext-inline-editor/formatter/index.css +31 -0
- package/dist/pages/longtext-inline-editor/formatter/index.js +66 -0
- package/dist/pages/longtext-inline-editor/index.css +71 -0
- package/dist/pages/longtext-inline-editor/index.js +128 -0
- package/dist/pages/seatable-editor.js +1 -1
- package/dist/pages/simple-editor.js +7 -3
- package/package.json +1 -1
- package/public/locales/cs/seafile-editor.json +2 -1
- package/public/locales/de/seafile-editor.json +2 -1
- package/public/locales/en/seafile-editor.json +6 -1
- package/public/locales/es/seafile-editor.json +2 -1
- package/public/locales/fr/seafile-editor.json +2 -1
- package/public/locales/it/seafile-editor.json +2 -1
- package/public/locales/ru/seafile-editor.json +2 -1
- package/public/locales/zh_CN/seafile-editor.json +2 -1
- package/public/media/seafile-editor-font/iconfont.eot +0 -0
- package/public/media/seafile-editor-font/iconfont.svg +2 -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 +10 -6
- package/readme.md +115 -24
- /package/dist/editors/{simple-slate-editor → simple-slate-editor}/style.css +0 -0
- /package/dist/editors/{simple-slate-editor → simple-slate-editor}/with-props-editor.js +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _simpleEditor = _interopRequireDefault(require("../simple-editor"));
|
|
11
|
+
var _getPreviewContent = _interopRequireDefault(require("../../utils/get-preview-content"));
|
|
12
|
+
var _markdownPreview = _interopRequireDefault(require("../markdown-preview"));
|
|
13
|
+
var _longtextEditorDialog = _interopRequireDefault(require("../longtext-editor-dialog"));
|
|
14
|
+
require("./index.css");
|
|
15
|
+
const Editor = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
lang,
|
|
18
|
+
headerName,
|
|
19
|
+
value: propsValue,
|
|
20
|
+
isWindowsWechat,
|
|
21
|
+
focusNodePath,
|
|
22
|
+
autoSave = true,
|
|
23
|
+
saveDelay = 60000,
|
|
24
|
+
isCheckBrowser = false,
|
|
25
|
+
editorApi,
|
|
26
|
+
onSaveEditorValue,
|
|
27
|
+
onEditorValueChanged
|
|
28
|
+
} = _ref;
|
|
29
|
+
const editorContainerRef = (0, _react.useRef)(null);
|
|
30
|
+
const editorRef = (0, _react.useRef)(null);
|
|
31
|
+
const [style, setStyle] = (0, _react.useState)({});
|
|
32
|
+
const [isValueChanged, setValueChanged] = (0, _react.useState)(false);
|
|
33
|
+
const [showExpandEditor, setShowExpandEditor] = (0, _react.useState)(false);
|
|
34
|
+
const [value, setValue] = (0, _react.useState)(typeof propsValue === 'string' ? {
|
|
35
|
+
text: propsValue
|
|
36
|
+
} : propsValue);
|
|
37
|
+
const saveValue = (0, _react.useCallback)(function (value) {
|
|
38
|
+
let save = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
39
|
+
setValueChanged(true);
|
|
40
|
+
setValue(value);
|
|
41
|
+
onEditorValueChanged && onEditorValueChanged(value);
|
|
42
|
+
if (!save) return;
|
|
43
|
+
onSaveEditorValue && onSaveEditorValue(value);
|
|
44
|
+
setValueChanged(false);
|
|
45
|
+
}, [onSaveEditorValue, onEditorValueChanged]);
|
|
46
|
+
const handelAutoSave = (0, _react.useCallback)(() => {
|
|
47
|
+
if (!isValueChanged) return;
|
|
48
|
+
saveValue(value, true);
|
|
49
|
+
}, [isValueChanged, value, saveValue]);
|
|
50
|
+
const onContentChanged = (0, _react.useCallback)(() => {
|
|
51
|
+
// delay to update editor's content
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
var _editorRef$current, _editorRef$current2;
|
|
54
|
+
// update parent's component cache value
|
|
55
|
+
const markdownString = (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.getValue();
|
|
56
|
+
const slateNodes = (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.getSlateValue();
|
|
57
|
+
const {
|
|
58
|
+
previewText,
|
|
59
|
+
images,
|
|
60
|
+
links,
|
|
61
|
+
checklist
|
|
62
|
+
} = (0, _getPreviewContent.default)(slateNodes, false);
|
|
63
|
+
const value = {
|
|
64
|
+
text: markdownString,
|
|
65
|
+
preview: previewText,
|
|
66
|
+
images: images,
|
|
67
|
+
links: links,
|
|
68
|
+
checklist
|
|
69
|
+
};
|
|
70
|
+
saveValue(value);
|
|
71
|
+
}, 0);
|
|
72
|
+
}, [saveValue]);
|
|
73
|
+
const openEditorDialog = (0, _react.useCallback)(() => {
|
|
74
|
+
const {
|
|
75
|
+
height
|
|
76
|
+
} = editorContainerRef.current.getBoundingClientRect();
|
|
77
|
+
setStyle({
|
|
78
|
+
height
|
|
79
|
+
});
|
|
80
|
+
setShowExpandEditor(true);
|
|
81
|
+
}, [editorContainerRef]);
|
|
82
|
+
const onCloseEditorDialog = (0, _react.useCallback)(value => {
|
|
83
|
+
value && saveValue(value);
|
|
84
|
+
setStyle({});
|
|
85
|
+
setShowExpandEditor(false);
|
|
86
|
+
}, [saveValue]);
|
|
87
|
+
(0, _react.useEffect)(() => {
|
|
88
|
+
let timer = null;
|
|
89
|
+
if (autoSave) {
|
|
90
|
+
timer = setTimeout(() => {
|
|
91
|
+
handelAutoSave();
|
|
92
|
+
}, saveDelay);
|
|
93
|
+
}
|
|
94
|
+
return () => {
|
|
95
|
+
timer && clearTimeout(timer);
|
|
96
|
+
};
|
|
97
|
+
}, [autoSave, saveDelay, handelAutoSave]);
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: "sf-long-text-inline-editor-container",
|
|
100
|
+
style: style,
|
|
101
|
+
ref: editorContainerRef
|
|
102
|
+
}, !showExpandEditor && !isWindowsWechat ? /*#__PURE__*/_react.default.createElement(_simpleEditor.default, {
|
|
103
|
+
isInline: true,
|
|
104
|
+
focusNodePath: focusNodePath,
|
|
105
|
+
ref: editorRef,
|
|
106
|
+
value: value.text,
|
|
107
|
+
onSave: handelAutoSave,
|
|
108
|
+
editorApi: editorApi,
|
|
109
|
+
onContentChanged: onContentChanged,
|
|
110
|
+
onExpandEditorToggle: openEditorDialog
|
|
111
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "sf-simple-slate-editor-container"
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
114
|
+
className: "sf-slate-editor-toolbar"
|
|
115
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
+
className: "sf-slate-editor-content"
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement(_markdownPreview.default, {
|
|
118
|
+
isWindowsWechat: isWindowsWechat,
|
|
119
|
+
value: value.text,
|
|
120
|
+
isShowOutline: false
|
|
121
|
+
})))), showExpandEditor && /*#__PURE__*/_react.default.createElement(_longtextEditorDialog.default, {
|
|
122
|
+
lang: lang,
|
|
123
|
+
readOnly: false,
|
|
124
|
+
headerName: headerName,
|
|
125
|
+
value: value.text,
|
|
126
|
+
autoSave: autoSave,
|
|
127
|
+
saveDelay: saveDelay,
|
|
128
|
+
isCheckBrowser: isCheckBrowser,
|
|
129
|
+
editorApi: editorApi,
|
|
130
|
+
onSaveEditorValue: saveValue,
|
|
131
|
+
onEditorValueChanged: saveValue,
|
|
132
|
+
onCloseEditorDialog: onCloseEditorDialog
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
var _default = exports.default = Editor;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.longtext-preview-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
padding: 16px;
|
|
5
|
+
overflow: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.longtext-preview-container .sf-slate-viewer-scroll-container {
|
|
9
|
+
overflow-y: auto;
|
|
10
|
+
height: fit-content;
|
|
11
|
+
padding: 0;
|
|
12
|
+
background: #fff;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.longtext-preview-container .sf-slate-viewer-article-container {
|
|
16
|
+
height: 100%;
|
|
17
|
+
width: 100%;
|
|
18
|
+
margin: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.longtext-preview-container .sf-slate-viewer-article-container .article {
|
|
22
|
+
padding: 0;
|
|
23
|
+
height: auto;
|
|
24
|
+
min-height: 100% !important;
|
|
25
|
+
border: 0;
|
|
26
|
+
color: #212529;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.longtext-preview-container .article :first-child {
|
|
30
|
+
margin-top: 0;
|
|
31
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _loading = _interopRequireDefault(require("../../../containers/loading"));
|
|
11
|
+
var _slateConvert = require("../../../slate-convert");
|
|
12
|
+
var _slateViewer = _interopRequireDefault(require("../../../editors/slate-viewer"));
|
|
13
|
+
require("./index.css");
|
|
14
|
+
// Windows old Wechat (3.0 or earlier) inner core is chrome 53 and don't support ECMA6, can't use seafile-editor markdownViewer
|
|
15
|
+
// Windows new Wechat (lastest version 3.3.5) support seafile-editor markdownViewer
|
|
16
|
+
// so use dangerouslySetInnerHTML to preview
|
|
17
|
+
class Formatter extends _react.default.PureComponent {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
(0, _defineProperty2.default)(this, "convertMarkdown", mdFile => {
|
|
21
|
+
_slateConvert.processor.process(mdFile).then(result => {
|
|
22
|
+
let innerHtml = String(result).replace(/<a /ig, '<a target="_blank" tabindex="-1"');
|
|
23
|
+
this.setState({
|
|
24
|
+
innerHtml
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
this.state = {
|
|
29
|
+
innerHtml: null
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
componentDidMount() {
|
|
33
|
+
const {
|
|
34
|
+
isWindowsWechat,
|
|
35
|
+
value
|
|
36
|
+
} = this.props;
|
|
37
|
+
if (isWindowsWechat) {
|
|
38
|
+
this.convertMarkdown(value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const {
|
|
43
|
+
isWindowsWechat,
|
|
44
|
+
value,
|
|
45
|
+
isShowOutline
|
|
46
|
+
} = this.props;
|
|
47
|
+
const {
|
|
48
|
+
innerHtml
|
|
49
|
+
} = this.state;
|
|
50
|
+
if (isWindowsWechat && innerHtml === null) {
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement(_loading.default, null);
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
className: "longtext-preview-container"
|
|
55
|
+
}, isWindowsWechat && /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
+
className: "article",
|
|
57
|
+
dangerouslySetInnerHTML: {
|
|
58
|
+
__html: this.state.innerHtml
|
|
59
|
+
}
|
|
60
|
+
}), !isWindowsWechat && /*#__PURE__*/_react.default.createElement(_slateViewer.default, {
|
|
61
|
+
value: value,
|
|
62
|
+
isShowOutline: isShowOutline
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var _default = exports.default = Formatter;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.sf-long-text-inline-editor-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
border: 1px solid rgba(0, 40, 100, .12);
|
|
5
|
+
border-radius: 3px;
|
|
6
|
+
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sf-long-text-inline-editor-container .sf-simple-slate-editor-container {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sf-long-text-inline-editor-container .sf-simple-slate-editor-container .sf-slate-editor-toolbar {
|
|
15
|
+
border-top-left-radius: 3px;
|
|
16
|
+
border-top-right-radius: 3px;
|
|
17
|
+
height: 33px;
|
|
18
|
+
box-shadow: none;
|
|
19
|
+
padding-right: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sf-long-text-inline-editor-container .sf-slate-editor-content {
|
|
23
|
+
border-bottom-left-radius: 3px;
|
|
24
|
+
border-bottom-right-radius: 3px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sf-long-text-inline-editor-container .sf-simple-slate-editor-container .sf-slate-editor-toolbar .sf-menu-group:last-child {
|
|
29
|
+
border-right: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sf-long-text-inline-editor-container .sf-simple-slate-editor-container .sf-slate-editor-content {
|
|
33
|
+
flex: 1 !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sf-long-text-inline-editor-container .sf-simple-slate-editor-container .sf-slate-editor-content .article {
|
|
37
|
+
padding: 16px !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* preview */
|
|
41
|
+
.sf-long-text-inline-editor-container .longtext-preview-container {
|
|
42
|
+
padding: 10px;
|
|
43
|
+
background-color: #fff;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sf-long-text-inline-editor-container .sf-slate-editor-content .article > div[role="textbox"] > :first-child {
|
|
47
|
+
margin-top: 0 !important;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sf-long-text-inline-editor-container .sf-slate-editor-toolbar .sf-menu-group,
|
|
51
|
+
.sf-editor-menu-popover .popover-inner .sf-menu-group {
|
|
52
|
+
padding: 4px 0 4px 8px !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sf-long-text-inline-editor-container .sf-slate-editor-toolbar .sf-menu-group:first-child {
|
|
56
|
+
padding-left: 0px !important;
|
|
57
|
+
flex: 1 !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sf-long-text-inline-editor-container .sf-slate-editor-toolbar .sf-header-menu {
|
|
61
|
+
padding: 4px 6px 4px 0 !important;
|
|
62
|
+
width: 100% !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.sf-long-text-inline-editor-container .sf-slate-editor-toolbar .sf-header-toggle {
|
|
66
|
+
padding: 0 3px 0 6px !important;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.sf-editor-menu-popover .popover-inner {
|
|
70
|
+
display: flex;
|
|
71
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _isHotkey = _interopRequireDefault(require("is-hotkey"));
|
|
11
|
+
var _ClickOutside = _interopRequireDefault(require("./ClickOutside"));
|
|
12
|
+
var _formatter = _interopRequireDefault(require("./formatter"));
|
|
13
|
+
var _editor = _interopRequireDefault(require("./editor"));
|
|
14
|
+
var _slateConvert = require("../../slate-convert");
|
|
15
|
+
var _getBrowserInfo = _interopRequireDefault(require("../../utils/get-browser-Info"));
|
|
16
|
+
const LongTextInlineEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
autoSave,
|
|
19
|
+
isCheckBrowser,
|
|
20
|
+
saveDelay,
|
|
21
|
+
value,
|
|
22
|
+
lang,
|
|
23
|
+
headerName,
|
|
24
|
+
onPreviewClick,
|
|
25
|
+
onSaveEditorValue,
|
|
26
|
+
editorApi
|
|
27
|
+
} = _ref;
|
|
28
|
+
const [isShowEditor, setShowEditor] = (0, _react.useState)(false);
|
|
29
|
+
const valueRef = (0, _react.useRef)(typeof value === 'string' ? {
|
|
30
|
+
text: value
|
|
31
|
+
} : value);
|
|
32
|
+
const longTextValueChangedRef = (0, _react.useRef)(false);
|
|
33
|
+
const [focusNodePath, setFocusNodePath] = (0, _react.useState)([0, 0]);
|
|
34
|
+
const {
|
|
35
|
+
isWindowsWechat
|
|
36
|
+
} = (0, _react.useMemo)(() => {
|
|
37
|
+
return (0, _getBrowserInfo.default)(isCheckBrowser);
|
|
38
|
+
}, [isCheckBrowser]);
|
|
39
|
+
const openEditor = (0, _react.useCallback)(function () {
|
|
40
|
+
let focusNodePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0];
|
|
41
|
+
setFocusNodePath(focusNodePath);
|
|
42
|
+
setShowEditor(true);
|
|
43
|
+
}, []);
|
|
44
|
+
const closeEditor = (0, _react.useCallback)(() => {
|
|
45
|
+
if (longTextValueChangedRef.current) {
|
|
46
|
+
onSaveEditorValue(valueRef.current);
|
|
47
|
+
}
|
|
48
|
+
setShowEditor(false);
|
|
49
|
+
}, [longTextValueChangedRef, valueRef, onSaveEditorValue]);
|
|
50
|
+
const getAttributeNode = (0, _react.useCallback)(function (node, attribute) {
|
|
51
|
+
let deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4;
|
|
52
|
+
if (!node) return null;
|
|
53
|
+
if (deep === -1) return null;
|
|
54
|
+
if (node.getAttribute(attribute)) return node.getAttribute(attribute);
|
|
55
|
+
if (node.parentNode) return getAttributeNode(node.parentNode, attribute, deep--);
|
|
56
|
+
}, []);
|
|
57
|
+
const getNodePathById = (0, _react.useCallback)(function (rootNode, nodeId) {
|
|
58
|
+
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
59
|
+
if (rootNode.id === nodeId) return path;
|
|
60
|
+
const {
|
|
61
|
+
children = []
|
|
62
|
+
} = rootNode;
|
|
63
|
+
for (let i = 0; i < children.length; i++) {
|
|
64
|
+
const child = children[i];
|
|
65
|
+
path.push(i);
|
|
66
|
+
const nodePath = getNodePathById(child, nodeId, path);
|
|
67
|
+
if (nodePath) return nodePath;
|
|
68
|
+
path.pop();
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}, []);
|
|
72
|
+
const previewClick = (0, _react.useCallback)((event, richValue) => {
|
|
73
|
+
if (event.target.nodeName === 'A') return;
|
|
74
|
+
const nodeId = getAttributeNode(event.target, 'data-id');
|
|
75
|
+
onPreviewClick && onPreviewClick();
|
|
76
|
+
openEditor(getNodePathById({
|
|
77
|
+
children: richValue
|
|
78
|
+
}, nodeId));
|
|
79
|
+
}, [onPreviewClick, openEditor, getAttributeNode, getNodePathById]);
|
|
80
|
+
const onEditorValueChanged = (0, _react.useCallback)(value => {
|
|
81
|
+
valueRef.current = value;
|
|
82
|
+
longTextValueChangedRef.current = true;
|
|
83
|
+
}, []);
|
|
84
|
+
const onHotKey = (0, _react.useCallback)(event => {
|
|
85
|
+
const keyCode = event.keyCode;
|
|
86
|
+
const isModP = (0, _isHotkey.default)('mod+p', event);
|
|
87
|
+
if (keyCode === 27 || isModP) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
!isModP && event.stopPropagation();
|
|
90
|
+
closeEditor();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}, [closeEditor]);
|
|
94
|
+
(0, _react.useImperativeHandle)(ref, () => {
|
|
95
|
+
return {
|
|
96
|
+
openEditor: openEditor,
|
|
97
|
+
closeEditor: closeEditor
|
|
98
|
+
};
|
|
99
|
+
}, [openEditor, closeEditor]);
|
|
100
|
+
if (!isShowEditor) {
|
|
101
|
+
const richValue = (0, _slateConvert.mdStringToSlate)(valueRef.current.text);
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
className: "sf-long-text-inline-editor-container preview",
|
|
104
|
+
onClick: event => previewClick(event, richValue)
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_formatter.default, {
|
|
106
|
+
value: isWindowsWechat ? valueRef.current : richValue
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
return /*#__PURE__*/_react.default.createElement(_ClickOutside.default, {
|
|
110
|
+
onClickOutside: closeEditor
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "w-100",
|
|
113
|
+
onKeyDown: onHotKey
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_editor.default, {
|
|
115
|
+
lang: lang,
|
|
116
|
+
isWindowsWechat: isWindowsWechat,
|
|
117
|
+
headerName: headerName,
|
|
118
|
+
focusNodePath: focusNodePath,
|
|
119
|
+
value: valueRef.current.text,
|
|
120
|
+
autoSave: autoSave,
|
|
121
|
+
saveDelay: saveDelay,
|
|
122
|
+
isCheckBrowser: isCheckBrowser,
|
|
123
|
+
editorApi: editorApi,
|
|
124
|
+
onSaveEditorValue: onSaveEditorValue,
|
|
125
|
+
onEditorValueChanged: onEditorValueChanged
|
|
126
|
+
})));
|
|
127
|
+
});
|
|
128
|
+
var _default = exports.default = LongTextInlineEditor;
|
|
@@ -10,7 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _loading = _interopRequireDefault(require("../containers/loading"));
|
|
11
11
|
var _slateConvert = require("../slate-convert");
|
|
12
12
|
var _useMathjax = _interopRequireDefault(require("../hooks/use-mathjax"));
|
|
13
|
-
var _simpleSlateEditor = _interopRequireDefault(require("../editors/simple-slate-editor
|
|
13
|
+
var _simpleSlateEditor = _interopRequireDefault(require("../editors/simple-slate-editor"));
|
|
14
14
|
const SeaTableEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
15
15
|
let {
|
|
16
16
|
isFetching,
|
|
@@ -10,15 +10,17 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _loading = _interopRequireDefault(require("../containers/loading"));
|
|
11
11
|
var _slateConvert = require("../slate-convert");
|
|
12
12
|
var _useMathjax = _interopRequireDefault(require("../hooks/use-mathjax"));
|
|
13
|
-
var _simpleSlateEditor = _interopRequireDefault(require("../editors/simple-slate-editor
|
|
13
|
+
var _simpleSlateEditor = _interopRequireDefault(require("../editors/simple-slate-editor"));
|
|
14
14
|
const SimpleEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
15
15
|
let {
|
|
16
|
+
isInline,
|
|
16
17
|
isFetching,
|
|
17
18
|
value,
|
|
18
19
|
editorApi,
|
|
19
20
|
mathJaxSource,
|
|
20
21
|
onSave: propsOnSave,
|
|
21
|
-
onContentChanged: propsOnContentChanged
|
|
22
|
+
onContentChanged: propsOnContentChanged,
|
|
23
|
+
...otherProps
|
|
22
24
|
} = _ref;
|
|
23
25
|
const [richValue, setRichValue] = (0, _react.useState)([]);
|
|
24
26
|
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
@@ -49,11 +51,13 @@ const SimpleEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
49
51
|
propsOnContentChanged && propsOnContentChanged();
|
|
50
52
|
}, [propsOnContentChanged]);
|
|
51
53
|
const props = {
|
|
54
|
+
isInline,
|
|
52
55
|
isSupportFormula: !!mathJaxSource,
|
|
53
56
|
value: richValue,
|
|
54
57
|
editorApi: editorApi,
|
|
55
58
|
onSave: propsOnSave,
|
|
56
|
-
onContentChanged: onContentChanged
|
|
59
|
+
onContentChanged: onContentChanged,
|
|
60
|
+
...otherProps
|
|
57
61
|
};
|
|
58
62
|
if (isFetching || isLoading || isLoadingMathJax) {
|
|
59
63
|
return /*#__PURE__*/_react.default.createElement(_loading.default, null);
|
package/package.json
CHANGED
|
@@ -222,5 +222,6 @@
|
|
|
222
222
|
"Font_style": "Schriftschnitt",
|
|
223
223
|
"Open_link": "Open link",
|
|
224
224
|
"Image_is_uploading": "Image is uploading",
|
|
225
|
-
"Image_loading_failed": "Image loading failed"
|
|
225
|
+
"Image_loading_failed": "Image loading failed",
|
|
226
|
+
"Expand_editor": "Expand editor"
|
|
226
227
|
}
|
|
@@ -222,5 +222,10 @@
|
|
|
222
222
|
"Font_style": "Font style",
|
|
223
223
|
"Open_link": "Open link",
|
|
224
224
|
"Image_is_uploading": "Image is uploading",
|
|
225
|
-
"Image_loading_failed": "Image loading failed"
|
|
225
|
+
"Image_loading_failed": "Image loading failed",
|
|
226
|
+
"Expand_editor": "Expand editor",
|
|
227
|
+
"Insert_below": "Insert below",
|
|
228
|
+
"Insert_above": "Insert above",
|
|
229
|
+
"Insert_on_the_right": "Insert on the right",
|
|
230
|
+
"Insert_on_the_left": "Insert on the left"
|
|
226
231
|
}
|
|
@@ -222,5 +222,6 @@
|
|
|
222
222
|
"Font_style": "Font style",
|
|
223
223
|
"Open_link": "Ouvrir le lien",
|
|
224
224
|
"Image_is_uploading": "Image is uploading",
|
|
225
|
-
"Image_loading_failed": "Image loading failed"
|
|
225
|
+
"Image_loading_failed": "Image loading failed",
|
|
226
|
+
"Expand_editor": "Expand editor"
|
|
226
227
|
}
|
|
@@ -222,5 +222,6 @@
|
|
|
222
222
|
"Font_style": "Стиль шрифта",
|
|
223
223
|
"Open_link": "Открыть ссылку",
|
|
224
224
|
"Image_is_uploading": "Изображение загружается",
|
|
225
|
-
"Image_loading_failed": "
|
|
225
|
+
"Image_loading_failed": "Ошибка загрузки изображения",
|
|
226
|
+
"Expand_editor": "Expand editor"
|
|
226
227
|
}
|
|
Binary file
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<missing-glyph />
|
|
16
16
|
|
|
17
|
+
<glyph glyph-name="more" unicode="" d="M835.2 387.2c0-54.4 41.6-96 96-96s96 41.6 96 96-41.6 96-96 96c-51.2 0-96-41.6-96-96z m-416 0c0-54.4 41.6-96 96-96s96 41.6 96 96-41.6 96-96 96c-51.2 0-96-41.6-96-96z m-416 0c0-54.4 41.6-96 96-96s96 41.6 96 96-41.6 96-96 96c-51.2 0-96-41.6-96-96z" horiz-adv-x="1027" />
|
|
18
|
+
|
|
17
19
|
<glyph glyph-name="drop-down" unicode="" d="M550.4 169.6l265.6 336c32 38.4 6.4 102.4-38.4 102.4H246.4c-44.8 0-70.4-60.8-38.4-102.4l265.6-336c19.2-25.6 57.6-25.6 76.8 0z" horiz-adv-x="1024" />
|
|
18
20
|
|
|
19
21
|
<glyph glyph-name="caret-up" unicode="" d="M550.4 588.8l265.6-336c32-38.4 6.4-102.4-38.4-102.4H246.4c-44.8 0-70.4 60.8-38.4 102.4l265.6 336c19.2 25.6 57.6 25.6 76.8 0z" horiz-adv-x="1024" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "iconfont"; /* Project id 4375832 */
|
|
3
|
-
src: url('./seafile-editor-font/iconfont.eot?t=
|
|
4
|
-
src: url('./seafile-editor-font/iconfont.eot?t=
|
|
5
|
-
url('./seafile-editor-font/iconfont.woff2?t=
|
|
6
|
-
url('./seafile-editor-font/iconfont.woff?t=
|
|
7
|
-
url('./seafile-editor-font/iconfont.ttf?t=
|
|
8
|
-
url('./seafile-editor-font/iconfont.svg?t=
|
|
3
|
+
src: url('./seafile-editor-font/iconfont.eot?t=1714979485064'); /* IE9 */
|
|
4
|
+
src: url('./seafile-editor-font/iconfont.eot?t=1714979485064#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
|
5
|
+
url('./seafile-editor-font/iconfont.woff2?t=1714979485064') format('woff2'),
|
|
6
|
+
url('./seafile-editor-font/iconfont.woff?t=1714979485064') format('woff'),
|
|
7
|
+
url('./seafile-editor-font/iconfont.ttf?t=1714979485064') format('truetype'),
|
|
8
|
+
url('./seafile-editor-font/iconfont.svg?t=1714979485064#iconfont') format('svg');
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.iconfont {
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
-moz-osx-font-smoothing: grayscale;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.icon-more:before {
|
|
20
|
+
content: "\e626";
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
.icon-drop-down:before {
|
|
20
24
|
content: "\e685";
|
|
21
25
|
}
|