@seafile/sdoc-editor 0.1.22 → 0.1.24

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.
@@ -51,7 +51,7 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
51
51
  }), _defineProperty(_MENUS_CONFIG_MAP, CODE_BLOCK, {
52
52
  id: CODE_BLOCK,
53
53
  iconClass: 'iconfont icon-code-block',
54
- text: 'code-block'
54
+ text: 'code_block'
55
55
  }), _defineProperty(_MENUS_CONFIG_MAP, LINK, {
56
56
  id: "sdoc_".concat(LINK),
57
57
  iconClass: 'iconfont icon-link',
@@ -84,7 +84,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
84
84
  onClick: this.onToggleClick
85
85
  }, /*#__PURE__*/React.createElement("span", {
86
86
  className: "active"
87
- }, HEADER_TITLE_MAP[headerType]), /*#__PURE__*/React.createElement("span", {
87
+ }, t(HEADER_TITLE_MAP[headerType])), /*#__PURE__*/React.createElement("span", {
88
88
  className: headerIconClass
89
89
  })), isShowHeaderPopover && /*#__PURE__*/React.createElement("div", {
90
90
  className: "header-popover"
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -235,5 +235,6 @@
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"
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"
239
240
  }