@seafile/sdoc-editor 1.0.81 → 1.0.83

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.
@@ -71,7 +71,7 @@
71
71
  .sdoc-editor__article .sdoc-image-content {
72
72
  display: flex;
73
73
  flex-direction: column;
74
- align-items: flex-start;
74
+ align-items: center;
75
75
  }
76
76
 
77
77
  .sdoc-editor__article .sdoc-image-content :first-child {
@@ -104,26 +104,45 @@ const withImage = editor => {
104
104
  };
105
105
  newEditor.imageOnKeyDown = e => {
106
106
  if (e.keyCode === 13) {
107
- const {
108
- selection
109
- } = newEditor;
110
- const {
111
- focus
112
- } = selection;
113
- const parentPath = _slate.Path.parent(focus.path);
114
- const nextPath = _slate.Path.next(parentPath);
115
- const nextSelection = {
116
- anchor: {
117
- offset: 0,
118
- path: nextPath
119
- },
120
- focus: {
121
- offset: 0,
122
- path: nextPath
123
- }
124
- };
125
- _slate.Transforms.setSelection(editor, nextSelection);
126
- return;
107
+ const [, imagePath] = (0, _core.getSelectedNodeEntryByType)(editor, _constants.ELEMENT_TYPE.IMAGE);
108
+ const nextPath = _slate.Path.next(imagePath);
109
+ const parentPath = _slate.Path.parent(imagePath);
110
+ const [parentNode] = _slate.Editor.node(editor, parentPath);
111
+ if (parentNode.type === _constants.IMAGE_BLOCK) {
112
+ const nextPath = _slate.Path.next(parentPath);
113
+ const p = (0, _core.generateEmptyElement)(_constants.PARAGRAPH);
114
+ _slate.Transforms.insertNodes(editor, p, {
115
+ at: nextPath
116
+ });
117
+ setTimeout(() => {
118
+ (0, _core.focusEditor)(editor, nextPath);
119
+ }, 0);
120
+ return;
121
+ }
122
+ if (_slate.Editor.hasPath(editor, nextPath)) {
123
+ const nextSelection = {
124
+ anchor: {
125
+ offset: 0,
126
+ path: nextPath
127
+ },
128
+ focus: {
129
+ offset: 0,
130
+ path: nextPath
131
+ }
132
+ };
133
+ _slate.Transforms.setSelection(editor, nextSelection);
134
+ return true;
135
+ } else {
136
+ const nextPath = _slate.Path.next(parentPath);
137
+ const p = (0, _core.generateEmptyElement)(_constants.PARAGRAPH);
138
+ _slate.Transforms.insertNodes(editor, p, {
139
+ at: nextPath
140
+ });
141
+ setTimeout(() => {
142
+ (0, _core.focusEditor)(editor, nextPath);
143
+ }, 0);
144
+ }
145
+ return true;
127
146
  }
128
147
  };
129
148
  newEditor.deleteBackward = unit => {
@@ -80,7 +80,7 @@ const SDocOutline = _ref => {
80
80
  });
81
81
  })))), !isShown && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
82
82
  id: "sdoc-outline-menu",
83
- className: "sdoc-outline-menu sdocfont sdoc-table-of-content",
83
+ className: "sdoc-outline-menu sdocfont sdoc-table-of-content-outline",
84
84
  onClick: toggleShow
85
85
  }), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
86
86
  placement: "right",
@@ -315,6 +315,12 @@ const transformMention = node => {
315
315
  value: data.value
316
316
  };
317
317
  };
318
+ const transformImageBlock = node => {
319
+ return {
320
+ type: 'paragraph',
321
+ children: transformNodeWithInlineChildren(node)
322
+ };
323
+ };
318
324
  const elementHandlers = {
319
325
  'paragraph': transformParagraph,
320
326
  'header1': transformHeader,
@@ -330,7 +336,8 @@ const elementHandlers = {
330
336
  'unordered_list': transformList,
331
337
  'code_block': transformCodeBlock,
332
338
  'formula': transformFormula,
333
- 'mention': transformMention
339
+ 'mention': transformMention,
340
+ 'image_block': transformImageBlock
334
341
  };
335
342
  const formatSlateToMd = children => {
336
343
  const validChildren = children.filter(child => elementHandlers[child.type]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.81",
3
+ "version": "1.0.83",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -14,6 +14,10 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <glyph glyph-name="sdoc-table-of-content-outline" unicode="&#59000;" d="M0 800h128v-96H0zM192 432h128v-96H192zM512 432h512v-96H512zM320 800h704v-96H320zM0 64h128v-96H0zM320 64h704v-96H320z" horiz-adv-x="1024" />
18
+
19
+ <glyph glyph-name="sdoc-table-of-content" unicode="&#58920;" d="M64 800h512c35.2 0 64-28.8 64-64s-28.8-64-64-64H64C28.8 672 0 700.8 0 736s28.8 64 64 64z m934.4-444.8l-12.8-12.8-172.8-172.8c-25.6-25.6-64-25.6-89.6 0-25.6 25.6-25.6 64 0 89.6l134.4 134.4-134.4 134.4c-25.6 25.6-25.6 64 0 89.6 25.6 25.6 64 25.6 89.6 0l172.8-172.8 9.6-9.6c12.8-12.8 19.2-25.6 19.2-41.6v-3.2c0-12.8-9.6-28.8-16-35.2zM64 448h800c35.2 0 64-28.8 64-64s-28.8-64-64-64H64c-35.2 0-64 28.8-64 64s28.8 64 64 64z m0-352h512c35.2 0 64-28.8 64-64s-28.8-64-64-64H64c-35.2 0-64 28.8-64 64s28.8 64 64 64z" horiz-adv-x="1024" />
20
+
17
21
  <glyph glyph-name="sdoc-info" unicode="&#58999;" d="M512 896c281.6 0 512-230.4 512-512s-230.4-512-512-512S0 102.4 0 384 230.4 896 512 896z m0-96C281.6 800 96 614.4 96 384s185.6-416 416-416 416 185.6 416 416c0 108.8-44.8 217.6-121.6 294.4S620.8 800 512 800z m32-352c19.2 0 32-12.8 32-32v-256c0-19.2-12.8-32-32-32h-64c-19.2 0-32 12.8-32 32V416c0 19.2 12.8 32 32 32h64z m-19.2 192c9.6 0 16-3.2 22.4-9.6 3.2-3.2 6.4-6.4 9.6-6.4 25.6-25.6 25.6-64 0-89.6-3.2-3.2-6.4-6.4-9.6-6.4-6.4-3.2-16-6.4-22.4-9.6h-25.6c-9.6 0-16 3.2-22.4 9.6-3.2 3.2-6.4 6.4-9.6 6.4-25.6 25.6-25.6 64 0 89.6 3.2 3.2 6.4 6.4 9.6 6.4 6.4 3.2 16 6.4 22.4 9.6h25.6z" horiz-adv-x="1024" />
18
22
 
19
23
  <glyph glyph-name="sdoc-inline-code" unicode="&#58998;" d="M1024 384l-272-288-67.2 70.4 204.8 217.6-204.8 217.6L752 672l272-288zM0 384l272-288 67.2 70.4L134.4 384l204.8 217.6L272 672 0 384z m451.2-512l-99.2 3.2L579.2 896h99.2l-227.2-1024z" horiz-adv-x="1024" />
@@ -246,8 +250,6 @@
246
250
 
247
251
  <glyph glyph-name="sdoc-share" unicode="&#58914;" d="M800 832c-70.4 0-128-54.4-128-128s57.6-128 128-128 128 54.4 128 128-57.6 128-128 128zM224 512c-70.4 0-128-54.4-128-128s57.6-128 128-128 128 54.4 128 128-57.6 128-128 128z m576-320c-70.4 0-128-54.4-128-128s57.6-128 128-128 128 54.4 128 128-60.8 128-128 128zM374.4 531.2l217.6 134.4L640 582.4 422.4 448l-48 83.2z m32-192l246.4-147.2-48-83.2-246.4 147.2 48 83.2z" horiz-adv-x="1024" />
248
252
 
249
- <glyph glyph-name="sdoc-table-of-content" unicode="&#58920;" d="M64 800h512c35.2 0 64-28.8 64-64s-28.8-64-64-64H64C28.8 672 0 700.8 0 736s28.8 64 64 64z m934.4-444.8l-12.8-12.8-172.8-172.8c-25.6-25.6-64-25.6-89.6 0-25.6 25.6-25.6 64 0 89.6l134.4 134.4-134.4 134.4c-25.6 25.6-25.6 64 0 89.6 25.6 25.6 64 25.6 89.6 0l172.8-172.8 9.6-9.6c12.8-12.8 19.2-25.6 19.2-41.6v-3.2c0-12.8-9.6-28.8-16-35.2zM64 448h800c35.2 0 64-28.8 64-64s-28.8-64-64-64H64c-35.2 0-64 28.8-64 64s28.8 64 64 64z m0-352h512c35.2 0 64-28.8 64-64s-28.8-64-64-64H64c-35.2 0-64 28.8-64 64s28.8 64 64 64z" horiz-adv-x="1024" />
250
-
251
253
  <glyph glyph-name="sdoc-user" unicode="&#58921;" d="M825.6 0H195.2c-32 0-60.8 32-44.8 64 60.8 140.8 198.4 224 361.6 224s304-80 361.6-224c12.8-32-12.8-64-48-64M316.8 576c0 105.6 86.4 192 195.2 192s195.2-86.4 195.2-192-86.4-192-195.2-192-195.2 86.4-195.2 192m672-556.8c-35.2 163.2-147.2 278.4-294.4 332.8 76.8 60.8 121.6 160 105.6 268.8-19.2 124.8-124.8 227.2-256 240C368 883.2 214.4 745.6 214.4 576c0-89.6 41.6-169.6 112-224-144-54.4-256-169.6-291.2-332.8-12.8-60.8 35.2-115.2 96-115.2h761.6c64 0 112 54.4 96 115.2" horiz-adv-x="1024" />
252
254
 
253
255
  </font>
@@ -1,11 +1,11 @@
1
1
  @font-face {
2
2
  font-family: "sdocfont"; /* Project id 4097705 */
3
- src: url('./sdoc-editor-font/iconfont.eot?t=1725002301707'); /* IE9 */
4
- src: url('./sdoc-editor-font/iconfont.eot?t=1725002301707#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
- url('./sdoc-editor-font/iconfont.woff2?t=1725002301707') format('woff2'),
6
- url('./sdoc-editor-font/iconfont.woff?t=1725002301707') format('woff'),
7
- url('./sdoc-editor-font/iconfont.ttf?t=1725002301707') format('truetype'),
8
- url('./sdoc-editor-font/iconfont.svg?t=1725002301707#sdocfont') format('svg');
3
+ src: url('./sdoc-editor-font/iconfont.eot?t=1726639586200'); /* IE9 */
4
+ src: url('./sdoc-editor-font/iconfont.eot?t=1726639586200#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
+ url('./sdoc-editor-font/iconfont.woff2?t=1726639586200') format('woff2'),
6
+ url('./sdoc-editor-font/iconfont.woff?t=1726639586200') format('woff'),
7
+ url('./sdoc-editor-font/iconfont.ttf?t=1726639586200') format('truetype'),
8
+ url('./sdoc-editor-font/iconfont.svg?t=1726639586200#sdocfont') format('svg');
9
9
  }
10
10
 
11
11
  .sdocfont {
@@ -16,6 +16,14 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
+ .sdoc-table-of-content-outline:before {
20
+ content: "\e678";
21
+ }
22
+
23
+ .sdoc-table-of-content:before {
24
+ content: "\e628";
25
+ }
26
+
19
27
  .sdoc-info:before {
20
28
  content: "\e677";
21
29
  }
@@ -480,10 +488,6 @@
480
488
  content: "\e622";
481
489
  }
482
490
 
483
- .sdoc-table-of-content:before {
484
- content: "\e628";
485
- }
486
-
487
491
  .sdoc-user:before {
488
492
  content: "\e629";
489
493
  }