@seafile/sdoc-editor 0.1.160 → 0.1.161-beta

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.
Files changed (36) hide show
  1. package/dist/api/seafile-api.js +32 -9
  2. package/dist/basic-sdk/constants/index.js +25 -1
  3. package/dist/basic-sdk/editor/common-editor.js +50 -0
  4. package/dist/basic-sdk/editor/index.css +29 -0
  5. package/dist/basic-sdk/editor/index.js +125 -0
  6. package/dist/basic-sdk/{slate-editor.js → editor/slate-editor.js} +21 -16
  7. package/dist/basic-sdk/extension/constants/element-type.js +6 -1
  8. package/dist/basic-sdk/extension/core/transforms/replace-node-children.js +26 -0
  9. package/dist/basic-sdk/extension/render/render-element.js +221 -1
  10. package/dist/basic-sdk/socket/helpers.js +2 -0
  11. package/dist/basic-sdk/socket/socket-client.js +36 -0
  12. package/dist/basic-sdk/socket/socket-manager.js +25 -2
  13. package/dist/basic-sdk/socket/with-socket-io.js +30 -12
  14. package/dist/basic-sdk/utils/diff.js +4 -3
  15. package/dist/basic-sdk/utils/rebase.js +193 -0
  16. package/dist/basic-sdk/views/diff-viewer.js +3 -1
  17. package/dist/basic-sdk/views/viewer.js +9 -12
  18. package/dist/components/doc-operations/index.js +4 -2
  19. package/dist/components/doc-operations/revision-operations/index.js +5 -2
  20. package/dist/components/doc-operations/revision-operations/publish-button.js +6 -13
  21. package/dist/components/tip-dialog/index.css +6 -0
  22. package/dist/components/tip-dialog/index.js +65 -0
  23. package/dist/components/tip-dialog/tip-content.js +47 -0
  24. package/dist/constants/index.js +28 -2
  25. package/dist/context.js +44 -9
  26. package/dist/pages/simple-editor.js +264 -88
  27. package/package.json +1 -1
  28. package/public/locales/cs/sdoc-editor.json +16 -1
  29. package/public/locales/de/sdoc-editor.json +16 -1
  30. package/public/locales/en/sdoc-editor.json +14 -1
  31. package/public/locales/es/sdoc-editor.json +16 -1
  32. package/public/locales/fr/sdoc-editor.json +14 -1
  33. package/public/locales/it/sdoc-editor.json +17 -2
  34. package/public/locales/ru/sdoc-editor.json +15 -2
  35. package/public/locales/zh_CN/sdoc-editor.json +14 -1
  36. package/dist/basic-sdk/editor.js +0 -105
@@ -347,6 +347,7 @@
347
347
  "Icon_and_text_Link": "Icon and text Link",
348
348
  "Card": "Card",
349
349
  "Select_sdoc_document": "Select sdoc document",
350
+ "Select_file": "Select file",
350
351
  "Local_file": "Local file",
351
352
  "Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
352
353
  "Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page",
@@ -362,5 +363,19 @@
362
363
  "No_changes": "No changes",
363
364
  "Title": "Título",
364
365
  "Subtitle": "Subtitle",
365
- "Link_sdoc": "Link sdoc"
366
+ "Link_sdoc": "Link sdoc",
367
+ "Link_file": "Link file",
368
+ "Keep_my_modification": "Keep my modification",
369
+ "Keep_other_modification": "Keep other's modification",
370
+ "Keep_both_modification": "Keep my modification",
371
+ "Tip": "Tip",
372
+ "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
373
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
374
+ "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
375
+ "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
376
+ "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
377
+ "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
378
+ "Has_been_removed_tip": "Document has been removed, please view other documents.",
379
+ "Checking": "Checking...",
380
+ "Publishing": "Publishing..."
366
381
  }
@@ -364,5 +364,18 @@
364
364
  "Title": "Titre",
365
365
  "Subtitle": "Sous-titre",
366
366
  "Link_sdoc": "Lien sdoc",
367
- "Link_file": "Link file"
367
+ "Link_file": "Link file",
368
+ "Keep_my_modification": "Keep my modification",
369
+ "Keep_other_modification": "Keep other's modification",
370
+ "Keep_both_modification": "Keep my modification",
371
+ "Tip": "Tip",
372
+ "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
373
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
374
+ "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
375
+ "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
376
+ "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
377
+ "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
378
+ "Has_been_removed_tip": "Document has been removed, please view other documents.",
379
+ "Checking": "Checking...",
380
+ "Publishing": "Publishing..."
368
381
  }
@@ -343,11 +343,11 @@
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",
350
349
  "Select_sdoc_document": "Select sdoc document",
350
+ "Select_file": "Select file",
351
351
  "Local_file": "Local file",
352
352
  "Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
353
353
  "Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page",
@@ -362,5 +362,20 @@
362
362
  "Changes": "Modifiche",
363
363
  "No_changes": "No changes",
364
364
  "Title": "Titolo",
365
- "SubTitle": "Subtitle"
365
+ "Subtitle": "Subtitle",
366
+ "Link_sdoc": "Link sdoc",
367
+ "Link_file": "Link file",
368
+ "Keep_my_modification": "Keep my modification",
369
+ "Keep_other_modification": "Keep other's modification",
370
+ "Keep_both_modification": "Keep my modification",
371
+ "Tip": "Tip",
372
+ "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
373
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
374
+ "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
375
+ "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
376
+ "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
377
+ "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
378
+ "Has_been_removed_tip": "Document has been removed, please view other documents.",
379
+ "Checking": "Checking...",
380
+ "Publishing": "Publishing..."
366
381
  }
@@ -347,7 +347,7 @@
347
347
  "Icon_and_text_Link": "Значок и текстовая ссылка",
348
348
  "Card": "Карта",
349
349
  "Select_sdoc_document": "Выбрать документ sdoc",
350
- "Select_file": "Select file",
350
+ "Select_file": "Выбрать файл",
351
351
  "Local_file": "Заблокировать файл",
352
352
  "Internal_server_exec_operations_error": "На сервере произошло исключение. Обновите страницу и повторите попытку",
353
353
  "Failed_to_sync_with_server_operations": "Не удалось синхронизироваться с сервером, обновите страницу.",
@@ -364,5 +364,18 @@
364
364
  "Title": "Название",
365
365
  "Subtitle": "Подзаголовок",
366
366
  "Link_sdoc": "Ссылка на sdoc",
367
- "Link_file": "Link file"
367
+ "Link_file": "Ссылка на файл",
368
+ "Keep_my_modification": "Сохранить мою модификацию",
369
+ "Keep_other_modification": "Сохранить чужую модификацию",
370
+ "Keep_both_modification": "Сохранить мою модификацию",
371
+ "Tip": "Совет",
372
+ "Rebase_delete_no_change_revision_tip": "Редакция не внесла никаких изменений по сравнению с исходным документом. Вы хотите удалить эту редакцию?",
373
+ "Has_been_replaced_tip": "Содержимое документа было заменено. Обновите страницу.",
374
+ "Has_been_published_tip": "Версия опубликована. Автоматический переход к исходному контенту через {{ time }} секунд.",
375
+ "Has_conflict_before_publish_tip": "В документе есть конфликты, разрешите их перед публикацией!",
376
+ "Merge_tip": "В документах есть конфликты. Вы хотите объединить их?",
377
+ "Has_conflict_before_view_changes_tip": "В документе есть конфликты. Разрешите конфликт перед просмотром изменений!",
378
+ "Has_been_removed_tip": "Документ удален, посмотрите другие документы.",
379
+ "Checking": "Checking...",
380
+ "Publishing": "Publishing..."
368
381
  }
@@ -364,5 +364,18 @@
364
364
  "Title": "标题",
365
365
  "Subtitle": "副标题",
366
366
  "Link_sdoc": "链接 sdoc",
367
- "Link_file": "文件链接"
367
+ "Link_file": "文件链接",
368
+ "Keep_my_modification": "保留我的更改",
369
+ "Keep_other_modification": "保留其他的更改",
370
+ "Keep_both_modification": "保留我的更改",
371
+ "Tip": "提示",
372
+ "Rebase_delete_no_change_revision_tip": "修订改没有更改,是否删除修订稿?",
373
+ "Has_been_replaced_tip": "文档内容已经被替换,请刷新页面。",
374
+ "Has_been_published_tip": "修订稿已经发布了,{{ time }} 秒后自动跳转到源文件。",
375
+ "Has_conflict_before_publish_tip": "文档有冲突,请解决冲突后再发布!",
376
+ "Merge_tip": "文档有冲突,是否合并?",
377
+ "Has_conflict_before_view_changes_tip": "文档有冲突,请解决冲突后再查看更改!",
378
+ "Has_been_removed_tip": "文档已经被删除,请查看其他文档",
379
+ "Checking": "检查中...",
380
+ "Publishing": "发布中..."
368
381
  }
@@ -1,105 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React, { useEffect, useMemo, useState, forwardRef, useImperativeHandle } from 'react';
3
- import { Editor } from '@seafile/slate';
4
- import { useTranslation } from 'react-i18next';
5
- import { createDefaultEditor } from './extension';
6
- import { focusEditor } from './extension/core';
7
- import { withSocketIO } from './socket';
8
- import withNodeId from './node-id';
9
- import { PAGE_EDIT_AREA_WIDTH } from './constants';
10
- import context from '../context';
11
- import { EditorContainer, EditorContent } from './layout';
12
- import SlateEditor from './slate-editor';
13
- import InsertElementDialog from './extension/commons/insert-element-dialog';
14
- var SDocEditor = forwardRef(function (_ref, ref) {
15
- var document = _ref.document,
16
- config = _ref.config;
17
- var _useTranslation = useTranslation(),
18
- t = _useTranslation.t;
19
-
20
- // init editor
21
- var editor = useMemo(function () {
22
- var defaultEditor = createDefaultEditor();
23
- var newEditor = withNodeId(withSocketIO(defaultEditor, {
24
- document: document,
25
- config: config
26
- }));
27
- var cursors = document.cursors;
28
- newEditor.cursors = cursors || {};
29
- newEditor.width = PAGE_EDIT_AREA_WIDTH; // default width
30
- newEditor.readonly = false;
31
- return newEditor;
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- }, []);
34
- var _useState = useState(document.children),
35
- _useState2 = _slicedToArray(_useState, 2),
36
- slateValue = _useState2[0],
37
- setSlateValue = _useState2[1];
38
-
39
- // The parent component can call the method of this component through ref
40
- useImperativeHandle(ref, function () {
41
- return {
42
- // get latest value
43
- getValue: function getValue() {
44
- return slateValue;
45
- }
46
- };
47
- }, [slateValue]);
48
-
49
- // useMount: init socket connection
50
- useEffect(function () {
51
- editor.openConnection();
52
- return function () {
53
- editor.closeConnection();
54
- };
55
- // eslint-disable-next-line react-hooks/exhaustive-deps
56
- }, []);
57
-
58
- // useMount: focus editor
59
- useEffect(function () {
60
- var timer = setTimeout(function () {
61
- var _editor$children = _slicedToArray(editor.children, 1),
62
- firstNode = _editor$children[0];
63
- if (firstNode) {
64
- var _firstNode$children = _slicedToArray(firstNode.children, 1),
65
- firstNodeFirstChild = _firstNode$children[0];
66
- if (firstNodeFirstChild) {
67
- var endOfFirstNode = Editor.end(editor, [0, 0]);
68
- var range = {
69
- anchor: endOfFirstNode,
70
- focus: endOfFirstNode
71
- };
72
- focusEditor(editor, range);
73
- }
74
- }
75
- }, 300);
76
- return function () {
77
- clearTimeout(timer);
78
- };
79
- // eslint-disable-next-line react-hooks/exhaustive-deps
80
- }, []);
81
-
82
- // useMount: reset title
83
- useEffect(function () {
84
- var isSdocRevision = context.getSetting('isSdocRevision');
85
- var originFilename = context.getSetting('originFilename');
86
- if (isSdocRevision) {
87
- window.document.getElementsByTagName('title')[0].innerText = "".concat(t('Revision'), " - ").concat(originFilename);
88
- }
89
-
90
- // eslint-disable-next-line react-hooks/exhaustive-deps
91
- }, []);
92
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorContainer, {
93
- editor: editor
94
- }, /*#__PURE__*/React.createElement(EditorContent, {
95
- docValue: slateValue,
96
- showOutline: true
97
- }, /*#__PURE__*/React.createElement(SlateEditor, {
98
- editor: editor,
99
- slateValue: slateValue,
100
- setSlateValue: setSlateValue
101
- }))), /*#__PURE__*/React.createElement(InsertElementDialog, {
102
- editor: editor
103
- }));
104
- });
105
- export default SDocEditor;