@kaitify/vue 0.0.1-beta.11 → 0.0.1-beta.12

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.
@@ -1477,6 +1477,12 @@ const deleteProperty = (val, propertyName) => {
1477
1477
  });
1478
1478
  return newObj;
1479
1479
  };
1480
+ const isOnlyTab = (e) => {
1481
+ return e.key.toLocaleLowerCase() == "tab" && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey;
1482
+ };
1483
+ const isTabWithShift = (e) => {
1484
+ return e.key.toLocaleLowerCase() == "tab" && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey;
1485
+ };
1480
1486
  class KNode {
1481
1487
  constructor() {
1482
1488
  __publicField(this, "key", createUniqueKey());
@@ -3358,8 +3364,7 @@ const setDomObserve = (editor) => {
3358
3364
  }
3359
3365
  if (hasUpdate) {
3360
3366
  illegalDoms.forEach((item) => {
3361
- var _a;
3362
- (_a = item.parentNode) == null ? void 0 : _a.removeChild(item);
3367
+ item.remove();
3363
3368
  });
3364
3369
  editor.updateView();
3365
3370
  }
@@ -7371,7 +7376,28 @@ const IndentExtension = () => Extension.create({
7371
7376
  }
7372
7377
  return styles2;
7373
7378
  },
7379
+ onKeydown(event2) {
7380
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7381
+ if (isOnlyTab(event2) && ((_b = (_a = this.commands).canUseIndent) == null ? void 0 : _b.call(_a))) {
7382
+ event2.preventDefault();
7383
+ (_d = (_c = this.commands).setIncreaseIndent) == null ? void 0 : _d.call(_c);
7384
+ }
7385
+ if (isTabWithShift(event2) && ((_f = (_e = this.commands).canUseIndent) == null ? void 0 : _f.call(_e))) {
7386
+ event2.preventDefault();
7387
+ (_h = (_g = this.commands).setDecreaseIndent) == null ? void 0 : _h.call(_g);
7388
+ }
7389
+ },
7374
7390
  addCommands() {
7391
+ const canUseIndent = () => {
7392
+ var _a, _b, _c, _d;
7393
+ if ((_b = (_a = this.commands).hasCodeBlock) == null ? void 0 : _b.call(_a)) {
7394
+ return false;
7395
+ }
7396
+ if (!!((_d = (_c = this.commands).canCreateInnerList) == null ? void 0 : _d.call(_c))) {
7397
+ return false;
7398
+ }
7399
+ return true;
7400
+ };
7375
7401
  const setIncreaseIndent = async () => {
7376
7402
  if (this.selection.collapsed()) {
7377
7403
  const blockNode = this.selection.start.node.getBlock();
@@ -7429,6 +7455,7 @@ const IndentExtension = () => Extension.create({
7429
7455
  await this.updateView();
7430
7456
  };
7431
7457
  return {
7458
+ canUseIndent,
7432
7459
  setDecreaseIndent,
7433
7460
  setIncreaseIndent
7434
7461
  };
@@ -7813,9 +7840,6 @@ const listMergeHandler = ({ editor, node }) => {
7813
7840
  }
7814
7841
  }
7815
7842
  };
7816
- const isOnlyTab$1 = (e) => {
7817
- return e.key.toLocaleLowerCase() == "tab" && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey;
7818
- };
7819
7843
  const getUnsetListItemNode = (matchNode, options) => {
7820
7844
  while (true) {
7821
7845
  if (!matchNode) {
@@ -7906,7 +7930,7 @@ const ListExtension = () => Extension.create({
7906
7930
  },
7907
7931
  onKeydown(event2) {
7908
7932
  var _a, _b, _c, _d;
7909
- if (isOnlyTab$1(event2)) {
7933
+ if (isOnlyTab(event2)) {
7910
7934
  const result = (_b = (_a = this.commands).canCreateInnerList) == null ? void 0 : _b.call(_a);
7911
7935
  if (!!result) {
7912
7936
  event2.preventDefault();
@@ -35076,9 +35100,6 @@ const isNeedUpdate = (editor, node, language, textContent) => {
35076
35100
  return true;
35077
35101
  }
35078
35102
  };
35079
- const isOnlyTab = (e) => {
35080
- return e.key.toLocaleLowerCase() == "tab" && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey;
35081
- };
35082
35103
  const CodeBlockExtension = () => Extension.create({
35083
35104
  name: "codeBlock",
35084
35105
  extraKeepTags: ["pre"],
@@ -36657,7 +36678,7 @@ class Editor {
36657
36678
  __publicField(this, "blockRenderTag", "p");
36658
36679
  __publicField(this, "emptyRenderTags", ["meta", "link", "style", "script", "title", "base", "noscript", "template", "annotation", "input", "form", "button"]);
36659
36680
  __publicField(this, "extraKeepTags", []);
36660
- __publicField(this, "extensions", [TextExtension(), ImageExtension(), VideoExtension(), HistoryExtension(), BoldExtension(), ItalicExtension(), StrikethroughExtension(), UnderlineExtension(), SuperscriptExtension(), SubscriptExtension(), CodeExtension(), FontSizeExtension(), FontFamilyExtension(), ColorExtension(), BackColorExtension(), LinkExtension(), AlignExtension(), LineHeightExtension(), IndentExtension(), HorizontalExtension(), BlockquoteExtension(), HeadingExtension(), ListExtension(), TaskExtension(), MathExtension(), CodeBlockExtension(), AttachmentExtension(), TableExtension()]);
36681
+ __publicField(this, "extensions", [TextExtension(), ImageExtension(), VideoExtension(), HistoryExtension(), BoldExtension(), ItalicExtension(), StrikethroughExtension(), UnderlineExtension(), SuperscriptExtension(), SubscriptExtension(), CodeExtension(), FontSizeExtension(), FontFamilyExtension(), ColorExtension(), BackColorExtension(), LinkExtension(), AlignExtension(), LineHeightExtension(), HorizontalExtension(), BlockquoteExtension(), HeadingExtension(), ListExtension(), IndentExtension(), TaskExtension(), MathExtension(), CodeBlockExtension(), AttachmentExtension(), TableExtension()]);
36661
36682
  __publicField(this, "formatRules", [fomratBlockTagParse, formatBlockInChildren, formatUneditableNoodes, formatPlaceholderMerge, formatZeroWidthTextMerge, formatLineBreakText, formatSiblingNodesMerge, formatParentNodeMerge]);
36662
36683
  __publicField(this, "domParseNodeCallback");
36663
36684
  __publicField(this, "onUpdateView");
@@ -42458,7 +42479,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
42458
42479
  if (!((_a = state.value.editor) == null ? void 0 : _a.selection.focused())) {
42459
42480
  return true;
42460
42481
  }
42461
- if (!!((_c = (_b = state.value.editor.commands).getCodeBlock) == null ? void 0 : _c.call(_b))) {
42482
+ if (!((_c = (_b = state.value.editor.commands).canUseIndent) == null ? void 0 : _c.call(_b))) {
42462
42483
  return true;
42463
42484
  }
42464
42485
  return props.disabled;
@@ -42502,7 +42523,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
42502
42523
  if (!((_a = state.value.editor) == null ? void 0 : _a.selection.focused())) {
42503
42524
  return true;
42504
42525
  }
42505
- if (!!((_c = (_b = state.value.editor.commands).getCodeBlock) == null ? void 0 : _c.call(_b))) {
42526
+ if (!((_c = (_b = state.value.editor.commands).canUseIndent) == null ? void 0 : _c.call(_b))) {
42506
42527
  return true;
42507
42528
  }
42508
42529
  return props.disabled;