@seafile/sdoc-editor 0.1.159-beta9 → 0.1.160

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,4 +1,3 @@
1
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
2
  import React, { useEffect, useMemo, useState, forwardRef, useImperativeHandle } from 'react';
4
3
  import { Editor } from '@seafile/slate';
@@ -12,8 +11,6 @@ import context from '../context';
12
11
  import { EditorContainer, EditorContent } from './layout';
13
12
  import SlateEditor from './slate-editor';
14
13
  import InsertElementDialog from './extension/commons/insert-element-dialog';
15
- import { REVISION_FIRST_LOAD_KEY } from '../constants';
16
- import toaster from '../components/toast';
17
14
  var SDocEditor = forwardRef(function (_ref, ref) {
18
15
  var document = _ref.document,
19
16
  config = _ref.config;
@@ -88,30 +85,6 @@ var SDocEditor = forwardRef(function (_ref, ref) {
88
85
  var originFilename = context.getSetting('originFilename');
89
86
  if (isSdocRevision) {
90
87
  window.document.getElementsByTagName('title')[0].innerText = "".concat(t('Revision'), " - ").concat(originFilename);
91
- var searchParams = window.location.search || window.location.hash;
92
- if (searchParams) {
93
- var searchParamsIndex = searchParams.indexOf('?');
94
- var validSearchParams = new URLSearchParams(searchParams.slice(searchParamsIndex + 1));
95
- var _iterator = _createForOfIteratorHelper(validSearchParams),
96
- _step;
97
- try {
98
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
99
- var query = _step.value;
100
- var key = query[0];
101
- var value = query[1];
102
- if (key === REVISION_FIRST_LOAD_KEY && value === '1') {
103
- var revisionId = context.getSetting('revisionId');
104
- toaster.success(t('Revision_created', {
105
- id: revisionId
106
- }));
107
- }
108
- }
109
- } catch (err) {
110
- _iterator.e(err);
111
- } finally {
112
- _iterator.f();
113
- }
114
- }
115
88
  }
116
89
 
117
90
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -58,7 +58,7 @@ var deserializeElements = function deserializeElements() {
58
58
  var node = deserializeElement(element);
59
59
  switch (typeOf(node)) {
60
60
  case 'array':
61
- var formatNode = isTopLevel ? formatElementNodes(node, true) : node;
61
+ var formatNode = isTopLevel ? formatElementNodes(node) : node;
62
62
  nodes = nodes.concat(formatNode);
63
63
  break;
64
64
  case 'object':
@@ -72,7 +72,6 @@ var deserializeElements = function deserializeElements() {
72
72
  return nodes;
73
73
  };
74
74
  var formatElementNodes = function formatElementNodes(nodes) {
75
- var isMergeForward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
76
75
  if (nodes.length === 0) return nodes;
77
76
  nodes = nodes.reduce(function (memo, node) {
78
77
  if (node.level === 'level1') {
@@ -92,7 +91,7 @@ var formatElementNodes = function formatElementNodes(nodes) {
92
91
  }
93
92
  if (node.level === 'level3') {
94
93
  var prevNode = memo[memo.length - 1];
95
- if (prevNode && prevNode.type === PARAGRAPH && isMergeForward) {
94
+ if (prevNode && prevNode.type === PARAGRAPH) {
96
95
  prevNode.children.push(node);
97
96
  return memo;
98
97
  }
@@ -4,7 +4,6 @@ import { withTranslation } from 'react-i18next';
4
4
  import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
5
5
  import context from '../../../../context';
6
6
  import toaster from '../../../toast';
7
- import { REVISION_FIRST_LOAD_KEY } from '../../../../constants';
8
7
  import './index.css';
9
8
  var MoreRevisionOperations = function MoreRevisionOperations(_ref) {
10
9
  var t = _ref.t;
@@ -19,7 +18,7 @@ var MoreRevisionOperations = function MoreRevisionOperations(_ref) {
19
18
  }, []);
20
19
  var startRevise = useCallback(function () {
21
20
  context.startRevise().then(function (res) {
22
- window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(res.data.revision_id, "/?").concat(REVISION_FIRST_LOAD_KEY, "=1");
21
+ window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(res.data.revision_id, "/");
23
22
  }).catch(function (error) {
24
23
  toaster.danger(t('Error'));
25
24
  });
@@ -1,4 +1,3 @@
1
- export var REVISION_FIRST_LOAD_KEY = 'first-load';
2
1
  export var EXTERNAL_EVENT = {
3
2
  INTERNAL_LINK_CLICK: 'internal_link_click',
4
3
  TOGGLE_STAR: 'toggle_star',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.159beta9",
3
+ "version": "0.1.160",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -364,6 +364,5 @@
364
364
  "Title": "Title",
365
365
  "Subtitle": "Subtitle",
366
366
  "Link_sdoc": "Link sdoc",
367
- "Link_file": "Link file",
368
- "Revision_created": "Revision {{id}} created"
367
+ "Link_file": "Link file"
369
368
  }