@seafile/seafile-editor 1.0.90 → 1.0.91-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/inline-editor/index.js +1 -2
- package/dist/extension/plugins/link/render-elem/index.js +5 -1
- package/dist/extension/plugins/table/plugin.js +2 -0
- package/dist/pages/longtext-inline-editor/index.css +8 -0
- package/dist/pages/longtext-inline-editor/normal-editor.js +1 -1
- package/dist/slate-convert/slate-to-md/transform.js +16 -2
- package/package.json +1 -1
|
@@ -15,7 +15,6 @@ var _eventHandler = _interopRequireDefault(require("../../utils/event-handler"))
|
|
|
15
15
|
var _withPropsEditor = _interopRequireDefault(require("./with-props-editor"));
|
|
16
16
|
var _core = require("../../extension/core");
|
|
17
17
|
var _common = require("../../utils/common");
|
|
18
|
-
var _userLinkClick = _interopRequireDefault(require("../../hooks/user-link-click"));
|
|
19
18
|
require("./index.css");
|
|
20
19
|
const isMacOS = (0, _common.isMac)();
|
|
21
20
|
const InlineEditor = _ref => {
|
|
@@ -34,6 +33,7 @@ const InlineEditor = _ref => {
|
|
|
34
33
|
const focusRangeRef = (0, _react.useRef)(null);
|
|
35
34
|
const editor = (0, _react.useMemo)(() => {
|
|
36
35
|
const baseEditor = (0, _extension.inlineEditor)();
|
|
36
|
+
baseEditor.isInline = true;
|
|
37
37
|
return (0, _withPropsEditor.default)(baseEditor, {
|
|
38
38
|
editorApi,
|
|
39
39
|
onSave,
|
|
@@ -102,7 +102,6 @@ const InlineEditor = _ref => {
|
|
|
102
102
|
focusNode(editor, focusRangeRef.current);
|
|
103
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
104
|
}, [enableEdit]);
|
|
105
|
-
(0, _userLinkClick.default)();
|
|
106
105
|
|
|
107
106
|
// willUnmount
|
|
108
107
|
(0, _react.useEffect)(() => {
|
|
@@ -46,6 +46,10 @@ const renderLink = (_ref, editor) => {
|
|
|
46
46
|
e.stopPropagation();
|
|
47
47
|
const eventBus = _eventBus.default.getInstance();
|
|
48
48
|
if (isReadonly) {
|
|
49
|
+
if (editor.isInline) {
|
|
50
|
+
window.open(element.url);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
49
53
|
eventBus.dispatch(_eventTypes.EXTERNAL_EVENTS.ON_LINK_CLICK, e);
|
|
50
54
|
return;
|
|
51
55
|
}
|
|
@@ -67,7 +71,7 @@ const renderLink = (_ref, editor) => {
|
|
|
67
71
|
});
|
|
68
72
|
setIsShowPopover(true);
|
|
69
73
|
registerClickEvent();
|
|
70
|
-
}, [editor, isReadonly, registerClickEvent]);
|
|
74
|
+
}, [editor, isReadonly, registerClickEvent, element]);
|
|
71
75
|
const onHrefClick = (0, _react.useCallback)(e => {
|
|
72
76
|
e.preventDefault();
|
|
73
77
|
}, []);
|
|
@@ -287,6 +287,7 @@ const withTable = editor => {
|
|
|
287
287
|
const tableCell = (0, _core.getSelectedNodeByType)(newEditor, _elementTypes.TABLE_CELL);
|
|
288
288
|
if (tableCell) {
|
|
289
289
|
const selection = window.getSelection();
|
|
290
|
+
const selectedText = selection.toString();
|
|
290
291
|
const range = selection.getRangeAt(0);
|
|
291
292
|
const selectedContent = range.cloneContents();
|
|
292
293
|
const div = document.createElement('div');
|
|
@@ -299,6 +300,7 @@ const withTable = editor => {
|
|
|
299
300
|
}
|
|
300
301
|
div.appendChild(node.cloneNode(true));
|
|
301
302
|
});
|
|
303
|
+
(0, _setEventTransfer.default)(event, 'text', selectedText);
|
|
302
304
|
(0, _setEventTransfer.default)(event, 'html', div.innerHTML.toString());
|
|
303
305
|
return true;
|
|
304
306
|
}
|
|
@@ -93,3 +93,11 @@
|
|
|
93
93
|
.sf-long-text-inline-editor-container .sf-image-wrapper .full-screen .iconfont {
|
|
94
94
|
color: #fff;
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
.sf-long-text-inline-editor-container .empty-loading-page {
|
|
98
|
+
position: relative;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.sf-long-text-inline-editor-container .sf-simple-slate-editor-container .sf-slate-editor-content {
|
|
102
|
+
border-radius: 3px;
|
|
103
|
+
}
|
|
@@ -324,6 +324,15 @@ const transformFormula = node => {
|
|
|
324
324
|
value: data.formula
|
|
325
325
|
};
|
|
326
326
|
};
|
|
327
|
+
const transformAsParagraph = node => {
|
|
328
|
+
const paragraph = {
|
|
329
|
+
type: 'paragraph',
|
|
330
|
+
children: [{
|
|
331
|
+
text: _slate.Node.string(node)
|
|
332
|
+
}]
|
|
333
|
+
};
|
|
334
|
+
return transformParagraph(paragraph);
|
|
335
|
+
};
|
|
327
336
|
const elementHandlers = {
|
|
328
337
|
'paragraph': transformParagraph,
|
|
329
338
|
'header1': transformHeader,
|
|
@@ -341,10 +350,15 @@ const elementHandlers = {
|
|
|
341
350
|
'formula': transformFormula
|
|
342
351
|
};
|
|
343
352
|
const formatSlateToMd = children => {
|
|
344
|
-
const validChildren = children.filter(child => elementHandlers[child.type]);
|
|
353
|
+
// const validChildren = children.filter(child => elementHandlers[child.type]);
|
|
354
|
+
const validChildren = children;
|
|
345
355
|
return validChildren.map(child => {
|
|
346
356
|
const handler = elementHandlers[child.type];
|
|
347
|
-
|
|
357
|
+
if (handler) {
|
|
358
|
+
return handler(child);
|
|
359
|
+
} else {
|
|
360
|
+
return transformAsParagraph(child);
|
|
361
|
+
}
|
|
348
362
|
}).flat();
|
|
349
363
|
};
|
|
350
364
|
exports.formatSlateToMd = formatSlateToMd;
|