@ones-editor/editor 2.6.1-beta.1 → 2.6.1-beta.3

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.
package/dist/index.js CHANGED
@@ -10588,6 +10588,10 @@ var __publicField = (obj, key, value) => {
10588
10588
  ];
10589
10589
  return checkChar(str.charCodeAt(0), CJKRange);
10590
10590
  }
10591
+ function isCJKPunctuation(char) {
10592
+ const reg = /[\u3000-\u303F\uFF00-\uFFEF\u2000-\u206F\u2E00-\u2E7F]/;
10593
+ return reg.test(char);
10594
+ }
10591
10595
  function trimChar(s, char) {
10592
10596
  let c = char;
10593
10597
  assert(logger$4O, c.length === 1, "invalid char length");
@@ -25082,9 +25086,17 @@ var __publicField = (obj, key, value) => {
25082
25086
  length: 1
25083
25087
  };
25084
25088
  }
25089
+ let charType = "text";
25090
+ if (isSpace(op.insert)) {
25091
+ charType = "space";
25092
+ } else if (isCJKPunctuation(op.insert)) {
25093
+ charType = "cjk_punctuation";
25094
+ } else if (isCJK(op.insert)) {
25095
+ charType = "cjk";
25096
+ }
25085
25097
  return {
25086
25098
  op,
25087
- charType: isSpace(op.insert) ? "space" : "text",
25099
+ charType,
25088
25100
  offset: newOffset,
25089
25101
  length: op.insert.length
25090
25102
  };
@@ -25110,9 +25122,17 @@ var __publicField = (obj, key, value) => {
25110
25122
  length: 1
25111
25123
  };
25112
25124
  }
25125
+ let charType = "text";
25126
+ if (isSpace(op.insert)) {
25127
+ charType = "space";
25128
+ } else if (isCJKPunctuation(op.insert)) {
25129
+ charType = "cjk_punctuation";
25130
+ } else if (isCJK(op.insert)) {
25131
+ charType = "cjk";
25132
+ }
25113
25133
  return {
25114
25134
  op,
25115
- charType: isSpace(op.insert) ? "space" : "text",
25135
+ charType,
25116
25136
  offset,
25117
25137
  length: op.insert.length
25118
25138
  };
@@ -25173,6 +25193,7 @@ var __publicField = (obj, key, value) => {
25173
25193
  return offset - 1;
25174
25194
  }
25175
25195
  let start = offset;
25196
+ let find = offsetInfo.charType;
25176
25197
  if (offsetInfo.charType === "space") {
25177
25198
  const startInfo2 = findPrevOffsetNotType(editor, block, start, "space");
25178
25199
  if (!startInfo2) {
@@ -25185,8 +25206,9 @@ var __publicField = (obj, key, value) => {
25185
25206
  return startInfo2.offset;
25186
25207
  }
25187
25208
  start = startInfo2.offset;
25209
+ find = getOffsetInfoBefore(editor, block, start).charType;
25188
25210
  }
25189
- const startInfo = findPrevOffsetNotType(editor, block, start, "text");
25211
+ const startInfo = findPrevOffsetNotType(editor, block, start, find);
25190
25212
  if (!startInfo)
25191
25213
  return 0;
25192
25214
  return startInfo.offset + startInfo.length;
@@ -25201,6 +25223,7 @@ var __publicField = (obj, key, value) => {
25201
25223
  return offset + 1;
25202
25224
  }
25203
25225
  let start = offset;
25226
+ let find = offsetInfo.charType;
25204
25227
  if (offsetInfo.charType === "space") {
25205
25228
  const startInfo2 = findAfterOffsetNotType(editor, block, start, "space");
25206
25229
  if (!startInfo2) {
@@ -25213,8 +25236,9 @@ var __publicField = (obj, key, value) => {
25213
25236
  return startInfo2.offset;
25214
25237
  }
25215
25238
  start = startInfo2.offset;
25239
+ find = getOffsetInfoAfter(editor, block, start).charType;
25216
25240
  }
25217
- const startInfo = findAfterOffsetNotType(editor, block, start, "text");
25241
+ const startInfo = findAfterOffsetNotType(editor, block, start, find);
25218
25242
  if (!startInfo)
25219
25243
  return getBlockTextLength$6(editor, block);
25220
25244
  return startInfo.offset;
@@ -29398,8 +29422,8 @@ ${codeText}
29398
29422
  "Cmd+ArrowRight": editorMoveLineEnd,
29399
29423
  "Option+ArrowLeft": editorMoveWordLeft,
29400
29424
  "Option+ArrowRight": editorMoveWordEnd,
29401
- "Ctrl+Shift+ArrowLeft": editorSelectWordLeft,
29402
- "Ctrl+Shift+ArrowRight": editorSelectWordEnd,
29425
+ "Option+Shift+ArrowLeft": editorSelectWordLeft,
29426
+ "Option+Shift+ArrowRight": editorSelectWordEnd,
29403
29427
  "Cmd+Shift+ArrowLeft": editorSelectLineHome,
29404
29428
  "Cmd+Shift+ArrowRight": editorSelectLineEnd,
29405
29429
  "Ctrl+A": editorMoveBlockStart,
@@ -29422,7 +29446,9 @@ ${codeText}
29422
29446
  "Ctrl+Delete": editorHandleDeleteRightWord,
29423
29447
  "Ctrl+Backspace": editorHandleDeleteLeftWord,
29424
29448
  "Ctrl+ArrowLeft": editorMoveWordLeft,
29425
- "Ctrl+ArrowRight": editorMoveWordEnd
29449
+ "Ctrl+ArrowRight": editorMoveWordEnd,
29450
+ "Ctrl+Shift+ArrowLeft": editorSelectWordLeft,
29451
+ "Ctrl+Shift+ArrowRight": editorSelectWordEnd
29426
29452
  };
29427
29453
  const isMac = clientType.isMac;
29428
29454
  const CustomShortcuts = isMac ? MacShortcuts : WinLinuxShortcuts;
@@ -61497,7 +61523,8 @@ $$${mathData.mathjaxText}$$
61497
61523
  "text/style-code": "code",
61498
61524
  "text/style-sub": "subscript",
61499
61525
  "text/style-super": "superscript",
61500
- link: "link"
61526
+ link: "link",
61527
+ "insert-link": "link"
61501
61528
  };
61502
61529
  function getTextCommands(editor, blockCommands) {
61503
61530
  const styleCommandsSet = new Set(Object.keys(TextCommands));
@@ -61514,7 +61541,7 @@ $$${mathData.mathjaxText}$$
61514
61541
  const range = editor.selection.range;
61515
61542
  const allCommands = editor.editorCommandProviders.getCommands(range);
61516
61543
  const textCommands = getTextCommands(editor, allCommands);
61517
- const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link");
61544
+ const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link" || c.id === "insert-link");
61518
61545
  if (!command) {
61519
61546
  return false;
61520
61547
  }
@@ -61553,7 +61580,7 @@ $$${mathData.mathjaxText}$$
61553
61580
  "CtrlOrCmd+I": (editor) => executeShortcut$1(editor, "style-italic"),
61554
61581
  "CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "style-underline"),
61555
61582
  "CtrlOrCmd+D": (editor) => executeShortcut$1(editor, "style-strikethrough"),
61556
- "CtrlOrCmd+K": (editor) => executeShortcut$1(editor, "link"),
61583
+ "CtrlOrCmd+K": (editor) => executeShortcut$1(editor, "insert-link"),
61557
61584
  ...headingShortcut()
61558
61585
  };
61559
61586
  function executeShortcut(editor) {
@@ -92406,7 +92433,7 @@ ${data2.plantumlText}
92406
92433
  }
92407
92434
  }
92408
92435
  });
92409
- editor.version = "2.6.1-beta.1";
92436
+ editor.version = "2.6.1-beta.3";
92410
92437
  return editor;
92411
92438
  }
92412
92439
  function isDoc(doc2) {
@@ -92519,7 +92546,7 @@ ${data2.plantumlText}
92519
92546
  }
92520
92547
  });
92521
92548
  OnesEditorToolbar.register(editor);
92522
- editor.version = "2.6.1-beta.1";
92549
+ editor.version = "2.6.1-beta.3";
92523
92550
  return editor;
92524
92551
  }
92525
92552
  async function showDocVersions(editor, options, serverUrl) {
@@ -138954,6 +138981,7 @@ ${data2.plantumlText}
138954
138981
  exports2.isBox = isBox;
138955
138982
  exports2.isBoxOp = isBoxOp;
138956
138983
  exports2.isCJK = isCJK;
138984
+ exports2.isCJKPunctuation = isCJKPunctuation;
138957
138985
  exports2.isChildContainer = isChildContainer;
138958
138986
  exports2.isChildNode = isChildNode;
138959
138987
  exports2.isClipboardEmpty = isClipboardEmpty$1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.6.1-beta.1",
3
+ "version": "2.6.1-beta.3",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {