@seafile/seafile-editor 0.3.97 → 0.3.100
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/_i18n/index.js +20 -0
- package/dist/assets/css/comment-dialog.css +50 -0
- package/dist/{css → assets/css}/diff-viewer.css +0 -0
- package/dist/{css/richeditor → assets/css}/formula.css +0 -0
- package/dist/{css → assets/css}/history-viewer.css +0 -0
- package/dist/{css/richeditor → assets/css}/image.css +0 -0
- package/dist/{index.css → assets/css/index.css} +0 -0
- package/dist/assets/css/issue-card.css +43 -0
- package/dist/{css → assets/css}/keyboard-shortcuts.css +0 -0
- package/dist/{css/richeditor → assets/css}/link.css +0 -0
- package/dist/{css/plaineditor → assets/css}/markdown-editor.css +0 -0
- package/dist/{css → assets/css}/markdown-viewer.css +0 -0
- package/dist/{css/richeditor → assets/css}/navbar-imgbutton.css +0 -0
- package/dist/assets/css/outline.css +29 -0
- package/dist/{css/richeditor → assets/css}/table.css +0 -0
- package/dist/{css/richeditor → assets/css}/textlink-hovermenu.css +0 -0
- package/dist/{css → assets/css}/topbar.css +19 -33
- package/dist/{css/richeditor → assets/css}/tree-view.css +0 -0
- package/dist/{css/richeditor/right-panel.css → assets/css/user-help.css} +9 -9
- package/dist/assets/editor/plain-editor.css +30 -0
- package/dist/assets/editor/rich-editor.css +104 -0
- package/dist/assets/editor/simple-editor.css +77 -0
- package/dist/{css/richeditor → assets/rich-editor}/document-info.css +0 -0
- package/dist/components/add-formula-dialog.js +6 -4
- package/dist/components/add-image-dialog.js +3 -1
- package/dist/components/add-link-dialog.js +4 -3
- package/dist/components/comment-dialog.js +12 -6
- package/dist/components/markdown-lint.js +1 -0
- package/dist/components/outline/index.js +97 -0
- package/dist/components/outline/outline-item.js +70 -0
- package/dist/components/shortcut-dialog.js +26 -51
- package/dist/components/{topbar-component → toolbar}/header-list.js +0 -0
- package/dist/components/toolbar/help-group.js +40 -0
- package/dist/components/toolbar/index.js +4 -0
- package/dist/components/{topbar-component/upload-img.js → toolbar/insert-image.js} +18 -15
- package/dist/components/toolbar/insert-table.js +155 -0
- package/dist/components/toolbar/table-group.js +82 -0
- package/dist/components/{toolbar.js → toolbar/toolbar.js} +102 -64
- package/dist/components/{topbar-component → toolbar/widgets}/button-group.js +0 -0
- package/dist/components/toolbar/widgets/button-item.js +144 -0
- package/dist/components/toolbar/widgets/drop-list.js +101 -0
- package/dist/components/user-help.js +16 -10
- package/dist/editor/controller/block-element-controller.js +6 -2
- package/dist/editor/controller/inline-element-controller.js +6 -2
- package/dist/editor/editor-builder.js +107 -0
- package/dist/editor/editor-component/formula.js +4 -2
- package/dist/editor/editor-component/image.js +10 -6
- package/dist/editor/editor-component/table.js +1 -1
- package/dist/editor/editor-plugin.js +3 -1
- package/dist/editor/editor.js +1 -32
- package/dist/editor/index.js +97 -0
- package/dist/editor/markdown-editor.js +323 -0
- package/dist/editor/plain-markdown-editor.js +5 -4
- package/dist/editor/rich-markdown-editor.js +70 -149
- package/dist/editor/simple-editor.js +44 -78
- package/dist/{css/richeditor → example/assets/css}/comments-list.css +0 -45
- package/dist/{css/richeditor → example/assets/css}/detail-list-view.css +0 -0
- package/dist/{css/richeditor → example/assets/css}/participants-list.css +0 -0
- package/dist/{css → example/assets/css}/react-mentions-default-style.js +0 -0
- package/dist/example/assets/css/seafile-editor-main.css +125 -0
- package/dist/example/assets/css/seafile-editor-side.css +89 -0
- package/dist/example/assets/css/side-panel.css +81 -0
- package/dist/{components → example/components}/comment-panel.js +12 -6
- package/dist/{components → example/components}/detail-list-view.js +1 -1
- package/dist/{components → example/components}/participants-list.js +1 -1
- package/dist/{components → example/components}/side-panel.js +5 -7
- package/dist/example/seafile-editor.js +137 -0
- package/dist/index.js +9 -0
- package/dist/index.local.js +58 -0
- package/dist/pages/seafile-editor/index.js +38 -0
- package/dist/{editor → pages/seafile-editor}/seafile-editor.js +19 -35
- package/dist/{seafile-editor-chooser.js → pages/seafile-editor-chooser.js} +0 -0
- package/dist/{seafile-markdown-editor.js → pages/seafile-markdown-editor.js} +5 -5
- package/dist/{seafile-markdown-viewer.js → pages/seafile-markdown-viewer.js} +3 -3
- package/dist/{seafile-simple-editor.js → pages/seafile-simple-editor.js} +5 -2
- package/dist/viewer/diff-viewer.js +1 -1
- package/dist/viewer/markdown-viewer.js +14 -15
- package/dist/viewer/slate-viewer.js +9 -24
- package/dist/viewer/viewer-formula.js +1 -1
- package/package.json +6 -14
- package/public/locales/zh-CN/seafile-editor.json +15 -13
- package/dist/components/generate-share-link.js +0 -412
- package/dist/components/internal-link-dialog.js +0 -96
- package/dist/components/outline.js +0 -130
- package/dist/components/topbar-component/icon-button.js +0 -99
- package/dist/components/topbar-component/insert-file.js +0 -67
- package/dist/components/topbar-component/table-toolbar.js +0 -175
- package/dist/config-0.js +0 -15
- package/dist/css/layout.css +0 -111
- package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -76
- package/dist/css/richeditor/rich-editor-main.css +0 -32
- package/dist/css/richeditor/side-panel.css +0 -183
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.seafile-markdown-editor {
|
|
2
|
+
flex: 1;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
min-height: 0;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.seafile-markdown-editor .markdown-editor-toolbar {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
position: relative;
|
|
14
|
+
border-bottom: 1px solid #e5e5e5;
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
user-select: none;
|
|
17
|
+
box-shadow: 0 3px 2px -2px rgba(200,200,200,.15);
|
|
18
|
+
z-index: 3;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.seafile-markdown-editor .markdown-editor-toolbar .editor-btn-group {
|
|
22
|
+
height: 100%;
|
|
23
|
+
padding: 5px 0 5px 5px;
|
|
24
|
+
font-size: 0.75rem;
|
|
25
|
+
border-right: 1px solid #e5e5e5;
|
|
26
|
+
color: #555555;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.seafile-markdown-editor .markdown-editor-content {
|
|
30
|
+
flex: 1;
|
|
31
|
+
display: flex;
|
|
32
|
+
min-height: 0;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.seafile-markdown-editor .markdown-editor-content .markdown-editor-wrapper {
|
|
38
|
+
flex: 1;
|
|
39
|
+
display: flex;
|
|
40
|
+
position: relative;
|
|
41
|
+
overflow-x: hidden;
|
|
42
|
+
min-height: 0;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
background-color: #fafaf9;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.seafile-markdown-editor .markdown-editor-content .markdown-help-wrapper {
|
|
48
|
+
width: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
min-height: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.seafile-markdown-editor .markdown-editor-content .markdown-help-wrapper.show {
|
|
56
|
+
width: 300px;
|
|
57
|
+
background-color: #fff;
|
|
58
|
+
border-left: 1px solid #e6e6dd;
|
|
59
|
+
position: relative;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
.seafile-markdown-editor .markdown-editor-content .markdown-help-wrapper .file-info {
|
|
64
|
+
flex: 1;
|
|
65
|
+
display: flex;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
min-height: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.seafile-markdown-editor .markdown-editor-content .markdown-help-wrapper .help-info {
|
|
71
|
+
flex: 1;
|
|
72
|
+
display: flex;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
min-height: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.seafile-markdown-editor ::-webkit-scrollbar{
|
|
78
|
+
width: 8px;
|
|
79
|
+
height: 8px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.seafile-markdown-editor ::-webkit-scrollbar-button {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.seafile-markdown-editor ::-webkit-scrollbar-thumb {
|
|
87
|
+
background-color: rgb(206, 206, 212);
|
|
88
|
+
border-radius: 10px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (max-width: 991.8px) {
|
|
92
|
+
.seafile-editor {
|
|
93
|
+
min-width: calc(100% - 40px);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.seafile-editor-main-panel {
|
|
97
|
+
width: calc(100% - 200px);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.seafile-editor-side-panel {
|
|
101
|
+
min-width: 200px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.editor-container {
|
|
105
|
+
width: 100%;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.editor-container .editor {
|
|
109
|
+
margin: 20px !important;
|
|
110
|
+
padding: 20px 30px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@media (max-width: 768px) {
|
|
115
|
+
.editor-container .editor {
|
|
116
|
+
margin: 0 !important;
|
|
117
|
+
padding: 10px 15px;
|
|
118
|
+
border: 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.full-screen .editor-container .article {
|
|
123
|
+
margin: 20px auto;
|
|
124
|
+
max-width: 950px;
|
|
125
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.seafile-markdown-editor .markdown-help-wrapper .side-panel {
|
|
2
|
+
flex: 1;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
background-color: #f5f5f5;
|
|
6
|
+
user-select: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.seafile-markdown-editor .side-panel .nav {
|
|
10
|
+
padding: 10px 0;
|
|
11
|
+
min-width: 125px;
|
|
12
|
+
border-bottom: 1px solid #eee;
|
|
13
|
+
height: 36px;
|
|
14
|
+
flex-wrap: nowrap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.seafile-markdown-editor .side-panel .nav .nav-item {
|
|
18
|
+
padding: 0 0.75rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.seafile-markdown-editor .side-panel .nav .nav-link {
|
|
22
|
+
padding: 0 0.75rem;
|
|
23
|
+
transition: 0.3s color;
|
|
24
|
+
margin-right: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.seafile-markdown-editor .side-panel .nav-link {
|
|
28
|
+
color: #888;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.seafile-markdown-editor .side-panel .nav .nav-link.active {
|
|
32
|
+
color: #f19645;
|
|
33
|
+
border-bottom: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.seafile-markdown-editor .side-panel .nav .iconfont {
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
font-size: 0.875rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.seafile-markdown-editor .side-panel-content {
|
|
42
|
+
font-size: 0.937rem;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.seafile-markdown-editor .side-panel-content:hover {
|
|
47
|
+
overflow: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.image-view {
|
|
51
|
+
width: 200px;
|
|
52
|
+
height: 150px;
|
|
53
|
+
position: absolute;
|
|
54
|
+
background-color: #fff;
|
|
55
|
+
z-index: 1004;
|
|
56
|
+
box-shadow: 0 0 10px #aaa;
|
|
57
|
+
border-radius: 3px;
|
|
58
|
+
line-height: 150px;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
font-size: 0;
|
|
61
|
+
text-align: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.image-view img {
|
|
65
|
+
max-width: 100%;
|
|
66
|
+
max-height: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.image-view i {
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
text-align: center;
|
|
73
|
+
line-height: 150px;
|
|
74
|
+
font-size: 30px;
|
|
75
|
+
color: #eb8205;
|
|
76
|
+
-moz-animation: rotate 1.5s ease infinite;
|
|
77
|
+
-webkit-animation: rotate 1.5s ease infinite;
|
|
78
|
+
animation: rotate 1.5s ease infinite;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@keyframes rotate {
|
|
82
|
+
0% {
|
|
83
|
+
transform: rotate(0deg);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
100% {
|
|
87
|
+
transform: rotate(360deg);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.seafile-rich-editor .side-panel {
|
|
2
|
+
user-select: none;
|
|
3
|
+
height:100%;
|
|
4
|
+
background-color: #f5f5f5;
|
|
5
|
+
}
|
|
6
|
+
.seafile-rich-editor .side-panel .nav {
|
|
7
|
+
border-bottom: 1px solid #eee;
|
|
8
|
+
padding-top: 10px;
|
|
9
|
+
padding-bottom: 10px;
|
|
10
|
+
min-width: 125px;
|
|
11
|
+
height: 36px;
|
|
12
|
+
flex-wrap: nowrap;
|
|
13
|
+
}
|
|
14
|
+
.seafile-rich-editor .side-panel .nav .nav-item {
|
|
15
|
+
padding: 0 0.75rem;
|
|
16
|
+
}
|
|
17
|
+
.seafile-rich-editor .side-panel .nav .nav-link {
|
|
18
|
+
padding: 0 0.75rem;
|
|
19
|
+
transition: 0.3s color;
|
|
20
|
+
margin-right: 0;
|
|
21
|
+
}
|
|
22
|
+
.seafile-rich-editor .side-panel .nav-link {
|
|
23
|
+
color: #888;
|
|
24
|
+
}
|
|
25
|
+
.seafile-rich-editor .side-panel .nav .nav-link.active {
|
|
26
|
+
color: #f19645;
|
|
27
|
+
border-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
.seafile-rich-editor .side-panel .nav .iconfont {
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
font-size: 0.875rem;
|
|
32
|
+
}
|
|
33
|
+
.seafile-rich-editor .side-panel-content {
|
|
34
|
+
font-size: 0.937rem;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.seafile-rich-editor .side-panel-content:hover {
|
|
39
|
+
overflow: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.image-view {
|
|
43
|
+
width: 200px;
|
|
44
|
+
height: 150px;
|
|
45
|
+
position: absolute;
|
|
46
|
+
background-color: #fff;
|
|
47
|
+
z-index: 1004;
|
|
48
|
+
box-shadow: 0 0 10px #aaa;
|
|
49
|
+
border-radius: 3px;
|
|
50
|
+
line-height: 150px;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
font-size: 0;
|
|
53
|
+
text-align: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.image-view img {
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
max-height: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.image-view i {
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
text-align: center;
|
|
65
|
+
line-height: 150px;
|
|
66
|
+
font-size: 30px;
|
|
67
|
+
color: #eb8205;
|
|
68
|
+
-moz-animation: rotate 1.5s ease infinite;
|
|
69
|
+
-webkit-animation: rotate 1.5s ease infinite;
|
|
70
|
+
animation: rotate 1.5s ease infinite;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@keyframes rotate {
|
|
74
|
+
0% {
|
|
75
|
+
transform: rotate(0deg);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
100% {
|
|
79
|
+
transform: rotate(360deg);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -5,13 +5,14 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
5
5
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
|
-
import { processor } from '
|
|
8
|
+
import { processor } from '../../utils/seafile-markdown2html';
|
|
9
9
|
import { Button, Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
|
10
|
-
import ParticipantsList from './participants-list';
|
|
11
|
-
import toaster from '../components/toast';
|
|
12
10
|
import { MentionsInput, Mention } from 'react-mentions';
|
|
13
|
-
import
|
|
14
|
-
import '
|
|
11
|
+
import toaster from '../../components/toast';
|
|
12
|
+
import ParticipantsList from './participants-list';
|
|
13
|
+
import EditorBuilder from '../../editor/editor-builder';
|
|
14
|
+
import { defaultStyle } from '../assets/css/react-mentions-default-style';
|
|
15
|
+
import '../assets/css/comments-list.css';
|
|
15
16
|
|
|
16
17
|
var CommentPanel = /*#__PURE__*/function (_React$Component) {
|
|
17
18
|
_inherits(CommentPanel, _React$Component);
|
|
@@ -136,6 +137,11 @@ var CommentPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
136
137
|
_this.toBeAddedParticipant.push(email);
|
|
137
138
|
};
|
|
138
139
|
|
|
140
|
+
_this.scrollToQuote = function (path) {
|
|
141
|
+
var editorRef = EditorBuilder.getEditorRef();
|
|
142
|
+
editorRef && editorRef.scrollToQuote(path);
|
|
143
|
+
};
|
|
144
|
+
|
|
139
145
|
_this.renderUserSuggestion = function (entry, search, highlightedDisplay, index, focused) {
|
|
140
146
|
return /*#__PURE__*/React.createElement("div", {
|
|
141
147
|
className: "user ".concat(focused ? 'focused' : '')
|
|
@@ -191,7 +197,7 @@ var CommentPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
191
197
|
editComment: _this2.editComment,
|
|
192
198
|
showResolvedComment: _this2.state.showResolvedComment,
|
|
193
199
|
editorApi: _this2.props.editorApi,
|
|
194
|
-
scrollToQuote: _this2.
|
|
200
|
+
scrollToQuote: _this2.scrollToQuote
|
|
195
201
|
}));
|
|
196
202
|
}), this.state.commentsList.length === 0 && /*#__PURE__*/React.createElement("li", {
|
|
197
203
|
className: "comment-vacant"
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import dayjs from 'dayjs/';
|
|
7
7
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
8
8
|
import ParticipantsList from './participants-list';
|
|
9
|
-
import '../css/
|
|
9
|
+
import '../assets/css/detail-list-view.css';
|
|
10
10
|
|
|
11
11
|
require('dayjs/locale/zh-cn');
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ 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
6
|
import { Tooltip } from 'reactstrap';
|
|
7
|
-
import '../css/
|
|
7
|
+
import '../assets/css/participants-list.css';
|
|
8
8
|
|
|
9
9
|
var ParticipantsList = /*#__PURE__*/function (_React$Component) {
|
|
10
10
|
_inherits(ParticipantsList, _React$Component);
|
|
@@ -5,9 +5,10 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import OutlineView from '
|
|
8
|
+
import OutlineView from '../../components/outline';
|
|
9
9
|
import CommentPanel from './comment-panel';
|
|
10
10
|
import DetailListView from './detail-list-view';
|
|
11
|
+
import '../assets/css/side-panel.css';
|
|
11
12
|
|
|
12
13
|
var SidePanel = /*#__PURE__*/function (_React$PureComponent) {
|
|
13
14
|
_inherits(SidePanel, _React$PureComponent);
|
|
@@ -146,17 +147,14 @@ var SidePanel = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
146
147
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
147
148
|
className: "side-panel-content flex-fill"
|
|
148
149
|
}, this.state.navItem === 'outline' && /*#__PURE__*/React.createElement(OutlineView, {
|
|
149
|
-
|
|
150
|
-
document: this.props.document,
|
|
151
|
-
t: this.props.t
|
|
150
|
+
document: this.props.document
|
|
152
151
|
}), this.state.navItem === 'commentsPanel' && /*#__PURE__*/React.createElement(CommentPanel, {
|
|
153
152
|
editorApi: this.props.editorApi,
|
|
154
|
-
t: this.props.t,
|
|
155
|
-
scrollToQuote: this.props.scrollToQuote,
|
|
156
153
|
relistComment: this.props.relistComment,
|
|
157
154
|
openDialogs: this.props.openDialogs,
|
|
158
155
|
participants: this.props.participants,
|
|
159
|
-
onParticipantsChange: this.props.onParticipantsChange
|
|
156
|
+
onParticipantsChange: this.props.onParticipantsChange,
|
|
157
|
+
t: this.props.t
|
|
160
158
|
}), this.state.navItem === 'detail' && /*#__PURE__*/React.createElement(DetailListView, {
|
|
161
159
|
t: this.props.t,
|
|
162
160
|
fileTagList: this.props.fileTagList,
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { withTranslation } from 'react-i18next';
|
|
8
|
+
import EditorBuilder from '../editor/editor-builder';
|
|
9
|
+
import MarkdownEditor from '../editor/markdown-editor';
|
|
10
|
+
import Toolbar from '../components/toolbar';
|
|
11
|
+
import UserHelp from '../components/user-help';
|
|
12
|
+
import SidePanel from './components/side-panel';
|
|
13
|
+
import './assets/css/seafile-editor-main.css';
|
|
14
|
+
import './assets/css/seafile-editor-side.css';
|
|
15
|
+
|
|
16
|
+
var SeafileEditor = /*#__PURE__*/function (_React$Component) {
|
|
17
|
+
_inherits(SeafileEditor, _React$Component);
|
|
18
|
+
|
|
19
|
+
var _super = _createSuper(SeafileEditor);
|
|
20
|
+
|
|
21
|
+
function SeafileEditor(props) {
|
|
22
|
+
var _this;
|
|
23
|
+
|
|
24
|
+
_classCallCheck(this, SeafileEditor);
|
|
25
|
+
|
|
26
|
+
_this = _super.call(this, props);
|
|
27
|
+
|
|
28
|
+
_this.toggleSidePanel = function () {
|
|
29
|
+
_this.setState({
|
|
30
|
+
isShowSidePanel: !_this.state.isShowSidePanel,
|
|
31
|
+
isShowHelpPanel: false
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
_this.showHelpDialog = function () {
|
|
36
|
+
_this.setState({
|
|
37
|
+
isShowSidePanel: false,
|
|
38
|
+
isShowHelpPanel: true
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
_this.hideHelpDialog = function () {
|
|
43
|
+
_this.setState({
|
|
44
|
+
isShowHelpPanel: false
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
_this.toggleCommentBtn = function () {
|
|
49
|
+
var isSupport = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
50
|
+
|
|
51
|
+
_this.setState({
|
|
52
|
+
isSupportComment: isSupport
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
_this.onAddComment = function () {
|
|
57
|
+
_this.setState({
|
|
58
|
+
relistComment: _this.state.relistComment + 1
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
_this.insertRepoFile = function () {
|
|
63
|
+
if (_this.props.readOnly) return;
|
|
64
|
+
_this.props.openDialogs && _this.props.openDialogs('insert_file');
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
_this.addLink = function (fileName, url, isImage) {
|
|
68
|
+
var editorRef = EditorBuilder.getEditorRef();
|
|
69
|
+
editorRef.addLink(fileName, url, isImage);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
_this.state = {
|
|
73
|
+
isShowSidePanel: false,
|
|
74
|
+
isSupportComment: false,
|
|
75
|
+
relistComment: 0
|
|
76
|
+
};
|
|
77
|
+
window.richMarkdownEditor = _assertThisInitialized(_this);
|
|
78
|
+
return _this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_createClass(SeafileEditor, [{
|
|
82
|
+
key: "render",
|
|
83
|
+
value: function render() {
|
|
84
|
+
var hasSidePanel = true;
|
|
85
|
+
var _this$state = this.state,
|
|
86
|
+
isShowSidePanel = _this$state.isShowSidePanel,
|
|
87
|
+
isShowHelpPanel = _this$state.isShowHelpPanel;
|
|
88
|
+
var isShowHelpWrapper = isShowSidePanel || isShowHelpPanel;
|
|
89
|
+
var helpWrapperStyle = isShowHelpPanel ? {
|
|
90
|
+
width: '350px'
|
|
91
|
+
} : {};
|
|
92
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: "seafile-markdown-editor"
|
|
94
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: "markdown-editor-toolbar"
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
97
|
+
hasSidePanel: hasSidePanel,
|
|
98
|
+
isShowSidePanel: isShowSidePanel,
|
|
99
|
+
toggleSidePanel: this.toggleSidePanel,
|
|
100
|
+
insertRepoFile: this.insertRepoFile
|
|
101
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "markdown-editor-content"
|
|
103
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "markdown-editor-wrapper ".concat(isShowHelpWrapper ? '' : 'full-screen')
|
|
105
|
+
}, /*#__PURE__*/React.createElement(MarkdownEditor, {
|
|
106
|
+
scriptSource: this.props.scriptSource,
|
|
107
|
+
value: this.props.value,
|
|
108
|
+
editorApi: this.props.editorApi,
|
|
109
|
+
onSave: this.props.onSave,
|
|
110
|
+
onChange: this.props.onChange,
|
|
111
|
+
resetRichValue: this.props.resetRichValue,
|
|
112
|
+
isSupportComment: this.state.isSupportComment,
|
|
113
|
+
onAddComment: this.onAddComment
|
|
114
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
className: "markdown-help-wrapper ".concat(isShowHelpWrapper ? 'show' : ''),
|
|
116
|
+
style: helpWrapperStyle
|
|
117
|
+
}, isShowSidePanel && /*#__PURE__*/React.createElement(SidePanel, {
|
|
118
|
+
document: this.props.value,
|
|
119
|
+
fileInfo: this.props.fileInfo,
|
|
120
|
+
editorApi: this.props.editorApi,
|
|
121
|
+
relistComment: this.state.relistComment,
|
|
122
|
+
fileTagList: this.props.fileTagList,
|
|
123
|
+
participants: this.props.participants,
|
|
124
|
+
onParticipantsChange: this.props.onParticipantsChange,
|
|
125
|
+
toggleCommentBtn: this.toggleCommentBtn,
|
|
126
|
+
openDialogs: this.props.openDialogs,
|
|
127
|
+
t: this.props.t
|
|
128
|
+
}), isShowHelpPanel && /*#__PURE__*/React.createElement(UserHelp, {
|
|
129
|
+
hideHelpDialog: this.hideHelpDialog
|
|
130
|
+
}))));
|
|
131
|
+
}
|
|
132
|
+
}]);
|
|
133
|
+
|
|
134
|
+
return SeafileEditor;
|
|
135
|
+
}(React.Component);
|
|
136
|
+
|
|
137
|
+
export default withTranslation('seafile-editor')(SeafileEditor);
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import DiffViewer from './viewer/diff-viewer';
|
|
2
|
+
import MarkdownViewer from './viewer/markdown-viewer';
|
|
3
|
+
import { deserialize, serialize } from "./utils/slate2markdown";
|
|
4
|
+
import { processor } from './utils/seafile-markdown2html';
|
|
5
|
+
import { EditorBuilder, MarkdownEditor, SimpleEditor, PlainMarkdownEditor } from './editor';
|
|
6
|
+
import Toolbar from './components/toolbar';
|
|
7
|
+
import Outline from './components/outline';
|
|
8
|
+
import UserHelp from './components/user-help';
|
|
9
|
+
export { EditorBuilder, MarkdownEditor, SimpleEditor, PlainMarkdownEditor, DiffViewer, MarkdownViewer, Toolbar, Outline, UserHelp, deserialize, serialize, processor };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Suspense } from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import { Router } from '@reach/router';
|
|
8
|
+
import { I18nextProvider } from 'react-i18next';
|
|
9
|
+
import Loading from './components/loading';
|
|
10
|
+
import SFChooser from './pages/seafile-editor-chooser';
|
|
11
|
+
import SFRichMdEditor from './pages/seafile-markdown-editor';
|
|
12
|
+
import SFSimpleMdEditor from './pages/seafile-simple-editor';
|
|
13
|
+
import SFMarkdownViewer from './pages/seafile-markdown-viewer';
|
|
14
|
+
import i18n from './_i18n';
|
|
15
|
+
import './assets/css/index.css';
|
|
16
|
+
|
|
17
|
+
var App = /*#__PURE__*/function (_React$Component) {
|
|
18
|
+
_inherits(App, _React$Component);
|
|
19
|
+
|
|
20
|
+
var _super = _createSuper(App);
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
_classCallCheck(this, App);
|
|
24
|
+
|
|
25
|
+
return _super.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_createClass(App, [{
|
|
29
|
+
key: "render",
|
|
30
|
+
value: function render() {
|
|
31
|
+
var style = {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
width: '100%',
|
|
34
|
+
height: '100%'
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(Router, {
|
|
37
|
+
primary: false,
|
|
38
|
+
style: style
|
|
39
|
+
}, /*#__PURE__*/React.createElement(SFChooser, {
|
|
40
|
+
path: "/"
|
|
41
|
+
}), /*#__PURE__*/React.createElement(SFMarkdownViewer, {
|
|
42
|
+
path: "/markdownviewer"
|
|
43
|
+
}), /*#__PURE__*/React.createElement(SFSimpleMdEditor, {
|
|
44
|
+
path: "/simple-editor"
|
|
45
|
+
}), /*#__PURE__*/React.createElement(SFRichMdEditor, {
|
|
46
|
+
path: "/seafile-markdown-editor"
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
}]);
|
|
50
|
+
|
|
51
|
+
return App;
|
|
52
|
+
}(React.Component);
|
|
53
|
+
|
|
54
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(I18nextProvider, {
|
|
55
|
+
i18n: i18n
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
57
|
+
fallback: /*#__PURE__*/React.createElement(Loading, null)
|
|
58
|
+
}, /*#__PURE__*/React.createElement(App, null))), document.getElementById('root'));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import SeafileEditor from './seafile-editor';
|
|
7
|
+
import LoadScript from '../../editor/load-script';
|
|
8
|
+
|
|
9
|
+
var SeafileEditorWithErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(SeafileEditorWithErrorBoundary, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(SeafileEditorWithErrorBoundary);
|
|
13
|
+
|
|
14
|
+
function SeafileEditorWithErrorBoundary() {
|
|
15
|
+
_classCallCheck(this, SeafileEditorWithErrorBoundary);
|
|
16
|
+
|
|
17
|
+
return _super.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_createClass(SeafileEditorWithErrorBoundary, [{
|
|
21
|
+
key: "componentDidCatch",
|
|
22
|
+
value: function componentDidCatch(error) {
|
|
23
|
+
console.error(error);
|
|
24
|
+
this.forceUpdate();
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "render",
|
|
28
|
+
value: function render() {
|
|
29
|
+
return /*#__PURE__*/React.createElement(LoadScript, {
|
|
30
|
+
scriptSource: this.props.scriptSource
|
|
31
|
+
}, /*#__PURE__*/React.createElement(SeafileEditor, this.props));
|
|
32
|
+
}
|
|
33
|
+
}]);
|
|
34
|
+
|
|
35
|
+
return SeafileEditorWithErrorBoundary;
|
|
36
|
+
}(React.Component);
|
|
37
|
+
|
|
38
|
+
export default SeafileEditorWithErrorBoundary;
|