@seafile/sdoc-editor 0.1.21-test → 0.1.22

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.
@@ -47,6 +47,11 @@
47
47
  z-index: 10;
48
48
  }
49
49
 
50
+ .header-menu .header-popover .header-divider {
51
+ width: 100%;
52
+ border-top: 1px solid #e5e5e5;
53
+ }
54
+
50
55
  .header-menu .header-popover .header-menu-item {
51
56
  cursor: pointer;
52
57
  height: 30px;
@@ -33,7 +33,7 @@ export var BOLD_ITALIC = 'bold-italic';
33
33
 
34
34
  // menus config
35
35
  export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CONFIG_MAP, BLOCKQUOTE, {
36
- id: 'BLOCKQUOTE',
36
+ id: "sdoc_".concat(BLOCKQUOTE),
37
37
  iconClass: 'iconfont icon-quote-left',
38
38
  text: 'quote'
39
39
  }), _defineProperty(_MENUS_CONFIG_MAP, ORDERED_LIST, {
@@ -53,9 +53,9 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
53
53
  iconClass: 'iconfont icon-code-block',
54
54
  text: 'code-block'
55
55
  }), _defineProperty(_MENUS_CONFIG_MAP, LINK, {
56
- id: LINK,
56
+ id: "sdoc_".concat(LINK),
57
57
  iconClass: 'iconfont icon-link',
58
- text: 'link'
58
+ text: 'insert_link'
59
59
  }), _defineProperty(_MENUS_CONFIG_MAP, TEXTSTYLE, [{
60
60
  id: ITALIC,
61
61
  iconClass: 'iconfont icon-italic',
@@ -67,4 +67,4 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
67
67
  text: 'bold',
68
68
  type: 'BOLD'
69
69
  }]), _MENUS_CONFIG_MAP);
70
- export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'header_1'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'header_2'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'header_3'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'header_4'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'header_5'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'header_6'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'paragraph'), _HEADER_TITLE_MAP);
70
+ export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'header_one'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'header_two'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'header_three'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'header_four'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'header_five'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'header_six'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'paragraph'), _HEADER_TITLE_MAP);
@@ -4,6 +4,7 @@ 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 { Tooltip } from 'reactstrap';
7
+ import { withTranslation } from 'react-i18next';
7
8
  var MenuItem = /*#__PURE__*/function (_React$Component) {
8
9
  _inherits(MenuItem, _React$Component);
9
10
  var _super = _createSuper(MenuItem);
@@ -20,7 +21,7 @@ var MenuItem = /*#__PURE__*/function (_React$Component) {
20
21
  };
21
22
  _this.toggle = function () {
22
23
  _this.setState({
23
- isShowToolTip: false
24
+ isShowToolTip: !_this.state.isShowToolTip
24
25
  });
25
26
  };
26
27
  _this.getClassName = function () {
@@ -46,7 +47,8 @@ var MenuItem = /*#__PURE__*/function (_React$Component) {
46
47
  isActive = _this$props2.isActive,
47
48
  id = _this$props2.id,
48
49
  iconClass = _this$props2.iconClass,
49
- text = _this$props2.text;
50
+ text = _this$props2.text,
51
+ t = _this$props2.t;
50
52
  var isShowToolTip = this.state.isShowToolTip;
51
53
  var className = this.getClassName();
52
54
  var delay = {
@@ -69,7 +71,7 @@ var MenuItem = /*#__PURE__*/function (_React$Component) {
69
71
  delay: delay,
70
72
  placement: "bottom",
71
73
  toggle: this.toggle
72
- }, text));
74
+ }, t(text)));
73
75
  }
74
76
  }]);
75
77
  return MenuItem;
@@ -78,4 +80,4 @@ MenuItem.defaultProps = {
78
80
  isRichEditor: true,
79
81
  className: 'menu-group-item'
80
82
  };
81
- export default MenuItem;
83
+ export default withTranslation('sdoc-editor')(MenuItem);
@@ -3,6 +3,7 @@ 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 from 'react';
6
+ import { withTranslation } from 'react-i18next';
6
7
  import { getHeaderType, isMenuDisabled, setHeaderType } from '../helpers';
7
8
  import { HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, HEADER_TITLE_MAP, PARAGRAPH } from '../../../constants';
8
9
  var HeaderMenu = /*#__PURE__*/function (_React$Component) {
@@ -72,6 +73,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
72
73
  _createClass(HeaderMenu, [{
73
74
  key: "render",
74
75
  value: function render() {
76
+ var t = this.props.t;
75
77
  var isShowHeaderPopover = this.state.isShowHeaderPopover;
76
78
  var headerIconClass = "iconfont icon-".concat(isShowHeaderPopover ? 'caret-up' : 'drop-down');
77
79
  var headerType = this.getValue();
@@ -89,27 +91,29 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
89
91
  }, /*#__PURE__*/React.createElement("div", {
90
92
  className: "header-menu-item",
91
93
  onClick: this.onMouseDown(PARAGRAPH)
92
- }, HEADER_TITLE_MAP.paragraph), /*#__PURE__*/React.createElement("div", {
94
+ }, t(HEADER_TITLE_MAP.paragraph)), /*#__PURE__*/React.createElement("div", {
95
+ className: "header-divider"
96
+ }), /*#__PURE__*/React.createElement("div", {
93
97
  className: "header-menu-item",
94
98
  onClick: this.onMouseDown(HEADER1)
95
- }, HEADER_TITLE_MAP.header1), /*#__PURE__*/React.createElement("div", {
99
+ }, t(HEADER_TITLE_MAP.header1)), /*#__PURE__*/React.createElement("div", {
96
100
  className: "header-menu-item",
97
101
  onClick: this.onMouseDown(HEADER2)
98
- }, HEADER_TITLE_MAP.header2), /*#__PURE__*/React.createElement("div", {
102
+ }, t(HEADER_TITLE_MAP.header2)), /*#__PURE__*/React.createElement("div", {
99
103
  className: "header-menu-item",
100
104
  onClick: this.onMouseDown(HEADER3)
101
- }, HEADER_TITLE_MAP.header3), /*#__PURE__*/React.createElement("div", {
105
+ }, t(HEADER_TITLE_MAP.header3)), /*#__PURE__*/React.createElement("div", {
102
106
  className: "header-menu-item",
103
107
  onClick: this.onMouseDown(HEADER4)
104
- }, HEADER_TITLE_MAP.header4), /*#__PURE__*/React.createElement("div", {
108
+ }, t(HEADER_TITLE_MAP.header4)), /*#__PURE__*/React.createElement("div", {
105
109
  className: "header-menu-item",
106
110
  onClick: this.onMouseDown(HEADER5)
107
- }, HEADER_TITLE_MAP.header5), /*#__PURE__*/React.createElement("div", {
111
+ }, t(HEADER_TITLE_MAP.header5)), /*#__PURE__*/React.createElement("div", {
108
112
  className: "header-menu-item",
109
113
  onClick: this.onMouseDown(HEADER6)
110
- }, HEADER_TITLE_MAP.header6)));
114
+ }, t(HEADER_TITLE_MAP.header6))));
111
115
  }
112
116
  }]);
113
117
  return HeaderMenu;
114
118
  }(React.Component);
115
- export default HeaderMenu;
119
+ export default withTranslation('sdoc-editor')(HeaderMenu);
@@ -3,49 +3,32 @@ 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';
7
6
  import CollaboratorsOperation from './collaborators-operation';
8
7
  import context from '../../context';
9
- import { withTranslation } from 'react-i18next';
10
8
  import './style.css';
11
9
  var DocOperations = /*#__PURE__*/function (_React$Component) {
12
10
  _inherits(DocOperations, _React$Component);
13
11
  var _super = _createSuper(DocOperations);
14
- function DocOperations(props) {
12
+ function DocOperations() {
15
13
  var _this;
16
14
  _classCallCheck(this, DocOperations);
17
- _this = _super.call(this, props);
18
- _this.toggleDropdown = function () {
19
- _this.setState({
20
- isDropdownOpen: !_this.state.isDropdownOpen
21
- });
22
- };
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));
23
19
  _this.toggleHistory = function (event) {
24
20
  event.stopPropagation();
25
21
  event.nativeEvent.stopImmediatePropagation();
26
22
  var historyURL = context.getSetting('historyURL');
27
23
  window.location.href = historyURL;
28
24
  };
29
- _this.state = {
30
- isDropdownOpen: false
31
- };
32
25
  return _this;
33
26
  }
34
27
  _createClass(DocOperations, [{
35
28
  key: "render",
36
29
  value: function render() {
37
- var t = this.props.t;
38
- var isDropdownOpen = this.state.isDropdownOpen;
39
30
  var docPerm = context.getSetting('docPerm');
40
31
  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
- }
49
32
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
50
33
  className: "doc-ops"
51
34
  }, /*#__PURE__*/React.createElement("span", {
@@ -57,25 +40,13 @@ var DocOperations = /*#__PURE__*/function (_React$Component) {
57
40
  onClick: this.toggleHistory
58
41
  }, /*#__PURE__*/React.createElement("i", {
59
42
  className: "iconfont icon-history"
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"
43
+ })), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), /*#__PURE__*/React.createElement("span", {
44
+ className: "op-item"
66
45
  }, /*#__PURE__*/React.createElement("i", {
67
46
  className: "iconfont icon-menu"
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
- })))));
47
+ }))));
77
48
  }
78
49
  }]);
79
50
  return DocOperations;
80
51
  }(React.Component);
81
- export default withTranslation('sdoc-editor')(DocOperations);
52
+ export default DocOperations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.21-test",
3
+ "version": "0.1.22",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -235,6 +235,5 @@
235
235
  "Server_is_disconnected_Reconnecting": "Server is disconnected. Reconnecting...",
236
236
  "Server_is_reconnected": "Server is reconnected.",
237
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"
238
+ "Headings_you_add_to_the_document_will_appear_here": "Headings you add to the document will appear here"
240
239
  }
@@ -228,5 +228,7 @@
228
228
  "me": "我",
229
229
  "Server_is_not_connected_Operation_will_be_sent_to_server_later": "服务器未连接。 操作稍后将发送到服务器。",
230
230
  "Server_is_disconnected_Reconnecting": "服务器断开连接。正在重新连接...",
231
- "Server_is_reconnected": "服务器已重新连接。"
231
+ "Server_is_reconnected": "服务器已重新连接。",
232
+ "Outline": "目录",
233
+ "Headings_you_add_to_the_document_will_appear_here": "您添加到文档中的标题将显示在此处"
232
234
  }
package/dist/config.js DELETED
@@ -1,16 +0,0 @@
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 };