@seafile/seafile-editor 0.3.108 → 0.3.111
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.
|
@@ -5,6 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Button } from 'reactstrap';
|
|
7
7
|
import { withTranslation } from 'react-i18next';
|
|
8
|
+
import isUrl from 'is-url';
|
|
8
9
|
|
|
9
10
|
var TextLinkHoverMenu = /*#__PURE__*/function (_React$Component) {
|
|
10
11
|
_inherits(TextLinkHoverMenu, _React$Component);
|
|
@@ -83,6 +84,12 @@ var TextLinkHoverMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
83
84
|
_this.getLinkUrl();
|
|
84
85
|
};
|
|
85
86
|
|
|
87
|
+
_this.onLinkClick = function (e) {
|
|
88
|
+
if (!isUrl(_this.linkUrl)) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
86
93
|
_this.linkUrl = '';
|
|
87
94
|
return _this;
|
|
88
95
|
}
|
|
@@ -110,6 +117,7 @@ var TextLinkHoverMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
110
117
|
}
|
|
111
118
|
}, /*#__PURE__*/React.createElement("a", {
|
|
112
119
|
href: this.linkUrl,
|
|
120
|
+
onClick: this.onLinkClick,
|
|
113
121
|
target: "_blank",
|
|
114
122
|
rel: "noopener noreferrer",
|
|
115
123
|
className: "seafile-ed-hovermenu-link"
|
|
@@ -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':
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
2
|
import { Text, Node } from 'slate';
|
|
3
|
-
import escapeHtml from 'escape-html';
|
|
4
3
|
import { isEmptyParagraph } from '../utils';
|
|
5
4
|
|
|
6
5
|
var unified = require('../../lib/unified');
|
|
@@ -356,7 +355,7 @@ function _slateNodeToMD(node) {
|
|
|
356
355
|
mdNodes = parseChildren(node);
|
|
357
356
|
return {
|
|
358
357
|
type: 'link',
|
|
359
|
-
url:
|
|
358
|
+
url: node.data.href,
|
|
360
359
|
title: node.data.title ? node.data.title : null,
|
|
361
360
|
children: mdNodes
|
|
362
361
|
};
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
1
|
+
.sf-editor-image-previewer .ril__closeButton {
|
|
2
|
+
background-image: none !important;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.
|
|
6
|
-
|
|
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);
|
|
5
|
+
.sf-editor-image-previewer .ril__caption {
|
|
6
|
+
justify-content: center !important;
|
|
23
7
|
}
|
|
@@ -3,8 +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
|
|
7
|
-
import { Modal } from 'reactstrap';
|
|
6
|
+
import Lightbox from '@seafile/react-image-lightbox';
|
|
8
7
|
import './viewer-image.css';
|
|
9
8
|
|
|
10
9
|
var ViewerImage = /*#__PURE__*/function (_React$Component) {
|
|
@@ -28,9 +27,16 @@ var ViewerImage = /*#__PURE__*/function (_React$Component) {
|
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
_this.renderBigImage = function (src) {
|
|
31
|
-
return /*#__PURE__*/React.createElement(
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
return /*#__PURE__*/React.createElement(Lightbox, {
|
|
31
|
+
wrapperClassName: "sf-editor-image-previewer",
|
|
32
|
+
mainSrc: src,
|
|
33
|
+
imagePadding: 70,
|
|
34
|
+
onCloseRequest: _this.toggleBigImage,
|
|
35
|
+
reactModalStyle: {
|
|
36
|
+
overlay: {
|
|
37
|
+
zIndex: 1051
|
|
38
|
+
}
|
|
39
|
+
}
|
|
34
40
|
});
|
|
35
41
|
};
|
|
36
42
|
|
|
@@ -49,7 +55,12 @@ var ViewerImage = /*#__PURE__*/function (_React$Component) {
|
|
|
49
55
|
var data = node.data;
|
|
50
56
|
var isShowBigImage = this.state.isShowBigImage;
|
|
51
57
|
var src = data.src;
|
|
52
|
-
|
|
58
|
+
|
|
59
|
+
if (!src) {
|
|
60
|
+
return /*#__PURE__*/React.createElement("span", attributes, "Loading...");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
53
64
|
className: "seafile-ed-image seafile-ed-image-viwer"
|
|
54
65
|
}, /*#__PURE__*/React.createElement("img", Object.assign({
|
|
55
66
|
draggable: false,
|
|
@@ -64,38 +75,10 @@ var ViewerImage = /*#__PURE__*/function (_React$Component) {
|
|
|
64
75
|
}, /*#__PURE__*/React.createElement("i", {
|
|
65
76
|
className: 'iconfont icon-fullscreen'
|
|
66
77
|
})), isShowBigImage && this.renderBigImage(src));
|
|
67
|
-
return src ? dom : /*#__PURE__*/React.createElement("span", attributes, "Loading...");
|
|
68
78
|
}
|
|
69
79
|
}]);
|
|
70
80
|
|
|
71
81
|
return ViewerImage;
|
|
72
82
|
}(React.Component);
|
|
73
83
|
|
|
74
|
-
var BigImage = function BigImage(props) {
|
|
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",
|
|
83
|
-
onClick: function onClick(event) {
|
|
84
|
-
return props.toggleBigImage(event);
|
|
85
|
-
}
|
|
86
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
87
|
-
className: "big-image-container"
|
|
88
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
89
|
-
src: props.src,
|
|
90
|
-
alt: ""
|
|
91
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
92
|
-
onClick: function onClick(event) {
|
|
93
|
-
return props.toggleBigImage(event);
|
|
94
|
-
},
|
|
95
|
-
className: "image-container-close"
|
|
96
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
97
|
-
className: "iconfont icon-close"
|
|
98
|
-
})))));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
84
|
export { ViewerImage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/seafile-editor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.111",
|
|
4
4
|
"private": false,
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "^0.0.9",
|
|
@@ -11,7 +11,6 @@
|
|
|
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",
|
|
15
14
|
"glamor": "^2.20.40",
|
|
16
15
|
"hast-util-sanitize": "^1.1.2",
|
|
17
16
|
"i18next": "^17.0.13",
|