@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)(newValue => {
120
- // delay to update editor's content
121
- // 好像图片不正确,这里获取到的不一定正确
122
- setTimeout(() => {
123
- // update parent's component cache value
124
- if (onEditorValueChanged && typeof onEditorValueChanged === 'function') {
125
- var _editorRef$current5, _editorRef$current6;
126
- 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);
130
- const {
131
- previewText,
132
- images,
133
- links,
134
- checklist
135
- } = (0, _getPreviewContent.default)(slateNodes, false);
136
- console.log(102, images);
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "2.0.2-alpha3",
3
+ "version": "2.0.2-alpha5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {