@seafile/sdoc-editor 1.0.198-test3.0 → 1.0.198-test4.0
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/basic-sdk/extension/commons/insert-element-dialog/index.js +0 -2
- package/dist/basic-sdk/extension/commons/select-file-dialog/index.js +0 -5
- package/dist/basic-sdk/extension/commons/select-file-dialog/local-files/index.js +0 -1
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +0 -1
- package/dist/basic-sdk/extension/plugins/whiteboard/helpers.js +1 -10
- package/dist/basic-sdk/extension/plugins/whiteboard/index.css +3 -4
- package/dist/basic-sdk/extension/plugins/whiteboard/plugin.js +0 -3
- package/dist/basic-sdk/extension/plugins/whiteboard/render-elem.js +1 -3
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +0 -1
- package/package.json +1 -1
|
@@ -27,7 +27,6 @@ const InsertElementDialog = _ref => {
|
|
|
27
27
|
let {
|
|
28
28
|
editor
|
|
29
29
|
} = _ref;
|
|
30
|
-
console.log(3, editor.selection);
|
|
31
30
|
const [dialogType, setDialogType] = (0, _react.useState)('');
|
|
32
31
|
const [element, setElement] = (0, _react.useState)('');
|
|
33
32
|
const [insertPosition, setInsertPosition] = (0, _react.useState)(_constants2.INSERT_POSITION.CURRENT);
|
|
@@ -98,7 +97,6 @@ const InsertElementDialog = _ref => {
|
|
|
98
97
|
// link shortcut wrapping link
|
|
99
98
|
handleSubmit
|
|
100
99
|
} = _ref2;
|
|
101
|
-
console.log(5, type, element, insertSdocFileLinkCallback, insertWhiteboard);
|
|
102
100
|
setInsertPosition(insertPosition);
|
|
103
101
|
setSlateNode(slateNode);
|
|
104
102
|
setElement(element);
|
|
@@ -24,7 +24,6 @@ const SelectSdocFileDialog = _ref => {
|
|
|
24
24
|
insertLinkCallback,
|
|
25
25
|
insertWhiteboardFile
|
|
26
26
|
} = _ref;
|
|
27
|
-
console.log(3, editor.selection);
|
|
28
27
|
const {
|
|
29
28
|
t
|
|
30
29
|
} = (0, _reactI18next.useTranslation)('sdoc-editor');
|
|
@@ -65,7 +64,6 @@ const SelectSdocFileDialog = _ref => {
|
|
|
65
64
|
insertSdocFileLinkCallback && insertSdocFileLinkCallback(editor, fileInfo.name, fileInfo.file_uuid);
|
|
66
65
|
break;
|
|
67
66
|
case _constants.ELEMENT_TYPE.WHITEBOARD:
|
|
68
|
-
console.log(33, insertWhiteboardFile, insertWhiteboard);
|
|
69
67
|
insertWhiteboard && insertWhiteboard(editor, fileInfo.name, fileInfo.path);
|
|
70
68
|
break;
|
|
71
69
|
default:
|
|
@@ -80,19 +78,16 @@ const SelectSdocFileDialog = _ref => {
|
|
|
80
78
|
let fileInfo = {
|
|
81
79
|
...currentSelectedFile
|
|
82
80
|
};
|
|
83
|
-
console.log(22, fileInfo, file_uuid, currentSelectedFile);
|
|
84
81
|
|
|
85
82
|
// Insert whiteboard file in sdoc
|
|
86
83
|
if (dialogType === _constants.ELEMENT_TYPE.WHITEBOARD) {
|
|
87
84
|
insertFile(fileInfo);
|
|
88
85
|
closeDialog();
|
|
89
|
-
console.log(7);
|
|
90
86
|
return;
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
// File has no id
|
|
94
90
|
if (!file_uuid || file_uuid === '') {
|
|
95
|
-
console.log('no operation');
|
|
96
91
|
_context.default.getSdocLocalFileId(currentSelectedFile.path).then(res => {
|
|
97
92
|
if (res.status === 200) {
|
|
98
93
|
fileInfo = {
|
|
@@ -46,7 +46,6 @@ const LocalFiles = _ref => {
|
|
|
46
46
|
}, []);
|
|
47
47
|
const getTreeData = (0, _react.useCallback)((p, indexId, treeData) => {
|
|
48
48
|
return _context.default.getSdocLocalFiles(p, fileType).then(res => {
|
|
49
|
-
console.log(9, res);
|
|
50
49
|
res.data.forEach(item => {
|
|
51
50
|
item.indexId = _slugid.default.nice();
|
|
52
51
|
});
|
|
@@ -62,17 +62,11 @@ const generateWhiteboardNode = function (repoID) {
|
|
|
62
62
|
exports.generateWhiteboardNode = generateWhiteboardNode;
|
|
63
63
|
const insertWhiteboard = (editor, filename, filePath) => {
|
|
64
64
|
var _editor$selection;
|
|
65
|
-
console.log(8, editor.selection);
|
|
66
65
|
if (isInsertWhiteboardMenuDisabled(editor)) return;
|
|
66
|
+
if (editor.selection == null) return;
|
|
67
67
|
const {
|
|
68
68
|
repoID
|
|
69
69
|
} = window.app.pageOptions;
|
|
70
|
-
const {
|
|
71
|
-
selection
|
|
72
|
-
} = editor;
|
|
73
|
-
if (selection == null) return;
|
|
74
|
-
// const isCollapsed = Range.isCollapsed(selection);
|
|
75
|
-
|
|
76
70
|
const whiteboardNode = generateWhiteboardNode(repoID, filename, filePath);
|
|
77
71
|
let path = (_editor$selection = editor.selection) === null || _editor$selection === void 0 ? void 0 : _editor$selection.anchor.path;
|
|
78
72
|
const position = 'after';
|
|
@@ -82,7 +76,6 @@ const insertWhiteboard = (editor, filename, filePath) => {
|
|
|
82
76
|
});
|
|
83
77
|
const nextPath = _slate.Path.next([path[0] + 1]);
|
|
84
78
|
if (!(0, _core.getNode)(editor, nextPath)) {
|
|
85
|
-
console.log(5);
|
|
86
79
|
_slate.Transforms.insertNodes(editor, (0, _core.generateDefaultParagraph)(), {
|
|
87
80
|
at: nextPath
|
|
88
81
|
});
|
|
@@ -92,14 +85,12 @@ const insertWhiteboard = (editor, filename, filePath) => {
|
|
|
92
85
|
anchor: endOfFirstNode,
|
|
93
86
|
focus: endOfFirstNode
|
|
94
87
|
};
|
|
95
|
-
console.log(range);
|
|
96
88
|
(0, _core.focusEditor)(editor, range);
|
|
97
89
|
return;
|
|
98
90
|
}
|
|
99
91
|
};
|
|
100
92
|
exports.insertWhiteboard = insertWhiteboard;
|
|
101
93
|
const onCreateWhiteboardFile = editor => {
|
|
102
|
-
// e.stopPropagation();
|
|
103
94
|
const eventBus = _eventBus.default.getInstance();
|
|
104
95
|
const external_props = {
|
|
105
96
|
insertWhiteboard,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
width: 670px;
|
|
4
4
|
height: 300px;
|
|
5
5
|
border: 1px solid #ccc;
|
|
6
|
+
margin: 5px 0;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.sdoc-whiteboard-container.isSelected {
|
|
@@ -19,15 +20,13 @@
|
|
|
19
20
|
top: 0;
|
|
20
21
|
left: 0%;
|
|
21
22
|
z-index: 2;
|
|
22
|
-
pointer-events: none !important;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.sdoc-whiteboard-
|
|
25
|
+
.sdoc-whiteboard-wrapper * {
|
|
26
26
|
pointer-events: none !important;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.sdoc-whiteboard-
|
|
29
|
+
.sdoc-whiteboard-wrapper .tldraw-editor-container {
|
|
30
30
|
position: absolute !important;
|
|
31
|
-
pointer-events: none !important;
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -29,11 +29,8 @@ const withWhiteboard = editor => {
|
|
|
29
29
|
return isVoid(elem);
|
|
30
30
|
};
|
|
31
31
|
newEditor.onHotKeyDown = event => {
|
|
32
|
-
console.log(77);
|
|
33
32
|
const [whiteboardNode, path] = (0, _core.getSelectedNodeEntryByType)(editor, _constants.WHITEBOARD) || [];
|
|
34
|
-
console.log(whiteboardNode, path);
|
|
35
33
|
if (path) {
|
|
36
|
-
console.log(55, event);
|
|
37
34
|
// Insert empty paragraph node after whiteboard when clicking 'enter' on selected whiteboard
|
|
38
35
|
if ((0, _isHotkey.default)('enter', event)) {
|
|
39
36
|
event.preventDefault();
|
|
@@ -23,7 +23,6 @@ const Whiteboard = _ref => {
|
|
|
23
23
|
title
|
|
24
24
|
} = element;
|
|
25
25
|
const whiteboardRef = (0, _react.useRef)();
|
|
26
|
-
console.log(33, repoID, filePath);
|
|
27
26
|
const isSelected = (0, _slateReact.useSelected)();
|
|
28
27
|
const containerId = `whiteboard-${title}`;
|
|
29
28
|
// Set default whiteboard readonly as true
|
|
@@ -35,7 +34,6 @@ const Whiteboard = _ref => {
|
|
|
35
34
|
window.open(url, '_blank');
|
|
36
35
|
return;
|
|
37
36
|
};
|
|
38
|
-
console.log(6, isSelected);
|
|
39
37
|
(0, _react.useEffect)(() => {
|
|
40
38
|
const eventBus = _eventBus.default.getInstance();
|
|
41
39
|
eventBus.dispatch(_constants.EXTERNAL_EVENT.TLDRAW_EDITOR, {
|
|
@@ -55,7 +53,7 @@ const Whiteboard = _ref => {
|
|
|
55
53
|
onDoubleClick: handleDoubleClick,
|
|
56
54
|
scrolling: "no"
|
|
57
55
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
-
className: "
|
|
56
|
+
className: "sdoc-whiteboard-title"
|
|
59
57
|
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
60
58
|
id: containerId,
|
|
61
59
|
className: "sdoc-whiteboard-wrapper"
|
|
@@ -66,7 +66,6 @@ const InsertToolbar = _ref => {
|
|
|
66
66
|
readonly,
|
|
67
67
|
toggle
|
|
68
68
|
};
|
|
69
|
-
console.log(9, props.editor.selection);
|
|
70
69
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
71
70
|
type: "button",
|
|
72
71
|
className: validClassName,
|