@seafile/sdoc-editor 0.1.36 → 0.1.37
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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getValue, isMenuDisabled, addMark, removeMark } from './helpers';
|
|
2
|
+
var withTextStyle = function withTextStyle(editor) {
|
|
3
|
+
var toggleTextStyle = function toggleTextStyle(type) {
|
|
4
|
+
var isDisabled = isMenuDisabled(editor);
|
|
5
|
+
if (isDisabled) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var isActive = !!getValue(editor, type);
|
|
9
|
+
if (isActive) {
|
|
10
|
+
removeMark(editor, type);
|
|
11
|
+
} else {
|
|
12
|
+
addMark(editor, type);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
editor.toggleTextBold = function () {
|
|
16
|
+
toggleTextStyle('BOLD');
|
|
17
|
+
};
|
|
18
|
+
editor.toggleTextItalic = function () {
|
|
19
|
+
toggleTextStyle('ITALIC');
|
|
20
|
+
};
|
|
21
|
+
return editor;
|
|
22
|
+
};
|
|
23
|
+
export default withTextStyle;
|
|
@@ -6,6 +6,43 @@ var EventProxy = /*#__PURE__*/_createClass(function EventProxy(_editor) {
|
|
|
6
6
|
_classCallCheck(this, EventProxy);
|
|
7
7
|
this.onKeyDown = function (event) {
|
|
8
8
|
var editor = _this.editor;
|
|
9
|
+
|
|
10
|
+
// bold
|
|
11
|
+
if (isHotkey('mod+b', event)) {
|
|
12
|
+
event.preventDefault();
|
|
13
|
+
editor.toggleTextBold();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// italic
|
|
17
|
+
if (isHotkey('mod+i', event)) {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
editor.toggleTextItalic();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// disable the default 'save page'
|
|
23
|
+
if (isHotkey('mod+s', event)) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// redo
|
|
28
|
+
if (isHotkey('mod+y', event)) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
var history = editor.history;
|
|
31
|
+
if (history.redos.length === 0) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
editor.redo();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// undo
|
|
38
|
+
if (isHotkey('mod+z', event)) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
var _history = editor.history;
|
|
41
|
+
if (_history.undos.length === 0) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
editor.undo();
|
|
45
|
+
}
|
|
9
46
|
if (isHotkey('tab', event) || isHotkey('shift+tab', event)) {
|
|
10
47
|
editor.handleTab && editor.handleTab(event);
|
|
11
48
|
}
|
package/dist/basic-sdk/viewer.js
CHANGED
|
@@ -4,7 +4,6 @@ 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 { Editable, Slate } from '@seafile/slate-react';
|
|
7
|
-
import isHotkey from 'is-hotkey';
|
|
8
7
|
import editor, { renderLeaf as _renderLeaf, renderElement as _renderElement } from './extension';
|
|
9
8
|
import { SocketManager, withSocketIO } from './socket';
|
|
10
9
|
import withNodeId from './node-id';
|
|
@@ -69,12 +68,7 @@ var SDocViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
69
68
|
renderLeaf: function renderLeaf(props) {
|
|
70
69
|
return _renderLeaf(props, _this2.editor);
|
|
71
70
|
},
|
|
72
|
-
onDOMBeforeInput: function onDOMBeforeInput(event) {}
|
|
73
|
-
onKeyDown: function onKeyDown(event) {
|
|
74
|
-
if (isHotkey('tab', event) || isHotkey('shift+tab', event)) {
|
|
75
|
-
editor.handleTab && editor.handleTab(event);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
71
|
+
onDOMBeforeInput: function onDOMBeforeInput(event) {}
|
|
78
72
|
}))))));
|
|
79
73
|
}
|
|
80
74
|
}]);
|
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 };
|