@seafile/seafile-editor 2.0.2-alpha2 → 2.0.2-alpha4
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.
|
@@ -44,7 +44,6 @@ const SimpleSlateEditor = _ref => {
|
|
|
44
44
|
const operations = editor.operations;
|
|
45
45
|
const modifyOps = operations.filter(o => o.type !== 'set_selection');
|
|
46
46
|
if (modifyOps.length > 0) {
|
|
47
|
-
console.log(32, value);
|
|
48
47
|
onContentChanged && onContentChanged(value);
|
|
49
48
|
}
|
|
50
49
|
const eventBus = _eventBus.default.getInstance();
|
|
@@ -116,24 +116,20 @@ function LongTextEditorDialog(_ref) {
|
|
|
116
116
|
setIsFullScreen(!isFullScreen);
|
|
117
117
|
setDialogStyle(containerStyle);
|
|
118
118
|
}, [isFullScreen]);
|
|
119
|
-
const onContentChanged = (0, _react.useCallback)(
|
|
119
|
+
const onContentChanged = (0, _react.useCallback)(newContent => {
|
|
120
120
|
// delay to update editor's content
|
|
121
|
-
// 好像图片不正确,这里获取到的不一定正确
|
|
122
121
|
setTimeout(() => {
|
|
123
122
|
// update parent's component cache value
|
|
124
123
|
if (onEditorValueChanged && typeof onEditorValueChanged === 'function') {
|
|
125
124
|
var _editorRef$current5, _editorRef$current6;
|
|
126
125
|
const markdownString = (_editorRef$current5 = editorRef.current) === null || _editorRef$current5 === void 0 ? void 0 : _editorRef$current5.getValue();
|
|
127
|
-
const slateNodes = (_editorRef$current6 = editorRef.current) === null || _editorRef$current6 === void 0 ? void 0 : _editorRef$current6.getSlateValue();
|
|
128
|
-
console.log(100, newValue);
|
|
129
|
-
console.log(101, slateNodes);
|
|
126
|
+
const slateNodes = newContent || ((_editorRef$current6 = editorRef.current) === null || _editorRef$current6 === void 0 ? void 0 : _editorRef$current6.getSlateValue());
|
|
130
127
|
const {
|
|
131
128
|
previewText,
|
|
132
129
|
images,
|
|
133
130
|
links,
|
|
134
131
|
checklist
|
|
135
132
|
} = (0, _getPreviewContent.default)(slateNodes, false);
|
|
136
|
-
console.log(102, images);
|
|
137
133
|
onEditorValueChanged({
|
|
138
134
|
text: markdownString,
|
|
139
135
|
preview: previewText,
|