@seafile/sdoc-editor 0.1.19 → 0.1.21-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@
22
22
  font-size: 16px;
23
23
  border-bottom: 1px solid #ededed;
24
24
  color: #212529;
25
+ background: #fff;
25
26
  }
26
27
 
27
28
  .collaborators-popover .popover-container .content-list {
@@ -23,15 +23,16 @@
23
23
 
24
24
  .sdoc-editor-container .sdoc-editor-content {
25
25
  flex: 1;
26
+ display: flex;
26
27
  background: #f5f5f5;
27
28
  overflow: auto;
28
29
  }
29
30
 
30
31
  .sdoc-editor-container .sdoc-editor-content .article {
31
- max-width: 950px;
32
+ width: 794px;
32
33
  min-height: calc(100% - 40px);
33
- margin: 20px auto;
34
34
  padding: 40px 60px;
35
+ margin: 20px 0;
35
36
  background-color: #fff;
36
37
  border: 1px solid #e5e6e8;
37
38
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.06);
@@ -0,0 +1,51 @@
1
+ .display-outline-icon {
2
+ font-size: 14px;
3
+ color: #888;
4
+ cursor: pointer;
5
+ width: 28px;
6
+ height: 28px;
7
+ background: #fff;
8
+ border-radius: 0 50% 50% 0;
9
+ box-shadow: 0 0 6px rgba(0,0,0, 0.12);
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ margin: 20px 230px 0 0;
14
+ }
15
+
16
+ .display-outline-icon:hover {
17
+ color: #333;
18
+ }
19
+
20
+ .sdoc-outline {
21
+ font-size: 14px;
22
+ width: 220px;
23
+ margin: 20px 30px 20px 16px;
24
+ }
25
+
26
+ .sdoc-outline-header {
27
+ color: #999;
28
+ border-bottom: 1px solid #dbdbdb;
29
+ }
30
+
31
+ .font-size-inherit {
32
+ font-size: inherit;
33
+ }
34
+
35
+ .sdoc-outline-header .close-icon {
36
+ cursor: pointer;
37
+ font-size: 14px;
38
+ }
39
+
40
+ .sdoc-outline-header .close-icon:hover {
41
+ color: #555;
42
+ }
43
+
44
+ .outline-item {
45
+ line-height: 30px;
46
+ cursor: pointer;
47
+ }
48
+
49
+ .outline-item.active {
50
+ color: #ff8000;
51
+ }
@@ -7,6 +7,7 @@ import { Editable, Slate } from '@seafile/slate-react';
7
7
  import editor, { renderLeaf as _renderLeaf, renderElement as _renderElement, Toolbar } from './extension';
8
8
  import { SocketManager, withSocketIO } from './socket';
9
9
  import withNodeId from './node-id';
10
+ import SDocOutline from './outline';
10
11
  import EventProxy from './utils/event-handler';
11
12
  import './assets/css/layout.css';
12
13
  import './assets/css/sdoc-editor-plugins.css';
@@ -62,12 +63,17 @@ var SDocEditor = /*#__PURE__*/function (_React$Component) {
62
63
  value: function render() {
63
64
  var _this2 = this;
64
65
  var slateValue = this.state.slateValue;
66
+ var doc = this.props.document;
65
67
  return /*#__PURE__*/React.createElement("div", {
66
68
  className: "sdoc-editor-container"
67
69
  }, /*#__PURE__*/React.createElement(Toolbar, {
68
70
  editor: this.editor
69
71
  }), /*#__PURE__*/React.createElement("div", {
70
72
  className: "sdoc-editor-content"
73
+ }, /*#__PURE__*/React.createElement(SDocOutline, {
74
+ doc: doc
75
+ }), /*#__PURE__*/React.createElement("div", {
76
+ className: "flex-fill o-auto"
71
77
  }, /*#__PURE__*/React.createElement(Slate, {
72
78
  editor: this.editor,
73
79
  value: slateValue,
@@ -83,7 +89,7 @@ var SDocEditor = /*#__PURE__*/function (_React$Component) {
83
89
  return _renderLeaf(props, _this2.editor);
84
90
  },
85
91
  onKeyDown: this.eventProxy.onKeyDown
86
- })))));
92
+ }))))));
87
93
  }
88
94
  }]);
89
95
  return SDocEditor;
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  var _MENUS_CONFIG_MAP, _HEADER_TITLE_MAP;
3
3
  // extension plugin
4
4
  export var BLOCKQUOTE = 'blockquote';
5
- export var BOLD = 'blod';
5
+ export var BOLD = 'bold';
6
6
  export var ITALIC = 'italic';
7
7
  export var HEADER = 'header';
8
8
  export var HEADER1 = 'header1';
@@ -29,6 +29,7 @@ export var TABLE_ROW = 'table-row';
29
29
  export var FORMULA = 'formula';
30
30
  export var COLUMN = 'column';
31
31
  export var TEXTSTYLE = 'text-style';
32
+ export var BOLD_ITALIC = 'bold-italic';
32
33
 
33
34
  // menus config
34
35
  export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CONFIG_MAP, BLOCKQUOTE, {
@@ -7,6 +7,7 @@ var renderHeader = function renderHeader(props, editor) {
7
7
  var level = type.split('header')[1];
8
8
  var Tag = "h".concat(level);
9
9
  return /*#__PURE__*/React.createElement(Tag, Object.assign({
10
+ id: element.id,
10
11
  "data-id": element.id
11
12
  }, attributes), children);
12
13
  };
@@ -1,3 +1,4 @@
1
+ import MarkDownPlugin from './markdown';
1
2
  import HeaderPlugin from './header';
2
3
  import LinkPlugin from './link';
3
4
  import BlockquotePlugin from './blockquote';
@@ -5,6 +6,6 @@ import ListPlugin from './list';
5
6
  import CheckListPlugin from './check-list';
6
7
  import TextPlugin from './text-style';
7
8
  import CodeBlockPlugin from './code-block';
8
- var Plugins = [HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin, CodeBlockPlugin];
9
+ var Plugins = [MarkDownPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin, CodeBlockPlugin];
9
10
  export default Plugins;
10
- export { HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin, CodeBlockPlugin };
11
+ export { MarkDownPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, TextPlugin, CodeBlockPlugin };
@@ -0,0 +1,5 @@
1
+ import withMarkDown from './plugin';
2
+ var MarkDownPlugin = {
3
+ editorPlugin: withMarkDown
4
+ };
5
+ export default MarkDownPlugin;
@@ -0,0 +1,165 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { Editor, Transforms, Range } from '@seafile/slate';
3
+ import { toggleList } from '../list/transforms';
4
+ import { getSelectedNodeByType } from '../../core';
5
+ import { HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, UNORDERED_LIST, BLOCKQUOTE, BOLD, ITALIC, BOLD_ITALIC } from '../../constants';
6
+ var KEY_TO_TYPE_FOR_SPACE = {
7
+ // Title shortcut
8
+ '#': HEADER1,
9
+ '##': HEADER2,
10
+ '###': HEADER3,
11
+ '####': HEADER4,
12
+ '#####': HEADER5,
13
+ '######': HEADER6,
14
+ // List shortcut
15
+ '*': UNORDERED_LIST,
16
+ '-': UNORDERED_LIST,
17
+ // Reference shortcut key
18
+ '>': BLOCKQUOTE
19
+ };
20
+ var KEY_TO_INLINE_TYPE_FOR_SPACE = {
21
+ // Inline shortcut keys
22
+ '**': BOLD,
23
+ '*': ITALIC,
24
+ '***': BOLD_ITALIC
25
+ };
26
+ var getBeforeText = function getBeforeText(editor) {
27
+ var selection = editor.selection;
28
+ if (selection == null) return {
29
+ beforeText: '',
30
+ range: null
31
+ };
32
+ var anchor = selection.anchor;
33
+ // Find the block element above the current text
34
+ var block = Editor.above(editor, {
35
+ match: function match(n) {
36
+ return Editor.isBlock(editor, n);
37
+ }
38
+ });
39
+ if (block == null) return {
40
+ beforeText: '',
41
+ range: null
42
+ };
43
+ var blockPath = block[1];
44
+ var blockStart = Editor.start(editor, blockPath); // The starting position of the block element
45
+ var range = {
46
+ anchor: anchor,
47
+ focus: blockStart
48
+ };
49
+ var beforeText = Editor.string(editor, range) || '';
50
+ return {
51
+ beforeText: beforeText,
52
+ range: range
53
+ };
54
+ };
55
+ var withMarkDown = function withMarkDown(editor) {
56
+ var insertText = editor.insertText;
57
+ var newEditor = editor;
58
+
59
+ // When entering a space, convert markdown
60
+ newEditor.insertText = function (text) {
61
+ var selection = editor.selection;
62
+ if (selection == null) return insertText(text);
63
+ if (Range.isExpanded(selection)) return insertText(text);
64
+ if (getSelectedNodeByType(editor, 'paragraph') == null) return insertText(text); // It must be in paragraph
65
+ if (text !== ' ') return insertText(text); // The value must be an input space
66
+
67
+ // Gets the text before the space
68
+ var _getBeforeText = getBeforeText(editor),
69
+ beforeText = _getBeforeText.beforeText,
70
+ range = _getBeforeText.range;
71
+ if (!beforeText || !range) return insertText(text);
72
+
73
+ // Based on the keyword, find the type of element you want to convert
74
+ var type = KEY_TO_TYPE_FOR_SPACE[beforeText.trim()];
75
+ var boldType = KEY_TO_INLINE_TYPE_FOR_SPACE[beforeText.slice(-2)];
76
+ var italicType = KEY_TO_INLINE_TYPE_FOR_SPACE[beforeText.slice(-1)];
77
+ var italicAndBoldType = KEY_TO_INLINE_TYPE_FOR_SPACE[beforeText.slice(-3)];
78
+ if (!type && !boldType && !italicType && !italicAndBoldType) return insertText(text);
79
+ if (italicAndBoldType === BOLD_ITALIC) {
80
+ var restStr = beforeText === null || beforeText === void 0 ? void 0 : beforeText.slice(0, beforeText.length - 3);
81
+ var startOffset = restStr === null || restStr === void 0 ? void 0 : restStr.lastIndexOf('***');
82
+ var endOffset = (beforeText === null || beforeText === void 0 ? void 0 : beforeText.lastIndexOf('***')) + 3;
83
+ if (startOffset !== -3) {
84
+ Transforms.delete(editor, {
85
+ at: {
86
+ anchor: {
87
+ path: range.focus.path,
88
+ offset: startOffset
89
+ },
90
+ focus: _objectSpread({}, selection.focus)
91
+ },
92
+ voids: true
93
+ });
94
+ var newText = beforeText.slice(startOffset + 3, endOffset - 3);
95
+ Editor.addMark(editor, 'BOLD', true);
96
+ Editor.addMark(editor, 'ITALIC', true);
97
+ return insertText(newText);
98
+ }
99
+ }
100
+ if (boldType === BOLD) {
101
+ var _restStr = beforeText.slice(0, beforeText.length - 2);
102
+ var _startOffset = _restStr.lastIndexOf('**');
103
+ var _endOffset = beforeText.lastIndexOf('**') + 2;
104
+ if (_startOffset === -1) {
105
+ return insertText(text);
106
+ }
107
+ Transforms.delete(editor, {
108
+ at: {
109
+ anchor: {
110
+ path: range.focus.path,
111
+ offset: _startOffset
112
+ },
113
+ focus: _objectSpread({}, selection.focus)
114
+ },
115
+ voids: true
116
+ });
117
+ var newType = boldType.toUpperCase();
118
+ var _newText = beforeText.slice(_startOffset + 2, _endOffset - 2);
119
+ Editor.addMark(editor, newType, true);
120
+ return insertText(_newText);
121
+ }
122
+ if (italicType === ITALIC) {
123
+ var _restStr2 = beforeText === null || beforeText === void 0 ? void 0 : beforeText.slice(0, beforeText.length - 1);
124
+ var _startOffset2 = _restStr2 === null || _restStr2 === void 0 ? void 0 : _restStr2.lastIndexOf('*');
125
+ var _endOffset2 = (beforeText === null || beforeText === void 0 ? void 0 : beforeText.lastIndexOf('*')) + 1;
126
+ if (_startOffset2 !== -1) {
127
+ Transforms.delete(editor, {
128
+ at: {
129
+ anchor: {
130
+ path: range.focus.path,
131
+ offset: _startOffset2
132
+ },
133
+ focus: _objectSpread({}, selection.focus)
134
+ },
135
+ voids: true
136
+ });
137
+ var _newType = italicType.toUpperCase();
138
+ var _newText2 = beforeText.slice(_startOffset2 + 1, _endOffset2 - 1);
139
+ Editor.addMark(editor, _newType, true);
140
+ return insertText(_newText2);
141
+ }
142
+ }
143
+
144
+ // Delete element
145
+ Transforms.select(editor, range);
146
+ Transforms.delete(editor);
147
+ if (type === UNORDERED_LIST) {
148
+ toggleList(editor, type);
149
+ return;
150
+ }
151
+ if (type === BLOCKQUOTE) {
152
+ Transforms.setNodes(editor, {
153
+ type: type
154
+ }, {
155
+ mode: 'highest'
156
+ });
157
+ return;
158
+ }
159
+ Transforms.setNodes(editor, {
160
+ type: type
161
+ });
162
+ };
163
+ return newEditor;
164
+ };
165
+ export default withMarkDown;
@@ -1,4 +1,5 @@
1
1
  import SDocEditor from './editor';
2
2
  import SDocViewer from './viewer';
3
+ import SDocOutline from './outline';
3
4
  import EventBus from './utils/event-bus';
4
- export { SDocEditor, SDocViewer, EventBus };
5
+ export { SDocEditor, SDocViewer, SDocOutline, EventBus };
@@ -0,0 +1,114 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ import { withTranslation } from 'react-i18next';
7
+ import { UncontrolledTooltip } from 'reactstrap';
8
+ import './assets/css/outline.css';
9
+ var SDocOutline = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(SDocOutline, _React$Component);
11
+ var _super = _createSuper(SDocOutline);
12
+ function SDocOutline(props) {
13
+ var _this;
14
+ _classCallCheck(this, SDocOutline);
15
+ _this = _super.call(this, props);
16
+ _this.toggleShow = function () {
17
+ _this.setState({
18
+ isShown: !_this.state.isShown
19
+ });
20
+ };
21
+ _this.state = {
22
+ isShown: false
23
+ };
24
+ return _this;
25
+ }
26
+ _createClass(SDocOutline, [{
27
+ key: "render",
28
+ value: function render() {
29
+ var _this$props = this.props,
30
+ doc = _this$props.doc,
31
+ t = _this$props.t;
32
+ var isShown = this.state.isShown;
33
+ var list = doc.children.filter(function (item) {
34
+ return item.type == 'header2' || item.type == 'header3';
35
+ });
36
+ return isShown ? /*#__PURE__*/React.createElement("div", {
37
+ className: "sdoc-outline d-flex flex-column"
38
+ }, /*#__PURE__*/React.createElement("div", {
39
+ className: "sdoc-outline-header d-flex align-items-center justify-content-between py-1"
40
+ }, /*#__PURE__*/React.createElement("h2", {
41
+ className: "font-weight-normal m-0 font-size-inherit"
42
+ }, t('Outline')), /*#__PURE__*/React.createElement("span", {
43
+ onClick: this.toggleShow,
44
+ className: "close-icon iconfont icon-cancel"
45
+ })), list.length ? /*#__PURE__*/React.createElement("ol", {
46
+ className: "list-unstyled py-2 flex-fill o-auto"
47
+ }, list.map(function (item, index) {
48
+ return /*#__PURE__*/React.createElement(OutlineItem, {
49
+ key: index,
50
+ item: item
51
+ });
52
+ })) : /*#__PURE__*/React.createElement("p", {
53
+ className: "mt-4 text-secondary"
54
+ }, t('Headings_you_add_to_the_document_will_appear_here'))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
55
+ onClick: this.toggleShow,
56
+ id: "display-outline-icon",
57
+ className: "display-outline-icon iconfont icon-table-of-content",
58
+ style: {
59
+ 'marginRight': (window.innerWidth - 794) / 2 - 36
60
+ }
61
+ }), /*#__PURE__*/React.createElement(UncontrolledTooltip, {
62
+ placement: "right",
63
+ target: "display-outline-icon"
64
+ }, t('Outline')));
65
+ }
66
+ }]);
67
+ return SDocOutline;
68
+ }(React.Component);
69
+ var OutlineItem = /*#__PURE__*/function (_React$Component2) {
70
+ _inherits(OutlineItem, _React$Component2);
71
+ var _super2 = _createSuper(OutlineItem);
72
+ function OutlineItem(props) {
73
+ var _this2;
74
+ _classCallCheck(this, OutlineItem);
75
+ _this2 = _super2.call(this, props);
76
+ _this2.onItemClick = function () {
77
+ var item = _this2.props.item;
78
+ var id = item.id;
79
+ document.getElementById(id).scrollIntoView();
80
+ };
81
+ _this2.onMouseOver = function () {
82
+ _this2.setState({
83
+ isHighlighted: true
84
+ });
85
+ };
86
+ _this2.onMouseOut = function () {
87
+ _this2.setState({
88
+ isHighlighted: false
89
+ });
90
+ };
91
+ _this2.state = {
92
+ isHighlighted: false
93
+ };
94
+ return _this2;
95
+ }
96
+ _createClass(OutlineItem, [{
97
+ key: "render",
98
+ value: function render() {
99
+ var isHighlighted = this.state.isHighlighted;
100
+ var item = this.props.item;
101
+ var id = item.id,
102
+ type = item.type,
103
+ children = item.children;
104
+ return /*#__PURE__*/React.createElement("li", {
105
+ className: "outline-item ".concat(type == 'header3' ? 'pl-5' : '', " ").concat(isHighlighted ? 'active' : ''),
106
+ onClick: this.onItemClick,
107
+ onMouseOver: this.onMouseOver,
108
+ onMouseOut: this.onMouseOut
109
+ }, children[0].text);
110
+ }
111
+ }]);
112
+ return OutlineItem;
113
+ }(React.Component);
114
+ export default withTranslation('sdoc-editor')(SDocOutline);
@@ -9,9 +9,12 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
9
9
  _classCallCheck(this, SocketClient);
10
10
  this.getParams = function () {
11
11
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- var docUuid = _this.config.docUuid;
12
+ var _this$config = _this.config,
13
+ docUuid = _this$config.docUuid,
14
+ user = _this$config.user;
13
15
  return _objectSpread({
14
- doc_uuid: docUuid
16
+ doc_uuid: docUuid,
17
+ user: user
15
18
  }, params);
16
19
  };
17
20
  this.onConnected = function () {
@@ -52,12 +52,14 @@ var SDocViewer = /*#__PURE__*/function (_React$Component) {
52
52
  className: "sdoc-editor-container"
53
53
  }, /*#__PURE__*/React.createElement("div", {
54
54
  className: "sdoc-editor-content"
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: "flex-fill o-auto"
55
57
  }, /*#__PURE__*/React.createElement(Slate, {
56
58
  editor: this.editor,
57
59
  value: slateValue,
58
60
  onChange: function onChange() {}
59
61
  }, /*#__PURE__*/React.createElement("div", {
60
- className: "article"
62
+ className: "article mx-auto"
61
63
  }, /*#__PURE__*/React.createElement(Editable, {
62
64
  readOnly: true,
63
65
  placeholder: "",
@@ -73,7 +75,7 @@ var SDocViewer = /*#__PURE__*/function (_React$Component) {
73
75
  editor.handleTab && editor.handleTab(event);
74
76
  }
75
77
  }
76
- })))));
78
+ }))))));
77
79
  }
78
80
  }]);
79
81
  return SDocViewer;
@@ -3,32 +3,49 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Fragment } from 'react';
6
+ import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
6
7
  import CollaboratorsOperation from './collaborators-operation';
7
8
  import context from '../../context';
9
+ import { withTranslation } from 'react-i18next';
8
10
  import './style.css';
9
11
  var DocOperations = /*#__PURE__*/function (_React$Component) {
10
12
  _inherits(DocOperations, _React$Component);
11
13
  var _super = _createSuper(DocOperations);
12
- function DocOperations() {
14
+ function DocOperations(props) {
13
15
  var _this;
14
16
  _classCallCheck(this, DocOperations);
15
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16
- args[_key] = arguments[_key];
17
- }
18
- _this = _super.call.apply(_super, [this].concat(args));
17
+ _this = _super.call(this, props);
18
+ _this.toggleDropdown = function () {
19
+ _this.setState({
20
+ isDropdownOpen: !_this.state.isDropdownOpen
21
+ });
22
+ };
19
23
  _this.toggleHistory = function (event) {
20
24
  event.stopPropagation();
21
25
  event.nativeEvent.stopImmediatePropagation();
22
26
  var historyURL = context.getSetting('historyURL');
23
27
  window.location.href = historyURL;
24
28
  };
29
+ _this.state = {
30
+ isDropdownOpen: false
31
+ };
25
32
  return _this;
26
33
  }
27
34
  _createClass(DocOperations, [{
28
35
  key: "render",
29
36
  value: function render() {
37
+ var t = this.props.t;
38
+ var isDropdownOpen = this.state.isDropdownOpen;
30
39
  var docPerm = context.getSetting('docPerm');
31
40
  var historyURL = context.getSetting('historyURL');
41
+ var parentFolderURL = context.getSetting('parentFolderURL');
42
+ var dropdownItems = [];
43
+ if (parentFolderURL) {
44
+ dropdownItems.push({
45
+ text: t('Open_parent_folder'),
46
+ URL: parentFolderURL
47
+ });
48
+ }
32
49
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
33
50
  className: "doc-ops"
34
51
  }, /*#__PURE__*/React.createElement("span", {
@@ -40,13 +57,25 @@ var DocOperations = /*#__PURE__*/function (_React$Component) {
40
57
  onClick: this.toggleHistory
41
58
  }, /*#__PURE__*/React.createElement("i", {
42
59
  className: "iconfont icon-history"
43
- })), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), /*#__PURE__*/React.createElement("span", {
44
- className: "op-item"
60
+ })), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), dropdownItems.length > 0 && /*#__PURE__*/React.createElement(Dropdown, {
61
+ isOpen: isDropdownOpen,
62
+ toggle: this.toggleDropdown
63
+ }, /*#__PURE__*/React.createElement(DropdownToggle, {
64
+ className: "op-item",
65
+ tag: "span"
45
66
  }, /*#__PURE__*/React.createElement("i", {
46
67
  className: "iconfont icon-menu"
47
- }))));
68
+ })), /*#__PURE__*/React.createElement(DropdownMenu, {
69
+ right: true
70
+ }, dropdownItems.map(function (item, index) {
71
+ return /*#__PURE__*/React.createElement(DropdownItem, {
72
+ tag: "a",
73
+ href: item.URL,
74
+ key: index
75
+ }, item.text);
76
+ })))));
48
77
  }
49
78
  }]);
50
79
  return DocOperations;
51
80
  }(React.Component);
52
- export default DocOperations;
81
+ export default withTranslation('sdoc-editor')(DocOperations);
package/dist/config.js ADDED
@@ -0,0 +1,16 @@
1
+ var serverConfig = {
2
+ //serviceUrl: "http://127.0.0.1:8000",
3
+ serviceUrl: "http://192.168.1.100:8000",
4
+ username: "lj@11.com",
5
+ password: "11",
6
+ repoID: "79d1fa93-4b5f-4d6c-8fb5-ad3958e1fa47",
7
+ userInfo: {
8
+ username: 'lj@11.com',
9
+ name: 'lj-',
10
+ contact_email: 'lj@11.com'
11
+ },
12
+ filePath: '/xxx.md',
13
+ fileName: 'xxx.md',
14
+ dirPath: '/'
15
+ };
16
+ export { serverConfig };
package/dist/context.js CHANGED
@@ -82,7 +82,8 @@ var Context = /*#__PURE__*/function () {
82
82
  this.config = {
83
83
  docUuid: docUuid,
84
84
  accessToken: accessToken,
85
- sdocServer: new Url(sdocServer).origin
85
+ sdocServer: new Url(sdocServer).origin,
86
+ user: this.getUserInfo()
86
87
  };
87
88
  return this.config;
88
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.19",
3
+ "version": "0.1.21-test",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -233,5 +233,8 @@
233
233
  "me": "me",
234
234
  "Server_is_not_connected_Operation_will_be_sent_to_server_later": "Server is not connected. Operation will be sent to server later.",
235
235
  "Server_is_disconnected_Reconnecting": "Server is disconnected. Reconnecting...",
236
- "Server_is_reconnected": "Server is reconnected."
236
+ "Server_is_reconnected": "Server is reconnected.",
237
+ "Outline": "Outline",
238
+ "Headings_you_add_to_the_document_will_appear_here": "Headings you add to the document will appear here",
239
+ "Open_parent_folder": "Open parent folder"
237
240
  }
@@ -14,6 +14,10 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <glyph glyph-name="cancel" unicode="&#58945;" 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" />
18
+
19
+ <glyph glyph-name="table-of-content" unicode="&#58946;" d="M64 800h512c35.2 0 64-28.8 64-64s-28.8-64-64-64H64C28.8 672 0 700.8 0 736s28.8 64 64 64zM998.4 355.2l-12.8-12.8-172.8-172.8c-25.6-25.6-64-25.6-89.6 0s-25.6 64 0 89.6l134.4 134.4-134.4 134.4c-25.6 25.6-25.6 64 0 89.6s64 25.6 89.6 0l172.8-172.8 9.6-9.6c12.8-12.8 19.2-25.6 19.2-41.6v-3.2c0-12.8-9.6-28.8-16-35.2zM64 448h800c35.2 0 64-28.8 64-64s-28.8-64-64-64H64c-35.2 0-64 28.8-64 64s28.8 64 64 64zM64 96h512c35.2 0 64-28.8 64-64s-28.8-64-64-64H64c-35.2 0-64 28.8-64 64s28.8 64 64 64z" horiz-adv-x="1024" />
20
+
17
21
  <glyph glyph-name="history" unicode="&#58944;" d="M544 864c265.6 0 480-214.4 480-480S809.6-96 544-96c-115.2 0-224 41.6-304 108.8-6.4 6.4-12.8 12.8-22.4 19.2l-9.6 9.6c-9.6 25.6-6.4 51.2 12.8 73.6l3.2 6.4c22.4 22.4 44.8 32 70.4 22.4l6.4-3.2 6.4-6.4c3.2-3.2 9.6-9.6 16-12.8 60.8-51.2 137.6-83.2 220.8-83.2 188.8 0 342.4 153.6 342.4 342.4S732.8 726.4 544 726.4C387.2 726.4 256 624 214.4 480h44.8c19.2 0 32-12.8 32-32 0-6.4-3.2-12.8-6.4-19.2L169.6 262.4c-9.6-12.8-28.8-19.2-44.8-6.4l-9.6 9.6L0 432c-9.6 16-6.4 35.2 9.6 44.8C16 480 22.4 480 28.8 480h44.8C115.2 697.6 304 860.8 531.2 864H544z m-6.4-224c32 0 60.8-25.6 60.8-60.8V400l115.2-89.6 3.2-3.2c22.4-19.2 22.4-54.4 3.2-76.8-22.4-25.6-60.8-25.6-86.4-6.4L476.8 348.8V582.4c0 28.8 28.8 57.6 60.8 57.6z" horiz-adv-x="1024" />
18
22
 
19
23
  <glyph glyph-name="share" unicode="&#58895;" d="M662.4 681.6c0 83.2 67.2 150.4 150.4 150.4S960 764.8 960 681.6s-67.2-150.4-150.4-150.4-147.2 70.4-147.2 150.4zM371.2 502.4l246.4 124.8c6.4-25.6 16-48 32-67.2L403.2 435.2c-3.2 25.6-16 48-32 67.2zM64 384c0 83.2 67.2 150.4 150.4 150.4S364.8 467.2 364.8 384s-67.2-150.4-150.4-150.4S64 300.8 64 384z m307.2-118.4c16 19.2 25.6 41.6 32 67.2L649.6 208c-16-19.2-25.6-41.6-32-67.2L371.2 265.6z m291.2-179.2c0 83.2 67.2 150.4 150.4 150.4s150.4-67.2 150.4-150.4S892.8-64 809.6-64s-147.2 67.2-147.2 150.4z" horiz-adv-x="1024" />
@@ -16,6 +16,13 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
+ .icon-cancel:before {
20
+ content: "\e641";
21
+ }
22
+
23
+ .icon-table-of-content:before {
24
+ content: "\e642";
25
+ }
19
26
 
20
27
  .icon-history:before {
21
28
  content: "\e640";