@seafile/sdoc-editor 0.1.140 → 0.1.142

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.
@@ -5,7 +5,7 @@
5
5
  }
6
6
 
7
7
  .sdoc-editor-container .article p {
8
- padding: 3px 0;
8
+ padding: 5px 0;
9
9
  margin: 0;
10
10
  }
11
11
 
@@ -134,7 +134,7 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
134
134
  }), _defineProperty(_MENUS_CONFIG_MAP, SDOC_LINK, {
135
135
  id: "sdoc_".concat(SDOC_LINK),
136
136
  iconClass: 'sdocfont sdoc-document',
137
- text: 'Sdoc_document'
137
+ text: 'Link_sdoc'
138
138
  }), _MENUS_CONFIG_MAP);
139
139
  export var HEADERS = [HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6];
140
140
  export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, TITLE, 'Title'), _defineProperty(_HEADER_TITLE_MAP, SUBTITLE, 'Subtitle'), _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);
@@ -1,14 +1,15 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { Transforms, Node } from '@seafile/slate';
2
+ import { Transforms, Node, Editor, Range } from '@seafile/slate';
3
3
  import slugid from 'slugid';
4
4
  import isUrl from 'is-url';
5
5
  import { genLinkNode } from './helpers';
6
- import { getNodeType } from '../../core';
6
+ import { getNodeType, getSelectedNodeByType } from '../../core';
7
7
  import { isImage } from '../../utils';
8
8
  var withLink = function withLink(editor) {
9
9
  var normalizeNode = editor.normalizeNode,
10
10
  isInline = editor.isInline,
11
- insertData = editor.insertData;
11
+ insertData = editor.insertData,
12
+ insertText = editor.insertText;
12
13
  var newEditor = editor;
13
14
 
14
15
  // Rewrite isInline
@@ -19,6 +20,17 @@ var withLink = function withLink(editor) {
19
20
  }
20
21
  return isInline(elem);
21
22
  };
23
+ newEditor.insertText = function (text) {
24
+ var path = Editor.path(editor, editor.selection);
25
+ if (Range.isCollapsed(editor.selection) && getSelectedNodeByType(editor, 'link') && Editor.isEnd(editor, editor.selection.focus, path)) {
26
+ editor.insertFragment([{
27
+ id: slugid.nice(),
28
+ text: text
29
+ }]);
30
+ return;
31
+ }
32
+ return insertText(text);
33
+ };
22
34
  newEditor.insertData = function (data) {
23
35
  // Paste content from sdoc document
24
36
  if (newEditor.insertFragmentData(data)) return;
@@ -12,6 +12,7 @@ import ClearFormatMenu from '../../plugins/clear-format/menu';
12
12
  import HistoryMenu from './redo-undo';
13
13
  import Font from '../../plugins/font/menu';
14
14
  import InsertToolbar from './insert-toolbar';
15
+ import ActiveTableMenu from '../../plugins/table/menu/active-table-menu';
15
16
  var Toolbar = function Toolbar(_ref) {
16
17
  var editor = _ref.editor,
17
18
  readonly = _ref.readonly;
@@ -53,7 +54,10 @@ var Toolbar = function Toolbar(_ref) {
53
54
  }), /*#__PURE__*/React.createElement(TextAlignMenu, {
54
55
  editor: editor,
55
56
  readonly: readonly
56
- })));
57
+ })), /*#__PURE__*/React.createElement(ActiveTableMenu, {
58
+ editor: editor,
59
+ readonly: readonly
60
+ }));
57
61
  };
58
62
  Toolbar.defaultProps = {
59
63
  readonly: false
@@ -1,14 +1,19 @@
1
1
  .menu-group .menu-group-item.sdoc-insert-toolbar-btn {
2
- width: 140px;
2
+ width: 76px;
3
3
  display: flex;
4
4
  align-items: center;
5
5
  justify-content: space-between;
6
6
  }
7
7
 
8
+ .menu-group .menu-group-item.sdoc-insert-toolbar-btn.disabled {
9
+ width: 64px !important; /* 64: 76 - 12 */
10
+ color: #BDBDBD;
11
+ }
12
+
8
13
  .menu-group .sdoc-insert-toolbar-btn .sdoc-menu-with-dropdown-icon {
9
14
  flex: 1;
10
15
  justify-content: flex-start;
11
- padding-left: 5px;
16
+ padding-left: 6px;
12
17
  padding-right: 2px;
13
18
  font-size: 14px;
14
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.140",
3
+ "version": "0.1.142",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "build": "node scripts/build.js",
37
37
  "pub:dist": "export BABEL_ENV=production && ./node_modules/.bin/babel src --out-dir dist --copy-files",
38
38
  "push-translate": "tx push -s",
39
- "pull-translate": "tx pull -a -f",
39
+ "pull-translate": "tx pull -f",
40
40
  "pub:optimized": "rm dist/config.js",
41
41
  "prepublishOnly": "npm run clean && npm run pub:dist",
42
42
  "test": "node scripts/test.js"
@@ -343,7 +343,6 @@
343
343
  "Default_font": "Default font",
344
344
  "Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
345
345
  "Recently_saved": "Recently saved",
346
- "Sdoc_document" : "Sdoc document",
347
346
  "Text_Link": "Text Link",
348
347
  "Icon_and_text_Link": "Icon and text Link",
349
348
  "Card": "Card",
@@ -362,5 +361,6 @@
362
361
  "Changes": "Změny",
363
362
  "No_changes": "No changes",
364
363
  "Title": "Název",
365
- "SubTitle": "Subtitle"
364
+ "Subtitle": "Subtitle",
365
+ "Link_sdoc": "Link sdoc"
366
366
  }
@@ -343,7 +343,6 @@
343
343
  "Default_font": "Default font",
344
344
  "Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
345
345
  "Recently_saved": "Recently saved",
346
- "Sdoc_document" : "Sdoc document",
347
346
  "Text_Link": "Text Link",
348
347
  "Icon_and_text_Link": "Icon and text Link",
349
348
  "Card": "Card",
@@ -362,5 +361,6 @@
362
361
  "Changes": "Änderungen",
363
362
  "No_changes": "No changes",
364
363
  "Title": "Titel",
365
- "SubTitle": "Subtitle"
364
+ "Subtitle": "Subtitle",
365
+ "Link_sdoc": "Link sdoc"
366
366
  }
@@ -343,7 +343,6 @@
343
343
  "Default_font": "Default font",
344
344
  "Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
345
345
  "Recently_saved": "Recently saved",
346
- "Sdoc_document" : "Sdoc document",
347
346
  "Text_Link": "Text Link",
348
347
  "Icon_and_text_Link": "Icon and text Link",
349
348
  "Card": "Card",
@@ -362,5 +361,6 @@
362
361
  "Changes": "Changes",
363
362
  "No_changes": "No changes",
364
363
  "Title": "Title",
365
- "Subtitle": "Subtitle"
364
+ "Subtitle": "Subtitle",
365
+ "Link_sdoc": "Link sdoc"
366
366
  }
@@ -343,7 +343,6 @@
343
343
  "Default_font": "Default font",
344
344
  "Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
345
345
  "Recently_saved": "Recently saved",
346
- "Sdoc_document" : "Sdoc document",
347
346
  "Text_Link": "Text Link",
348
347
  "Icon_and_text_Link": "Icon and text Link",
349
348
  "Card": "Card",
@@ -362,5 +361,6 @@
362
361
  "Changes": "Cambios",
363
362
  "No_changes": "No changes",
364
363
  "Title": "Título",
365
- "SubTitle": "Subtitle"
364
+ "Subtitle": "Subtitle",
365
+ "Link_sdoc": "Link sdoc"
366
366
  }
@@ -343,7 +343,6 @@
343
343
  "Default_font": "Default font",
344
344
  "Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
345
345
  "Recently_saved": "Recently saved",
346
- "Sdoc_document" : "Sdoc document",
347
346
  "Text_Link": "Text Link",
348
347
  "Icon_and_text_Link": "Icon and text Link",
349
348
  "Card": "Card",
@@ -362,5 +361,6 @@
362
361
  "Changes": "Modifications",
363
362
  "No_changes": "No changes",
364
363
  "Title": "Titre",
365
- "SubTitle": "Subtitle"
364
+ "Subtitle": "Subtitle",
365
+ "Link_sdoc": "Link sdoc"
366
366
  }
@@ -343,7 +343,6 @@
343
343
  "Default_font": "Шрифт по умолчанию",
344
344
  "Pending_operations_exceed_limit": "Несколько операций не синхронизированы с сервером. Проверьте вашу сеть.",
345
345
  "Recently_saved": "Недавно сохранено",
346
- "Sdoc_document" : "Документ Sdoc",
347
346
  "Text_Link": "Текстовая ссылка",
348
347
  "Icon_and_text_Link": "Значок и текстовая ссылка",
349
348
  "Card": "Карта",
@@ -362,5 +361,6 @@
362
361
  "Changes": "Изменения",
363
362
  "No_changes": "Без изменений",
364
363
  "Title": "Название",
365
- "SubTitle": "Subtitle"
364
+ "Subtitle": "Подзаголовок",
365
+ "Link_sdoc": "Ссылка на sdoc"
366
366
  }
@@ -343,7 +343,6 @@
343
343
  "Default_font": "默认字体",
344
344
  "Pending_operations_exceed_limit": "有多个操作未同步到服务器。请检查你的网络。",
345
345
  "Recently_saved": "最近保存",
346
- "Sdoc_document" : "sdoc 文档",
347
346
  "Text_Link": "文字链",
348
347
  "Icon_and_text_Link": "图标+文字链",
349
348
  "Card": "卡片",
@@ -362,5 +361,6 @@
362
361
  "Changes": "改动",
363
362
  "No_changes": "没有变化",
364
363
  "Title": "标题",
365
- "Subtitle": "副标题"
364
+ "Subtitle": "副标题",
365
+ "Link_sdoc": "链接 sdoc"
366
366
  }