@seafile/sdoc-editor 0.1.12 → 0.1.14-beta

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.
@@ -7,7 +7,6 @@
7
7
  flex: 1;
8
8
  display: flex;
9
9
  flex-direction: column;
10
- background: #f0f0f0;
11
10
  min-height: 0;
12
11
  }
13
12
 
@@ -19,13 +18,12 @@
19
18
  padding: 0 10px;
20
19
  background-color: #fff;
21
20
  user-select: none;
22
- border-bottom: 1px solid #e5e5e5;
23
- box-shadow: 0 3px 2px -2px rgb(200 200 200 / 15%)
21
+ border-bottom: 1px solid #e5e6e8;
24
22
  }
25
23
 
26
24
  .sdoc-editor-container .sdoc-editor-content {
27
25
  flex: 1;
28
- height: 100%;
26
+ background: #f5f5f5;
29
27
  overflow: auto;
30
28
  }
31
29
 
@@ -35,5 +33,6 @@
35
33
  margin: 20px auto;
36
34
  padding: 40px 60px;
37
35
  background-color: #fff;
38
- border: 1px solid rgb(230,230,221);
36
+ border: 1px solid #e5e6e8;
37
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.06);
39
38
  }
@@ -1,11 +1,10 @@
1
1
  .header-menu {
2
2
  display: flex;
3
- height: 30px;
3
+ height: 100%;
4
4
  width: 140px;
5
- padding: 5px;
6
- box-sizing: border-box;
7
- border-right: 1px solid #e5e5e5;
8
- border-left: 1px solid #e5e5e5;
5
+ padding: 6px 10px;
6
+ border-right: 1px solid #e5e6e8;
7
+ border-left: 1px solid #e5e6e8;
9
8
  position: relative;
10
9
  }
11
10
 
@@ -14,7 +13,12 @@
14
13
  display: flex;
15
14
  justify-content: space-between;
16
15
  align-items: center;
17
- margin: 0 5px;
16
+ padding-left: 5px;
17
+ }
18
+
19
+ .header-menu .header-toggle:hover {
20
+ background: #e5e5e5;
21
+ border-radius: 2px;
18
22
  }
19
23
 
20
24
  .header-menu .header-toggle .iconfont {
@@ -30,14 +34,17 @@
30
34
 
31
35
  .header-menu .header-popover {
32
36
  position: absolute;
33
- top: 32px;
34
- left: 5px;
37
+ top: 42px;
38
+ left: 10px;
35
39
  padding: 8px 0;
40
+ background-color: #fff;
41
+ border: 1px solid #e5e6e8;
42
+ border-radius: 2px;
43
+ box-shadow: 0 0 10px #ccc;
36
44
  display: flex;
37
45
  flex-direction: column;
38
46
  align-items: flex-start;
39
47
  z-index: 10;
40
- background-color: #fff;
41
48
  }
42
49
 
43
50
  .header-menu .header-popover .header-menu-item {
@@ -1,8 +1,8 @@
1
1
  .menu-group {
2
2
  height: 100%;
3
- padding: 5px 0 5px 5px;
3
+ padding: 6px 0 6px 10px;
4
4
  font-size: 0.75rem;
5
- border-right: 1px solid #e5e5e5;
5
+ border-right: 1px solid #e5e6e8;
6
6
  color: #555555;
7
7
  }
8
8
 
@@ -31,4 +31,4 @@
31
31
 
32
32
  .menu-group .menu-group-item .iconfont {
33
33
  font-size: 13px;
34
- }
34
+ }
@@ -38,7 +38,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
38
38
  };
39
39
  _this.onToggleClick = function (event) {
40
40
  event.stopPropagation();
41
- event.nativeEvent.stopImmediatePropagation;
41
+ event.nativeEvent.stopImmediatePropagation();
42
42
  var isShowHeaderPopover = !_this.state.isShowHeaderPopover;
43
43
  if (isShowHeaderPopover) {
44
44
  _this.setState({
@@ -31,7 +31,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
31
31
  editor: this.props.editor
32
32
  }), /*#__PURE__*/React.createElement(LinkMenu, {
33
33
  editor: this.props.editor
34
- }), /*#__PURE__*/React.createElement(QuoteMenu, {
34
+ })), /*#__PURE__*/React.createElement(MenuGroup, null, /*#__PURE__*/React.createElement(QuoteMenu, {
35
35
  editor: this.props.editor
36
36
  }), /*#__PURE__*/React.createElement(ListMenu, {
37
37
  editor: this.props.editor,
@@ -41,7 +41,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
41
41
  type: ORDERED_LIST
42
42
  }), /*#__PURE__*/React.createElement(CheckListMenu, {
43
43
  editor: this.props.editor
44
- }), /*#__PURE__*/React.createElement(CodeBlockMenu, {
44
+ })), /*#__PURE__*/React.createElement(MenuGroup, null, /*#__PURE__*/React.createElement(CodeBlockMenu, {
45
45
  editor: this.props.editor
46
46
  })));
47
47
  }
@@ -4,25 +4,42 @@ 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
6
  import CollaboratorsOperation from './collaborators-operation';
7
+ import context from '../../context';
8
+ import { encodePath } from '../../utils';
7
9
  import './style.css';
8
10
  var DocOperations = /*#__PURE__*/function (_React$Component) {
9
11
  _inherits(DocOperations, _React$Component);
10
12
  var _super = _createSuper(DocOperations);
11
13
  function DocOperations() {
14
+ var _this;
12
15
  _classCallCheck(this, DocOperations);
13
- return _super.apply(this, arguments);
16
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
17
+ args[_key] = arguments[_key];
18
+ }
19
+ _this = _super.call.apply(_super, [this].concat(args));
20
+ _this.toggleHistory = function (event) {
21
+ event.stopPropagation();
22
+ event.nativeEvent.stopImmediatePropagation();
23
+ var siteRoot = context.getSetting('siteRoot');
24
+ var repoID = context.getSetting('repoID');
25
+ var docPath = context.getSetting('docPath');
26
+ window.location.href = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + encodePath(docPath);
27
+ };
28
+ return _this;
14
29
  }
15
30
  _createClass(DocOperations, [{
16
31
  key: "render",
17
32
  value: function render() {
33
+ var docPerm = context.getSetting('docPerm');
18
34
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
19
35
  className: "doc-ops"
20
36
  }, /*#__PURE__*/React.createElement("span", {
21
37
  className: "op-item"
22
38
  }, /*#__PURE__*/React.createElement("i", {
23
39
  className: "iconfont icon-share"
24
- })), /*#__PURE__*/React.createElement("span", {
25
- className: "op-item"
40
+ })), docPerm === 'rw' && /*#__PURE__*/React.createElement("span", {
41
+ className: "op-item",
42
+ onClick: this.toggleHistory
26
43
  }, /*#__PURE__*/React.createElement("i", {
27
44
  className: "iconfont icon-history"
28
45
  })), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), /*#__PURE__*/React.createElement("span", {
@@ -4,7 +4,7 @@
4
4
  }
5
5
 
6
6
  .doc-ops .op-item {
7
- margin-right: 1rem;
7
+ margin-left: 1rem;
8
8
  display: flex;
9
9
  position: relative;
10
10
  }
@@ -20,12 +20,15 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
20
20
  });
21
21
  };
22
22
  _this.onDocumentSaved = function () {
23
- _this.setState({
24
- isSaving: false,
25
- isSaved: true
26
- });
27
23
  if (_this.saveTimer) clearTimeout(_this.saveTimer);
24
+ if (_this.resetTimer) clearTimeout(_this.resetTimer);
28
25
  _this.saveTimer = setTimeout(function () {
26
+ _this.setState({
27
+ isSaving: false,
28
+ isSaved: true
29
+ });
30
+ }, 1000);
31
+ _this.resetTimer = setTimeout(function () {
29
32
  _this.setState({
30
33
  isSaving: false,
31
34
  isSaved: false
@@ -21,7 +21,7 @@ var Header = /*#__PURE__*/function (_Component) {
21
21
  className = _this$props.className,
22
22
  restProps = _objectWithoutProperties(_this$props, _excluded);
23
23
  return /*#__PURE__*/React.createElement("div", Object.assign({
24
- className: classnames('sdoc-editor-page-header', className)
24
+ className: classnames('sdoc-editor-page-header d-flex justify-content-between align-items-center px-4', className)
25
25
  }, restProps), children);
26
26
  }
27
27
  }]);
@@ -17,11 +17,7 @@ html, body {
17
17
  }
18
18
 
19
19
  .sdoc-editor-page-wrapper .sdoc-editor-page-header {
20
- display: flex;
21
- align-items: center;
22
- justify-content: space-between;
23
- padding: 4px 10px;
24
- border-bottom: 1px solid #c9c9c9;
20
+ border-bottom: 1px solid #e5e6e8;
25
21
  flex-shrink: 0;
26
22
  height: 56px;
27
23
  }
@@ -30,4 +26,4 @@ html, body {
30
26
  flex: 1;
31
27
  min-height: 0;
32
28
  display: flex;
33
- }
29
+ }
@@ -18,4 +18,15 @@ export var generateDefaultDocContent = function generateDefaultDocContent() {
18
18
  }]
19
19
  };
20
20
  return defaultValue;
21
+ };
22
+
23
+ // IE8 not support map, so use push
24
+ export var encodePath = function encodePath(path) {
25
+ if (!path) return '';
26
+ var path_arr = path.split('/');
27
+ var path_arr_ = [];
28
+ for (var i = 0, len = path_arr.length; i < len; i++) {
29
+ path_arr_.push(encodeURIComponent(path_arr[i]));
30
+ }
31
+ return path_arr_.join('/');
21
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.12",
3
+ "version": "0.1.14beta",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",