@seafile/sdoc-editor 0.1.58 → 0.1.60
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/assets/css/simple-editor.css +2 -0
- package/dist/basic-sdk/assets/css/code-block.css +111 -17
- package/dist/basic-sdk/editor.js +9 -3
- package/dist/basic-sdk/extension/menu/menu.css +2 -1
- package/dist/basic-sdk/extension/plugins/code-block/helpers.js +11 -12
- package/dist/basic-sdk/extension/plugins/code-block/menu/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/code-block/plugin.js +3 -38
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +119 -95
- package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +0 -1
- package/dist/basic-sdk/extension/plugins/text-align/menu/style.css +1 -0
- package/dist/basic-sdk/extension/plugins/text-style/render-elem.js +6 -1
- package/dist/basic-sdk/extension/render/render-element.js +12 -2
- package/dist/basic-sdk/highlight-decorate/index.js +22 -0
- package/dist/basic-sdk/highlight-decorate/setNodeToDecorations.js +104 -0
- package/dist/basic-sdk/utils/prismjs.js +172 -0
- package/dist/components/code-block-hover-menu/index.css +84 -0
- package/dist/components/code-block-hover-menu/index.js +110 -0
- package/dist/components/doc-info/index.js +17 -4
- package/dist/constants/index.js +1 -0
- package/dist/pages/simple-editor.js +3 -1
- package/package.json +2 -4
- package/public/locales/en/sdoc-editor.json +6 -1
- package/public/locales/zh-CN/sdoc-editor.json +2 -1
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +6 -2
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +18 -10
|
@@ -1,22 +1,116 @@
|
|
|
1
|
-
.code-block-container {
|
|
1
|
+
.sdoc-code-block-container {
|
|
2
2
|
position: relative;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.
|
|
6
|
-
|
|
5
|
+
.sdoc-code-block-pre {
|
|
6
|
+
border: 1px solid #ccc;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sdoc-code-block-pre .sdoc-code-no-wrap {
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sdoc-code-block-pre .sdoc-code-no-wrap .sdoc-code-line > span {
|
|
14
|
+
white-space: pre;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sdoc-code-block-code .sdoc-code-line {
|
|
18
|
+
position: relative;
|
|
19
|
+
padding-left: 5px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sdoc-code-block-code .sdoc-code-line .sdoc-code-line-index {
|
|
7
23
|
position: absolute;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
left: -10px;
|
|
25
|
+
color: #ccc;
|
|
26
|
+
width: 10px;
|
|
27
|
+
height: 10px;
|
|
28
|
+
caret-color: transparent;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sdoc-code-line
|
|
33
|
+
.token.comment,
|
|
34
|
+
.token.prolog,
|
|
35
|
+
.token.doctype,
|
|
36
|
+
.token.cdata {
|
|
37
|
+
color: slategray;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sdoc-code-line
|
|
41
|
+
.token.punctuation {
|
|
42
|
+
color: #999;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sdoc-code-line
|
|
46
|
+
.token.namespace {
|
|
47
|
+
opacity: .7;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sdoc-code-line
|
|
51
|
+
.token.property,
|
|
52
|
+
.token.tag,
|
|
53
|
+
.token.boolean,
|
|
54
|
+
.token.number,
|
|
55
|
+
.token.constant,
|
|
56
|
+
.token.symbol,
|
|
57
|
+
.token.deleted {
|
|
58
|
+
color: #905;
|
|
59
|
+
padding: 0rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.sdoc-code-line
|
|
63
|
+
.token.selector,
|
|
64
|
+
.token.attr-name,
|
|
65
|
+
.token.string,
|
|
66
|
+
.token.char,
|
|
67
|
+
.token.builtin,
|
|
68
|
+
.token.inserted {
|
|
69
|
+
color: #690;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.sdoc-code-line
|
|
73
|
+
.token.operator,
|
|
74
|
+
.token.entity,
|
|
75
|
+
.token.url,
|
|
76
|
+
.language-css .token.string,
|
|
77
|
+
.style .token.string {
|
|
78
|
+
color: #9a6e3a;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sdoc-code-line
|
|
82
|
+
.token.atrule,
|
|
83
|
+
.token.attr-value,
|
|
84
|
+
.token.keyword {
|
|
85
|
+
color: #07a;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.sdoc-code-line
|
|
89
|
+
.token.function,
|
|
90
|
+
.token.class-name {
|
|
91
|
+
color: #DD4A68;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.sdoc-code-line
|
|
95
|
+
.token.regex,
|
|
96
|
+
.token.important,
|
|
97
|
+
.token.variable {
|
|
98
|
+
color: #e90;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.sdoc-code-line
|
|
102
|
+
.sdoc-code-line
|
|
103
|
+
.token.important,
|
|
104
|
+
.token.bold {
|
|
105
|
+
font-weight: bold;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.sdoc-code-line
|
|
109
|
+
.token.italic {
|
|
110
|
+
font-style: italic;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.sdoc-code-line
|
|
114
|
+
.token.entity {
|
|
115
|
+
cursor: help;
|
|
22
116
|
}
|
package/dist/basic-sdk/editor.js
CHANGED
|
@@ -9,9 +9,11 @@ import withNodeId from './node-id';
|
|
|
9
9
|
import SDocOutline from './outline';
|
|
10
10
|
import EventProxy from './utils/event-handler';
|
|
11
11
|
import { useCursors } from './cursor/use-cursors';
|
|
12
|
+
import { useHighlightDecorate } from './highlight-decorate';
|
|
12
13
|
import EventBus from './utils/event-bus';
|
|
13
14
|
import { EXTERNAL_EVENT } from '../constants';
|
|
14
15
|
import { isAllInTable } from './extension/plugins/table/helpers';
|
|
16
|
+
import { SetNodeToDecorations } from './highlight-decorate/setNodeToDecorations';
|
|
15
17
|
import './assets/css/layout.css';
|
|
16
18
|
import './assets/css/sdoc-editor-plugins.css';
|
|
17
19
|
var SDocEditor = function SDocEditor(_ref) {
|
|
@@ -42,6 +44,8 @@ var SDocEditor = function SDocEditor(_ref) {
|
|
|
42
44
|
setMenuPosition = _useState6[1];
|
|
43
45
|
var _useCursors = useCursors(editor),
|
|
44
46
|
cursors = _useCursors.cursors;
|
|
47
|
+
var _useHighlightDecorate = useHighlightDecorate(editor),
|
|
48
|
+
highlightDecorate = _useHighlightDecorate.highlightDecorate;
|
|
45
49
|
|
|
46
50
|
// init eventHandler
|
|
47
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -100,20 +104,22 @@ var SDocEditor = function SDocEditor(_ref) {
|
|
|
100
104
|
doc: slateValue,
|
|
101
105
|
docUuid: config.docUuid
|
|
102
106
|
}), /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
className: "flex-fill o-auto sdoc-editor-article-container"
|
|
107
|
+
className: "flex-fill o-auto sdoc-editor-article-container",
|
|
108
|
+
id: "sdoc-editor-article-container"
|
|
104
109
|
}, /*#__PURE__*/React.createElement(Slate, {
|
|
105
110
|
editor: editor,
|
|
106
111
|
value: slateValue,
|
|
107
112
|
onChange: onChange
|
|
108
113
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
114
|
className: "article"
|
|
110
|
-
}, /*#__PURE__*/React.createElement(Editable, {
|
|
115
|
+
}, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
111
116
|
renderElement: renderElement,
|
|
112
117
|
renderLeaf: renderLeaf,
|
|
113
118
|
onKeyDown: eventProxy.onKeyDown,
|
|
114
119
|
cursors: cursors,
|
|
115
120
|
onContextMenu: onContextMenu,
|
|
116
|
-
onMouseDown: onMouseDown
|
|
121
|
+
onMouseDown: onMouseDown,
|
|
122
|
+
decorate: highlightDecorate
|
|
117
123
|
})))))), isShowContextMenu && /*#__PURE__*/React.createElement(ContextMenu, {
|
|
118
124
|
editor: editor,
|
|
119
125
|
contextMenuPosition: menuPosition
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
3
|
import { Transforms, Editor, Node } from '@seafile/slate';
|
|
4
|
-
import
|
|
4
|
+
import slugid from 'slugid';
|
|
5
|
+
import { CODE_BLOCK, CODE_LINE, PARAGRAPH } from '../../constants';
|
|
5
6
|
import { getNodeType, getSelectedNodeByType, getSelectedElems } from '../../core';
|
|
6
7
|
export var isMenuDisabled = function isMenuDisabled(editor) {
|
|
7
8
|
var selection = editor.selection;
|
|
@@ -25,13 +26,6 @@ export var getSelectCodeElem = function getSelectCodeElem(editor) {
|
|
|
25
26
|
if (codeNode == null) return null;
|
|
26
27
|
return codeNode;
|
|
27
28
|
};
|
|
28
|
-
export var updateLanguageSetting = function updateLanguageSetting(editor, language) {
|
|
29
|
-
Transforms.setNodes(editor, {
|
|
30
|
-
language: language
|
|
31
|
-
}, {
|
|
32
|
-
mode: 'highest'
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
29
|
export var changeToCodeBlock = function changeToCodeBlock(editor, language) {
|
|
36
30
|
// Summarizes the strings for the selected highest-level node
|
|
37
31
|
var strArr = [];
|
|
@@ -65,16 +59,21 @@ export var changeToCodeBlock = function changeToCodeBlock(editor, language) {
|
|
|
65
59
|
// Insert the codeBlockNode node
|
|
66
60
|
var newCodeBlockNode = {
|
|
67
61
|
type: CODE_BLOCK,
|
|
62
|
+
language: language,
|
|
63
|
+
style: {
|
|
64
|
+
white_space: 'nowrap' // default nowrap
|
|
65
|
+
},
|
|
66
|
+
|
|
68
67
|
children: [{
|
|
69
|
-
|
|
68
|
+
id: slugid.nice(),
|
|
69
|
+
type: CODE_LINE,
|
|
70
70
|
children: [{
|
|
71
71
|
text: strArr.join('\n')
|
|
72
72
|
} // Select the plain text of the node
|
|
73
73
|
]
|
|
74
|
-
}]
|
|
75
|
-
|
|
76
|
-
language: language
|
|
74
|
+
}]
|
|
77
75
|
};
|
|
76
|
+
|
|
78
77
|
Transforms.insertNodes(editor, newCodeBlockNode, {
|
|
79
78
|
mode: 'highest'
|
|
80
79
|
});
|
|
@@ -36,7 +36,7 @@ var CodeBlockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
36
36
|
changeToPlainText(editor);
|
|
37
37
|
} else {
|
|
38
38
|
// It is not currently in code-block, so it needs to be converted to code-block
|
|
39
|
-
changeToCodeBlock(editor, '
|
|
39
|
+
changeToCodeBlock(editor, 'plaintext');
|
|
40
40
|
}
|
|
41
41
|
focusEditor(editor);
|
|
42
42
|
};
|
|
@@ -1,46 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import { Transforms
|
|
3
|
-
import {
|
|
2
|
+
import { Transforms } from '@seafile/slate';
|
|
3
|
+
import { getNodeType, isLastNode, genEmptyParagraph } from '../../core';
|
|
4
4
|
import { CODE_BLOCK } from '../../constants';
|
|
5
|
-
var getLastTextLineBeforeSelection = function getLastTextLineBeforeSelection(codeNode, editor) {
|
|
6
|
-
var selection = editor.selection;
|
|
7
|
-
if (selection == null) return '';
|
|
8
|
-
var codeText = Node.string(codeNode);
|
|
9
|
-
var anchorOffset = selection.anchor.offset;
|
|
10
|
-
var textBeforeAnchor = codeText.slice(0, anchorOffset); // The text before the selection
|
|
11
|
-
var arr = textBeforeAnchor.split('\n'); // text before selection, split by line break
|
|
12
|
-
var length = arr.length;
|
|
13
|
-
if (length === 0) return '';
|
|
14
|
-
return arr[length - 1];
|
|
15
|
-
};
|
|
16
5
|
var withCodeBlock = function withCodeBlock(editor) {
|
|
17
|
-
var
|
|
18
|
-
normalizeNode = editor.normalizeNode;
|
|
6
|
+
var normalizeNode = editor.normalizeNode;
|
|
19
7
|
var newEditor = editor;
|
|
20
8
|
|
|
21
|
-
// Rewrite insertBreak
|
|
22
|
-
newEditor.insertBreak = function () {
|
|
23
|
-
var codeNode = getSelectedNodeByType(newEditor, CODE_BLOCK);
|
|
24
|
-
if (codeNode == null) {
|
|
25
|
-
insertBreak(); // Perform the default line feed
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// When press Enter, the space is automatically inserted according to the space in the current line
|
|
30
|
-
var lastLineBeforeSelection = getLastTextLineBeforeSelection(codeNode, newEditor);
|
|
31
|
-
if (lastLineBeforeSelection) {
|
|
32
|
-
var arr = lastLineBeforeSelection.match(/^\s+/); // The space at the beginning of a line
|
|
33
|
-
if (arr != null && arr[0] != null) {
|
|
34
|
-
var spaces = arr[0];
|
|
35
|
-
newEditor.insertText("\n".concat(spaces)); // Insert a space after a newline
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Normal line feed
|
|
41
|
-
newEditor.insertText('\n');
|
|
42
|
-
};
|
|
43
|
-
|
|
44
9
|
// Rewrite normalizeNode
|
|
45
10
|
newEditor.normalizeNode = function (_ref) {
|
|
46
11
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -1,104 +1,128 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { updateLanguageSetting } from './helpers';
|
|
8
|
-
import { getSelectedNodeByType } from '../../core';
|
|
9
|
-
import { CODE_BLOCK } from '../../constants';
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
4
|
+
import { ReactEditor, useSlateStatic } from '@seafile/slate-react';
|
|
5
|
+
import { Transforms } from '@seafile/slate';
|
|
6
|
+
import CodeBlockHoverMenu from '../../../../components/code-block-hover-menu';
|
|
10
7
|
import '../../../assets/css/code-block.css';
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
var CodeBlock = function CodeBlock(_ref) {
|
|
9
|
+
var codeBlockProps = _ref.codeBlockProps;
|
|
10
|
+
var codeBlockRef = useRef();
|
|
11
|
+
var attributes = codeBlockProps.attributes,
|
|
12
|
+
children = codeBlockProps.children,
|
|
13
|
+
element = codeBlockProps.element;
|
|
14
|
+
var _element$style = element.style,
|
|
15
|
+
style = _element$style === void 0 ? {
|
|
16
|
+
white_space: 'nowrap'
|
|
17
|
+
} : _element$style;
|
|
18
|
+
var white_space = style.white_space;
|
|
19
|
+
var editor = useSlateStatic();
|
|
20
|
+
var _useState = useState({
|
|
21
|
+
top: '',
|
|
22
|
+
left: ''
|
|
23
|
+
}),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
menuPosition = _useState2[0],
|
|
26
|
+
setMenuPosition = _useState2[1];
|
|
27
|
+
var _useState3 = useState(false),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
showHoverMenu = _useState4[0],
|
|
30
|
+
setShowHoverMenu = _useState4[1];
|
|
31
|
+
var onChangeLanguage = useCallback(function (lang) {
|
|
32
|
+
var language = lang.value;
|
|
33
|
+
var path = ReactEditor.findPath(editor, element);
|
|
34
|
+
Transforms.setNodes(editor, {
|
|
35
|
+
language: language
|
|
36
|
+
}, {
|
|
37
|
+
at: path
|
|
38
|
+
});
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
}, []);
|
|
41
|
+
var onChangeAutoLineWrap = useCallback(function (autoWrap) {
|
|
42
|
+
var path = ReactEditor.findPath(editor, element);
|
|
43
|
+
var newStyle = _objectSpread(_objectSpread({}, style), {}, {
|
|
44
|
+
white_space: autoWrap
|
|
45
|
+
});
|
|
46
|
+
Transforms.setNodes(editor, {
|
|
47
|
+
style: newStyle
|
|
48
|
+
}, {
|
|
49
|
+
at: path
|
|
50
|
+
});
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
var onDeleteCodeBlock = useCallback(function () {
|
|
54
|
+
var path = ReactEditor.findPath(editor, element);
|
|
55
|
+
Transforms.removeNodes(editor, {
|
|
56
|
+
at: path
|
|
57
|
+
});
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
}, []);
|
|
60
|
+
var onMouseEnter = useCallback(function (e) {
|
|
61
|
+
if (codeBlockRef.current) {
|
|
62
|
+
var _codeBlockRef$current = codeBlockRef.current.getBoundingClientRect(),
|
|
63
|
+
top = _codeBlockRef$current.top,
|
|
64
|
+
left = _codeBlockRef$current.left;
|
|
65
|
+
var menuTop = top - 42; // top = top distance - menu height
|
|
66
|
+
var newMenuPosition = {
|
|
67
|
+
top: menuTop,
|
|
68
|
+
left: left // left = code-block left distance
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
setMenuPosition(newMenuPosition);
|
|
19
72
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
73
|
+
setShowHoverMenu(true);
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
}, []);
|
|
76
|
+
var onMouseLeave = useCallback(function (e) {
|
|
77
|
+
setShowHoverMenu(false);
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, []);
|
|
80
|
+
var onScroll = useCallback(function (e) {
|
|
81
|
+
if (e.currentTarget.scrollTop) {
|
|
82
|
+
var _codeBlockRef$current2 = codeBlockRef.current.getBoundingClientRect(),
|
|
83
|
+
top = _codeBlockRef$current2.top,
|
|
84
|
+
left = _codeBlockRef$current2.left;
|
|
85
|
+
var menuTop = top - 42; // top = top distance - menu height
|
|
86
|
+
var newMenuPosition = {
|
|
87
|
+
top: menuTop,
|
|
88
|
+
left: left // left = code-block left distance
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
setMenuPosition(newMenuPosition);
|
|
36
92
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
contentEditable: false,
|
|
46
|
-
className: "language-type"
|
|
47
|
-
}, /*#__PURE__*/React.createElement("select", {
|
|
48
|
-
ref: function ref(_ref) {
|
|
49
|
-
return _this2.selector = _ref;
|
|
50
|
-
},
|
|
51
|
-
value: language,
|
|
52
|
-
name: "language",
|
|
53
|
-
onInput: function onInput(event) {
|
|
54
|
-
return event.stopPropagation();
|
|
55
|
-
},
|
|
56
|
-
onChange: onChange
|
|
57
|
-
}, /*#__PURE__*/React.createElement("option", {
|
|
58
|
-
value: "none"
|
|
59
|
-
}, "Text")));
|
|
93
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
|
+
}, []);
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
if (showHoverMenu) {
|
|
97
|
+
document.getElementById('sdoc-editor-article-container').addEventListener('scroll', onScroll);
|
|
98
|
+
} else {
|
|
99
|
+
document.getElementById('sdoc-editor-article-container').removeEventListener('scroll', onScroll);
|
|
60
100
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}(React.PureComponent);
|
|
64
|
-
var CodeBlock = /*#__PURE__*/function (_React$PureComponent2) {
|
|
65
|
-
_inherits(CodeBlock, _React$PureComponent2);
|
|
66
|
-
var _super2 = _createSuper(CodeBlock);
|
|
67
|
-
function CodeBlock() {
|
|
68
|
-
var _this3;
|
|
69
|
-
_classCallCheck(this, CodeBlock);
|
|
70
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
71
|
-
args[_key2] = arguments[_key2];
|
|
72
|
-
}
|
|
73
|
-
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
74
|
-
_this3.onChange = function (event) {
|
|
75
|
-
var editor = _this3.props.editor;
|
|
76
|
-
var language = event.target.value;
|
|
77
|
-
updateLanguageSetting(editor, language);
|
|
101
|
+
return function () {
|
|
102
|
+
document.getElementById('sdoc-editor-article-container').removeEventListener('scroll', onScroll);
|
|
78
103
|
};
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
}(React.PureComponent);
|
|
104
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
105
|
+
}, [showHoverMenu]);
|
|
106
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
ref: codeBlockRef,
|
|
108
|
+
className: 'sdoc-code-block-container',
|
|
109
|
+
onMouseEnter: onMouseEnter,
|
|
110
|
+
onMouseLeave: onMouseLeave
|
|
111
|
+
}, /*#__PURE__*/React.createElement("pre", Object.assign({
|
|
112
|
+
className: 'sdoc-code-block-pre'
|
|
113
|
+
}, attributes), /*#__PURE__*/React.createElement("code", {
|
|
114
|
+
className: "sdoc-code-block-code ".concat(white_space === 'nowrap' ? 'sdoc-code-no-wrap' : '')
|
|
115
|
+
}, children)), showHoverMenu && /*#__PURE__*/React.createElement(CodeBlockHoverMenu, {
|
|
116
|
+
menuPosition: menuPosition,
|
|
117
|
+
onChangeLanguage: onChangeLanguage,
|
|
118
|
+
language: element.language,
|
|
119
|
+
style: element.style || {
|
|
120
|
+
white_space: 'nowrap'
|
|
121
|
+
},
|
|
122
|
+
onChangeAutoLineWrap: onChangeAutoLineWrap,
|
|
123
|
+
onDeleteCodeBlock: onDeleteCodeBlock
|
|
124
|
+
}));
|
|
125
|
+
};
|
|
102
126
|
export var renderCodeBlock = function renderCodeBlock(props, editor) {
|
|
103
127
|
return /*#__PURE__*/React.createElement(CodeBlock, {
|
|
104
128
|
codeBlockProps: _objectSpread({}, props),
|
|
@@ -70,7 +70,6 @@ var TextAlignMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
70
70
|
key: "render",
|
|
71
71
|
value: function render() {
|
|
72
72
|
var _this2 = this;
|
|
73
|
-
var t = this.props.t;
|
|
74
73
|
var isDropdownMenuOpen = this.state.isDropdownMenuOpen;
|
|
75
74
|
var caretIconClass = "caret-icon sdocfont sdoc-".concat(isDropdownMenuOpen ? 'caret-up' : 'drop-down');
|
|
76
75
|
var curType = this.getCurrentType();
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["text"];
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import Caret from './caret';
|
|
3
5
|
var renderText = function renderText(props, editor) {
|
|
4
6
|
var attributes = props.attributes,
|
|
5
7
|
children = props.children,
|
|
6
8
|
leaf = props.leaf;
|
|
9
|
+
var text = leaf.text,
|
|
10
|
+
rest = _objectWithoutProperties(leaf, _excluded);
|
|
7
11
|
var markedChildren = React.cloneElement(children);
|
|
8
12
|
if (leaf.BOLD) {
|
|
9
13
|
markedChildren = /*#__PURE__*/React.createElement("strong", null, markedChildren);
|
|
@@ -49,7 +53,8 @@ var renderText = function renderText(props, editor) {
|
|
|
49
53
|
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
50
54
|
"data-id": leaf.id
|
|
51
55
|
}, attributes, {
|
|
52
|
-
style: style
|
|
56
|
+
style: style,
|
|
57
|
+
className: Object.keys(rest).join(' ')
|
|
53
58
|
}), leaf.isCaret ? /*#__PURE__*/React.createElement(Caret, leaf) : null, markedChildren);
|
|
54
59
|
};
|
|
55
60
|
export default renderText;
|
|
@@ -3,9 +3,9 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Node } from '@seafile/slate';
|
|
5
5
|
import { useSlateStatic } from '@seafile/slate-react';
|
|
6
|
-
import { BLOCKQUOTE, LINK, CHECK_LIST_ITEM, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, LIST_ITEM, LIST_LIC, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, CODE_BLOCK, IMAGE, ELEMENT_TYPE } from '../constants';
|
|
6
|
+
import { BLOCKQUOTE, LINK, CHECK_LIST_ITEM, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, LIST_ITEM, LIST_LIC, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, CODE_BLOCK, CODE_LINE, IMAGE, ELEMENT_TYPE } from '../constants';
|
|
7
7
|
import { BlockquotePlugin, LinkPlugin, CheckListPlugin, HeaderPlugin, ListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin } from '../plugins';
|
|
8
|
-
import { Placeholder } from '../core';
|
|
8
|
+
import { Placeholder, findPath } from '../core';
|
|
9
9
|
var CustomElement = function CustomElement(props) {
|
|
10
10
|
var editor = useSlateStatic();
|
|
11
11
|
var attributes = props.attributes,
|
|
@@ -92,6 +92,16 @@ var CustomElement = function CustomElement(props) {
|
|
|
92
92
|
renderCodeBlock = _CodeBlockPlugin$rend[0];
|
|
93
93
|
return renderCodeBlock(props, editor);
|
|
94
94
|
}
|
|
95
|
+
case CODE_LINE:
|
|
96
|
+
{
|
|
97
|
+
var path = findPath(editor, element);
|
|
98
|
+
var lineNumber = path.at(-1) + 1;
|
|
99
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
|
|
100
|
+
className: 'sdoc-code-line'
|
|
101
|
+
}), lineNumber && /*#__PURE__*/React.createElement("span", {
|
|
102
|
+
className: "sdoc-code-line-index"
|
|
103
|
+
}, lineNumber), children);
|
|
104
|
+
}
|
|
95
105
|
case IMAGE:
|
|
96
106
|
{
|
|
97
107
|
var _ImagePlugin$renderEl = _slicedToArray(ImagePlugin.renderElements, 1),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { Element } from '@seafile/slate';
|
|
4
|
+
import { CODE_LINE } from '../extension/constants';
|
|
5
|
+
import { SetNodeToDecorations } from './setNodeToDecorations';
|
|
6
|
+
export var useHighlightDecorate = function useHighlightDecorate(editor) {
|
|
7
|
+
var highlightDecorate = useCallback(function (_ref) {
|
|
8
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
9
|
+
node = _ref2[0],
|
|
10
|
+
path = _ref2[1];
|
|
11
|
+
if (Element.isElement(node) && node.type === CODE_LINE) {
|
|
12
|
+
var ranges = editor.nodeToDecorations.get(node) || [];
|
|
13
|
+
return ranges;
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
},
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
+
[editor.nodeToDecorations]);
|
|
19
|
+
return {
|
|
20
|
+
highlightDecorate: highlightDecorate
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
5
|
+
import { Node, Element, Editor } from '@seafile/slate';
|
|
6
|
+
import { useSlateStatic } from '@seafile/slate-react';
|
|
7
|
+
import Prism, { normalizeTokens, normalizeTokensByLanguageType } from '../utils/prismjs';
|
|
8
|
+
import { CODE_BLOCK } from '../extension/constants';
|
|
9
|
+
var mergeMaps = function mergeMaps() {
|
|
10
|
+
var map = new Map();
|
|
11
|
+
for (var _len = arguments.length, maps = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12
|
+
maps[_key] = arguments[_key];
|
|
13
|
+
}
|
|
14
|
+
for (var _i = 0, _maps = maps; _i < _maps.length; _i++) {
|
|
15
|
+
var m = _maps[_i];
|
|
16
|
+
var _iterator = _createForOfIteratorHelper(m),
|
|
17
|
+
_step;
|
|
18
|
+
try {
|
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
+
var item = _step.value;
|
|
21
|
+
map.set.apply(map, _toConsumableArray(item));
|
|
22
|
+
}
|
|
23
|
+
} catch (err) {
|
|
24
|
+
_iterator.e(err);
|
|
25
|
+
} finally {
|
|
26
|
+
_iterator.f();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return map;
|
|
30
|
+
};
|
|
31
|
+
var getChildNodeToDecorations = function getChildNodeToDecorations(_ref) {
|
|
32
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
33
|
+
block = _ref2[0],
|
|
34
|
+
blockPath = _ref2[1];
|
|
35
|
+
var nodeToDecorations = new Map();
|
|
36
|
+
var text = block.children.map(function (line) {
|
|
37
|
+
return Node.string(line);
|
|
38
|
+
}).join('\n');
|
|
39
|
+
var language = block.language || 'plaintext'; // default 'plaintext'
|
|
40
|
+
var tokens = Prism.tokenize(text, Prism.languages[language]);
|
|
41
|
+
if (Object.keys(normalizeTokensByLanguageType).includes(language)) {
|
|
42
|
+
tokens = normalizeTokensByLanguageType[language](tokens);
|
|
43
|
+
}
|
|
44
|
+
var normalizedTokens = normalizeTokens(tokens); // make tokens flat and grouped by line
|
|
45
|
+
var blockChildren = block.children;
|
|
46
|
+
for (var index = 0; index < normalizedTokens.length; index++) {
|
|
47
|
+
var _tokens = normalizedTokens[index];
|
|
48
|
+
var element = blockChildren[index];
|
|
49
|
+
if (element) {
|
|
50
|
+
if (!nodeToDecorations.has(element)) {
|
|
51
|
+
nodeToDecorations.set(element, []);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var start = 0;
|
|
55
|
+
var _iterator2 = _createForOfIteratorHelper(_tokens),
|
|
56
|
+
_step2;
|
|
57
|
+
try {
|
|
58
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
59
|
+
var token = _step2.value;
|
|
60
|
+
var length = token.content.length;
|
|
61
|
+
if (!length) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
var end = start + length;
|
|
65
|
+
var path = [].concat(_toConsumableArray(blockPath), [index, 0]);
|
|
66
|
+
var range = _objectSpread({
|
|
67
|
+
anchor: {
|
|
68
|
+
path: path,
|
|
69
|
+
offset: start
|
|
70
|
+
},
|
|
71
|
+
focus: {
|
|
72
|
+
path: path,
|
|
73
|
+
offset: end
|
|
74
|
+
},
|
|
75
|
+
token: true
|
|
76
|
+
}, Object.fromEntries(token.types.map(function (type) {
|
|
77
|
+
return [type, true];
|
|
78
|
+
})));
|
|
79
|
+
if (nodeToDecorations.get(element)) {
|
|
80
|
+
nodeToDecorations.get(element).push(range);
|
|
81
|
+
}
|
|
82
|
+
start = end;
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
_iterator2.e(err);
|
|
86
|
+
} finally {
|
|
87
|
+
_iterator2.f();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return nodeToDecorations;
|
|
91
|
+
};
|
|
92
|
+
export var SetNodeToDecorations = function SetNodeToDecorations() {
|
|
93
|
+
var editor = useSlateStatic();
|
|
94
|
+
var blockEntries = Array.from(Editor.nodes(editor, {
|
|
95
|
+
at: [],
|
|
96
|
+
mode: 'highest',
|
|
97
|
+
match: function match(n) {
|
|
98
|
+
return Element.isElement(n) && n.type === CODE_BLOCK;
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
var nodeToDecorations = mergeMaps.apply(void 0, _toConsumableArray(blockEntries.map(getChildNodeToDecorations)));
|
|
102
|
+
editor.nodeToDecorations = nodeToDecorations;
|
|
103
|
+
return null;
|
|
104
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import Prism from 'prismjs';
|
|
2
|
+
import 'prismjs/themes/prism.css';
|
|
3
|
+
|
|
4
|
+
// languages
|
|
5
|
+
import 'prismjs/components/prism-javascript';
|
|
6
|
+
import 'prismjs/components/prism-typescript';
|
|
7
|
+
import 'prismjs/components/prism-markup';
|
|
8
|
+
import 'prismjs/components/prism-go';
|
|
9
|
+
import 'prismjs/components/prism-php';
|
|
10
|
+
import 'prismjs/components/prism-c';
|
|
11
|
+
import 'prismjs/components/prism-python';
|
|
12
|
+
import 'prismjs/components/prism-java';
|
|
13
|
+
import 'prismjs/components/prism-cpp';
|
|
14
|
+
import 'prismjs/components/prism-csharp';
|
|
15
|
+
import 'prismjs/components/prism-sql';
|
|
16
|
+
import 'prismjs/components/prism-ruby';
|
|
17
|
+
import 'prismjs/components/prism-swift';
|
|
18
|
+
import 'prismjs/components/prism-bash';
|
|
19
|
+
import 'prismjs/components/prism-lua';
|
|
20
|
+
var newlineRe = /\r\n|\r|\n/;
|
|
21
|
+
export var genCodeLangs = function genCodeLangs() {
|
|
22
|
+
return [{
|
|
23
|
+
text: 'Plain Text',
|
|
24
|
+
value: 'plaintext'
|
|
25
|
+
}, {
|
|
26
|
+
text: 'CSS',
|
|
27
|
+
value: 'css'
|
|
28
|
+
}, {
|
|
29
|
+
text: 'HTML',
|
|
30
|
+
value: 'html'
|
|
31
|
+
}, {
|
|
32
|
+
text: 'XML',
|
|
33
|
+
value: 'xml'
|
|
34
|
+
}, {
|
|
35
|
+
text: 'Javascript',
|
|
36
|
+
value: 'javascript'
|
|
37
|
+
}, {
|
|
38
|
+
text: 'Typescript',
|
|
39
|
+
value: 'typescript'
|
|
40
|
+
}, {
|
|
41
|
+
text: 'Go',
|
|
42
|
+
value: 'go'
|
|
43
|
+
}, {
|
|
44
|
+
text: 'PHP',
|
|
45
|
+
value: 'php'
|
|
46
|
+
}, {
|
|
47
|
+
text: 'C',
|
|
48
|
+
value: 'c'
|
|
49
|
+
}, {
|
|
50
|
+
text: 'Python',
|
|
51
|
+
value: 'python'
|
|
52
|
+
}, {
|
|
53
|
+
text: 'Java',
|
|
54
|
+
value: 'java'
|
|
55
|
+
}, {
|
|
56
|
+
text: 'C++',
|
|
57
|
+
value: 'cpp'
|
|
58
|
+
}, {
|
|
59
|
+
text: 'C#',
|
|
60
|
+
value: 'csharp'
|
|
61
|
+
}, {
|
|
62
|
+
text: 'SQL',
|
|
63
|
+
value: 'sql'
|
|
64
|
+
}, {
|
|
65
|
+
text: 'Ruby',
|
|
66
|
+
value: 'ruby'
|
|
67
|
+
}, {
|
|
68
|
+
text: 'Swift',
|
|
69
|
+
value: 'swift'
|
|
70
|
+
}, {
|
|
71
|
+
text: 'Bash',
|
|
72
|
+
value: 'bash'
|
|
73
|
+
}];
|
|
74
|
+
};
|
|
75
|
+
export var normalizeTokensByLanguageType = {
|
|
76
|
+
'php': function php(tokens) {
|
|
77
|
+
tokens.forEach(function (token) {
|
|
78
|
+
if (['<?', '?>'].includes(token.content)) {
|
|
79
|
+
token.type = 'operator';
|
|
80
|
+
token.alias = '';
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return tokens;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var normalizeEmptyLines = function normalizeEmptyLines(line) {
|
|
87
|
+
if (line.length === 0) {
|
|
88
|
+
line.push({
|
|
89
|
+
types: ['plain'],
|
|
90
|
+
content: '\n',
|
|
91
|
+
empty: true
|
|
92
|
+
});
|
|
93
|
+
} else if (line.length === 1 && line[0].content === '') {
|
|
94
|
+
line[0].content = '\n';
|
|
95
|
+
line[0].empty = true;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var appendTypes = function appendTypes(types, add) {
|
|
99
|
+
var typesSize = types.length;
|
|
100
|
+
if (typesSize > 0 && types[typesSize - 1] === add) {
|
|
101
|
+
return types;
|
|
102
|
+
}
|
|
103
|
+
return types.concat(add);
|
|
104
|
+
};
|
|
105
|
+
export var normalizeTokens = function normalizeTokens(tokens) {
|
|
106
|
+
var typeArrStack = [[]];
|
|
107
|
+
var tokenArrStack = [tokens];
|
|
108
|
+
var tokenArrIndexStack = [0];
|
|
109
|
+
var tokenArrSizeStack = [tokens.length];
|
|
110
|
+
var i = 0;
|
|
111
|
+
var stackIndex = 0;
|
|
112
|
+
var currentLine = [];
|
|
113
|
+
var acc = [currentLine];
|
|
114
|
+
while (stackIndex > -1) {
|
|
115
|
+
while ((i = tokenArrIndexStack[stackIndex]++) < tokenArrSizeStack[stackIndex]) {
|
|
116
|
+
var content = void 0;
|
|
117
|
+
var types = typeArrStack[stackIndex];
|
|
118
|
+
var tokenArr = tokenArrStack[stackIndex];
|
|
119
|
+
var token = tokenArr[i];
|
|
120
|
+
|
|
121
|
+
// Determine content and append type to types if necessary
|
|
122
|
+
if (typeof token === 'string') {
|
|
123
|
+
types = stackIndex > 0 ? types : ['plain'];
|
|
124
|
+
content = token;
|
|
125
|
+
} else {
|
|
126
|
+
types = appendTypes(types, token.type);
|
|
127
|
+
if (token.alias) {
|
|
128
|
+
types = appendTypes(types, token.alias);
|
|
129
|
+
}
|
|
130
|
+
content = token.content;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// If token.content is an array, increase the stack depth and repeat this while-loop
|
|
134
|
+
if (typeof content !== 'string') {
|
|
135
|
+
stackIndex++;
|
|
136
|
+
typeArrStack.push(types);
|
|
137
|
+
tokenArrStack.push(content);
|
|
138
|
+
tokenArrIndexStack.push(0);
|
|
139
|
+
tokenArrSizeStack.push(content.length);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Split by newlines
|
|
144
|
+
var splitByNewlines = content.split(newlineRe);
|
|
145
|
+
var newlineCount = splitByNewlines.length;
|
|
146
|
+
currentLine.push({
|
|
147
|
+
types: types,
|
|
148
|
+
content: splitByNewlines[0]
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Create a new line for each string on a new line
|
|
152
|
+
for (var _i = 1; _i < newlineCount; _i++) {
|
|
153
|
+
normalizeEmptyLines(currentLine);
|
|
154
|
+
acc.push(currentLine = []);
|
|
155
|
+
currentLine.push({
|
|
156
|
+
types: types,
|
|
157
|
+
content: splitByNewlines[_i]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Decreate the stack depth
|
|
163
|
+
stackIndex--;
|
|
164
|
+
typeArrStack.pop();
|
|
165
|
+
tokenArrStack.pop();
|
|
166
|
+
tokenArrIndexStack.pop();
|
|
167
|
+
tokenArrSizeStack.pop();
|
|
168
|
+
}
|
|
169
|
+
normalizeEmptyLines(currentLine);
|
|
170
|
+
return acc;
|
|
171
|
+
};
|
|
172
|
+
export default Prism;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.sdoc-code-block-hover-menu-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
height: 42px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.sdoc-code-block-hover-menu-container .hover-menu-container {
|
|
7
|
+
height: 36px;
|
|
8
|
+
padding: 7px 8px;
|
|
9
|
+
background-color: #fff;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
column-gap: 5px;
|
|
14
|
+
border-radius: 3px;
|
|
15
|
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
|
|
16
|
+
border: 1px solid #e8e8e8;
|
|
17
|
+
z-index: 1000;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sdoc-code-block-hover-menu-container .hover-menu-container .active {
|
|
21
|
+
color: #212529;
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
background: #f1f1f1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sdoc-code-block-hover-menu-container .hover-menu-container .op-item {
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: #212529;
|
|
29
|
+
padding: 0 5px;
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sdoc-code-block-hover-menu-container .hover-menu-container .op-item:hover {
|
|
34
|
+
color: #212529;
|
|
35
|
+
text-decoration: none;
|
|
36
|
+
background: #f1f1f1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.sdoc-code-block-hover-menu-container .hover-menu-container .icon-font {
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
color: #999999;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sdoc-langs-list-container {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 36px;
|
|
47
|
+
left: 8px;
|
|
48
|
+
width: 90%;
|
|
49
|
+
height: 400px;
|
|
50
|
+
overflow-y: auto;
|
|
51
|
+
background-color: #fff;
|
|
52
|
+
border-radius: 3px;
|
|
53
|
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
|
|
54
|
+
border: 1px solid #e8e8e8;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.sdoc-langs-list-container .langs-list-ul {
|
|
58
|
+
list-style: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.sdoc-langs-list-container .langs-list-ul .langs-list-li {
|
|
62
|
+
padding: 7px;
|
|
63
|
+
position: relative;
|
|
64
|
+
text-align: left;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.sdoc-langs-list-container .langs-list-ul .langs-list-li:hover {
|
|
70
|
+
background: #f1f1f1;;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sdoc-langs-list-container .langs-list-ul .langs-list-li .active {
|
|
74
|
+
background: #f1f1f1;;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sdoc-langs-list-container .langs-list-ul .langs-list-li .li-check-mark {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
padding: 0 10px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.sdoc-langs-list-container .langs-list-ul .langs-list-li .li-checked {
|
|
83
|
+
opacity: 1;
|
|
84
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { withTranslation } from 'react-i18next';
|
|
5
|
+
import { genCodeLangs } from '../../basic-sdk/utils/prismjs';
|
|
6
|
+
import './index.css';
|
|
7
|
+
var CodeBlockHoverMenu = function CodeBlockHoverMenu(_ref) {
|
|
8
|
+
var style = _ref.style,
|
|
9
|
+
language = _ref.language,
|
|
10
|
+
menuPosition = _ref.menuPosition,
|
|
11
|
+
onChangeLanguage = _ref.onChangeLanguage,
|
|
12
|
+
onChangeAutoLineWrap = _ref.onChangeAutoLineWrap,
|
|
13
|
+
onDeleteCodeBlock = _ref.onDeleteCodeBlock,
|
|
14
|
+
t = _ref.t;
|
|
15
|
+
var _style$white_space = style.white_space,
|
|
16
|
+
white_space = _style$white_space === void 0 ? 'nowrap' : _style$white_space;
|
|
17
|
+
var _useState = useState(false),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
isShowlangsList = _useState2[0],
|
|
20
|
+
setIsShowlangsList = _useState2[1];
|
|
21
|
+
var _useState3 = useState(''),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
selectedLanguageText = _useState4[0],
|
|
24
|
+
setSelectedLanguageText = _useState4[1];
|
|
25
|
+
var onHiddenLangsList = useCallback(function () {
|
|
26
|
+
setIsShowlangsList(false);
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
}, []);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
window.addEventListener('click', onHiddenLangsList);
|
|
31
|
+
return function () {
|
|
32
|
+
window.removeEventListener('click', onHiddenLangsList);
|
|
33
|
+
};
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, []);
|
|
36
|
+
var onShowLangs = useCallback(function (e) {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
setIsShowlangsList(!isShowlangsList);
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
}, [isShowlangsList]);
|
|
41
|
+
var onAutoLineWrap = useCallback(function () {
|
|
42
|
+
if (white_space === 'normal') {
|
|
43
|
+
onChangeAutoLineWrap('nowrap');
|
|
44
|
+
} else {
|
|
45
|
+
onChangeAutoLineWrap('normal');
|
|
46
|
+
}
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, [white_space]);
|
|
49
|
+
var onDelete = useCallback(function () {
|
|
50
|
+
onDeleteCodeBlock();
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
var onSelectLang = useCallback(function (lang) {
|
|
54
|
+
var text = lang.text;
|
|
55
|
+
setSelectedLanguageText(text);
|
|
56
|
+
onChangeLanguage(lang);
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, []);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
// Compatible with legacy code
|
|
61
|
+
var selectedLanguage = language;
|
|
62
|
+
if (language === 'text') {
|
|
63
|
+
selectedLanguage = 'plaintext';
|
|
64
|
+
}
|
|
65
|
+
var selectedLanguageText = genCodeLangs().find(function (item) {
|
|
66
|
+
return item.value === selectedLanguage;
|
|
67
|
+
}).text;
|
|
68
|
+
setSelectedLanguageText(selectedLanguageText);
|
|
69
|
+
}, [language]);
|
|
70
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, createPortal( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "sdoc-code-block-hover-menu-container",
|
|
72
|
+
style: menuPosition
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "hover-menu-container"
|
|
75
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
role: "button",
|
|
77
|
+
className: "op-item ".concat(isShowlangsList ? 'active' : ''),
|
|
78
|
+
onClick: onShowLangs
|
|
79
|
+
}, /*#__PURE__*/React.createElement("span", null, selectedLanguageText), /*#__PURE__*/React.createElement("i", {
|
|
80
|
+
className: "sdocfont sdoc-drop-down ml-1 icon-font"
|
|
81
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
role: "button",
|
|
83
|
+
className: "op-item ".concat(white_space === 'normal' ? 'active' : ''),
|
|
84
|
+
onClick: onAutoLineWrap
|
|
85
|
+
}, /*#__PURE__*/React.createElement("span", null, t('Auto_wrap'))), /*#__PURE__*/React.createElement("span", {
|
|
86
|
+
role: "button",
|
|
87
|
+
className: 'op-item',
|
|
88
|
+
onClick: onDelete
|
|
89
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
90
|
+
className: "sdocfont sdoc-delete icon-font"
|
|
91
|
+
})), isShowlangsList && /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "sdoc-langs-list-container"
|
|
93
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
94
|
+
className: "langs-list-ul"
|
|
95
|
+
}, genCodeLangs().map(function (item) {
|
|
96
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
97
|
+
className: "langs-list-li ".concat(selectedLanguageText === item.text ? 'active' : ''),
|
|
98
|
+
id: item.value,
|
|
99
|
+
key: item.value,
|
|
100
|
+
onClick: function onClick() {
|
|
101
|
+
onSelectLang(item);
|
|
102
|
+
}
|
|
103
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
104
|
+
className: "li-check-mark ".concat(selectedLanguageText === item.text ? 'li-checked' : '')
|
|
105
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
106
|
+
className: "sdocfont sdoc-check-square icon-font"
|
|
107
|
+
})), item.text);
|
|
108
|
+
})))))), document.body));
|
|
109
|
+
};
|
|
110
|
+
export default withTranslation('sdoc-editor')(CodeBlockHoverMenu);
|
|
@@ -22,21 +22,34 @@ var DocInfo = /*#__PURE__*/function (_React$Component) {
|
|
|
22
22
|
var eventBus = EventBus.getInstance();
|
|
23
23
|
eventBus.dispatch(EXTERNAL_EVENT.INTERNAL_LINK_CLICK);
|
|
24
24
|
};
|
|
25
|
+
_this.toggleStar = function () {
|
|
26
|
+
var eventBus = EventBus.getInstance();
|
|
27
|
+
eventBus.dispatch(EXTERNAL_EVENT.TOGGLE_STAR);
|
|
28
|
+
};
|
|
25
29
|
return _this;
|
|
26
30
|
}
|
|
27
31
|
_createClass(DocInfo, [{
|
|
28
32
|
key: "render",
|
|
29
33
|
value: function render() {
|
|
30
|
-
var
|
|
34
|
+
var _this$props = this.props,
|
|
35
|
+
t = _this$props.t,
|
|
36
|
+
isStarred = _this$props.isStarred;
|
|
31
37
|
var docName = context.getSetting('docName');
|
|
32
|
-
var
|
|
38
|
+
var _context$getSettings = context.getSettings(),
|
|
39
|
+
isShowInternalLink = _context$getSettings.isShowInternalLink,
|
|
40
|
+
isStarIconShown = _context$getSettings.isStarIconShown;
|
|
33
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
34
42
|
className: "doc-info"
|
|
35
43
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
44
|
className: "doc-name"
|
|
37
|
-
}, docName), /*#__PURE__*/React.createElement("
|
|
45
|
+
}, docName), isStarIconShown && /*#__PURE__*/React.createElement("button", {
|
|
46
|
+
className: "doc-icon sdocfont ".concat(isStarred ? 'sdoc-starred' : 'sdoc-unstarred', " border-0 p-0 bg-transparent"),
|
|
47
|
+
title: isStarred ? t('starred') : t('unstarred'),
|
|
48
|
+
"aria-label": isStarred ? t('Unstar') : t('Star'),
|
|
49
|
+
onClick: this.toggleStar
|
|
50
|
+
}), isShowInternalLink && /*#__PURE__*/React.createElement("span", {
|
|
38
51
|
className: "doc-icon"
|
|
39
|
-
},
|
|
52
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
40
53
|
className: "internal-link sdocfont sdoc-link",
|
|
41
54
|
title: t('internal_link'),
|
|
42
55
|
onClick: this.onInternalLinkClick
|
package/dist/constants/index.js
CHANGED
|
@@ -112,7 +112,9 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
112
112
|
}, errorMessage);
|
|
113
113
|
}
|
|
114
114
|
var isOpenSocket = context.getSetting('isOpenSocket');
|
|
115
|
-
return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(DocInfo,
|
|
115
|
+
return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(DocInfo, {
|
|
116
|
+
isStarred: this.props.isStarred
|
|
117
|
+
}), /*#__PURE__*/React.createElement(DocOperations, null)), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocEditor, {
|
|
116
118
|
config: context.getEditorConfig(),
|
|
117
119
|
document: document,
|
|
118
120
|
isOpenSocket: isOpenSocket,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.60",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"is-url": "^1.2.4",
|
|
18
18
|
"lodash.throttle": "4.1.1",
|
|
19
19
|
"randomcolor": "0.6.2",
|
|
20
|
+
"prismjs": "^1.29.0",
|
|
20
21
|
"react-cookies": "0.1.1",
|
|
21
22
|
"reactstrap": "8.9.0",
|
|
22
23
|
"slugid": "3.2.0",
|
|
@@ -149,8 +150,5 @@
|
|
|
149
150
|
"last 1 firefox version",
|
|
150
151
|
"last 1 safari version"
|
|
151
152
|
]
|
|
152
|
-
},
|
|
153
|
-
"publishConfig": {
|
|
154
|
-
"access": "public"
|
|
155
153
|
}
|
|
156
154
|
}
|
|
@@ -247,5 +247,10 @@
|
|
|
247
247
|
"Insert_below": "Insert below",
|
|
248
248
|
"Insert_above": "Insert above",
|
|
249
249
|
"Insert_on_the_right": "Insert on the right",
|
|
250
|
-
"Insert_on_the_left": "Insert on the left"
|
|
250
|
+
"Insert_on_the_left": "Insert on the left",
|
|
251
|
+
"starred": "starred",
|
|
252
|
+
"unstarred": "unstarred",
|
|
253
|
+
"Star": "Star",
|
|
254
|
+
"Unstar": "Unstar",
|
|
255
|
+
"Auto_wrap": "Auto wrap"
|
|
251
256
|
}
|
|
Binary file
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<missing-glyph />
|
|
16
16
|
|
|
17
|
+
<glyph glyph-name="sdoc-caret-up" unicode="" d="M550.4 588.8l265.6-336c32-38.4 6.4-102.4-38.4-102.4H246.4c-44.8 0-70.4 60.8-38.4 102.4l265.6 336c19.2 25.6 57.6 25.6 76.8 0z" horiz-adv-x="1024" />
|
|
18
|
+
|
|
19
|
+
<glyph glyph-name="sdoc-starred" unicode="" d="M995.2 412.8c54.4 54.4 25.6 153.6-51.2 163.2l-192 28.8c-28.8 3.2-57.6 25.6-70.4 54.4l-86.4 182.4C579.2 876.8 544 896 512 896s-67.2-19.2-83.2-54.4l-86.4-182.4c-12.8-28.8-38.4-48-70.4-51.2l-192-28.8C3.2 566.4-25.6 470.4 28.8 416l140.8-140.8c22.4-22.4 32-54.4 25.6-86.4l-32-201.6c-9.6-64 38.4-112 92.8-112 12.8 0 28.8 3.2 41.6 12.8l172.8 96c12.8 6.4 28.8 9.6 41.6 9.6 16 0 28.8-3.2 41.6-9.6l172.8-96c12.8-6.4 28.8-12.8 41.6-12.8 54.4 0 102.4 51.2 92.8 112l-32 201.6c-6.4 32 3.2 64 25.6 86.4l140.8 137.6z" horiz-adv-x="1024" />
|
|
20
|
+
|
|
21
|
+
<glyph glyph-name="sdoc-unstarred" unicode="" d="M816 368c-60.8-60.8-86.4-150.4-73.6-236.8L768-32l-137.6 76.8c-35.2 19.2-76.8 32-118.4 32s-83.2-9.6-118.4-32L256-32l25.6 163.2c12.8 86.4-12.8 176-73.6 236.8L96 483.2l153.6 22.4c83.2 12.8 153.6 67.2 192 147.2L512 800l70.4-147.2c38.4-80 108.8-134.4 192-147.2l153.6-22.4-112-115.2z m179.2 44.8c54.4 54.4 25.6 153.6-51.2 163.2l-192 28.8c-28.8 3.2-57.6 25.6-70.4 54.4l-86.4 182.4C579.2 876.8 544 896 512 896s-67.2-19.2-83.2-54.4l-86.4-182.4c-12.8-28.8-38.4-48-70.4-51.2l-192-28.8C3.2 566.4-25.6 470.4 28.8 416l140.8-140.8c22.4-22.4 32-54.4 25.6-86.4l-32-201.6c-9.6-64 38.4-112 92.8-112 12.8 0 28.8 3.2 41.6 12.8l172.8 96c12.8 6.4 28.8 9.6 41.6 9.6 16 0 28.8-3.2 41.6-9.6l172.8-96c12.8-6.4 28.8-12.8 41.6-12.8 54.4 0 102.4 51.2 92.8 112l-32 201.6c-6.4 32 3.2 64 25.6 86.4l140.8 137.6z" horiz-adv-x="1024" />
|
|
22
|
+
|
|
17
23
|
<glyph glyph-name="sdoc-more" unicode="" d="M259.2 380.8c0-54.4-41.6-96-96-96s-96 41.6-96 96 41.6 96 96 96 96-44.8 96-96z m352 6.4c0-54.4-41.6-96-96-96s-96 41.6-96 96 41.6 96 96 96 96-41.6 96-96z m352 0c0-54.4-41.6-96-96-96s-96 41.6-96 96 41.6 96 96 96 96-41.6 96-96z" horiz-adv-x="1024" />
|
|
18
24
|
|
|
19
25
|
<glyph glyph-name="sdoc-comment" unicode="" d="M886.4 800C928 800 960 768 960 726.4v-537.6c0-41.6-32-73.6-73.6-73.6h-192l-156.8-140.8c-12.8-12.8-35.2-12.8-48 0l-156.8 140.8h-192c-41.6 0-73.6 32-73.6 73.6V726.4C64 768 96 800 137.6 800h748.8z m0-73.6H137.6v-537.6h220.8l153.6-137.6 153.6 137.6h220.8V726.4zM665.6 480c19.2 0 38.4-16 38.4-38.4 0-19.2-16-35.2-38.4-38.4h-310.4c-19.2 0-38.4 16-38.4 38.4 0 19.2 16 35.2 38.4 38.4h310.4z m-115.2-192c0-19.2-16-38.4-38.4-38.4-19.2 0-35.2 16-38.4 38.4V598.4c0 19.2 16 38.4 38.4 38.4 19.2 0 35.2-16 38.4-38.4V288z" horiz-adv-x="1024" />
|
|
@@ -30,8 +36,6 @@
|
|
|
30
36
|
|
|
31
37
|
<glyph glyph-name="sdoc-delete-table" unicode="" d="M800 352c124.8 0 224-102.4 224-220.8S921.6-96 800-96s-224 102.4-224 220.8 99.2 227.2 224 227.2z m128 448c35.2 0 60.8-25.6 64-60.8v-396.8c-35.2 32-80 54.4-128 67.2V544h-288v-160h92.8C576 336 512 240 512 128c0-60.8 19.2-115.2 48-160H96c-35.2 0-60.8 25.6-64 60.8V736c0 35.2 25.6 60.8 60.8 64H928z m-38.4-640h-176c-25.6 0-38.4-12.8-38.4-32 0-12.8 19.2-32 38.4-32h176c25.6 0 38.4 12.8 38.4 32 0 12.8-16 32-38.4 32zM448 256H160v-160h288v160z m0 288H160v-160h288v160z" horiz-adv-x="1024" />
|
|
32
38
|
|
|
33
|
-
<glyph glyph-name="sdoc-caret-up" unicode="" d="M870.4 137.6H153.6c-51.2 0-73.6 60.8-38.4 96L473.6 592c22.4 22.4 57.6 22.4 80 0L912 233.6c35.2-38.4 9.6-96-41.6-96z" horiz-adv-x="1024" />
|
|
34
|
-
|
|
35
39
|
<glyph glyph-name="sdoc-align-right" unicode="" d="M393.6 697.6V771.2c0 16 12.8 28.8 28.8 28.8h476.8c16 0 28.8-12.8 28.8-28.8v-73.6c0-16-12.8-28.8-28.8-28.8H422.4c-16 0-28.8 12.8-28.8 28.8z m-268.8-262.4H896c16 0 28.8 12.8 28.8 28.8v73.6c0 16-12.8 28.8-28.8 28.8H124.8c-16 0-28.8-12.8-28.8-28.8v-73.6c0-16 12.8-28.8 28.8-28.8z m0-467.2H896c16 0 28.8 12.8 28.8 28.8v73.6c0 16-12.8 28.8-28.8 28.8H124.8c-16 0-28.8-12.8-28.8-28.8v-73.6c0-16 12.8-28.8 28.8-28.8z m297.6 233.6h476.8c16 0 28.8 12.8 28.8 28.8v73.6c0 16-12.8 28.8-28.8 28.8H422.4c-16 0-28.8-12.8-28.8-28.8v-73.6c0-16 12.8-28.8 28.8-28.8z" horiz-adv-x="1024" />
|
|
36
40
|
|
|
37
41
|
<glyph glyph-name="sdoc-cancel" unicode="" d="M512 441.6L214.4 742.4 185.6 768 128 710.4l25.6-28.8 300.8-297.6-300.8-297.6-25.6-28.8L185.6 0l28.8 25.6 297.6 300.8 297.6-300.8 28.8-25.6 57.6 57.6-25.6 28.8-300.8 297.6 300.8 297.6 25.6 28.8L838.4 768l-28.8-25.6-297.6-300.8z" horiz-adv-x="1024" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "sdocfont"; /* Project id 4097705 */
|
|
3
|
-
src: url('./sdoc-editor-font/iconfont.eot?t=
|
|
4
|
-
src: url('./sdoc-editor-font/iconfont.eot?t=
|
|
5
|
-
url('./sdoc-editor-font/iconfont.woff2?t=
|
|
6
|
-
url('./sdoc-editor-font/iconfont.woff?t=
|
|
7
|
-
url('./sdoc-editor-font/iconfont.ttf?t=
|
|
8
|
-
url('./sdoc-editor-font/iconfont.svg?t=
|
|
3
|
+
src: url('./sdoc-editor-font/iconfont.eot?t=1688352029576'); /* IE9 */
|
|
4
|
+
src: url('./sdoc-editor-font/iconfont.eot?t=1688352029576#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
|
5
|
+
url('./sdoc-editor-font/iconfont.woff2?t=1688352029576') format('woff2'),
|
|
6
|
+
url('./sdoc-editor-font/iconfont.woff?t=1688352029576') format('woff'),
|
|
7
|
+
url('./sdoc-editor-font/iconfont.ttf?t=1688352029576') format('truetype'),
|
|
8
|
+
url('./sdoc-editor-font/iconfont.svg?t=1688352029576#sdocfont') format('svg');
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.sdocfont {
|
|
@@ -16,6 +16,18 @@
|
|
|
16
16
|
-moz-osx-font-smoothing: grayscale;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.sdoc-caret-up:before {
|
|
20
|
+
content: "\e636";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sdoc-starred:before {
|
|
24
|
+
content: "\e63d";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sdoc-unstarred:before {
|
|
28
|
+
content: "\e63e";
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
.sdoc-more:before {
|
|
20
32
|
content: "\e63a";
|
|
21
33
|
}
|
|
@@ -48,10 +60,6 @@
|
|
|
48
60
|
content: "\e637";
|
|
49
61
|
}
|
|
50
62
|
|
|
51
|
-
.sdoc-caret-up:before {
|
|
52
|
-
content: "\e636";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
63
|
.sdoc-align-right:before {
|
|
56
64
|
content: "\e630";
|
|
57
65
|
}
|