@seafile/seafile-editor 0.3.104 → 0.3.107
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.
- package/dist/components/outline/outline-item.js +3 -1
- package/dist/editor/editor-component/textlink-hovermenu.js +4 -3
- package/dist/editor/markdown-editor.js +11 -1
- package/dist/editor/simple-editor.js +11 -1
- package/dist/index.js +2 -2
- package/dist/utils/seafile-markdown2html.js +9 -2
- package/dist/utils/slate2markdown/deserialize.js +3 -4
- package/package.json +1 -1
- package/dist/config.js +0 -15
|
@@ -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
|
|
63
|
+
}, node.children.map(function (child) {
|
|
64
|
+
return child.text;
|
|
65
|
+
}).join(''));
|
|
64
66
|
}
|
|
65
67
|
}]);
|
|
66
68
|
|
|
@@ -102,6 +102,7 @@ var TextLinkHoverMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
102
102
|
value: function render() {
|
|
103
103
|
var _this2 = this;
|
|
104
104
|
|
|
105
|
+
var editorUtils = this.props.editorUtils;
|
|
105
106
|
return /*#__PURE__*/React.createElement("div", {
|
|
106
107
|
className: "seafile-ed-hovermenu",
|
|
107
108
|
ref: function ref(_ref) {
|
|
@@ -115,13 +116,13 @@ var TextLinkHoverMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
115
116
|
}, this.linkUrl), /*#__PURE__*/React.createElement(Button, {
|
|
116
117
|
color: "",
|
|
117
118
|
className: "seafile-ed-hovermenu-btn",
|
|
118
|
-
onClick:
|
|
119
|
+
onClick: editorUtils.unwrapLink
|
|
119
120
|
}, /*#__PURE__*/React.createElement("i", {
|
|
120
121
|
className: "iconfont icon-delete"
|
|
121
122
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
122
123
|
color: "",
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
className: "seafile-ed-hovermenu-btn",
|
|
125
|
+
onClick: this.props.onToggleLinkDialog
|
|
125
126
|
}, /*#__PURE__*/React.createElement("i", {
|
|
126
127
|
className: "iconfont icon-edit"
|
|
127
128
|
})), /*#__PURE__*/React.createElement("span", {
|
|
@@ -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
|
}]);
|
|
@@ -15,6 +15,7 @@ import TextLinkHoverMenu from './editor-component/textlink-hovermenu';
|
|
|
15
15
|
import ContextMenu from '../components/context-menu';
|
|
16
16
|
import KeyboardShortcuts from '../components/shortcut-dialog';
|
|
17
17
|
import EditorBuilder from './editor-builder';
|
|
18
|
+
import AddLinkDialog from '../components/add-link-dialog';
|
|
18
19
|
import './code-highlight-package';
|
|
19
20
|
import '../assets/editor/simple-editor.css';
|
|
20
21
|
import '../assets/css/image.css';
|
|
@@ -104,6 +105,12 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
104
105
|
});
|
|
105
106
|
};
|
|
106
107
|
|
|
108
|
+
_this.onToggleLinkDialog = function () {
|
|
109
|
+
_this.setState({
|
|
110
|
+
isShowLinkDialog: !_this.state.isShowLinkDialog
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
107
114
|
_this.setEditorRef = function (ref) {
|
|
108
115
|
_this.editorRef = ref;
|
|
109
116
|
};
|
|
@@ -112,7 +119,8 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
112
119
|
value: deserialize(props.value),
|
|
113
120
|
isShowBigImage: false,
|
|
114
121
|
isShowContextMenu: false,
|
|
115
|
-
isShowShortcutDialog: false
|
|
122
|
+
isShowShortcutDialog: false,
|
|
123
|
+
isShowLinkDialog: false
|
|
116
124
|
};
|
|
117
125
|
_this.editor = EditorBuilder.getEditor(props);
|
|
118
126
|
_this.editorUtils = EditorBuilder.getEditorUtils();
|
|
@@ -201,6 +209,8 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
201
209
|
returnObjects: true
|
|
202
210
|
}),
|
|
203
211
|
toggleShortcutDialog: this.toggleShortcutDialog
|
|
212
|
+
}), this.state.isShowLinkDialog && /*#__PURE__*/React.createElement(AddLinkDialog, {
|
|
213
|
+
toggleLinkDialog: this.onToggleLinkDialog
|
|
204
214
|
}))));
|
|
205
215
|
}
|
|
206
216
|
}]);
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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({
|
package/package.json
CHANGED
package/dist/config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var serverConfig = {
|
|
2
|
-
serviceUrl: 'dhttps://dev.seafile.com/seahub',
|
|
3
|
-
username: 'bing.an@seafile.com',
|
|
4
|
-
password: 'Seafile123#$%',
|
|
5
|
-
repoID: '66ffac5c-9cce-4738-a867-bb8931821e04',
|
|
6
|
-
userInfo: {
|
|
7
|
-
username: 'bing.an@seafile.com',
|
|
8
|
-
name: '安冰',
|
|
9
|
-
contact_email: 'bing.an@seafile.com'
|
|
10
|
-
},
|
|
11
|
-
filePath: '/测试.md',
|
|
12
|
-
fileName: '测试.md',
|
|
13
|
-
dirPath: '/'
|
|
14
|
-
};
|
|
15
|
-
export { serverConfig };
|