@seafile/seafile-editor 2.0.2-alpha3 → 2.0.2-alpha5
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();
|
|
@@ -12,6 +12,7 @@ var _simpleEditor = _interopRequireDefault(require("../simple-editor"));
|
|
|
12
12
|
var _getPreviewContent = _interopRequireDefault(require("../../utils/get-preview-content"));
|
|
13
13
|
var _getBrowserInfo = _interopRequireDefault(require("../../utils/get-browser-Info"));
|
|
14
14
|
var _components = require("../../components");
|
|
15
|
+
var _slateConvert = require("../slate-convert");
|
|
15
16
|
var _markdownPreview = _interopRequireDefault(require("../markdown-preview"));
|
|
16
17
|
require("./style.css");
|
|
17
18
|
function LongTextEditorDialog(_ref) {
|
|
@@ -116,34 +117,24 @@ function LongTextEditorDialog(_ref) {
|
|
|
116
117
|
setIsFullScreen(!isFullScreen);
|
|
117
118
|
setDialogStyle(containerStyle);
|
|
118
119
|
}, [isFullScreen]);
|
|
119
|
-
const onContentChanged = (0, _react.useCallback)(
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
onEditorValueChanged({
|
|
138
|
-
text: markdownString,
|
|
139
|
-
preview: previewText,
|
|
140
|
-
images: images,
|
|
141
|
-
links: links,
|
|
142
|
-
checklist
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
setValueChanged(true);
|
|
146
|
-
}, 0);
|
|
120
|
+
const onContentChanged = (0, _react.useCallback)(newContent => {
|
|
121
|
+
// update parent's component cache value
|
|
122
|
+
if (typeof onEditorValueChanged === 'function') {
|
|
123
|
+
const {
|
|
124
|
+
previewText: preview,
|
|
125
|
+
images,
|
|
126
|
+
links,
|
|
127
|
+
checklist
|
|
128
|
+
} = (0, _getPreviewContent.default)(newContent, false);
|
|
129
|
+
onEditorValueChanged({
|
|
130
|
+
text: (0, _slateConvert.slateToMdString)(newContent),
|
|
131
|
+
preview,
|
|
132
|
+
images,
|
|
133
|
+
links,
|
|
134
|
+
checklist
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
setValueChanged(true);
|
|
147
138
|
}, [onEditorValueChanged]);
|
|
148
139
|
const onContainerKeyDown = event => {
|
|
149
140
|
event.stopPropagation();
|