@seafile/sdoc-editor 0.1.121 → 0.1.123

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.
@@ -1,5 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import React, { useCallback, useEffect, useMemo, useRef, useState, forwardRef, useImperativeHandle, Fragment } from 'react';
3
+ import { Editor } from '@seafile/slate';
3
4
  import { Editable, ReactEditor, Slate } from '@seafile/slate-react';
4
5
  import defaultEditor, { renderLeaf, renderElement, Toolbar, ContextToolbar } from './extension';
5
6
  import { focusEditor, getAboveBlockNode, getNextNode, getPrevNode, isSelectionAtBlockEnd, isSelectionAtBlockStart } from './extension/core';
@@ -73,7 +74,20 @@ var SDocEditor = forwardRef(function (_ref, ref) {
73
74
  // useMount: focus editor
74
75
  useEffect(function () {
75
76
  var timer = setTimeout(function () {
76
- focusEditor(editor);
77
+ var _editor$children = _slicedToArray(editor.children, 1),
78
+ firstNode = _editor$children[0];
79
+ if (firstNode) {
80
+ var _firstNode$children = _slicedToArray(firstNode.children, 1),
81
+ firstNodeFirstChild = _firstNode$children[0];
82
+ if (firstNodeFirstChild) {
83
+ var endOfFirstNode = Editor.end(editor, [0, 0]);
84
+ var range = {
85
+ anchor: endOfFirstNode,
86
+ focus: endOfFirstNode
87
+ };
88
+ focusEditor(editor, range);
89
+ }
90
+ }
77
91
  }, 300);
78
92
  return function () {
79
93
  clearTimeout(timer);
@@ -118,7 +118,11 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
118
118
  if (lastSavedAt) {
119
119
  return /*#__PURE__*/React.createElement("span", {
120
120
  className: "tip-message"
121
- }, /*#__PURE__*/React.createElement("span", null, t('Recently_saved'), ' '), /*#__PURE__*/React.createElement("span", null, dayjs(lastSavedAt).format('HH:mm')));
121
+ }, /*#__PURE__*/React.createElement("span", {
122
+ className: "sdocfont sdoc-save-tip mr-2"
123
+ }), /*#__PURE__*/React.createElement("span", {
124
+ className: "save-time"
125
+ }, dayjs(lastSavedAt).format('HH:mm')));
122
126
  }
123
127
  return null;
124
128
  };
@@ -4,6 +4,12 @@
4
4
  opacity: 0.75;
5
5
  color: #999;
6
6
  width: max-content;
7
- display: inline-block;
8
- white-space: nowrap;
7
+ height: 27px;
8
+ line-height: 27px;
9
+ display: inline-flex;
10
+ }
11
+
12
+ .sdoc-editor-page-wrapper .tip-message .sdocfont {
13
+ padding-top: 1px;
14
+ font-size: 14px;
9
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.121",
3
+ "version": "0.1.123",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -14,6 +14,8 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <glyph glyph-name="sdoc-save-tip" unicode="&#58960;" d="M528 800c153.6 0 272-112 284.8-252.8 121.6-9.6 208-137.6 208-291.2 0-160-86.4-284.8-201.6-288H208c-96 0-208 124.8-208 284.8s89.6 294.4 227.2 288c9.6 0 16 0 22.4-3.2C291.2 694.4 374.4 800 528 800z m3.2-96c-99.2 0-179.2-73.6-208-256-48 3.2-76.8 3.2-96 0-73.6-9.6-131.2-86.4-131.2-185.6S166.4 64 227.2 64h582.4c54.4 0 118.4 96 118.4 198.4 0 89.6-35.2 166.4-99.2 185.6-28.8 9.6-67.2 12.8-92.8 6.4-6.4 169.6-99.2 249.6-204.8 249.6z m163.2-252.8l38.4-41.6c6.4-6.4 6.4-16 0-22.4l-256-249.6c-12.8-12.8-32-16-44.8-3.2l-147.2 140.8c-6.4 6.4-6.4 12.8-3.2 19.2l3.2 3.2 38.4 38.4c6.4 6.4 16 6.4 22.4 0l108.8-105.6L672 448c6.4 9.6 16 9.6 22.4 3.2z" horiz-adv-x="1024" />
18
+
17
19
  <glyph glyph-name="sdoc-file" unicode="&#58895;" d="M460.8 723.2H112c-16 0-35.2-12.8-35.2-35.2v-601.6c0-19.2 16-35.2 35.2-35.2h803.2c16 0 35.2 19.2 35.2 35.2V576c0 19.2-16 35.2-35.2 35.2H588.8c-12.8 0-16 6.4-22.4 12.8l-105.6 99.2z m137.6-38.4h313.6c57.6 0 112-48 112-115.2v-489.6c0-60.8-48-115.2-112-115.2h-800C51.2-32 0 16 0 83.2V684.8C0 745.6 48 800 112 800h361.6c12.8 0 16-6.4 22.4-12.8l102.4-102.4z" horiz-adv-x="1024" />
18
20
 
19
21
  <glyph glyph-name="sdoc-header6" unicode="&#58894;" d="M96 896v-400h448V896h96v-960h-96V400H96V-64H0V896h96zM787.2 115.2c12.8 16 28.8 28.8 44.8 35.2s35.2 12.8 54.4 12.8c19.2 0 38.4-3.2 54.4-9.6 16-6.4 32-16 41.6-28.8 16-16 25.6-28.8 32-48s9.6-35.2 9.6-54.4c0-28.8-6.4-54.4-19.2-76.8s-32-41.6-54.4-54.4c-25.6-12.8-51.2-19.2-80-19.2-35.2 0-64 9.6-89.6 25.6S736-64 723.2-32s-19.2 70.4-19.2 118.4c0 38.4 3.2 70.4 12.8 102.4s19.2 51.2 32 73.6 32 35.2 54.4 44.8 44.8 12.8 73.6 12.8c25.6 0 48-6.4 70.4-16s32-22.4 44.8-35.2c9.6-16 16-28.8 16-41.6 0-9.6-3.2-16-9.6-22.4s-16-12.8-25.6-12.8c-9.6 0-16 3.2-25.6 9.6-6.4 6.4-12.8 12.8-16 22.4-3.2 9.6-12.8 19.2-22.4 28.8-9.6 6.4-22.4 9.6-35.2 9.6-9.6 0-22.4-3.2-32-9.6-9.6-6.4-19.2-12.8-25.6-22.4-16-22.4-25.6-60.8-28.8-115.2z m83.2-185.6c19.2 0 38.4 9.6 51.2 25.6s19.2 38.4 19.2 64c0 19.2-3.2 35.2-9.6 48-3.2 12.8-12.8 22.4-25.6 28.8-9.6 6.4-22.4 9.6-35.2 9.6-12.8 0-25.6-3.2-35.2-9.6-12.8-6.4-22.4-16-28.8-28.8-6.4-9.6-9.6-25.6-9.6-41.6 0-25.6 6.4-48 22.4-67.2 12.8-19.2 28.8-28.8 51.2-28.8z" horiz-adv-x="1024" />
@@ -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=1691653499663'); /* IE9 */
4
- src: url('./sdoc-editor-font/iconfont.eot?t=1691653499663#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
- url('./sdoc-editor-font/iconfont.woff2?t=1691653499663') format('woff2'),
6
- url('./sdoc-editor-font/iconfont.woff?t=1691653499663') format('woff'),
7
- url('./sdoc-editor-font/iconfont.ttf?t=1691653499663') format('truetype'),
8
- url('./sdoc-editor-font/iconfont.svg?t=1691653499663#sdocfont') format('svg');
3
+ src: url('./sdoc-editor-font/iconfont.eot?t=1692612471690'); /* IE9 */
4
+ src: url('./sdoc-editor-font/iconfont.eot?t=1692612471690#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
+ url('./sdoc-editor-font/iconfont.woff2?t=1692612471690') format('woff2'),
6
+ url('./sdoc-editor-font/iconfont.woff?t=1692612471690') format('woff'),
7
+ url('./sdoc-editor-font/iconfont.ttf?t=1692612471690') format('truetype'),
8
+ url('./sdoc-editor-font/iconfont.svg?t=1692612471690#sdocfont') format('svg');
9
9
  }
10
10
 
11
11
  .sdocfont {
@@ -16,6 +16,10 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
+ .sdoc-save-tip:before {
20
+ content: "\e650";
21
+ }
22
+
19
23
  .sdoc-file:before {
20
24
  content: "\e60f";
21
25
  }