@seafile/seafile-editor 1.0.24 → 1.0.26

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.
@@ -34,7 +34,7 @@
34
34
  overflow: auto;
35
35
  }
36
36
 
37
- .sf-simple-slate-editor-container .sf-slate-scroll-container.isWin::-webkit-scrollbar{
37
+ .sf-simple-slate-editor-container .sf-slate-scroll-container.isWin::-webkit-scrollbar {
38
38
  width: 8px;
39
39
  height: 8px;
40
40
  }
@@ -69,9 +69,9 @@
69
69
  padding: 10px;
70
70
  border: none;
71
71
  background-color: #fff;
72
- height: 100%;
72
+ min-height: 100%;
73
73
  }
74
74
 
75
75
  .sf-simple-slate-editor-container .sf-slate-editor-content .article div:first-child {
76
76
  outline: none;
77
- }
77
+ }
@@ -31,7 +31,7 @@ const SeaTableEditor = forwardRef((_ref, ref) => {
31
31
  }, [richValue]);
32
32
  useEffect(() => {
33
33
  if (!isFetching) {
34
- const richValue = mdStringToSlate(value);
34
+ const richValue = value ? JSON.parse(value) : mdStringToSlate('');
35
35
  setRichValue(richValue);
36
36
  setIsLoading(false);
37
37
  }
@@ -1,2 +1,39 @@
1
- import SeaTableViewer from './markdown-view';
2
- export default SeaTableViewer;
1
+ import React, { useEffect, useState } from 'react';
2
+ import Loading from '../containers/loading';
3
+ import useMathJax from '../hooks/use-mathjax';
4
+ import SlateViewer from '../editors/slate-viewer';
5
+ import { mdStringToSlate } from '../slate-convert';
6
+ export default function MarkdownViewer(_ref) {
7
+ let {
8
+ isFetching,
9
+ value,
10
+ mathJaxSource,
11
+ isShowOutline,
12
+ scrollRef,
13
+ onLinkClick
14
+ } = _ref;
15
+ const [richValue, setRichValue] = useState([]);
16
+ const [isLoading, setIsLoading] = useState(true);
17
+ const {
18
+ isLoadingMathJax
19
+ } = useMathJax(mathJaxSource);
20
+ useEffect(() => {
21
+ if (!isFetching) {
22
+ const richValue = value ? JSON.parse(value) : mdStringToSlate('');
23
+ setRichValue(richValue);
24
+ setIsLoading(false);
25
+ }
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ }, [isFetching]);
28
+ const props = {
29
+ isSupportFormula: !!mathJaxSource,
30
+ value: richValue,
31
+ isShowOutline: isShowOutline,
32
+ scrollRef: scrollRef,
33
+ onLinkClick: onLinkClick
34
+ };
35
+ if (isFetching || isLoading || isLoadingMathJax) {
36
+ return /*#__PURE__*/React.createElement(Loading, null);
37
+ }
38
+ return /*#__PURE__*/React.createElement(SlateViewer, props);
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {