@portabletext/editor 1.47.3 → 1.47.4

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 (39) hide show
  1. package/lib/_chunks-cjs/editor-provider.cjs +125 -100
  2. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  3. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs +0 -5
  4. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -1
  5. package/lib/_chunks-es/editor-provider.js +126 -101
  6. package/lib/_chunks-es/editor-provider.js.map +1 -1
  7. package/lib/_chunks-es/util.is-selection-collapsed.js +0 -5
  8. package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -1
  9. package/lib/behaviors/index.d.cts +404 -543
  10. package/lib/behaviors/index.d.ts +404 -543
  11. package/lib/index.cjs +3 -8
  12. package/lib/index.cjs.map +1 -1
  13. package/lib/index.d.cts +411 -34
  14. package/lib/index.d.ts +411 -34
  15. package/lib/index.js +4 -9
  16. package/lib/index.js.map +1 -1
  17. package/lib/plugins/index.d.cts +411 -34
  18. package/lib/plugins/index.d.ts +411 -34
  19. package/lib/selectors/index.d.cts +404 -33
  20. package/lib/selectors/index.d.ts +404 -33
  21. package/lib/utils/index.cjs +4 -1
  22. package/lib/utils/index.cjs.map +1 -1
  23. package/lib/utils/index.d.cts +404 -33
  24. package/lib/utils/index.d.ts +404 -33
  25. package/lib/utils/index.js +6 -3
  26. package/lib/utils/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/behavior-actions/behavior.action.insert.text.ts +10 -1
  29. package/src/behavior-actions/behavior.actions.ts +0 -18
  30. package/src/behaviors/behavior.perform-event.ts +55 -65
  31. package/src/behaviors/behavior.types.event.ts +7 -9
  32. package/src/editor/Editable.tsx +4 -17
  33. package/src/editor/create-editor.ts +14 -0
  34. package/src/editor/editor-machine.ts +76 -5
  35. package/src/editor/plugins/create-with-event-listeners.ts +0 -6
  36. package/src/editor/plugins/createWithEditableAPI.ts +2 -8
  37. package/src/editor/with-applying-behavior-actions.ts +2 -2
  38. package/src/behavior-actions/behavior.action.blur.ts +0 -8
  39. package/src/behavior-actions/behavior.action.focus.ts +0 -8
@@ -1,16 +1,11 @@
1
- import { isEqualSelectionPoints } from "./util.slice-blocks.js";
2
1
  function getSelectionEndPoint(selection) {
3
2
  return selection ? selection.backward ? selection.anchor : selection.focus : null;
4
3
  }
5
- function isEqualSelections(a, b) {
6
- return !a && !b ? !0 : !a || !b ? !1 : isEqualSelectionPoints(a.anchor, b.anchor) && isEqualSelectionPoints(a.focus, b.focus);
7
- }
8
4
  function isSelectionCollapsed(selection) {
9
5
  return selection ? selection.anchor.path.join() === selection.focus.path.join() && selection.anchor.offset === selection.focus.offset : !1;
10
6
  }
11
7
  export {
12
8
  getSelectionEndPoint,
13
- isEqualSelections,
14
9
  isSelectionCollapsed
15
10
  };
16
11
  //# sourceMappingURL=util.is-selection-collapsed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.is-selection-collapsed.js","sources":["../../src/utils/util.get-selection-end-point.ts","../../src/utils/util.is-equal-selections.ts","../../src/utils/util.is-selection-collapsed.ts"],"sourcesContent":["import type {EditorSelection, EditorSelectionPoint} from '..'\n\n/**\n * @public\n */\nexport function getSelectionEndPoint<\n TEditorSelection extends NonNullable<EditorSelection> | null,\n TEditorSelectionPoint extends\n EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>\n ? EditorSelectionPoint\n : null,\n>(selection: TEditorSelection): TEditorSelectionPoint {\n if (!selection) {\n return null as TEditorSelectionPoint\n }\n\n return (\n selection.backward ? selection.anchor : selection.focus\n ) as TEditorSelectionPoint\n}\n","import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from './util.is-equal-selection-points'\n\n/**\n * @public\n */\nexport function isEqualSelections(a: EditorSelection, b: EditorSelection) {\n if (!a && !b) {\n return true\n }\n\n if (!a || !b) {\n return false\n }\n\n return (\n isEqualSelectionPoints(a.anchor, b.anchor) &&\n isEqualSelectionPoints(a.focus, b.focus)\n )\n}\n","import type {EditorSelection} from '../types/editor'\n\n/**\n * @public\n */\nexport function isSelectionCollapsed(selection: EditorSelection) {\n if (!selection) {\n return false\n }\n\n return (\n selection.anchor.path.join() === selection.focus.path.join() &&\n selection.anchor.offset === selection.focus.offset\n )\n}\n"],"names":["getSelectionEndPoint","selection","backward","anchor","focus","isEqualSelections","a","b","isEqualSelectionPoints","isSelectionCollapsed","path","join","offset"],"mappings":";AAKO,SAASA,qBAMdC,WAAoD;AACpD,SAAKA,YAKHA,UAAUC,WAAWD,UAAUE,SAASF,UAAUG,QAJ3C;AAMX;ACbgBC,SAAAA,kBAAkBC,GAAoBC,GAAoB;AACpE,SAAA,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,uBAAuBF,EAAEH,QAAQI,EAAEJ,MAAM,KACzCK,uBAAuBF,EAAEF,OAAOG,EAAEH,KAAK;AAE3C;ACdO,SAASK,qBAAqBR,WAA4B;AAC/D,SAAKA,YAKHA,UAAUE,OAAOO,KAAKC,KAAAA,MAAWV,UAAUG,MAAMM,KAAKC,KAAAA,KACtDV,UAAUE,OAAOS,WAAWX,UAAUG,MAAMQ,SALrC;AAOX;"}
1
+ {"version":3,"file":"util.is-selection-collapsed.js","sources":["../../src/utils/util.get-selection-end-point.ts","../../src/utils/util.is-selection-collapsed.ts"],"sourcesContent":["import type {EditorSelection, EditorSelectionPoint} from '..'\n\n/**\n * @public\n */\nexport function getSelectionEndPoint<\n TEditorSelection extends NonNullable<EditorSelection> | null,\n TEditorSelectionPoint extends\n EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>\n ? EditorSelectionPoint\n : null,\n>(selection: TEditorSelection): TEditorSelectionPoint {\n if (!selection) {\n return null as TEditorSelectionPoint\n }\n\n return (\n selection.backward ? selection.anchor : selection.focus\n ) as TEditorSelectionPoint\n}\n","import type {EditorSelection} from '../types/editor'\n\n/**\n * @public\n */\nexport function isSelectionCollapsed(selection: EditorSelection) {\n if (!selection) {\n return false\n }\n\n return (\n selection.anchor.path.join() === selection.focus.path.join() &&\n selection.anchor.offset === selection.focus.offset\n )\n}\n"],"names":["getSelectionEndPoint","selection","backward","anchor","focus","isSelectionCollapsed","path","join","offset"],"mappings":"AAKO,SAASA,qBAMdC,WAAoD;AACpD,SAAKA,YAKHA,UAAUC,WAAWD,UAAUE,SAASF,UAAUG,QAJ3C;AAMX;ACdO,SAASC,qBAAqBJ,WAA4B;AAC/D,SAAKA,YAKHA,UAAUE,OAAOG,KAAKC,KAAAA,MAAWN,UAAUG,MAAME,KAAKC,KAAAA,KACtDN,UAAUE,OAAOK,WAAWP,UAAUG,MAAMI,SALrC;AAOX;"}