@seafile/sdoc-editor 0.1.44 → 0.1.46

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.
@@ -19,6 +19,6 @@
19
19
  color: #333;
20
20
  }
21
21
 
22
- .sdoc-editor-page-header .doc-info .sdocfont {
23
- font-size: 18px;
22
+ .sdoc-editor-page-header .doc-info .sdoc-link {
23
+ font-size: 14px;
24
24
  }
@@ -1,6 +1,8 @@
1
1
  export var BLOCKQUOTE = 'blockquote';
2
2
  export var BOLD = 'bold';
3
3
  export var ITALIC = 'italic';
4
+ export var UNDERLINE = 'underline';
5
+ export var STRIKETHROUGH = 'strikethrough';
4
6
  export var HEADER = 'header';
5
7
  export var HEADER1 = 'header1';
6
8
  export var HEADER2 = 'header2';
@@ -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
  import * as ELEMENT_TYPE from './element-type';
5
- import { BLOCKQUOTE, BOLD, ITALIC, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, PARAGRAPH, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, BOLD_ITALIC } from './element-type';
5
+ import { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, BOLD_ITALIC } from './element-type';
6
6
  import KEYBOARD from './keyboard';
7
7
 
8
8
  // history
@@ -59,6 +59,16 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
59
59
  iconClass: 'sdocfont sdoc-bold',
60
60
  text: 'bold',
61
61
  type: 'BOLD'
62
+ }, {
63
+ id: UNDERLINE,
64
+ iconClass: 'sdocfont sdoc-underline',
65
+ text: 'underline',
66
+ type: 'UNDERLINE'
67
+ }, {
68
+ id: STRIKETHROUGH,
69
+ iconClass: 'sdocfont sdoc-strikethrough',
70
+ text: 'strikethrough',
71
+ type: 'STRIKETHROUGH'
62
72
  }]), _defineProperty(_MENUS_CONFIG_MAP, UNDO, {
63
73
  id: UNDO,
64
74
  iconClass: 'sdocfont sdoc-revoke',
@@ -90,4 +100,4 @@ export var TABLE_ELEMENT_POSITION = {
90
100
  AFTER: 'after',
91
101
  BEFORE: 'before'
92
102
  };
93
- export { BLOCKQUOTE, BOLD, ITALIC, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, PARAGRAPH, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, BOLD_ITALIC, ELEMENT_TYPE, KEYBOARD };
103
+ export { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, BOLD_ITALIC, ELEMENT_TYPE, KEYBOARD };
@@ -2,6 +2,7 @@
2
2
  padding: 8px 0;
3
3
  }
4
4
 
5
- .sdoc-table-menu-group .sdocfont {
5
+ .sdoc-table-menu-group .sdoc-drop-down,
6
+ .sdoc-table-menu-group .sdoc-caret-up {
6
7
  transform: scale(.8);
7
8
  }
@@ -11,10 +11,13 @@ import { getValue, isMenuDisabled, addMark, removeMark } from '../helpers';
11
11
  var TextStyleMenuList = /*#__PURE__*/function (_React$Component) {
12
12
  _inherits(TextStyleMenuList, _React$Component);
13
13
  var _super = _createSuper(TextStyleMenuList);
14
- function TextStyleMenuList(props) {
14
+ function TextStyleMenuList() {
15
15
  var _this;
16
16
  _classCallCheck(this, TextStyleMenuList);
17
- _this = _super.call(this, props);
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
19
+ }
20
+ _this = _super.call.apply(_super, [this].concat(args));
18
21
  _this.isActive = function (editor, type) {
19
22
  var isMark = getValue(editor, type);
20
23
  return !!isMark;
@@ -36,43 +39,36 @@ var TextStyleMenuList = /*#__PURE__*/function (_React$Component) {
36
39
  }
37
40
  focusEditor(editor);
38
41
  };
39
- _this.state = {
40
- isShowLinkDialog: false
41
- };
42
42
  return _this;
43
43
  }
44
44
  _createClass(TextStyleMenuList, [{
45
45
  key: "getTextStyleMenuList",
46
46
  value: function getTextStyleMenuList() {
47
+ var _this2 = this;
47
48
  var _this$props = this.props,
48
49
  isRichEditor = _this$props.isRichEditor,
49
50
  className = _this$props.className,
50
51
  editor = _this$props.editor;
51
- var textStyleMenuList = [{
52
- isRichEditor: isRichEditor,
53
- className: className,
54
- disabled: this.isDisabled(),
55
- isActive: this.isActive(editor, 'ITALIC'),
56
- onMouseDown: this.onMouseDown
57
- }, {
58
- isRichEditor: isRichEditor,
59
- className: className,
60
- disabled: this.isDisabled(),
61
- isActive: this.isActive(editor, 'BOLD'),
62
- onMouseDown: this.onMouseDown
63
- }];
64
- return textStyleMenuList;
52
+ var list = MENUS_CONFIG_MAP[TEXT_STYLE].map(function (item) {
53
+ var itemProps = {
54
+ isRichEditor: isRichEditor,
55
+ className: className,
56
+ disabled: _this2.isDisabled(),
57
+ isActive: _this2.isActive(editor, item.type),
58
+ onMouseDown: _this2.onMouseDown
59
+ };
60
+ return _objectSpread(_objectSpread({}, itemProps), item);
61
+ });
62
+ return list;
65
63
  }
66
64
  }, {
67
65
  key: "render",
68
66
  value: function render() {
69
67
  var textStyleMenuList = this.getTextStyleMenuList();
70
- return /*#__PURE__*/React.createElement(React.Fragment, null, textStyleMenuList.map(function (menuItem, index) {
71
- var menuItemConfig = MENUS_CONFIG_MAP[TEXT_STYLE][index];
72
- var menuItemProps = _objectSpread(_objectSpread({}, menuItem), menuItemConfig);
68
+ return /*#__PURE__*/React.createElement(React.Fragment, null, textStyleMenuList.map(function (itemProps, index) {
73
69
  return /*#__PURE__*/React.createElement(MenuItem, Object.assign({
74
70
  key: index
75
- }, menuItemProps));
71
+ }, itemProps));
76
72
  }));
77
73
  }
78
74
  }]);
@@ -7,12 +7,26 @@ var renderText = function renderText(props, editor) {
7
7
  if (leaf.BOLD) {
8
8
  markedChildren = /*#__PURE__*/React.createElement("strong", null, markedChildren);
9
9
  }
10
- if (leaf.CODE) {
11
- markedChildren = /*#__PURE__*/React.createElement("code", null, markedChildren);
12
- }
13
10
  if (leaf.ITALIC) {
14
11
  markedChildren = /*#__PURE__*/React.createElement("i", null, markedChildren);
15
12
  }
13
+ if (leaf.UNDERLINE) {
14
+ markedChildren = /*#__PURE__*/React.createElement("span", {
15
+ style: {
16
+ textDecoration: 'underline'
17
+ }
18
+ }, markedChildren);
19
+ }
20
+ if (leaf.STRIKETHROUGH) {
21
+ markedChildren = /*#__PURE__*/React.createElement("span", {
22
+ style: {
23
+ textDecoration: 'line-through'
24
+ }
25
+ }, markedChildren);
26
+ }
27
+ if (leaf.CODE) {
28
+ markedChildren = /*#__PURE__*/React.createElement("code", null, markedChildren);
29
+ }
16
30
  if (leaf.DELETE) {
17
31
  markedChildren = /*#__PURE__*/React.createElement("del", null, markedChildren);
18
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "bold": "Bold",
3
3
  "italic": "Italic",
4
+ "underline": "Underline",
5
+ "strikethrough": "Strikethrough",
4
6
  "inline_code": "Code",
5
7
  "header_one": "Heading 1",
6
8
  "header_two": "Heading 2",