@seafile/sdoc-editor 0.1.0 → 0.1.1
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/{new-editors/editor.js → editor.js} +23 -17
- package/dist/index.js +2 -36
- package/dist/slate-extension/plugins/index.js +3 -2
- package/dist/slate-extension/plugins/socket/index.js +6 -0
- package/dist/slate-extension/plugins/socket/plugin.js +17 -0
- package/dist/slate-extension/socket/socket-client.js +84 -0
- package/dist/slate-extension/socket/socket-manager.js +61 -0
- package/dist/slate-extension/toolbar/index.js +1 -1
- package/package.json +3 -23
- package/dist/assets/css/comment-dialog.css +0 -50
- package/dist/assets/css/diff-viewer.css +0 -105
- package/dist/assets/css/formula.css +0 -19
- package/dist/assets/css/history-viewer.css +0 -104
- package/dist/assets/css/image.css +0 -134
- package/dist/assets/css/issue-card.css +0 -43
- package/dist/assets/css/keyboard-shortcuts.css +0 -58
- package/dist/assets/css/link.css +0 -7
- package/dist/assets/css/markdown-editor.css +0 -12
- package/dist/assets/css/markdown-viewer.css +0 -69
- package/dist/assets/css/navbar-imgbutton.css +0 -83
- package/dist/assets/css/outline.css +0 -29
- package/dist/assets/css/table.css +0 -57
- package/dist/assets/css/textlink-hovermenu.css +0 -47
- package/dist/assets/css/topbar.css +0 -350
- package/dist/assets/css/tree-view.css +0 -67
- package/dist/assets/css/user-help.css +0 -84
- package/dist/assets/editor/plain-editor.css +0 -30
- package/dist/assets/editor/seatable-editor.css +0 -77
- package/dist/assets/editor/simple-editor.css +0 -77
- package/dist/components/click-outside.js +0 -46
- package/dist/components/context-menu.js +0 -97
- package/dist/components/dialogs/add-formula-dialog.js +0 -116
- package/dist/components/dialogs/add-image-dialog.js +0 -69
- package/dist/components/dialogs/add-link-dialog.js +0 -133
- package/dist/components/dialogs/comment-dialog.js +0 -97
- package/dist/components/dialogs/shortcut-dialog.js +0 -131
- package/dist/components/error-boundary.js +0 -28
- package/dist/components/load-script/index.js +0 -69
- package/dist/components/loading.js +0 -25
- package/dist/components/markdown-lint.js +0 -72
- package/dist/components/menu/index.js +0 -4
- package/dist/components/menu/item.js +0 -49
- package/dist/components/menu/menu.js +0 -38
- package/dist/components/menu/style.css +0 -42
- package/dist/components/modal-portal.js +0 -38
- package/dist/components/outline/index.js +0 -92
- package/dist/components/outline/outline-item.js +0 -58
- package/dist/components/select/_option.js +0 -44
- package/dist/components/select/field-setting.js +0 -106
- package/dist/components/select/index.js +0 -149
- package/dist/components/select/style.css +0 -144
- package/dist/components/svg-icons/check-mark-icon.js +0 -14
- package/dist/components/svg-icons/column-icon.js +0 -17
- package/dist/components/svg-icons/text-icon.js +0 -34
- package/dist/components/text-link-hover-menu/index.js +0 -123
- package/dist/components/toast/alert.js +0 -138
- package/dist/components/toast/index.js +0 -3
- package/dist/components/toast/toast.js +0 -159
- package/dist/components/toast/toastManager.js +0 -139
- package/dist/components/toast/toaster.js +0 -65
- package/dist/components/toolbar/header-list.js +0 -114
- package/dist/components/toolbar/help-group.js +0 -33
- package/dist/components/toolbar/index.js +0 -4
- package/dist/components/toolbar/insert-image.js +0 -106
- package/dist/components/toolbar/insert-table.js +0 -136
- package/dist/components/toolbar/table-group.js +0 -74
- package/dist/components/toolbar/toolbar.js +0 -317
- package/dist/components/toolbar/widgets/button-group.js +0 -24
- package/dist/components/toolbar/widgets/button-item.js +0 -129
- package/dist/components/toolbar/widgets/drop-list.js +0 -88
- package/dist/components/user-help/index.js +0 -179
- package/dist/config-0.js +0 -15
- package/dist/config.js +0 -16
- package/dist/constants/cell-types.js +0 -29
- package/dist/constants/column.js +0 -4
- package/dist/containers/code-highlight-package.js +0 -14
- package/dist/containers/controller/block-element-controller.js +0 -375
- package/dist/containers/controller/index.js +0 -5
- package/dist/containers/controller/inline-element-controller.js +0 -134
- package/dist/containers/controller/normalize-controller.js +0 -95
- package/dist/containers/controller/shortcut-controller.js +0 -385
- package/dist/containers/controller/void-element-controller.js +0 -9
- package/dist/containers/custom/custom.js +0 -18
- package/dist/containers/custom/get-event-transfer.js +0 -33
- package/dist/containers/custom/getNodesByTypeAtRange.js +0 -57
- package/dist/containers/custom/insertNodes.js +0 -120
- package/dist/containers/custom/is-empty-paragraph.js +0 -9
- package/dist/containers/custom/set-event-transfer.js +0 -30
- package/dist/containers/custom/split-nodes-at-point.js +0 -136
- package/dist/containers/custom/unwrap-node-by-type-at-range.js +0 -70
- package/dist/containers/editor-context.js +0 -85
- package/dist/containers/editor-utils/block-element-utils/blockquote-utils.js +0 -80
- package/dist/containers/editor-utils/block-element-utils/code-utils.js +0 -145
- package/dist/containers/editor-utils/block-element-utils/formula-utils.js +0 -51
- package/dist/containers/editor-utils/block-element-utils/index.js +0 -31
- package/dist/containers/editor-utils/block-element-utils/list-utils.js +0 -395
- package/dist/containers/editor-utils/block-element-utils/table-utils.js +0 -412
- package/dist/containers/editor-utils/clear-format-utils.js +0 -84
- package/dist/containers/editor-utils/common-editor-utils.js +0 -492
- package/dist/containers/editor-utils/inline-element-utils/index.js +0 -95
- package/dist/containers/editor-utils/mark-utils.js +0 -20
- package/dist/containers/editor-utils/range-utils.js +0 -7
- package/dist/containers/editor-utils/selection-utils.js +0 -30
- package/dist/containers/editor-utils/text-utils.js +0 -117
- package/dist/containers/editor-widgets/check-list-item.js +0 -53
- package/dist/containers/editor-widgets/code-block.js +0 -128
- package/dist/containers/editor-widgets/column.js +0 -100
- package/dist/containers/editor-widgets/formula.js +0 -67
- package/dist/containers/editor-widgets/image.js +0 -237
- package/dist/containers/editor-widgets/link.js +0 -9
- package/dist/containers/editor-widgets/table.js +0 -144
- package/dist/containers/element-model/blockquote.js +0 -13
- package/dist/containers/element-model/column.js +0 -19
- package/dist/containers/element-model/image.js +0 -16
- package/dist/containers/element-model/link.js +0 -16
- package/dist/containers/element-model/table.js +0 -57
- package/dist/containers/element-model/text.js +0 -10
- package/dist/containers/render-utils/common-utils.js +0 -80
- package/dist/containers/render-utils/editor-utils.js +0 -133
- package/dist/containers/render-utils/viewer-utils.js +0 -198
- package/dist/containers/viewer-widgets/viewer-formula/index.js +0 -54
- package/dist/containers/viewer-widgets/viewer-image/index.js +0 -70
- package/dist/containers/viewer-widgets/viewer-image/viewer-image.css +0 -3
- package/dist/editors/index.js +0 -78
- package/dist/editors/markdown-editor.js +0 -280
- package/dist/editors/plain-markdown-editor.js +0 -285
- package/dist/editors/seatable-editor.js +0 -210
- package/dist/editors/simple-editor.js +0 -200
- package/dist/utils/deserialize-html.js +0 -260
- package/dist/utils/diff/compare-strings.js +0 -35
- package/dist/utils/diff/diff.js +0 -769
- package/dist/utils/diff/index.js +0 -2
- package/dist/utils/seafile-markdown2html.js +0 -52
- package/dist/utils/slate2markdown/deserialize.js +0 -588
- package/dist/utils/slate2markdown/index.js +0 -3
- package/dist/utils/slate2markdown/serialize.js +0 -366
- package/dist/utils/utils.js +0 -69
- package/dist/viewer/diff-viewer.js +0 -85
- package/dist/viewer/index.js +0 -4
- package/dist/viewer/markdown-viewer.js +0 -121
- package/dist/viewer/seatable-viewer.js +0 -63
- package/dist/viewer/slate-viewer.js +0 -71
- /package/dist/assets/css/{new-editor-toolbar.css → sdoc-editor-toolbar.css} +0 -0
- /package/dist/assets/css/{new-editor.css → sdoc-editor.css} +0 -0
|
@@ -5,14 +5,15 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Editable, Slate } from 'slate-react';
|
|
7
7
|
import isHotkey from 'is-hotkey';
|
|
8
|
-
import editor, { renderLeaf as _renderLeaf, renderElement as _renderElement, Toolbar } from '
|
|
9
|
-
import '
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import editor, { renderLeaf as _renderLeaf, renderElement as _renderElement, Toolbar } from './slate-extension';
|
|
9
|
+
import SocketManager from './slate-extension/socket/socket-manager';
|
|
10
|
+
import './assets/css/sdoc-editor.css';
|
|
11
|
+
var SDocEditor = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(SDocEditor, _React$Component);
|
|
13
|
+
var _super = _createSuper(SDocEditor);
|
|
14
|
+
function SDocEditor(props) {
|
|
14
15
|
var _this;
|
|
15
|
-
_classCallCheck(this,
|
|
16
|
+
_classCallCheck(this, SDocEditor);
|
|
16
17
|
_this = _super.call(this, props);
|
|
17
18
|
_this.onChange = function (slateValue) {
|
|
18
19
|
var onValueChanged = _this.props.onValueChanged;
|
|
@@ -21,22 +22,24 @@ var NewEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
21
22
|
});
|
|
22
23
|
onValueChanged && onValueChanged(slateValue);
|
|
23
24
|
};
|
|
25
|
+
var content = props.document.content;
|
|
24
26
|
_this.state = {
|
|
25
|
-
slateValue:
|
|
27
|
+
slateValue: content,
|
|
26
28
|
isLoading: true
|
|
27
29
|
};
|
|
28
30
|
_this.editor = editor;
|
|
29
31
|
return _this;
|
|
30
32
|
}
|
|
31
|
-
_createClass(
|
|
33
|
+
_createClass(SDocEditor, [{
|
|
32
34
|
key: "componentDidMount",
|
|
33
35
|
value: function componentDidMount() {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
var _this$props = this.props,
|
|
37
|
+
isOpenSocket = _this$props.isOpenSocket,
|
|
38
|
+
document = _this$props.document,
|
|
39
|
+
config = _this$props.config;
|
|
40
|
+
if (isOpenSocket) {
|
|
41
|
+
SocketManager.getInstance(document, config);
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
}, {
|
|
42
45
|
key: "render",
|
|
@@ -72,6 +75,9 @@ var NewEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
72
75
|
})))));
|
|
73
76
|
}
|
|
74
77
|
}]);
|
|
75
|
-
return
|
|
78
|
+
return SDocEditor;
|
|
76
79
|
}(React.Component);
|
|
77
|
-
|
|
80
|
+
SDocEditor.defaultProps = {
|
|
81
|
+
isOpenSocket: false
|
|
82
|
+
};
|
|
83
|
+
export default SDocEditor;
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// import UserHelp from './components/user-help';
|
|
4
|
-
// import EditorContext from './containers/editor-context';
|
|
5
|
-
// import { deserialize, serialize } from './utils/slate2markdown';
|
|
6
|
-
// import { processor } from './utils/seafile-markdown2html';
|
|
7
|
-
// import { replaceColumnData } from './utils/utils';
|
|
8
|
-
// import {
|
|
9
|
-
// MarkdownEditor,
|
|
10
|
-
// SimpleEditor,
|
|
11
|
-
// PlainMarkdownEditor,
|
|
12
|
-
// SeatableEditor
|
|
13
|
-
// } from './editors';
|
|
14
|
-
// import {
|
|
15
|
-
// DiffViewer,
|
|
16
|
-
// MarkdownViewer,
|
|
17
|
-
// SeatableViewer
|
|
18
|
-
// } from './viewer';
|
|
19
|
-
import NewEditor from './new-editors/editor';
|
|
20
|
-
export {
|
|
21
|
-
// EditorContext,
|
|
22
|
-
// MarkdownEditor,
|
|
23
|
-
// SimpleEditor,
|
|
24
|
-
// PlainMarkdownEditor,
|
|
25
|
-
// DiffViewer,
|
|
26
|
-
// MarkdownViewer,
|
|
27
|
-
// SeatableViewer,
|
|
28
|
-
// Toolbar,
|
|
29
|
-
// Outline,
|
|
30
|
-
// UserHelp,
|
|
31
|
-
// deserialize,
|
|
32
|
-
// serialize,
|
|
33
|
-
// processor,
|
|
34
|
-
// SeatableEditor,
|
|
35
|
-
// replaceColumnData,
|
|
36
|
-
NewEditor };
|
|
1
|
+
import SDocEditor from './editor';
|
|
2
|
+
export { SDocEditor };
|
|
@@ -3,6 +3,7 @@ import BlockquotePlugin from './blockquote';
|
|
|
3
3
|
import ListPlugin from './list';
|
|
4
4
|
import CheckListPlugin from './check-list';
|
|
5
5
|
import TextPlugin from './text-style';
|
|
6
|
-
|
|
6
|
+
import SocketPlugin from './socket';
|
|
7
|
+
var Plugins = [HeaderPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin, SocketPlugin];
|
|
7
8
|
export default Plugins;
|
|
8
|
-
export { HeaderPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin };
|
|
9
|
+
export { HeaderPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin, SocketPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import SocketManager from "../../socket/socket-manager";
|
|
2
|
+
var withSocket = function withSocket(editor) {
|
|
3
|
+
var apply = editor.apply;
|
|
4
|
+
var newEditor = editor;
|
|
5
|
+
newEditor.apply = function (operation) {
|
|
6
|
+
// 合并 op
|
|
7
|
+
try {
|
|
8
|
+
var socketManager = SocketManager.getInstance();
|
|
9
|
+
socketManager.addOperation && socketManager.addOperation(operation);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
// first load, socketManager has not been init
|
|
12
|
+
}
|
|
13
|
+
apply(operation);
|
|
14
|
+
};
|
|
15
|
+
return newEditor;
|
|
16
|
+
};
|
|
17
|
+
export default withSocket;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import io from 'socket.io-client';
|
|
5
|
+
import Debug from 'debug';
|
|
6
|
+
import SocketManager from './socket-manager';
|
|
7
|
+
var debug = Debug('sdoc:socket-client');
|
|
8
|
+
var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
|
|
9
|
+
var _this = this;
|
|
10
|
+
_classCallCheck(this, SocketClient);
|
|
11
|
+
this.getParams = function () {
|
|
12
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
+
return _objectSpread({}, params);
|
|
14
|
+
};
|
|
15
|
+
this.onConnected = function () {
|
|
16
|
+
var socketManager = SocketManager.getInstance();
|
|
17
|
+
// todo
|
|
18
|
+
_this.socket.emit('join-room', _this.getParams(_this.config), function (result) {
|
|
19
|
+
if (result.status) {
|
|
20
|
+
socketManager.dispatchConnectState('connect', result);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Disconnect the server in the client side. There will be no reconnection.
|
|
25
|
+
_this.socket.disconnect();
|
|
26
|
+
socketManager.dispatchConnectState('connect-error', result);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
this.onReconnect = function (data) {
|
|
30
|
+
debug('reconnect.');
|
|
31
|
+
var socketManager = SocketManager.getInstance();
|
|
32
|
+
socketManager.dispatchConnectState('reconnect');
|
|
33
|
+
};
|
|
34
|
+
this.onReconnecting = function (attemptNumber) {
|
|
35
|
+
debug('reconnecting.', attemptNumber);
|
|
36
|
+
var socketManager = SocketManager.getInstance();
|
|
37
|
+
socketManager.dispatchConnectState('reconnecting', attemptNumber);
|
|
38
|
+
};
|
|
39
|
+
this.onDisconnected = function (data) {
|
|
40
|
+
debug('disconnect message: %s', data);
|
|
41
|
+
var socketManager = SocketManager.getInstance();
|
|
42
|
+
socketManager.dispatchConnectState('disconnect');
|
|
43
|
+
};
|
|
44
|
+
this.onJoinRoom = function (username) {
|
|
45
|
+
debug('%s joined room success.', username);
|
|
46
|
+
var socketManager = SocketManager.getInstance();
|
|
47
|
+
socketManager.dispatchConnectState('join-room', username);
|
|
48
|
+
};
|
|
49
|
+
this.onLeaveRoom = function (username) {
|
|
50
|
+
debug('%s leaved room success.', username);
|
|
51
|
+
var socketManager = SocketManager.getInstance();
|
|
52
|
+
socketManager.dispatchConnectState('leave-room', username);
|
|
53
|
+
};
|
|
54
|
+
this.sendOperation = function (operation, callback) {
|
|
55
|
+
debug('==================================');
|
|
56
|
+
debug('send operation: %s' + operation.toString());
|
|
57
|
+
debug('==================================');
|
|
58
|
+
_this.socket.emit('update-document', _this.getParams({
|
|
59
|
+
operation: operation
|
|
60
|
+
}), function (result) {
|
|
61
|
+
callback && callback(result);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
this.receiveOperation = function (operation, version) {
|
|
65
|
+
debug('==================================');
|
|
66
|
+
debug('received operation: %s' + operation.toString());
|
|
67
|
+
debug('==================================');
|
|
68
|
+
var socketManager = SocketManager.getInstance();
|
|
69
|
+
socketManager.receiveOperation(operation, version);
|
|
70
|
+
};
|
|
71
|
+
this.disconnectWithServer = function () {
|
|
72
|
+
_this.socket.disconnect();
|
|
73
|
+
};
|
|
74
|
+
this.config = config;
|
|
75
|
+
this.socket = io(config.sdocServer);
|
|
76
|
+
this.socket.on('connect', this.onConnected);
|
|
77
|
+
this.socket.on('reconnect', this.onReconnect);
|
|
78
|
+
this.socket.on('reconnecting', this.onReconnecting);
|
|
79
|
+
this.socket.on('disconnect', this.onDisconnected);
|
|
80
|
+
this.socket.on('join-room', this.onJoinRoom);
|
|
81
|
+
this.socket.on('leave-room', this.onLeaveRoom);
|
|
82
|
+
this.socket.on('update-document', this.receiveOperation);
|
|
83
|
+
});
|
|
84
|
+
export default SocketClient;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import SocketClient from './socket-client';
|
|
4
|
+
var SocketManager = /*#__PURE__*/_createClass(function SocketManager(document, config) {
|
|
5
|
+
var _this = this;
|
|
6
|
+
_classCallCheck(this, SocketManager);
|
|
7
|
+
this.addOperation = function (operation) {
|
|
8
|
+
_this.pendingOperations.push(operation);
|
|
9
|
+
_this.sendOperation();
|
|
10
|
+
};
|
|
11
|
+
this.sendOperation = function () {
|
|
12
|
+
if (_this.isSendingOperation || _this.pendingOperations.length === 0) return;
|
|
13
|
+
_this.isSendingOperation = true;
|
|
14
|
+
_this.sendNextOperation();
|
|
15
|
+
};
|
|
16
|
+
this.sendNextOperation = function () {
|
|
17
|
+
if (_this.pendingOperations.length === 0) {
|
|
18
|
+
_this.isSendingOperation = false;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
var operation = _this.pendingOperations.shift();
|
|
22
|
+
_this.sendingOperation = operation;
|
|
23
|
+
_this.socketClient.sendOperation(operation, _this.sendOperationCallback);
|
|
24
|
+
};
|
|
25
|
+
this.sendOperationCallback = function (result) {
|
|
26
|
+
if (result && result.success) {
|
|
27
|
+
_this.sendingOperation = null;
|
|
28
|
+
var remoteVersion = result.version;
|
|
29
|
+
var localeVersion = _this.doc.version;
|
|
30
|
+
_this.doc['version'] = remoteVersion > localeVersion ? remoteVersion : localeVersion;
|
|
31
|
+
_this.sendNextOperation();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// operation is execute failure
|
|
36
|
+
_this.sendingOperation = null;
|
|
37
|
+
_this.sendNextOperation();
|
|
38
|
+
};
|
|
39
|
+
this.receiveOperation = function (operation, last_version) {
|
|
40
|
+
console.log(operation);
|
|
41
|
+
};
|
|
42
|
+
this.dispatchConnectState = function (type, message) {
|
|
43
|
+
console.log(type);
|
|
44
|
+
};
|
|
45
|
+
this.doc = document;
|
|
46
|
+
this.socketClient = new SocketClient(config);
|
|
47
|
+
this.sendingOperation = null;
|
|
48
|
+
this.pendingOperations = [];
|
|
49
|
+
this.isSendingOperation = false;
|
|
50
|
+
});
|
|
51
|
+
SocketManager.getInstance = function (document, socketConfig) {
|
|
52
|
+
if (SocketManager.instance) {
|
|
53
|
+
return SocketManager.instance;
|
|
54
|
+
}
|
|
55
|
+
if (!document || !socketConfig) {
|
|
56
|
+
throw new Error('SocketManager init params is invalid. Place check your code to fix it.');
|
|
57
|
+
}
|
|
58
|
+
SocketManager.instance = new SocketManager(document, socketConfig);
|
|
59
|
+
return SocketManager.instance;
|
|
60
|
+
};
|
|
61
|
+
export default SocketManager;
|
|
@@ -9,7 +9,7 @@ import { ORDERED_LIST, UNORDERED_LIST } from '../constants';
|
|
|
9
9
|
import HeaderMenu from '../plugins/header/menu';
|
|
10
10
|
import CheckListMenu from '../plugins/check-list/menu';
|
|
11
11
|
import { MenuGroup } from '../menu';
|
|
12
|
-
import '../../assets/css/
|
|
12
|
+
import '../../assets/css/sdoc-editor-toolbar.css';
|
|
13
13
|
var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
14
14
|
_inherits(Toolbar, _React$Component);
|
|
15
15
|
var _super = _createSuper(Toolbar);
|
package/package.json
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@seafile/react-image-lightbox": "2.0.2",
|
|
9
|
-
"@seafile/slate-react": "^0.54.13",
|
|
10
|
-
"codemirror": "^5.37.0",
|
|
11
|
-
"deepmerge": "^2.1.0",
|
|
12
|
-
"detect-indent": "^4.0.0",
|
|
13
|
-
"hast-util-sanitize": "^1.1.2",
|
|
14
9
|
"is-hotkey": "0.2.0",
|
|
15
|
-
"
|
|
16
|
-
"lodash": "4.17.21",
|
|
17
|
-
"mdast-util-definitions": "^1.2.2",
|
|
18
|
-
"prismjs": "1.23.0",
|
|
10
|
+
"react-cookies": "0.1.1",
|
|
19
11
|
"reactstrap": "8.9.0",
|
|
20
|
-
"rehype-format": "^2.2.0",
|
|
21
|
-
"rehype-mathjax": "^2.0.0",
|
|
22
|
-
"rehype-raw": "^2.0.0",
|
|
23
|
-
"rehype-stringify": "^3.0.0",
|
|
24
|
-
"remark": "^9.0.0",
|
|
25
|
-
"remark-breaks": "^1.0.0",
|
|
26
|
-
"remark-math": "^3.0.0",
|
|
27
|
-
"remark-parse": "^5.0.0",
|
|
28
|
-
"remark-rehype": "^3.0.0",
|
|
29
|
-
"remark-slug": "^5.0.0",
|
|
30
12
|
"slate": "0.88.1",
|
|
31
13
|
"slate-history": "0.86.0",
|
|
32
14
|
"slate-hyperscript": "0.77.0",
|
|
33
15
|
"slate-react": "0.88.2",
|
|
34
|
-
"
|
|
35
|
-
"url-parse": "^1.4.3",
|
|
36
|
-
"xtend": "^4.0.1"
|
|
16
|
+
"socket.io-client": "4.6.1"
|
|
37
17
|
},
|
|
38
18
|
"scripts": {
|
|
39
19
|
"clean": "rm -rf dist && mkdir dist",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
.seafile-editor-comment.comment-dialog {
|
|
2
|
-
width: 500px;
|
|
3
|
-
position: absolute;
|
|
4
|
-
top: 30%;
|
|
5
|
-
right: 0;
|
|
6
|
-
padding: 15px;
|
|
7
|
-
background-color: #fafafa;
|
|
8
|
-
border: 1px solid rgba(0,0,0,.2);
|
|
9
|
-
border-radius: .3rem;
|
|
10
|
-
box-shadow: 0 0 3px #ccc;
|
|
11
|
-
z-index: 1000;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.seafile-editor-comment.comment-dialog .comment-dialog-triangle {
|
|
15
|
-
position: absolute;
|
|
16
|
-
left: -5px;
|
|
17
|
-
top: 50%;
|
|
18
|
-
transform: rotate(45deg);
|
|
19
|
-
border: 1px solid rgba(0,0,0,.2);
|
|
20
|
-
border-top: none;
|
|
21
|
-
border-right: none;
|
|
22
|
-
width: 10px;
|
|
23
|
-
height: 10px;
|
|
24
|
-
background-color: #fafafa;
|
|
25
|
-
box-shadow: -1px 1px #ccc;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.seafile-editor-comment.comment-dialog textarea {
|
|
29
|
-
width: 100%;
|
|
30
|
-
min-height: 100px;
|
|
31
|
-
max-height: 300px;
|
|
32
|
-
padding: 5px;
|
|
33
|
-
background-color: #fff;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.seafile-editor-comment.comment-dialog .button-group .btn {
|
|
37
|
-
margin-right: 10px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.seafile-editor-comment.comment-dialog .comment-dialog-quote {
|
|
41
|
-
margin-top: 10px;
|
|
42
|
-
max-height: 6rem;
|
|
43
|
-
overflow: auto;
|
|
44
|
-
padding-left: 1rem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.seafile-editor-comment.comment-dialog .comment-dialog-quote ul,
|
|
48
|
-
.seafile-editor-comment.comment-dialog .comment-dialog-quote ol {
|
|
49
|
-
padding-left: 1rem;
|
|
50
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
.diff-added {
|
|
2
|
-
padding: 0 5px;
|
|
3
|
-
margin: 0 -5px;
|
|
4
|
-
background-color: #e6ffed;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.diff-removed {
|
|
9
|
-
padding: 0 5px;
|
|
10
|
-
margin: 0 -5px;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
background-color: #ffeef0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.diff-removed * {
|
|
16
|
-
border-left: none;
|
|
17
|
-
padding-left: 0
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.diff-added * {
|
|
21
|
-
padding-left: 0;
|
|
22
|
-
border-left: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.diff-replaced {
|
|
27
|
-
padding-left: 2px;
|
|
28
|
-
margin-left: -5px;
|
|
29
|
-
border-left: 3px solid #f9c513;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.diff-replaced .diff-added {
|
|
33
|
-
background-color: #e6ffed;
|
|
34
|
-
margin-left: 0;
|
|
35
|
-
padding-left: 0;
|
|
36
|
-
overflow: visible;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.diff-replaced .diff-removed {
|
|
40
|
-
overflow: visible;
|
|
41
|
-
padding-left: 0;
|
|
42
|
-
color: #cb2431;
|
|
43
|
-
margin-left: 0;
|
|
44
|
-
background-color: #ffeef0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.diff-replaced .diff-replaced {
|
|
48
|
-
border-left: none;
|
|
49
|
-
margin-left: 0;
|
|
50
|
-
overflow: visible;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.diff-replaced .diff-removed-container {
|
|
54
|
-
padding: 0 5px;
|
|
55
|
-
margin: 0 -5px;
|
|
56
|
-
background-color: #ffeef0;
|
|
57
|
-
box-sizing: border-box;
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.diff-replaced .diff-added-container {
|
|
62
|
-
padding: 0 5px;
|
|
63
|
-
margin: 0 -5px;
|
|
64
|
-
background-color: #e6ffed;
|
|
65
|
-
box-sizing: border-box;
|
|
66
|
-
overflow: hidden;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.diff-replaced table .diff-added {
|
|
71
|
-
background-color: #e6ffed;
|
|
72
|
-
padding: 0 0;
|
|
73
|
-
margin: 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.diff-replaced table .diff-removed {
|
|
77
|
-
background-color: #ffeef0;
|
|
78
|
-
margin: 0;
|
|
79
|
-
padding: 0 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.diff-replaced table tr.diff-replaced {
|
|
83
|
-
padding-left: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.diff-replaced del {
|
|
87
|
-
background-color: #fdb8c0;
|
|
88
|
-
text-decoration: none;
|
|
89
|
-
color: #cb2431;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.diff-replaced ins {
|
|
93
|
-
background-color: #acf2bd;
|
|
94
|
-
text-decoration: none;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.article .diff-replaced .old-paragraph {
|
|
98
|
-
background-color: #ffeef0;
|
|
99
|
-
margin-bottom: 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.article .diff-replaced .new-paragraph {
|
|
103
|
-
background-color: #e6ffed;
|
|
104
|
-
margin-top: 0;
|
|
105
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.seafile-editor-module .selected-formula {
|
|
2
|
-
outline: 2px solid #007bff;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.seafile-editor-module .block-formula {
|
|
6
|
-
display: block;
|
|
7
|
-
user-select: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.seafile-editor-module .MathJax {
|
|
11
|
-
margin: 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.formula-preview {
|
|
15
|
-
padding: 10px;
|
|
16
|
-
border: 2px dashed #ebebeb;
|
|
17
|
-
min-height: 40px;
|
|
18
|
-
overflow-x: auto;
|
|
19
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
.seafile-history-side-panel {
|
|
2
|
-
user-select: none;
|
|
3
|
-
border-left: 1px solid #e5e5e5;
|
|
4
|
-
background-color: #fff;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
flex: 0 0 auto;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.history-side-panel-title {
|
|
11
|
-
height: 50px;
|
|
12
|
-
border-bottom: 1px solid #e5e5e5;
|
|
13
|
-
line-height: 50px;
|
|
14
|
-
font-size: 1rem;
|
|
15
|
-
padding: 0 10px;
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
background-color: rgb(250,250,249);
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: row;
|
|
20
|
-
justify-content: space-between;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.history-side-panel-title .history-tile-text {
|
|
24
|
-
font-weight: bolder;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.history-side-panel-title .history-title-close {
|
|
29
|
-
color: #b9b9b9;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.history-side-panel-title .history-title-close:hover {
|
|
33
|
-
color: #888;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.history-list-container {
|
|
38
|
-
height: calc(100% - 36px);
|
|
39
|
-
overflow-y: hidden;
|
|
40
|
-
}
|
|
41
|
-
.history-list-container:hover {
|
|
42
|
-
overflow-y: auto;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.item-active {
|
|
46
|
-
background-color: #fdc297;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.history-item-container {
|
|
50
|
-
padding: 0.5rem .8rem;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.history-item-container:not(.item-active):hover {
|
|
54
|
-
background-color: #ffe7d5;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.history-item-container div {
|
|
58
|
-
width: 100%;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.history-item-container .owner {
|
|
62
|
-
margin-top: 0.2rem;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.history-item-container .owner i {
|
|
66
|
-
color: #549b5a;
|
|
67
|
-
font-size: 0.2rem;
|
|
68
|
-
margin-right: 0.2rem;
|
|
69
|
-
vertical-align: middle;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.history-item-container .owner span {
|
|
73
|
-
vertical-align: middle;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.diff-container {
|
|
77
|
-
flex: 1 1 auto;
|
|
78
|
-
overflow: auto;
|
|
79
|
-
box-sizing: border-box;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.diff-wrapper {
|
|
83
|
-
width: 90%;
|
|
84
|
-
border: 1px solid #e5e5e5;
|
|
85
|
-
margin: 20px auto;
|
|
86
|
-
background-color: #fff;
|
|
87
|
-
min-height: calc(100% - 40px);
|
|
88
|
-
padding: 70px 75px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@media (max-width:991.8px) {
|
|
92
|
-
.diff-container {
|
|
93
|
-
width: 100%;
|
|
94
|
-
box-sizing: border-box;
|
|
95
|
-
}
|
|
96
|
-
.diff-wrapper {
|
|
97
|
-
padding: 20px;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
@media (min-width:992px) {
|
|
101
|
-
.seafile-history-side-panel {
|
|
102
|
-
width: 260px;
|
|
103
|
-
}
|
|
104
|
-
}
|