@seafile/seafile-editor 0.3.106 → 0.3.109

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.
@@ -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: this.props.editorUtils.unwrapLink
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
- onClick: this.props.onToggleLinkDialog,
124
- className: "seafile-ed-hovermenu-btn"
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", {
@@ -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
  }]);
@@ -3,6 +3,7 @@ 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 isUrl from 'is-url';
6
7
  import CheckListItem from '../editor/editor-component/check-list-item';
7
8
  import Formula from '../viewer/viewer-formula';
8
9
  import { ViewerImage } from '../viewer/viewer-image';
@@ -112,10 +113,21 @@ function renderNode(_ref) {
112
113
  }, attributes), children);
113
114
 
114
115
  case 'link':
116
+ if (isUrl(href)) {
117
+ return /*#__PURE__*/React.createElement("a", Object.assign({
118
+ className: diffClass ? diffClass : ''
119
+ }, attributes, {
120
+ href: href
121
+ }), children);
122
+ }
123
+
115
124
  return /*#__PURE__*/React.createElement("a", Object.assign({
116
125
  className: diffClass ? diffClass : ''
117
126
  }, attributes, {
118
- href: href
127
+ href: href,
128
+ onClick: function onClick(e) {
129
+ return e.preventDefault();
130
+ }
119
131
  }), children);
120
132
 
121
133
  case 'hr':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "0.3.106",
3
+ "version": "0.3.109",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "^0.0.9",