@seafile/seafile-editor 0.3.105 → 0.3.108
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
|
|
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
|
}]);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
2
|
import { Text, Node } from 'slate';
|
|
3
|
+
import escapeHtml from 'escape-html';
|
|
3
4
|
import { isEmptyParagraph } from '../utils';
|
|
4
5
|
|
|
5
6
|
var unified = require('../../lib/unified');
|
|
@@ -355,7 +356,7 @@ function _slateNodeToMD(node) {
|
|
|
355
356
|
mdNodes = parseChildren(node);
|
|
356
357
|
return {
|
|
357
358
|
type: 'link',
|
|
358
|
-
url: node.data.href,
|
|
359
|
+
url: escapeHtml(node.data.href),
|
|
359
360
|
title: node.data.title ? node.data.title : null,
|
|
360
361
|
children: mdNodes
|
|
361
362
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/seafile-editor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.108",
|
|
4
4
|
"private": false,
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "^0.0.9",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"deepmerge": "^2.1.0",
|
|
12
12
|
"detect-indent": "^4.0.0",
|
|
13
13
|
"detect-newline": "^2.1.0",
|
|
14
|
+
"escape-html": "1.0.3",
|
|
14
15
|
"glamor": "^2.20.40",
|
|
15
16
|
"hast-util-sanitize": "^1.1.2",
|
|
16
17
|
"i18next": "^17.0.13",
|