@seafile/sdoc-editor 0.2.24-beta → 0.2.24-beta2

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.
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { EventBus } from '../../../basic-sdk';
4
4
  import { getRebase, hasConflict } from '../../../basic-sdk/utils/rebase';
5
5
  import context from '../../../context';
6
- import { EXTERNAL_EVENT, TIP_TYPE } from '../../../constants';
6
+ import { EXTERNAL_EVENT, TIP_CONTENT, TIP_TYPE } from '../../../constants';
7
7
  import { useDocument } from '../../../hooks';
8
8
  import toaster from '../../toast';
9
9
  import TipDialog from '../../tip-dialog';
@@ -45,7 +45,7 @@ var RevisionOperations = function RevisionOperations(_ref) {
45
45
  }, [isShowTip]);
46
46
  var hasPublishRevision = useCallback(function () {
47
47
  handleRevisionPublished();
48
- toaster.success(t('Revision published'));
48
+ toaster.success(t(TIP_CONTENT[TIP_TYPE.HAS_BEEN_PUBLISHED]));
49
49
  }, [handleRevisionPublished, t]);
50
50
  var onDocumentRemoved = useCallback(function () {
51
51
  if (isShowTip) return;
@@ -3,8 +3,7 @@ import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
5
5
  import classnames from 'classnames';
6
- import { TIP_TYPE, TIP_TITLE } from '../../constants';
7
- import TipContent from './tip-content';
6
+ import { TIP_TYPE, TIP_TITLE, TIP_CONTENT } from '../../constants';
8
7
  import CommonLoading from '../common-loading';
9
8
  import './index.css';
10
9
  var NOT_CLOSE_DIALOG_TIP_TYPE = [TIP_TYPE.HAS_BEEN_REPLACED, TIP_TYPE.HAS_BEEN_PUBLISHED, TIP_TYPE.CHECKING, TIP_TYPE.PUBLISHING];
@@ -58,9 +57,7 @@ var TipDialog = function TipDialog(_ref) {
58
57
  toggle: NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) ? undefined : closeDialog
59
58
  }, t(TIP_TITLE[tipType])), /*#__PURE__*/React.createElement(ModalBody, {
60
59
  className: "sdoc-tip-body"
61
- }, children ? children : /*#__PURE__*/React.createElement(TipContent, {
62
- tipType: tipType
63
- })), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
60
+ }, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType]))), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
64
61
  color: "secondary",
65
62
  className: "mr-2",
66
63
  onClick: closeDialog
@@ -81,6 +81,10 @@ var SimpleEditor = function SimpleEditor(_ref) {
81
81
  setRevisionContent(document);
82
82
  setPublished(true);
83
83
  context.settings['isPublished'] = true;
84
+ var oldAssetsUrl = context.getSetting('assetsUrl');
85
+ var docUuid = context.getSetting('docUuid');
86
+ var originDocUuid = context.getSetting('originDocUuid');
87
+ context.settings['assetsUrl'] = oldAssetsUrl.replace(docUuid, originDocUuid);
84
88
  }).catch(function (error) {
85
89
  // eslint-disable-next-line
86
90
  console.log(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.2.24beta",
3
+ "version": "0.2.24beta2",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -379,7 +379,7 @@
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
381
  "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
382
- "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
@@ -406,5 +406,7 @@
406
406
  "Search_tags": "Search tags",
407
407
  "No_options_available": "Tag not found",
408
408
  "Add_option": "Vytvořit nový štítek",
409
- "Find_an_option": "Search tags"
409
+ "Find_an_option": "Search tags",
410
+ "Copy_link_of_section": "Copy link of section",
411
+ "revision": "revision"
410
412
  }
@@ -379,7 +379,7 @@
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
381
  "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
382
- "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
@@ -379,7 +379,7 @@
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
381
  "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
382
- "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
@@ -379,7 +379,7 @@
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
381
  "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
382
- "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
@@ -379,7 +379,7 @@
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
381
  "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
382
- "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
@@ -406,5 +406,7 @@
406
406
  "Search_tags": "Search tags",
407
407
  "No_options_available": "Tag not found",
408
408
  "Add_option": "Créer un nouveau Tag",
409
- "Find_an_option": "Search tags"
409
+ "Find_an_option": "Search tags",
410
+ "Copy_link_of_section": "Copy link of section",
411
+ "revision": "revision"
410
412
  }
@@ -379,7 +379,7 @@
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
381
  "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
382
- "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
@@ -379,7 +379,7 @@
379
379
  "Tip": "Совет",
380
380
  "Rebase_delete_no_change_revision_tip": "Редакция не внесла никаких изменений по сравнению с исходным документом. Вы хотите удалить эту редакцию?",
381
381
  "Has_been_replaced_tip": "Содержимое документа было заменено. Обновите страницу.",
382
- "Has_been_published_tip": "Версия опубликована. Автоматический переход к исходному контенту через {{ time }} секунд.",
382
+ "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "В документе есть конфликты, разрешите их перед публикацией!",
384
384
  "Merge_tip": "В документах есть конфликты. Вы хотите объединить их?",
385
385
  "Has_conflict_before_view_changes_tip": "В документе есть конфликты. Разрешите конфликт перед просмотром изменений!",
@@ -379,7 +379,7 @@
379
379
  "Tip": "提示",
380
380
  "Rebase_delete_no_change_revision_tip": "修订改没有更改,是否删除修订稿?",
381
381
  "Has_been_replaced_tip": "文档内容已经被替换,请刷新页面。",
382
- "Has_been_published_tip": "修订稿已经发布了,{{ time }} 秒后自动跳转到源文件。",
382
+ "Has_been_published_tip": "修订稿已发布",
383
383
  "Has_conflict_before_publish_tip": "文档有冲突,请解决冲突后再发布!",
384
384
  "Merge_tip": "文档有冲突,是否合并?",
385
385
  "Has_conflict_before_view_changes_tip": "文档有冲突,请解决冲突后再查看更改!",
@@ -1,47 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React, { useEffect, useState } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { useTranslation } from 'react-i18next';
5
- import { TIP_TYPE, TIP_CONTENT } from '../../constants';
6
- import context from '../../context';
7
- var TipContent = function TipContent(_ref) {
8
- var tipType = _ref.tipType;
9
- var _useState = useState(3),
10
- _useState2 = _slicedToArray(_useState, 2),
11
- time = _useState2[0],
12
- setTime = _useState2[1];
13
- useEffect(function () {
14
- if (tipType === TIP_TYPE.HAS_BEEN_PUBLISHED) {
15
- var _time = 3;
16
- var timer = setInterval(function () {
17
- _time--;
18
- setTime(_time);
19
- if (_time === 0) {
20
- clearInterval(timer);
21
- timer = null;
22
- }
23
- }, 1000);
24
- return function () {
25
- timer && clearInterval(timer);
26
- };
27
- }
28
- }, [tipType]);
29
- useEffect(function () {
30
- if (time === 0) {
31
- var originFileURL = context.getSetting('originFileURL');
32
- window.location.href = originFileURL;
33
- }
34
- }, [time]);
35
- var _useTranslation = useTranslation(),
36
- t = _useTranslation.t;
37
- if (tipType === TIP_TYPE.HAS_BEEN_PUBLISHED) {
38
- return /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType], {
39
- time: time
40
- }));
41
- }
42
- return /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType]));
43
- };
44
- TipContent.propTypes = {
45
- tipType: PropTypes.string
46
- };
47
- export default TipContent;