@seafile/seafile-editor 0.3.76

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.
Files changed (156) hide show
  1. package/README.md +119 -0
  2. package/TODO.md +55 -0
  3. package/dist/components/add-formula-dialog.js +135 -0
  4. package/dist/components/add-image-dialog.js +78 -0
  5. package/dist/components/add-link-dialog.js +148 -0
  6. package/dist/components/comment-dialog.js +107 -0
  7. package/dist/components/comment-panel.js +452 -0
  8. package/dist/components/context-menu.js +112 -0
  9. package/dist/components/detail-list-view.js +119 -0
  10. package/dist/components/generate-share-link.js +412 -0
  11. package/dist/components/internal-link-dialog.js +96 -0
  12. package/dist/components/loading.js +32 -0
  13. package/dist/components/markdown-lint.js +87 -0
  14. package/dist/components/modal-portal.js +46 -0
  15. package/dist/components/outline.js +130 -0
  16. package/dist/components/participants-list.js +126 -0
  17. package/dist/components/related-files-list.js +75 -0
  18. package/dist/components/shortcut-dialog.js +167 -0
  19. package/dist/components/side-panel.js +175 -0
  20. package/dist/components/toast/alert.js +150 -0
  21. package/dist/components/toast/index.js +3 -0
  22. package/dist/components/toast/toast.js +179 -0
  23. package/dist/components/toast/toastManager.js +158 -0
  24. package/dist/components/toast/toaster.js +76 -0
  25. package/dist/components/toolbar.js +235 -0
  26. package/dist/components/topbar-component/button-group.js +31 -0
  27. package/dist/components/topbar-component/editor-toolbar.js +545 -0
  28. package/dist/components/topbar-component/file-info.js +65 -0
  29. package/dist/components/topbar-component/header-list.js +128 -0
  30. package/dist/components/topbar-component/icon-button.js +99 -0
  31. package/dist/components/topbar-component/insert-file.js +67 -0
  32. package/dist/components/topbar-component/table-toolbar.js +175 -0
  33. package/dist/components/topbar-component/upload-img.js +122 -0
  34. package/dist/components/user-help.js +205 -0
  35. package/dist/css/diff-viewer.css +105 -0
  36. package/dist/css/history-viewer.css +104 -0
  37. package/dist/css/keyboard-shortcuts.css +59 -0
  38. package/dist/css/layout.css +110 -0
  39. package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
  40. package/dist/css/markdown-viewer.css +69 -0
  41. package/dist/css/plaineditor/markdown-editor.css +12 -0
  42. package/dist/css/react-mentions-default-style.js +72 -0
  43. package/dist/css/related-files-list.css +56 -0
  44. package/dist/css/richeditor/comments-list.css +184 -0
  45. package/dist/css/richeditor/detail-list-view.css +114 -0
  46. package/dist/css/richeditor/document-info.css +57 -0
  47. package/dist/css/richeditor/formula.css +19 -0
  48. package/dist/css/richeditor/image.css +141 -0
  49. package/dist/css/richeditor/link.css +7 -0
  50. package/dist/css/richeditor/navbar-imgbutton.css +79 -0
  51. package/dist/css/richeditor/participants-list.css +22 -0
  52. package/dist/css/richeditor/rich-editor-main.css +42 -0
  53. package/dist/css/richeditor/right-panel.css +84 -0
  54. package/dist/css/richeditor/side-panel.css +190 -0
  55. package/dist/css/richeditor/table.css +57 -0
  56. package/dist/css/richeditor/textlink-hovermenu.css +47 -0
  57. package/dist/css/richeditor/tree-view.css +67 -0
  58. package/dist/css/topbar.css +400 -0
  59. package/dist/editor/code-highlight-package.js +27 -0
  60. package/dist/editor/controller/block-element-controller.js +376 -0
  61. package/dist/editor/controller/inline-element-controller.js +129 -0
  62. package/dist/editor/controller/normalize-controller.js +107 -0
  63. package/dist/editor/controller/shortcut-controller.js +394 -0
  64. package/dist/editor/controller/void-element-controller.js +12 -0
  65. package/dist/editor/custom/custom.js +17 -0
  66. package/dist/editor/custom/get-event-transfer.js +34 -0
  67. package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
  68. package/dist/editor/custom/insertNodes.js +140 -0
  69. package/dist/editor/custom/is-empty-paragraph.js +13 -0
  70. package/dist/editor/custom/set-event-transfer.js +31 -0
  71. package/dist/editor/custom/split-nodes-at-point.js +162 -0
  72. package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
  73. package/dist/editor/editor-component/check-list-item.js +64 -0
  74. package/dist/editor/editor-component/code-block.js +150 -0
  75. package/dist/editor/editor-component/formula.js +79 -0
  76. package/dist/editor/editor-component/image.js +215 -0
  77. package/dist/editor/editor-component/link.js +11 -0
  78. package/dist/editor/editor-component/table.js +172 -0
  79. package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
  80. package/dist/editor/editor-plugin.js +249 -0
  81. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
  82. package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
  83. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
  84. package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
  85. package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
  86. package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
  87. package/dist/editor/editor-utils/common-editor-utils.js +587 -0
  88. package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
  89. package/dist/editor/editor-utils/mark-utils.js +25 -0
  90. package/dist/editor/editor-utils/range-utils.js +9 -0
  91. package/dist/editor/editor-utils/selection-utils.js +33 -0
  92. package/dist/editor/editor-utils/text-utils.js +130 -0
  93. package/dist/editor/editor.js +66 -0
  94. package/dist/editor/element-model/blockquote.js +16 -0
  95. package/dist/editor/element-model/image.js +19 -0
  96. package/dist/editor/element-model/link.js +19 -0
  97. package/dist/editor/element-model/table.js +50 -0
  98. package/dist/editor/element-model/text.js +13 -0
  99. package/dist/editor/load-script.js +83 -0
  100. package/dist/editor/plain-markdown-editor.js +324 -0
  101. package/dist/editor/rich-markdown-editor.js +580 -0
  102. package/dist/editor/seafile-editor.js +326 -0
  103. package/dist/editor/simple-editor.js +245 -0
  104. package/dist/editor-api.js +261 -0
  105. package/dist/index.css +97 -0
  106. package/dist/lib/slate-hyperscript/creators.js +263 -0
  107. package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
  108. package/dist/lib/slate-hyperscript/index.js +3 -0
  109. package/dist/lib/slate-hyperscript/tokens.js +102 -0
  110. package/dist/lib/unified/index.js +470 -0
  111. package/dist/lib/vfile/core.js +172 -0
  112. package/dist/lib/vfile/index.js +48 -0
  113. package/dist/seafile-editor-chooser.js +45 -0
  114. package/dist/seafile-markdown-editor.js +301 -0
  115. package/dist/seafile-markdown-viewer.js +79 -0
  116. package/dist/seafile-simple-editor.js +56 -0
  117. package/dist/utils/copy-to-clipboard.js +47 -0
  118. package/dist/utils/deserialize-html.js +282 -0
  119. package/dist/utils/diff/compare-strings.js +46 -0
  120. package/dist/utils/diff/diff.js +855 -0
  121. package/dist/utils/diff/index.js +2 -0
  122. package/dist/utils/render-slate.js +219 -0
  123. package/dist/utils/seafile-markdown2html.js +62 -0
  124. package/dist/utils/slate2markdown/deserialize.js +689 -0
  125. package/dist/utils/slate2markdown/index.js +3 -0
  126. package/dist/utils/slate2markdown/serialize.js +407 -0
  127. package/dist/utils/utils.js +28 -0
  128. package/dist/viewer/diff-viewer.js +98 -0
  129. package/dist/viewer/markdown-viewer.js +139 -0
  130. package/dist/viewer/slate-viewer.js +73 -0
  131. package/dist/viewer/viewer-formula.js +67 -0
  132. package/dist/viewer/viewer-image.js +93 -0
  133. package/dist/viewer/viewer-outline.js +118 -0
  134. package/package.json +215 -0
  135. package/public/favicon.ico +0 -0
  136. package/public/index.html +45 -0
  137. package/public/locales/cs/seafile-editor.json +169 -0
  138. package/public/locales/de/seafile-editor.json +169 -0
  139. package/public/locales/en/seafile-editor.json +222 -0
  140. package/public/locales/es/seafile-editor.json +169 -0
  141. package/public/locales/es-AR/seafile-editor.json +169 -0
  142. package/public/locales/es-MX/seafile-editor.json +169 -0
  143. package/public/locales/fr/seafile-editor.json +169 -0
  144. package/public/locales/it/seafile-editor.json +169 -0
  145. package/public/locales/ru/seafile-editor.json +169 -0
  146. package/public/locales/zh-CN/seafile-editor.json +219 -0
  147. package/public/manifest.json +15 -0
  148. package/public/media/scripts/mathjax/tex-svg.js +1 -0
  149. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  150. package/public/media/seafile-editor-font/iconfont.svg +164 -0
  151. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  152. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  153. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
  154. package/public/media/seafile-editor-font.css +201 -0
  155. package/public/media/seafile-logo.png +0 -0
  156. package/public/media/seafile-ui.css +11169 -0
@@ -0,0 +1,33 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { Editor, Range } from 'slate';
3
+ /** Triple-click can set the selection focus point to
4
+ * the start of the following block node.
5
+ * Use this function to reset the selection focus point to the end of the previous block node
6
+ * */
7
+
8
+ export var normailizeSelection = function normailizeSelection(editor) {
9
+ var selection = editor.selection;
10
+ if (!selection) return false;
11
+ var anchor = selection.anchor,
12
+ focus = selection.focus;
13
+ if (Range.isCollapsed(selection)) return;
14
+ if (focus.offset !== 0) return;
15
+
16
+ var _Editor$nodes = Editor.nodes(editor, {
17
+ match: 'block',
18
+ at: focus
19
+ }),
20
+ _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
21
+ node = _Editor$nodes2[0];
22
+
23
+ if (!node) return;
24
+
25
+ if (Editor.isStart(editor, focus, node[1])) {
26
+ var newFocusNode = Editor.before(editor, focus);
27
+ var newSelection = {
28
+ anchor: anchor,
29
+ focus: newFocusNode
30
+ };
31
+ Editor.select(editor, newSelection);
32
+ }
33
+ };
@@ -0,0 +1,130 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import { Editor, Path } from 'slate';
5
+ var BOLDITALICREG = /\*\*\*(\S+)\*\*\*|\_\_\_(\S+)\_\_\_|\*\_\_(\S+)\_\_\*|\_\*\*(\S+)\*\*\_|\_\_\*(\S+)\*\_\_|\*\*\_(\S+)_\*\*/;
6
+ var BOLDREG = /\*\*(\S+)\*\*|\_\_(\S+)\_\_/;
7
+ var ITALICREG = /\*(\S+)\*|_(\S+)_/;
8
+ var CODEREG = /\`(\S+)\`/;
9
+
10
+ var TextUtils = function TextUtils(_editor) {
11
+ var _this = this;
12
+
13
+ _classCallCheck(this, TextUtils);
14
+
15
+ this.getTextInfoBeforeSelection = function () {
16
+ var editor = _this.editor;
17
+ var selection = _this.editor.selection;
18
+ var anchor = selection.anchor;
19
+
20
+ var _Editor$nodes = Editor.nodes(editor, {
21
+ match: 'block'
22
+ }),
23
+ _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
24
+ block = _Editor$nodes2[0];
25
+
26
+ var path = block ? block[1] : [];
27
+ var start = Editor.start(editor, path);
28
+ var range = {
29
+ anchor: anchor,
30
+ focus: start
31
+ };
32
+ var beforeText = Editor.text(editor, range);
33
+ return {
34
+ range: range,
35
+ beforeText: beforeText,
36
+ block: block
37
+ };
38
+ };
39
+
40
+ this.setTextMarkByShortCut = function (exec, command) {
41
+ var editor = _this.editor;
42
+ var selection = editor.selection;
43
+
44
+ var _Editor$node = Editor.node(editor, selection),
45
+ _Editor$node2 = _slicedToArray(_Editor$node, 2),
46
+ textNode = _Editor$node2[0],
47
+ textPath = _Editor$node2[1];
48
+
49
+ var text = textNode.text;
50
+ var offset = selection.anchor.offset;
51
+ var lastChart = text[offset - 1];
52
+ var marks, markText, startOffset;
53
+ var matched;
54
+
55
+ if (lastChart === '_' || lastChart === '`' || lastChart === '*') {
56
+ if (matched = text.match(BOLDITALICREG)) {
57
+ startOffset = matched.index;
58
+ marks = {
59
+ BOLD: true,
60
+ ITALIC: true
61
+ };
62
+ } else if (matched = text.match(BOLDREG)) {
63
+ startOffset = matched.index;
64
+ marks = {
65
+ BOLD: true
66
+ };
67
+ } else if (matched = text.match(ITALICREG)) {
68
+ startOffset = matched.index;
69
+ marks = {
70
+ ITALIC: true
71
+ };
72
+ } else if (matched = text.match(CODEREG)) {
73
+ startOffset = matched.index;
74
+ marks = {
75
+ CODE: true
76
+ };
77
+ }
78
+
79
+ if (matched) {
80
+ for (var index = 1; index < matched.length; index++) {
81
+ if (matched[index]) {
82
+ markText = matched[index];
83
+ break;
84
+ }
85
+ }
86
+
87
+ marks = Object.assign({
88
+ BOLD: false,
89
+ ITALIC: false,
90
+ CODE: false
91
+ }, marks);
92
+ Editor.select(editor, {
93
+ anchor: {
94
+ path: textPath,
95
+ offset: startOffset
96
+ },
97
+ focus: {
98
+ path: textPath,
99
+ offset: offset
100
+ }
101
+ });
102
+ Editor.delete(editor, editor.selection); // insert a space before mark
103
+
104
+ Editor.insertText(editor, ' ');
105
+ Editor.insertNodes(editor, [_objectSpread({
106
+ text: markText
107
+ }, marks), {
108
+ text: ' '
109
+ }]);
110
+ var selectedPath = Path.next(Path.next(textPath)); // select the next empty text node to escape the mark
111
+
112
+ Editor.select(editor, selectedPath);
113
+ Editor.collapse(editor, {
114
+ edge: 'end'
115
+ });
116
+ return;
117
+ }
118
+ }
119
+
120
+ exec(command);
121
+ };
122
+
123
+ this.editor = _editor;
124
+ } // Get text related variables before current selection
125
+ // block: Parent of current text node
126
+ // range: From start of block to current selection
127
+ // beforeText: The text of block from start to selection
128
+ ;
129
+
130
+ export default TextUtils;
@@ -0,0 +1,66 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ import SimpleEditor from './simple-editor';
7
+ import SeafileEditor from './seafile-editor';
8
+ import LoadScript from './load-script';
9
+
10
+ var SimpleEditorWithErrorBoundary = /*#__PURE__*/function (_React$Component) {
11
+ _inherits(SimpleEditorWithErrorBoundary, _React$Component);
12
+
13
+ var _super = _createSuper(SimpleEditorWithErrorBoundary);
14
+
15
+ function SimpleEditorWithErrorBoundary() {
16
+ _classCallCheck(this, SimpleEditorWithErrorBoundary);
17
+
18
+ return _super.apply(this, arguments);
19
+ }
20
+
21
+ _createClass(SimpleEditorWithErrorBoundary, [{
22
+ key: "componentDidCatch",
23
+ value: function componentDidCatch(error) {
24
+ console.error(error);
25
+ this.forceUpdate();
26
+ }
27
+ }, {
28
+ key: "render",
29
+ value: function render() {
30
+ return /*#__PURE__*/React.createElement(SimpleEditor, this.props);
31
+ }
32
+ }]);
33
+
34
+ return SimpleEditorWithErrorBoundary;
35
+ }(React.Component);
36
+
37
+ var SeafileEditorWithErrorBundary = /*#__PURE__*/function (_React$Component2) {
38
+ _inherits(SeafileEditorWithErrorBundary, _React$Component2);
39
+
40
+ var _super2 = _createSuper(SeafileEditorWithErrorBundary);
41
+
42
+ function SeafileEditorWithErrorBundary() {
43
+ _classCallCheck(this, SeafileEditorWithErrorBundary);
44
+
45
+ return _super2.apply(this, arguments);
46
+ }
47
+
48
+ _createClass(SeafileEditorWithErrorBundary, [{
49
+ key: "componentDidCatch",
50
+ value: function componentDidCatch(error) {
51
+ console.error(error);
52
+ this.forceUpdate();
53
+ }
54
+ }, {
55
+ key: "render",
56
+ value: function render() {
57
+ return /*#__PURE__*/React.createElement(LoadScript, {
58
+ scriptSource: this.props.scriptSource
59
+ }, /*#__PURE__*/React.createElement(SeafileEditor, this.props));
60
+ }
61
+ }]);
62
+
63
+ return SeafileEditorWithErrorBundary;
64
+ }(React.Component);
65
+
66
+ export { SimpleEditorWithErrorBoundary as SimpleEditor, SeafileEditorWithErrorBundary as SeafileEditor };
@@ -0,0 +1,16 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+
3
+ var Blockquote = function Blockquote(options) {
4
+ _classCallCheck(this, Blockquote);
5
+
6
+ this.type = options.type || 'blockquote';
7
+ this.children = options.children || [{
8
+ text: ''
9
+ }];
10
+ };
11
+
12
+ var generateBlockquote = function generateBlockquote(options) {
13
+ return Object.assign({}, new Blockquote(options));
14
+ };
15
+
16
+ export default generateBlockquote;
@@ -0,0 +1,19 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+
3
+ var Image = function Image(options) {
4
+ _classCallCheck(this, Image);
5
+
6
+ this.type = options.type || 'image';
7
+ this.data = options.data || {
8
+ src: ''
9
+ };
10
+ this.children = options.children || [{
11
+ text: ''
12
+ }];
13
+ };
14
+
15
+ var generateImage = function generateImage(options) {
16
+ return Object.assign({}, new Image(options));
17
+ };
18
+
19
+ export default generateImage;
@@ -0,0 +1,19 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+
3
+ var Link = function Link(options) {
4
+ _classCallCheck(this, Link);
5
+
6
+ this.type = options.type || 'link';
7
+ this.children = options.children || [{
8
+ text: ''
9
+ }];
10
+ this.data = options.data || {
11
+ href: ''
12
+ };
13
+ };
14
+
15
+ var generateLinkElement = function generateLinkElement(options) {
16
+ return Object.assign({}, new Link(options));
17
+ };
18
+
19
+ export default generateLinkElement;
@@ -0,0 +1,50 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+
3
+ var Table = function Table() {
4
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5
+
6
+ _classCallCheck(this, Table);
7
+
8
+ this.type = options.type || 'table';
9
+ this.children = options.children || [generateTableRow(), generateTableRow()];
10
+ };
11
+
12
+ var TableRow = function TableRow() {
13
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+
15
+ _classCallCheck(this, TableRow);
16
+
17
+ this.type = options.type || 'table_row';
18
+ this.children = options.children || [generateTableCell(), generateTableCell()];
19
+ };
20
+
21
+ var TableCell = function TableCell() {
22
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
+
24
+ _classCallCheck(this, TableCell);
25
+
26
+ this.type = options.type || 'table_cell';
27
+ this.children = options.children || [{
28
+ type: 'paragraph',
29
+ children: [{
30
+ text: ''
31
+ }]
32
+ }];
33
+ this.data = options.data || {
34
+ align: 'left'
35
+ };
36
+ };
37
+
38
+ var generateTable = function generateTable(options) {
39
+ return Object.assign({}, new Table(options));
40
+ };
41
+
42
+ var generateTableRow = function generateTableRow(options) {
43
+ return Object.assign({}, new TableRow(options));
44
+ };
45
+
46
+ var generateTableCell = function generateTableCell(options) {
47
+ return Object.assign({}, new TableCell(options));
48
+ };
49
+
50
+ export { generateTable, generateTableRow, generateTableCell };
@@ -0,0 +1,13 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+
3
+ var Text = function Text(options) {
4
+ _classCallCheck(this, Text);
5
+
6
+ this.text = options.text || '';
7
+ };
8
+
9
+ var generateTextElement = function generateTextElement(options) {
10
+ return Object.assign({}, new Text(options));
11
+ };
12
+
13
+ export default generateTextElement;
@@ -0,0 +1,83 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import React from 'react';
7
+ import Loading from '../components/loading'; // load mathjax.js first before show editor
8
+
9
+ var LoadScript = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(LoadScript, _React$Component);
11
+
12
+ var _super = _createSuper(LoadScript);
13
+
14
+ function LoadScript(props) {
15
+ var _this;
16
+
17
+ _classCallCheck(this, LoadScript);
18
+
19
+ _this = _super.call(this, props);
20
+
21
+ _this.loadScript = function () {
22
+ if (!_this.props.scriptSource) return;
23
+
24
+ if (!document.querySelector('#mathjax')) {
25
+ var script = document.createElement('script');
26
+ script.src = _this.props.scriptSource;
27
+ script.id = 'mathjax';
28
+ document.body.appendChild(script);
29
+
30
+ script.onload = function () {
31
+ _this.setState({
32
+ isScriptLoaded: true
33
+ });
34
+ };
35
+ }
36
+ };
37
+
38
+ if (!props.scriptSource || window.MathJax) {
39
+ _this.state = {
40
+ isScriptLoaded: true
41
+ };
42
+ return _possibleConstructorReturn(_this);
43
+ }
44
+
45
+ window.canInsertFormula = true;
46
+
47
+ if (!window.MathJax) {
48
+ // config mathjax
49
+ window.MathJax = {
50
+ options: {
51
+ enableMenu: false
52
+ },
53
+ tex: {
54
+ inlineMath: [['$', '$']],
55
+ displayMath: [['$$', '$$']]
56
+ },
57
+ svg: {
58
+ fontCache: 'global'
59
+ }
60
+ };
61
+ _this.state = {
62
+ isScriptLoaded: false
63
+ };
64
+
65
+ _this.loadScript();
66
+ }
67
+
68
+ return _this;
69
+ } // load mathjax
70
+
71
+
72
+ _createClass(LoadScript, [{
73
+ key: "render",
74
+ value: function render() {
75
+ var isScriptLoaded = this.state.isScriptLoaded;
76
+ return isScriptLoaded ? this.props.children : /*#__PURE__*/React.createElement(Loading, null);
77
+ }
78
+ }]);
79
+
80
+ return LoadScript;
81
+ }(React.Component);
82
+
83
+ export default LoadScript;