@seafile/seafile-editor 2.0.2 → 2.0.3
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.
|
@@ -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,30 +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
|
-
links: links,
|
|
138
|
-
checklist
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
setValueChanged(true);
|
|
142
|
-
}, 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);
|
|
143
138
|
}, [onEditorValueChanged]);
|
|
144
139
|
const onContainerKeyDown = event => {
|
|
145
140
|
event.stopPropagation();
|
|
@@ -50,7 +50,7 @@ const SimpleEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
50
50
|
}, [isFetching]);
|
|
51
51
|
const onContentChanged = (0, _react.useCallback)(content => {
|
|
52
52
|
setRichValue(content);
|
|
53
|
-
propsOnContentChanged && propsOnContentChanged();
|
|
53
|
+
propsOnContentChanged && propsOnContentChanged(content);
|
|
54
54
|
}, [propsOnContentChanged]);
|
|
55
55
|
const props = {
|
|
56
56
|
isSupportFormula: !!mathJaxSource,
|