@seafile/sdoc-editor 0.1.80 → 0.1.81-test
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/api/seafile-api.js +6 -0
- package/dist/basic-sdk/assets/css/dropdown-menu.css +23 -0
- package/dist/basic-sdk/assets/css/sdoc-editor-plugins.css +2 -0
- package/dist/basic-sdk/comment/comment-item.js +1 -3
- package/dist/basic-sdk/comment/style.css +13 -6
- package/dist/basic-sdk/editor.js +5 -2
- package/dist/basic-sdk/extension/constants/index.js +2 -0
- package/dist/basic-sdk/extension/core/queries/index.js +15 -3
- package/dist/basic-sdk/extension/plugins/blockquote/helpers.js +28 -8
- package/dist/basic-sdk/extension/plugins/blockquote/menu/index.js +2 -3
- package/dist/basic-sdk/extension/plugins/header/menu/index.js +24 -12
- package/dist/basic-sdk/extension/plugins/header/menu/style.css +0 -17
- package/dist/basic-sdk/extension/plugins/header/plugin.js +20 -4
- package/dist/basic-sdk/extension/plugins/image/helpers.js +1 -5
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/helpers.js +11 -0
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/common-menu.js +1 -4
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.css +0 -4
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.js +14 -14
- package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/row-header.js +13 -0
- package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +17 -5
- package/dist/basic-sdk/extension/plugins/text-align/menu/style.css +0 -12
- package/dist/basic-sdk/socket/socket-manager.js +3 -0
- package/dist/basic-sdk/socket/with-socket-io.js +2 -2
- package/dist/basic-sdk/views/viewer.js +1 -0
- package/dist/components/doc-info/index.js +12 -5
- package/dist/components/doc-operations/index.js +10 -3
- package/dist/components/doc-operations/revision-operations/index.js +16 -0
- package/dist/components/doc-operations/revision-operations/more-revision-operations/index.css +58 -0
- package/dist/components/doc-operations/revision-operations/more-revision-operations/index.js +56 -0
- package/dist/components/doc-operations/revision-operations/publish-button.js +28 -0
- package/dist/components/doc-operations/{revision-operations.js → revision-operations/revision-operations.js} +3 -3
- package/dist/components/doc-operations/revision-operations/view-changes/index.css +3 -0
- package/dist/components/doc-operations/revision-operations/view-changes/index.js +26 -0
- package/dist/components/draft-dropdown/index.js +77 -0
- package/dist/components/draft-dropdown/style.css +43 -0
- package/dist/components/switch/index.css +14 -0
- package/dist/components/switch/index.js +28 -0
- package/dist/components/tip-message/index.js +4 -1
- package/dist/config.js +16 -0
- package/dist/constants/index.js +1 -0
- package/dist/context.js +6 -0
- package/dist/pages/simple-editor.js +134 -116
- package/dist/pages/simple-viewer.js +5 -3
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +5 -1
- package/public/locales/zh-CN/sdoc-editor.json +4 -2
- package/public/media/sdoc-editor-font.css +6 -6
|
@@ -8,6 +8,7 @@ import { SetNodeToDecorations } from '../highlight-decorate/setNodeToDecorations
|
|
|
8
8
|
import { usePipDecorate } from '../decorates';
|
|
9
9
|
import '../assets/css/layout.css';
|
|
10
10
|
import '../assets/css/sdoc-editor-plugins.css';
|
|
11
|
+
import '../assets/css/dropdown-menu.css';
|
|
11
12
|
var SDocViewer = function SDocViewer(_ref) {
|
|
12
13
|
var document = _ref.document,
|
|
13
14
|
customRenderLeaf = _ref.renderLeaf,
|
|
@@ -5,9 +5,12 @@ import context from '../../context';
|
|
|
5
5
|
import { EventBus } from '../../basic-sdk';
|
|
6
6
|
import { EXTERNAL_EVENT } from '../../constants';
|
|
7
7
|
import { DateUtils } from '../../utils';
|
|
8
|
+
import DraftDropdown from '../draft-dropdown';
|
|
8
9
|
var DocInfo = function DocInfo(_ref) {
|
|
9
10
|
var t = _ref.t,
|
|
10
|
-
isStarred = _ref.isStarred
|
|
11
|
+
isStarred = _ref.isStarred,
|
|
12
|
+
isDraft = _ref.isDraft,
|
|
13
|
+
isEditMode = _ref.isEditMode;
|
|
11
14
|
var onInternalLinkClick = useCallback(function () {
|
|
12
15
|
var eventBus = EventBus.getInstance();
|
|
13
16
|
eventBus.dispatch(EXTERNAL_EVENT.INTERNAL_LINK_CLICK);
|
|
@@ -21,7 +24,7 @@ var DocInfo = function DocInfo(_ref) {
|
|
|
21
24
|
var _context$getSettings = context.getSettings(),
|
|
22
25
|
isShowInternalLink = _context$getSettings.isShowInternalLink,
|
|
23
26
|
isStarIconShown = _context$getSettings.isStarIconShown;
|
|
24
|
-
var docInfo = /*#__PURE__*/React.createElement(React.Fragment, null, isStarIconShown && /*#__PURE__*/React.createElement("button", {
|
|
27
|
+
var docInfo = /*#__PURE__*/React.createElement(React.Fragment, null, isDraft && /*#__PURE__*/React.createElement(DraftDropdown, null), isStarIconShown && /*#__PURE__*/React.createElement("button", {
|
|
25
28
|
className: "doc-icon sdocfont ".concat(isStarred ? 'sdoc-starred' : 'sdoc-unstarred', " border-0 p-0 bg-transparent"),
|
|
26
29
|
title: isStarred ? t('Starred') : t('Unstarred'),
|
|
27
30
|
"aria-label": isStarred ? t('Unstar') : t('Star'),
|
|
@@ -32,7 +35,9 @@ var DocInfo = function DocInfo(_ref) {
|
|
|
32
35
|
className: "internal-link sdocfont sdoc-link",
|
|
33
36
|
title: t('Internal_link'),
|
|
34
37
|
onClick: onInternalLinkClick
|
|
35
|
-
})), /*#__PURE__*/React.createElement(TipMessage,
|
|
38
|
+
})), /*#__PURE__*/React.createElement(TipMessage, {
|
|
39
|
+
isEditMode: isEditMode
|
|
40
|
+
}));
|
|
36
41
|
if (!isSdocRevision) {
|
|
37
42
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
43
|
className: "doc-info"
|
|
@@ -43,12 +48,14 @@ var DocInfo = function DocInfo(_ref) {
|
|
|
43
48
|
var revisionCreatedAt = context.getSetting('revisionCreatedAt');
|
|
44
49
|
var oldDocName = context.getSetting('originFilename');
|
|
45
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
-
className: "doc-info d-flex flex-column"
|
|
51
|
+
className: "doc-info d-flex flex-column align-items-start"
|
|
47
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
48
53
|
className: "doc-name-container d-flex align-items-center justify-content-start w-100"
|
|
49
54
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
55
|
className: "doc-name"
|
|
51
|
-
}, oldDocName),
|
|
56
|
+
}, oldDocName), /*#__PURE__*/React.createElement(TipMessage, {
|
|
57
|
+
isEditMode: isEditMode
|
|
58
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
52
59
|
className: "doc-state"
|
|
53
60
|
}, /*#__PURE__*/React.createElement("span", {
|
|
54
61
|
className: "mr-2"
|
|
@@ -4,14 +4,21 @@ import RevisionOperations from './revision-operations';
|
|
|
4
4
|
import HistoryOperation from './history-operation';
|
|
5
5
|
import CollaboratorsOperation from './collaborators-operation';
|
|
6
6
|
import MoreOperations from './more-operations';
|
|
7
|
+
import context from '../../context';
|
|
7
8
|
import './style.css';
|
|
8
|
-
var DocOperations = function DocOperations() {
|
|
9
|
+
var DocOperations = function DocOperations(_ref) {
|
|
10
|
+
var isShowChanges = _ref.isShowChanges,
|
|
11
|
+
toggleViewChanges = _ref.toggleViewChanges;
|
|
12
|
+
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
9
13
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
14
|
className: "doc-ops"
|
|
11
|
-
}, /*#__PURE__*/React.createElement(RevisionOperations,
|
|
15
|
+
}, /*#__PURE__*/React.createElement(RevisionOperations, {
|
|
16
|
+
isShowChanges: isShowChanges,
|
|
17
|
+
toggleViewChanges: toggleViewChanges
|
|
18
|
+
}), !isSdocRevision && /*#__PURE__*/React.createElement("span", {
|
|
12
19
|
className: "op-item"
|
|
13
20
|
}, /*#__PURE__*/React.createElement("i", {
|
|
14
21
|
className: "sdocfont sdoc-share"
|
|
15
|
-
})), /*#__PURE__*/React.createElement(HistoryOperation, null), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), /*#__PURE__*/React.createElement(MoreOperations, null));
|
|
22
|
+
})), /*#__PURE__*/React.createElement(HistoryOperation, null), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(MoreOperations, null));
|
|
16
23
|
};
|
|
17
24
|
export default withTranslation('sdoc-editor')(DocOperations);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import context from '../../../context';
|
|
3
|
+
import PublishRevision from './publish-button';
|
|
4
|
+
import ViewChanges from './view-changes';
|
|
5
|
+
import MoreRevisionOperations from './more-revision-operations';
|
|
6
|
+
var RevisionOperations = function RevisionOperations(_ref) {
|
|
7
|
+
var isShowChanges = _ref.isShowChanges,
|
|
8
|
+
toggleViewChanges = _ref.toggleViewChanges;
|
|
9
|
+
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
10
|
+
var isPublished = context.getSetting('isPublished');
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !isSdocRevision && /*#__PURE__*/React.createElement(MoreRevisionOperations, null), isSdocRevision && /*#__PURE__*/React.createElement(ViewChanges, {
|
|
12
|
+
isShowChanges: isShowChanges,
|
|
13
|
+
toggleViewChanges: toggleViewChanges
|
|
14
|
+
}), isSdocRevision && !isPublished && /*#__PURE__*/React.createElement(PublishRevision, null));
|
|
15
|
+
};
|
|
16
|
+
export default RevisionOperations;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operations-toggle {
|
|
2
|
+
width: 66px;
|
|
3
|
+
height: 30px;
|
|
4
|
+
border-radius: 15px;
|
|
5
|
+
background-color: #F0F0F0;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
color: #666;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operations-toggle:hover {
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
color: #333;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operations-toggle .sdoc-revise {
|
|
18
|
+
margin-right: 10px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operations-toggle .sdocfont {
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sdoc-more-revision-operations-dropdown .dropdown-item {
|
|
26
|
+
padding: 12px;
|
|
27
|
+
min-height: 32px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operation {
|
|
31
|
+
width: 373px;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: flex-start;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operation-title .sdocfont {
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
margin-right: 6px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operation-title-name {
|
|
43
|
+
color: #212529;
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operation-describe {
|
|
48
|
+
padding-left: 20px;
|
|
49
|
+
color: #999;
|
|
50
|
+
font-size: 13px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
white-space: break-spaces;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sdoc-more-revision-operations-dropdown .dropdown-item:hover .sdoc-more-revision-operation-title-name,
|
|
56
|
+
.sdoc-more-revision-operations-dropdown .dropdown-item:hover .sdoc-more-revision-operation-describe {
|
|
57
|
+
color: #fff;
|
|
58
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { withTranslation } from 'react-i18next';
|
|
4
|
+
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
|
5
|
+
import context from '../../../../context';
|
|
6
|
+
import toaster from '../../../toast';
|
|
7
|
+
import './index.css';
|
|
8
|
+
var MoreRevisionOperations = function MoreRevisionOperations(_ref) {
|
|
9
|
+
var t = _ref.t;
|
|
10
|
+
var repoID = context.getSetting('repoID');
|
|
11
|
+
var siteRoot = context.getSetting('siteRoot');
|
|
12
|
+
var _useState = useState(false),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
isDropdownOpen = _useState2[0],
|
|
15
|
+
setIsDropdownOpen = _useState2[1];
|
|
16
|
+
var toggleDropdown = useCallback(function (isDropdownOpen) {
|
|
17
|
+
setIsDropdownOpen(!isDropdownOpen);
|
|
18
|
+
}, []);
|
|
19
|
+
var startRevise = useCallback(function () {
|
|
20
|
+
context.startRevise().then(function (res) {
|
|
21
|
+
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/file").concat(res.data.file_path);
|
|
22
|
+
}).catch(function (error) {
|
|
23
|
+
toaster.danger(t('Error'));
|
|
24
|
+
});
|
|
25
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
+
}, []);
|
|
27
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
28
|
+
isOpen: isDropdownOpen,
|
|
29
|
+
toggle: function toggle() {
|
|
30
|
+
return toggleDropdown(isDropdownOpen);
|
|
31
|
+
},
|
|
32
|
+
className: "sdoc-more-revision-operations-dropdown"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
34
|
+
className: "ml-4 sdoc-more-revision-operations-toggle",
|
|
35
|
+
tag: "div"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
37
|
+
className: "sdocfont sdoc-revise"
|
|
38
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
39
|
+
className: "sdocfont sdoc-".concat(isDropdownOpen ? 'caret-up' : 'drop-down')
|
|
40
|
+
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
41
|
+
right: true
|
|
42
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
43
|
+
onClick: startRevise
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: "sdoc-more-revision-operation"
|
|
46
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "sdoc-more-revision-operation-title"
|
|
48
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
49
|
+
className: "sdocfont sdoc-revise"
|
|
50
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
51
|
+
className: "sdoc-more-revision-operation-title-name"
|
|
52
|
+
}, t('Revise'))), /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "sdoc-more-revision-operation-describe"
|
|
54
|
+
}, t('Start_revise_tip'))))));
|
|
55
|
+
};
|
|
56
|
+
export default withTranslation('sdoc-editor')(MoreRevisionOperations);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { Button } from 'reactstrap';
|
|
3
|
+
import { withTranslation } from 'react-i18next';
|
|
4
|
+
import context from '../../../context';
|
|
5
|
+
import toaster from '../../../components/toast';
|
|
6
|
+
var PublishRevision = function PublishRevision(_ref) {
|
|
7
|
+
var t = _ref.t;
|
|
8
|
+
var repoID = context.getSetting('repoID');
|
|
9
|
+
var siteRoot = context.getSetting('siteRoot');
|
|
10
|
+
var publish = useCallback(function (event) {
|
|
11
|
+
event.stopPropagation();
|
|
12
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
13
|
+
context.publishSdocRevision().then(function (res) {
|
|
14
|
+
var origin_file_path = res.data.origin_file_path;
|
|
15
|
+
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/file/").concat(origin_file_path);
|
|
16
|
+
}).catch(function (error) {
|
|
17
|
+
toaster.danger(t('Error'));
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
}, []);
|
|
22
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
23
|
+
color: "success",
|
|
24
|
+
onClick: publish,
|
|
25
|
+
className: "ml-4"
|
|
26
|
+
}, t('Publish'));
|
|
27
|
+
};
|
|
28
|
+
export default withTranslation('sdoc-editor')(PublishRevision);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { Button } from 'reactstrap';
|
|
3
3
|
import { withTranslation } from 'react-i18next';
|
|
4
|
-
import context from '
|
|
5
|
-
import toaster from '../../
|
|
4
|
+
import context from '../../../context';
|
|
5
|
+
import toaster from '../../toast';
|
|
6
6
|
var RevisionOperations = function RevisionOperations(_ref) {
|
|
7
7
|
var t = _ref.t;
|
|
8
8
|
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
@@ -48,7 +48,7 @@ var RevisionOperations = function RevisionOperations(_ref) {
|
|
|
48
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
49
|
}, []);
|
|
50
50
|
if (!isSdocRevision) return startReviseBtn();
|
|
51
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !isPublished && revisionURL && /*#__PURE__*/React.createElement(Button, {
|
|
52
52
|
color: "success",
|
|
53
53
|
className: "mr-4",
|
|
54
54
|
onClick: viewChanges
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { withTranslation } from 'react-i18next';
|
|
3
|
+
import { UncontrolledTooltip } from 'reactstrap';
|
|
4
|
+
import Switch from '../../../switch';
|
|
5
|
+
import './index.css';
|
|
6
|
+
var ViewChanges = function ViewChanges(_ref) {
|
|
7
|
+
var isShowChanges = _ref.isShowChanges,
|
|
8
|
+
t = _ref.t,
|
|
9
|
+
toggleViewChanges = _ref.toggleViewChanges;
|
|
10
|
+
var onToggleViewCHanges = useCallback(function () {
|
|
11
|
+
toggleViewChanges(!isShowChanges);
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
+
}, [isShowChanges]);
|
|
15
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
id: "sdoc-toggle-revision-changes-container",
|
|
17
|
+
className: "h-100 ml-4 d-flex align-items-center "
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
19
|
+
checked: isShowChanges,
|
|
20
|
+
onChange: onToggleViewCHanges,
|
|
21
|
+
className: "sdoc-toggle-revision-changes d-flex align-items-center"
|
|
22
|
+
})), /*#__PURE__*/React.createElement(UncontrolledTooltip, {
|
|
23
|
+
target: "sdoc-toggle-revision-changes-container"
|
|
24
|
+
}, t('View_changes')));
|
|
25
|
+
};
|
|
26
|
+
export default withTranslation('sdoc-editor')(ViewChanges);
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { withTranslation } from 'react-i18next';
|
|
7
|
+
import { EventBus } from '../../basic-sdk';
|
|
8
|
+
import { EXTERNAL_EVENT } from '../../constants';
|
|
9
|
+
import './style.css';
|
|
10
|
+
var DraftDropdownMenu = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(DraftDropdownMenu, _React$Component);
|
|
12
|
+
var _super = _createSuper(DraftDropdownMenu);
|
|
13
|
+
function DraftDropdownMenu(props) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, DraftDropdownMenu);
|
|
16
|
+
_this = _super.call(this, props);
|
|
17
|
+
_this.registerEventHandler = function () {
|
|
18
|
+
document.addEventListener('click', _this.onHideDraftDropdownMenu);
|
|
19
|
+
};
|
|
20
|
+
_this.unregisterEventHandler = function () {
|
|
21
|
+
document.removeEventListener('click', _this.onHideDraftDropdownMenu);
|
|
22
|
+
};
|
|
23
|
+
_this.onHideDraftDropdownMenu = function () {
|
|
24
|
+
_this.setState({
|
|
25
|
+
isDropdownMenuOpen: false
|
|
26
|
+
}, function () {
|
|
27
|
+
_this.unregisterEventHandler();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
_this.onToggleClick = function (event) {
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
33
|
+
var isDropdownMenuOpen = !_this.state.isDropdownMenuOpen;
|
|
34
|
+
if (isDropdownMenuOpen) {
|
|
35
|
+
_this.setState({
|
|
36
|
+
isDropdownMenuOpen: isDropdownMenuOpen
|
|
37
|
+
}, function () {
|
|
38
|
+
_this.registerEventHandler();
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
_this.setState({
|
|
42
|
+
isDropdownMenuOpen: isDropdownMenuOpen
|
|
43
|
+
}, function () {
|
|
44
|
+
_this.unregisterEventHandler();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
_this.unmark = function () {
|
|
49
|
+
var eventBus = EventBus.getInstance();
|
|
50
|
+
eventBus.dispatch(EXTERNAL_EVENT.UNMARK_AS_DRAFT);
|
|
51
|
+
};
|
|
52
|
+
_this.state = {
|
|
53
|
+
isDropdownMenuOpen: false
|
|
54
|
+
};
|
|
55
|
+
return _this;
|
|
56
|
+
}
|
|
57
|
+
_createClass(DraftDropdownMenu, [{
|
|
58
|
+
key: "render",
|
|
59
|
+
value: function render() {
|
|
60
|
+
var isDropdownMenuOpen = this.state.isDropdownMenuOpen;
|
|
61
|
+
var t = this.props.t;
|
|
62
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "sdoc-draft-menu"
|
|
64
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
className: "draft-toggle sdoc-draft-identifier",
|
|
66
|
+
onClick: this.onToggleClick
|
|
67
|
+
}, t('Draft')), isDropdownMenuOpen && /*#__PURE__*/React.createElement("ul", {
|
|
68
|
+
className: "draft-popover list-unstyled m-0"
|
|
69
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
70
|
+
className: "draft-menu-item",
|
|
71
|
+
onClick: this.unmark
|
|
72
|
+
}, t('Unmark_as_draft'))));
|
|
73
|
+
}
|
|
74
|
+
}]);
|
|
75
|
+
return DraftDropdownMenu;
|
|
76
|
+
}(React.Component);
|
|
77
|
+
export default withTranslation('sdoc-editor')(DraftDropdownMenu);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.sdoc-draft-menu {
|
|
2
|
+
position: relative;
|
|
3
|
+
margin-left: 0.5rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.sdoc-draft-identifier {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
color: #888;
|
|
10
|
+
background: #eee;
|
|
11
|
+
padding: 0 8px;
|
|
12
|
+
height: 20px;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
border-radius: 10px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sdoc-draft-identifier:hover {
|
|
19
|
+
background: #dbdbdb;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sdoc-draft-menu .draft-popover {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 25px;
|
|
25
|
+
left: 0;
|
|
26
|
+
width: 178px;
|
|
27
|
+
background-color: #fff;
|
|
28
|
+
border: 1px solid #e5e6e8;
|
|
29
|
+
border-radius: 2px;
|
|
30
|
+
padding: 8px 0;
|
|
31
|
+
box-shadow: 0 0 10px #e5e6e8;
|
|
32
|
+
z-index: 10;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sdoc-draft-menu .draft-popover .draft-menu-item {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
width: 100%;
|
|
38
|
+
padding: 4px 12px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sdoc-draft-menu .draft-popover .draft-menu-item:hover {
|
|
42
|
+
background-color: rgb(245, 245, 245);
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.seadoc-switch.small .custom-switch-indicator {
|
|
2
|
+
width: 22px;
|
|
3
|
+
height: 12px;
|
|
4
|
+
border-radius: 6px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.seadoc-switch.small .custom-switch-indicator:before {
|
|
8
|
+
height: 8px;
|
|
9
|
+
width: 8px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.seadoc-switch.small .custom-switch-input:checked~.custom-switch-indicator:before {
|
|
13
|
+
left: 12px;
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import './index.css';
|
|
4
|
+
function Switch(props) {
|
|
5
|
+
var onChange = props.onChange,
|
|
6
|
+
checked = props.checked,
|
|
7
|
+
placeholder = props.placeholder,
|
|
8
|
+
disabled = props.disabled,
|
|
9
|
+
className = props.className,
|
|
10
|
+
size = props.size;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: classnames('seadoc-switch position-relative', className, size)
|
|
13
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
14
|
+
className: "custom-switch"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
16
|
+
className: "custom-switch-input",
|
|
17
|
+
type: "checkbox",
|
|
18
|
+
checked: checked,
|
|
19
|
+
onChange: onChange,
|
|
20
|
+
name: "custom-switch-checkbox",
|
|
21
|
+
disabled: disabled
|
|
22
|
+
}), placeholder && /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: "custom-switch-description text-truncate"
|
|
24
|
+
}, placeholder), /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: "custom-switch-indicator"
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
export default Switch;
|
|
@@ -23,7 +23,10 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
_this.onDisconnect = function () {
|
|
26
|
-
var
|
|
26
|
+
var _this$props = _this.props,
|
|
27
|
+
t = _this$props.t,
|
|
28
|
+
isEditMode = _this$props.isEditMode;
|
|
29
|
+
if (!isEditMode) return;
|
|
27
30
|
var message = t('Server_is_not_connected_Operation_will_be_sent_to_server_later');
|
|
28
31
|
toaster.warning(message, {
|
|
29
32
|
hasCloseButton: true,
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var serverConfig = {
|
|
2
|
+
//serviceUrl: "http://127.0.0.1:8000",
|
|
3
|
+
serviceUrl: "http://192.168.1.100:8000",
|
|
4
|
+
username: "lj@11.com",
|
|
5
|
+
password: "11",
|
|
6
|
+
repoID: "79d1fa93-4b5f-4d6c-8fb5-ad3958e1fa47",
|
|
7
|
+
userInfo: {
|
|
8
|
+
username: 'lj@11.com',
|
|
9
|
+
name: 'lj-',
|
|
10
|
+
contact_email: 'lj@11.com'
|
|
11
|
+
},
|
|
12
|
+
filePath: '/xxx.md',
|
|
13
|
+
fileName: 'xxx.md',
|
|
14
|
+
dirPath: '/'
|
|
15
|
+
};
|
|
16
|
+
export { serverConfig };
|
package/dist/constants/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var EXTERNAL_EVENT = {
|
|
2
2
|
INTERNAL_LINK_CLICK: 'internal_link_click',
|
|
3
3
|
TOGGLE_STAR: 'toggle_star',
|
|
4
|
+
UNMARK_AS_DRAFT: 'unmark_as_draft',
|
|
4
5
|
CANCEL_TABLE_SELECT_RANGE: 'cancel_table_select_range'
|
|
5
6
|
};
|
|
6
7
|
export var PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
|
package/dist/context.js
CHANGED
|
@@ -139,6 +139,12 @@ var Context = /*#__PURE__*/function () {
|
|
|
139
139
|
var docUuid = this.getSetting('docUuid');
|
|
140
140
|
return this.api.sdocPublishRevision(docUuid);
|
|
141
141
|
}
|
|
142
|
+
}, {
|
|
143
|
+
key: "getSeadocRevisionDownloadLinks",
|
|
144
|
+
value: function getSeadocRevisionDownloadLinks() {
|
|
145
|
+
var docUuid = this.getSetting('docUuid');
|
|
146
|
+
return this.api.getSeadocRevisionDownloadLinks(docUuid);
|
|
147
|
+
}
|
|
142
148
|
}]);
|
|
143
149
|
return Context;
|
|
144
150
|
}();
|