@seafile/seafile-editor 0.3.103 → 0.3.106

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.
@@ -60,7 +60,9 @@ var OutlineItem = /*#__PURE__*/function (_React$PureComponent) {
60
60
  return /*#__PURE__*/React.createElement("div", {
61
61
  className: className,
62
62
  onClick: this.onClick
63
- }, node.children[0].text);
63
+ }, node.children.map(function (child) {
64
+ return child.text;
65
+ }).join(''));
64
66
  }
65
67
  }]);
66
68
 
@@ -16,6 +16,7 @@ import { serialize } from '../utils/slate2markdown/index';
16
16
  import TextLinkHoverMenu from './editor-component/textlink-hovermenu';
17
17
  import { isRangeCollapsed } from './editor-utils/range-utils';
18
18
  import EditorBuilder from './editor-builder';
19
+ import AddLinkDialog from '../components/add-link-dialog';
19
20
  import '../assets/css/navbar-imgbutton.css';
20
21
  import '../assets/css/textlink-hovermenu.css';
21
22
  import '../assets/css/image.css';
@@ -100,6 +101,12 @@ var MarkdownEditor = /*#__PURE__*/function (_React$Component) {
100
101
  });
101
102
  };
102
103
 
104
+ _this.onToggleLinkDialog = function () {
105
+ _this.setState({
106
+ isShowLinkDialog: !_this.state.isShowLinkDialog
107
+ });
108
+ };
109
+
103
110
  _this.getQuote = function () {
104
111
  _this.quote = serialize(Editor.fragment(_this.editor, _this.editor.selection));
105
112
 
@@ -215,7 +222,8 @@ var MarkdownEditor = /*#__PURE__*/function (_React$Component) {
215
222
  value: props.value,
216
223
  isShowContextMenu: false,
217
224
  showCommentDialog: false,
218
- commentPosition: null
225
+ commentPosition: null,
226
+ isShowLinkDialog: false
219
227
  };
220
228
  _this.editor = EditorBuilder.getEditor(props);
221
229
  _this.plugin = EditorBuilder.getPlugin();
@@ -311,6 +319,8 @@ var MarkdownEditor = /*#__PURE__*/function (_React$Component) {
311
319
  commentPosition: commentPosition,
312
320
  onCommentAdded: this.onCommentAdded,
313
321
  toggleCommentDialog: this.toggleCommentDialog
322
+ }), this.state.isShowLinkDialog && /*#__PURE__*/React.createElement(AddLinkDialog, {
323
+ toggleLinkDialog: this.onToggleLinkDialog
314
324
  })));
315
325
  }
316
326
  }]);
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import DiffViewer from './viewer/diff-viewer';
2
2
  import MarkdownViewer from './viewer/markdown-viewer';
3
3
  import { deserialize, serialize } from './utils/slate2markdown';
4
- import { processor } from './utils/seafile-markdown2html';
4
+ import { processor, processorWithoutHTML } from './utils/seafile-markdown2html';
5
5
  import { EditorBuilder, MarkdownEditor, SimpleEditor, PlainMarkdownEditor } from './editor';
6
6
  import Toolbar from './components/toolbar';
7
7
  import Outline from './components/outline';
8
8
  import UserHelp from './components/user-help';
9
- export { EditorBuilder, MarkdownEditor, SimpleEditor, PlainMarkdownEditor, DiffViewer, MarkdownViewer, Toolbar, Outline, UserHelp, deserialize, serialize, processor };
9
+ export { EditorBuilder, MarkdownEditor, SimpleEditor, PlainMarkdownEditor, DiffViewer, MarkdownViewer, Toolbar, Outline, UserHelp, deserialize, serialize, processor, processorWithoutHTML };
@@ -58,5 +58,12 @@ var processor = unified().use(markdown, {
58
58
  }).use(raw).use(format).use(stringify);
59
59
  var processorGetAST = unified().use(markdown, {
60
60
  commonmark: true
61
- }).use(slug);
62
- export { processor, processorGetAST };
61
+ }).use(slug); // markdown -> mdast -> html AST -> html
62
+ // don't support dangerous html
63
+
64
+ var processorWithoutHTML = unified().use(markdown, {
65
+ commonmark: true
66
+ }).use(math).use(breaks).use(slug).use(remark2rehype).use(mathjax, {
67
+ displayMath: ['$$', '$$']
68
+ }).use(raw).use(format).use(stringify);
69
+ export { processor, processorWithoutHTML, processorGetAST };
@@ -421,7 +421,7 @@ function _nodeToSlate(node, opts) {
421
421
  return mdImageToSlate(node, opts);
422
422
  } else {
423
423
  return {
424
- text: node.value
424
+ text: ''
425
425
  };
426
426
  }
427
427
 
@@ -659,9 +659,8 @@ function deserialize(content) {
659
659
  } // handle image and html_block
660
660
 
661
661
 
662
- var c;
663
- c = fixValue(nodes);
664
- var firstBlockType = c[0].type;
662
+ var c = fixValue(nodes);
663
+ var firstBlockType = c[0] && c[0].type;
665
664
 
666
665
  if (firstBlockType === 'table' || firstBlockType === 'code_block' || firstBlockType === 'blockquote') {
667
666
  c.unshift({
@@ -0,0 +1,23 @@
1
+ .big-image-cover {
2
+ position: relative;
3
+ }
4
+
5
+ .big-image-cover .image-container-close {
6
+ position: absolute;
7
+ top: 10px;
8
+ right: 10px;
9
+ cursor: pointer;
10
+ width: 30px;
11
+ height: 30px;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ }
16
+
17
+ .big-image-cover .image-container-close .icon-close {
18
+ color: rgba(0, 0, 0, 0.5);
19
+ }
20
+
21
+ .big-image-cover .image-container-close .icon-close:hover {
22
+ color: rgba(0, 0, 0, 0.75);
23
+ }
@@ -3,7 +3,9 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import Modal from '../components/modal-portal';
6
+ import ModalPortal from '../components/modal-portal';
7
+ import { Modal } from 'reactstrap';
8
+ import './viewer-image.css';
7
9
 
8
10
  var ViewerImage = /*#__PURE__*/function (_React$Component) {
9
11
  _inherits(ViewerImage, _React$Component);
@@ -18,7 +20,7 @@ var ViewerImage = /*#__PURE__*/function (_React$Component) {
18
20
  _this = _super.call(this, props);
19
21
 
20
22
  _this.toggleBigImage = function (event) {
21
- event.preventDefault();
23
+ event && event.preventDefault();
22
24
 
23
25
  _this.setState({
24
26
  isShowBigImage: !_this.state.isShowBigImage
@@ -70,13 +72,19 @@ var ViewerImage = /*#__PURE__*/function (_React$Component) {
70
72
  }(React.Component);
71
73
 
72
74
  var BigImage = function BigImage(props) {
73
- return /*#__PURE__*/React.createElement(Modal, null, /*#__PURE__*/React.createElement("div", {
74
- className: 'big-image-cover',
75
+ return /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement(Modal, {
76
+ isOpen: true,
77
+ centered: true,
78
+ toggle: function toggle() {
79
+ props.toggleBigImage();
80
+ }
81
+ }, /*#__PURE__*/React.createElement("div", {
82
+ className: "big-image-cover",
75
83
  onClick: function onClick(event) {
76
84
  return props.toggleBigImage(event);
77
85
  }
78
86
  }, /*#__PURE__*/React.createElement("div", {
79
- className: 'big-image-container'
87
+ className: "big-image-container"
80
88
  }, /*#__PURE__*/React.createElement("img", {
81
89
  src: props.src,
82
90
  alt: ""
@@ -84,10 +92,10 @@ var BigImage = function BigImage(props) {
84
92
  onClick: function onClick(event) {
85
93
  return props.toggleBigImage(event);
86
94
  },
87
- className: 'image-container-close'
95
+ className: "image-container-close"
88
96
  }, /*#__PURE__*/React.createElement("i", {
89
- className: 'iconfont icon-close'
90
- }))));
97
+ className: "iconfont icon-close"
98
+ })))));
91
99
  };
92
100
 
93
101
  export { ViewerImage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "0.3.103",
3
+ "version": "0.3.106",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "^0.0.9",
package/dist/config-0.js DELETED
@@ -1,15 +0,0 @@
1
- var serverConfig = {
2
- serviceUrl: "https://download.seafile.top",
3
- username: "xxx",
4
- password: "xxx",
5
- repoID: "xxxxxxx-xxxx-xxx-xxx-xxxx",
6
- userInfo: {
7
- username: 'xxx',
8
- name: 'xxx',
9
- contact_email: 'xxxx'
10
- },
11
- filePath: '/demo.md',
12
- fileName: 'demo.md',
13
- dirPath: '/'
14
- };
15
- export { serverConfig };
package/dist/config.js DELETED
@@ -1,16 +0,0 @@
1
- var serverConfig = {
2
- //serviceUrl: "http://127.0.0.1:8000",
3
- serviceUrl: "http://192.168.1.100:8000",
4
- username: "lj@11.com",
5
- password: "11",
6
- repoID: "79d1fa93-4b5f-4d6c-8fb5-ad3958e1fa47",
7
- userInfo: {
8
- username: 'lj@11.com',
9
- name: 'lj-',
10
- contact_email: 'lj@11.com'
11
- },
12
- filePath: '/xxx.md',
13
- fileName: 'xxx.md',
14
- dirPath: '/'
15
- };
16
- export { serverConfig };