@seafile/sdoc-editor 0.1.4 → 0.1.5

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.
@@ -50,4 +50,4 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
50
50
  iconClass: 'iconfont icon-link',
51
51
  text: 'link'
52
52
  }), _MENUS_CONFIG_MAP);
53
- export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'header_1'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'header_2'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'header_3'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'header_4'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'header_5'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'header_6'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'pargraph'), _HEADER_TITLE_MAP);
53
+ export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'header_1'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'header_2'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'header_3'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'header_4'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'header_5'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'header_6'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'paragraph'), _HEADER_TITLE_MAP);
@@ -143,4 +143,4 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
143
143
  }]);
144
144
  return AddLinkDialog;
145
145
  }(React.PureComponent);
146
- export default withTranslation('seafile-editor')(AddLinkDialog);
146
+ export default withTranslation('sdoc-editor')(AddLinkDialog);
@@ -61,11 +61,13 @@ export var validateOperation = function validateOperation(editor, operation) {
61
61
  }
62
62
 
63
63
  // reset insert node path
64
- var parentNode = Node.get(editor, _path);
65
- var childLength = parentNode.children.length;
66
- var index = Math.min(_path[_path.length - 1], childLength);
67
- newOperation.path = parentNodePath.concat([index]);
68
- isValid = true;
64
+ var parentNode = getNode(editor, _path);
65
+ if (parentNode) {
66
+ var childLength = parentNode.children.length;
67
+ var index = Math.min(_path[_path.length - 1], childLength);
68
+ newOperation.path = parentNodePath.concat([index]);
69
+ isValid = true;
70
+ }
69
71
  break;
70
72
  }
71
73
  case OPERATION.REMOVE_NODE:
@@ -2,9 +2,8 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import io from 'socket.io-client';
5
- import Debug from 'debug';
6
5
  import SocketManager from './socket-manager';
7
- var debug = Debug('sdoc:socket-client');
6
+ import debug from '../utils/debug';
8
7
  var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
9
8
  var _this = this;
10
9
  _classCallCheck(this, SocketClient);
@@ -1,10 +1,9 @@
1
1
  import _createClass from "@babel/runtime/helpers/esm/createClass";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import Debug from 'debug';
4
3
  import EventBus from '../utils/event-bus';
5
4
  import { syncRemoteOperations, reExecRevertOperationList, revertOperationList } from './helpers';
6
5
  import SocketClient from './socket-client';
7
- var debug = Debug('sdoc:socket-client');
6
+ import debug from '../utils/debug';
8
7
  var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, document, config) {
9
8
  var _this = this;
10
9
  _classCallCheck(this, SocketManager);
@@ -111,7 +110,7 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
111
110
  _this.revertOperationList = [];
112
111
  });
113
112
  } else {
114
- // conflict:
113
+ // conflict:
115
114
  // remote operations is not empty, waiting until remote operations all executed
116
115
  debug('remote operations is not empty, and local version is not match remote version.');
117
116
  }
@@ -0,0 +1,5 @@
1
+ import Debug from 'debug';
2
+ var debug = Debug('sdoc:socket-client');
3
+ debug.enabled = true;
4
+ debug.log = console.log;
5
+ export default debug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,225 @@
1
+ {
2
+ "bold": "粗体",
3
+ "italic": "斜体",
4
+ "inline_code": "代码",
5
+ "header_one": "一级标题",
6
+ "header_two": "二级标题",
7
+ "header_three": "三级标题",
8
+ "header_four": "四级标题",
9
+ "header_five": "五级标题",
10
+ "header_six": "六级标题",
11
+ "paragraph": "段落",
12
+ "quote": "引用",
13
+ "ordered_list": "有序列表",
14
+ "unordered_list": "无序列表",
15
+ "check_list_item": "任务列表",
16
+ "insert_image": "插入图片",
17
+ "insert_formula": "插入公式",
18
+ "formula": "公式",
19
+ "insert_file": "插入文件",
20
+ "code": "行内代码",
21
+ "code_block": "代码块",
22
+ "insert_link": "添加链接",
23
+ "insert_table": "添加表格",
24
+ "save": "保存",
25
+ "more": "更多",
26
+ "invalid_url": "无效链接",
27
+ "link_address": "链接地址",
28
+ "image_address": "图片地址",
29
+ "submit": "提交",
30
+ "cancel": "取消",
31
+ "switch_to_plain_text_editor": "切换至普通文本编辑器",
32
+ "switch_to_rich_text_editor": "切换至富文本编辑器",
33
+ "switch_to_viewer": "切换到只读模式",
34
+ "help": "帮助",
35
+ "remove_table": "删除表格",
36
+ "column": "列",
37
+ "row": "行",
38
+ "Insert_Row_Before": "上方插入行",
39
+ "Insert_Row_After": "下方插入行",
40
+ "Insert_Column_Before": "左边插入列",
41
+ "Insert_Column_After": "右边插入列",
42
+ "Remove_Row": "删除当前行",
43
+ "Remove_Column": "删除当前列",
44
+ "Insert_Row": "插入行",
45
+ "Insert_Column": "插入列",
46
+ "set_align": "对齐方式",
47
+ "left": "左对齐",
48
+ "center": "居中",
49
+ "right": "右对齐",
50
+ "file_saved": "保存文件成功",
51
+ "file_failed_to_save": "保存文件失败",
52
+ "star": "添加星标",
53
+ "unstar": "移除星标",
54
+ "back_to_parent_directory":"返回上级目录",
55
+ "edit": "编辑",
56
+ "copy": "复制",
57
+ "copied": "已复制",
58
+ "internal_link": "内部链接",
59
+ "copy_internal_link": "内部链接已复制到剪贴板",
60
+ "internal_link_desc": "内部链接是指向文件或目录的链接,只有对该文件或目录有访问权限的人可以访问。",
61
+ "share": "共享",
62
+ "share_link": "共享链接",
63
+ "generate": "生成链接",
64
+ "add_password_protection": "增加密码保护",
65
+ "password": "密码",
66
+ "at_least_8_characters": "至少8个字符",
67
+ "password_again": "请再次输入密码",
68
+ "add_auto_expiration": "增加自动过期",
69
+ "days": "天",
70
+ "please_enter_password": "请输入密码",
71
+ "greater_than_or_equal_to": "大于或等于",
72
+ "less_than_or_equal_to": "小于或等于",
73
+ "set_permission": "设置权限",
74
+ "preview_and_download": "预览与下载",
75
+ "preview_only": "仅查看",
76
+ "please_enter_valid_days": "请输入有效的天数",
77
+ "please_enter_a_non-negative_integer": "请输入一个非负整数",
78
+ "please_enter_days": "请输入天数",
79
+ "password_is_too_short": "密码长度太短",
80
+ "passwords_do_not_match": "两次输入的密码不一致",
81
+ "return_to_wiki_page": "返回维基页面",
82
+ "insert_network_image": "插入网络图片",
83
+ "upload_local_image": "上传本地图片",
84
+ "add_link": "加入链接",
85
+ "file_history": "文件历史",
86
+ "history_version": "历史版本",
87
+ "back_to_viewer": "返回查看页面",
88
+ "link_title": "链接标题",
89
+ "local_draft": "本地草稿",
90
+ "use_draft": "使用草稿",
91
+ "delete_draft": "删除草稿",
92
+ "you_have_an_unsaved_draft_do_you_like_to_use_it": "有未保存的草稿,使用草稿吗?",
93
+ "local_draft_saved": "本地草稿已保存",
94
+ "new_draft": "创建草稿",
95
+ "view_draft": "查看草稿",
96
+ "publish": "发布",
97
+ "this_file_has_a_draft": "这个文件有一个草稿.",
98
+ "delete": "删除",
99
+ "comments": "评论",
100
+ "add_a_comment": "增加评论",
101
+ "no_comment_yet": "还没有评论",
102
+ "Mark_as_Resolved": "标记为已解决",
103
+ "ask_for_review": "发起评审",
104
+ "review_already_exists": "评审已存在",
105
+ "view_review": "查看评审",
106
+ "there_is_an_associated_review_with_this_file": "有一个与此文件相关联的评审。",
107
+ "start_review": "开始评审",
108
+ "this_file_is_in_draft_stage": "该文件处于草稿阶段。",
109
+ "this_file_is_in_review_stage": "该文件处于评审阶段。",
110
+ "this_file_has_been_updated": "这个文件已被修改。",
111
+ "refresh": "刷新",
112
+ "related_files": "相关文件",
113
+ "related_file": "相关文件",
114
+ "no_tags": "没有标签",
115
+ "Date": "日期",
116
+ "Participants": "参与人",
117
+ "Meeting_note": "会议记录",
118
+ "Chooser_document_type": "选择文档类型",
119
+ "Empty": "空",
120
+ "no_related_files": "没有相关文件",
121
+ "no_out_line": "没有大纲",
122
+ "Editing_files_in_this_browser_can_lead_to_slight_display_problems": "在此浏览器中,编辑文件可能导致轻微的显示问题。",
123
+ "no_document_improvement_suggestion": "没有文档改进建议",
124
+ "Hide_side_panel": "隐藏侧旁栏",
125
+ "Show_side_panel": "显示侧旁栏",
126
+ "Show_resolved_comments": "显示已解决的评论",
127
+ "Update": "更新",
128
+ "Width": "宽度",
129
+ "Height": "高度",
130
+ "Full_screen": "全屏",
131
+ "Insert_library_image": "插入资料库图片",
132
+ "Size": "大小",
133
+ "Location": "位置",
134
+ "Last_Update": "更新时间",
135
+ "Tags": "标签",
136
+ "Related_Files": "相关文档",
137
+ "Add_participants": "增加文件参与人",
138
+ "markdownLint": {
139
+ "missing_h1": {
140
+ "description": "文档缺少一级标题",
141
+ "issue" : "缺少一级标题"
142
+ },
143
+ "heading_end_with_colon": {
144
+ "description": "标题末尾的标点符号不应该是冒号",
145
+ "issue": "标题末尾是冒号"
146
+ },
147
+ "heading_increase_irregular": {
148
+ "description": "标题级别一次只能增加一级",
149
+ "issue": "标题级别不规范"
150
+ }
151
+ },
152
+ "Shortcut_help": "快捷键帮助",
153
+ "userHelp": {
154
+ "title": "键盘快捷键",
155
+ "userHelpData": [
156
+ {
157
+ "shortcutType":"列表快捷键",
158
+ "shortcutData": {
159
+ "Make_list": "生成列表",
160
+ "Make_ordered_list": "生成有序列表",
161
+ "Insert_new_item": "插入列表项",
162
+ "Insert_child_in_item": "插入新段落",
163
+ "Increase_depth": "增加列表项深度"
164
+ }
165
+ }, {
166
+ "shortcutType": "标题快捷键",
167
+ "shortcutData": {
168
+ "Heading_1": "一级标题",
169
+ "Heading_2": "二级标题",
170
+ "Heading_3": "三级标题",
171
+ "Heading_4": "四级标题",
172
+ "Heading_5": "五级标题",
173
+ "Heading_6": "六级标题"
174
+ }
175
+ }, {
176
+ "shortcutType": "代码块快捷键",
177
+ "shortcutData": {
178
+ "Make_code_block": "生成代码块",
179
+ "Insert_new_line": "插入行",
180
+ "Escape_code_block": "退出代码块",
181
+ "Insert_indent": "缩进"
182
+ }
183
+ }, {
184
+ "shortcutType": "引用快捷键",
185
+ "shortcutData": {
186
+ "Make_Block_quote": "生成引用",
187
+ "Escape_Block_quote": "退出引用"
188
+ }
189
+ }, {
190
+ "shortcutType": "表格快捷键",
191
+ "shortcutData": {
192
+ "Insert_Table_Row": "插入行",
193
+ "Escape_table": "退出表格"
194
+ }
195
+ }, {
196
+ "shortcutType": "公式快捷键",
197
+ "shortcutData": {
198
+ "Insert_Formula": "插入公式"
199
+ }
200
+ }, {
201
+ "shortcutType":"行内快捷键",
202
+ "shortcutData": {
203
+ "Bold": "粗体",
204
+ "Italic": "斜体",
205
+ "Italic_Bold": "斜体粗体",
206
+ "Inline_code": "行内代码"
207
+ }
208
+ }, {
209
+ "shortcutType": "保存快捷键",
210
+ "shortcutData": {
211
+ "Save_file": "保存文件"
212
+ }
213
+ }, {
214
+ "shortcutType": "图片快捷键",
215
+ "shortcutData": {
216
+ "Paste_screen_shot": "粘贴屏幕截图",
217
+ "Drag_image_from_anywhere_to_upload_it": "从任意地方拖动图像以上传"
218
+ }
219
+ }
220
+ ]
221
+ },
222
+ "The_link_address_is_required": "链接地址是必填项。",
223
+ "The_link_title_is_required": "链接标题是必填项。",
224
+ "The_link_address_is_invalid": "链接地址不合法,请输入一个正确的链接地址。"
225
+ }
package/dist/config.js DELETED
@@ -1,16 +0,0 @@
1
- var serverConfig = {
2
- //serviceUrl: "http://127.0.0.1:8000",
3
- serviceUrl: "http://192.168.1.100:8000",
4
- username: "lj@11.com",
5
- password: "11",
6
- repoID: "79d1fa93-4b5f-4d6c-8fb5-ad3958e1fa47",
7
- userInfo: {
8
- username: 'lj@11.com',
9
- name: 'lj-',
10
- contact_email: 'lj@11.com'
11
- },
12
- filePath: '/xxx.md',
13
- fileName: 'xxx.md',
14
- dirPath: '/'
15
- };
16
- export { serverConfig };