@portabletext/editor 1.46.0 → 1.47.1

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 (97) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +7 -7
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
  4. package/lib/_chunks-cjs/editor-provider.cjs +411 -327
  5. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  6. package/lib/_chunks-cjs/parse-blocks.cjs +4 -4
  7. package/lib/_chunks-cjs/parse-blocks.cjs.map +1 -1
  8. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
  9. package/lib/_chunks-es/behavior.core.js +7 -7
  10. package/lib/_chunks-es/behavior.core.js.map +1 -1
  11. package/lib/_chunks-es/behavior.markdown.js.map +1 -1
  12. package/lib/_chunks-es/editor-provider.js +412 -328
  13. package/lib/_chunks-es/editor-provider.js.map +1 -1
  14. package/lib/_chunks-es/parse-blocks.js +4 -4
  15. package/lib/_chunks-es/parse-blocks.js.map +1 -1
  16. package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
  17. package/lib/behaviors/index.cjs.map +1 -1
  18. package/lib/behaviors/index.d.cts +590 -28
  19. package/lib/behaviors/index.d.ts +590 -28
  20. package/lib/behaviors/index.js.map +1 -1
  21. package/lib/index.cjs +4 -4
  22. package/lib/index.cjs.map +1 -1
  23. package/lib/index.d.cts +71 -3
  24. package/lib/index.d.ts +71 -3
  25. package/lib/index.js +4 -4
  26. package/lib/index.js.map +1 -1
  27. package/lib/plugins/index.cjs.map +1 -1
  28. package/lib/plugins/index.d.cts +78 -23
  29. package/lib/plugins/index.d.ts +78 -23
  30. package/lib/plugins/index.js.map +1 -1
  31. package/lib/selectors/index.d.cts +79 -27
  32. package/lib/selectors/index.d.ts +79 -27
  33. package/lib/utils/index.d.cts +84 -29
  34. package/lib/utils/index.d.ts +84 -29
  35. package/package.json +6 -6
  36. package/src/behavior-actions/behavior.action.insert.block.ts +1 -1
  37. package/src/behavior-actions/behavior.action.move.backward.ts +12 -0
  38. package/src/behavior-actions/behavior.action.move.forward.ts +11 -0
  39. package/src/behavior-actions/behavior.action.split.block.ts +1 -1
  40. package/src/behavior-actions/behavior.actions.ts +18 -0
  41. package/src/behavior-actions/behavior.guards.ts +1 -1
  42. package/src/behaviors/behavior.core.decorators.ts +4 -4
  43. package/src/behaviors/behavior.core.insert-break.ts +4 -4
  44. package/src/behaviors/behavior.decorator-pair.ts +1 -1
  45. package/src/behaviors/behavior.links.ts +1 -1
  46. package/src/behaviors/behavior.markdown.ts +1 -1
  47. package/src/behaviors/behavior.perform-event.ts +1 -1
  48. package/src/behaviors/behavior.types.event.ts +10 -0
  49. package/src/converters/converter.portable-text.deserialize.test.ts +2 -3
  50. package/src/converters/converter.text-html.deserialize.test.ts +62 -5
  51. package/src/converters/converter.text-html.serialize.test.ts +9 -5
  52. package/src/converters/converter.text-html.ts +66 -64
  53. package/src/converters/converter.text-plain.test.ts +9 -4
  54. package/src/converters/converter.text-plain.ts +91 -87
  55. package/src/converters/converters.core.ts +13 -8
  56. package/src/editor/Editable.tsx +10 -5
  57. package/src/editor/PortableTextEditor.tsx +5 -5
  58. package/src/editor/__tests__/PortableTextEditorTester.tsx +4 -3
  59. package/src/editor/__tests__/insert-block.test.tsx +10 -10
  60. package/src/editor/__tests__/self-solving.test.tsx +2 -2
  61. package/src/editor/components/Synchronizer.tsx +1 -1
  62. package/src/editor/create-editor.ts +51 -18
  63. package/src/editor/editor-machine.ts +1 -1
  64. package/src/editor/{define-schema.ts → editor-schema.ts} +114 -5
  65. package/src/editor/editor-snapshot.ts +1 -1
  66. package/src/editor/get-active-decorators.ts +2 -2
  67. package/src/editor/{create-editor-schema.ts → legacy-schema.ts} +3 -3
  68. package/src/editor/mutation-machine.ts +1 -1
  69. package/src/editor/plugins/createWithObjectKeys.ts +6 -9
  70. package/src/editor/plugins/createWithPatches.ts +12 -11
  71. package/src/editor/plugins/createWithPortableTextBlockStyle.ts +2 -6
  72. package/src/editor/plugins/createWithPortableTextMarkModel.ts +15 -12
  73. package/src/editor/plugins/createWithSchemaTypes.ts +24 -16
  74. package/src/editor/plugins/createWithUndoRedo.ts +3 -4
  75. package/src/editor/plugins/createWithUtils.ts +12 -10
  76. package/src/editor/plugins/with-plugins.ts +5 -15
  77. package/src/editor/range-decorations-machine.ts +1 -1
  78. package/src/editor/sync-machine.ts +1 -1
  79. package/src/index.ts +2 -2
  80. package/src/internal-utils/__tests__/operationToPatches.test.ts +12 -10
  81. package/src/internal-utils/__tests__/patchToOperations.test.ts +3 -2
  82. package/src/internal-utils/__tests__/values.test.ts +3 -2
  83. package/src/internal-utils/applyPatch.ts +7 -9
  84. package/src/internal-utils/create-test-snapshot.ts +1 -1
  85. package/src/internal-utils/drag-selection.test.ts +1 -1
  86. package/src/internal-utils/operationToPatches.ts +4 -6
  87. package/src/internal-utils/parse-blocks.test.ts +1 -1
  88. package/src/internal-utils/parse-blocks.ts +8 -7
  89. package/src/internal-utils/slate-children-to-blocks.ts +1 -1
  90. package/src/internal-utils/slate-utils.ts +1 -1
  91. package/src/internal-utils/validateValue.ts +4 -6
  92. package/src/internal-utils/values.ts +5 -5
  93. package/src/plugins/plugin.decorator-shortcut.ts +1 -1
  94. package/src/plugins/plugin.markdown.test.tsx +1 -1
  95. package/src/plugins/plugin.markdown.tsx +1 -1
  96. package/src/selectors/selector.get-selection-text.test.ts +1 -1
  97. package/src/selectors/selector.get-trimmed-selection.test.ts +1 -1
@@ -3,8 +3,8 @@ import React from 'react'
3
3
  import {describe, expect, test, vi} from 'vitest'
4
4
  import {render} from 'vitest-browser-react'
5
5
  import {PortableTextEditable, type Editor} from '..'
6
- import {defineSchema} from '../editor/define-schema'
7
6
  import {EditorProvider} from '../editor/editor-provider'
7
+ import {defineSchema} from '../editor/editor-schema'
8
8
  import {getTersePt} from '../internal-utils/terse-pt'
9
9
  import {createTestKeyGenerator} from '../internal-utils/test-key-generator'
10
10
  import {getTextMarks} from '../internal-utils/text-marks'
@@ -3,8 +3,8 @@ import {
3
3
  createMarkdownBehaviors,
4
4
  type MarkdownBehaviorsConfig,
5
5
  } from '../behaviors/behavior.markdown'
6
- import type {EditorSchema} from '../editor/define-schema'
7
6
  import {useEditor} from '../editor/editor-provider'
7
+ import type {EditorSchema} from '../editor/editor-schema'
8
8
  import {DecoratorShortcutPlugin} from './plugin.decorator-shortcut'
9
9
 
10
10
  /**
@@ -1,7 +1,7 @@
1
1
  import type {PortableTextBlock} from '@sanity/types'
2
2
  import {expect, test} from 'vitest'
3
3
  import type {EditorSelection} from '..'
4
- import {compileSchemaDefinition, defineSchema} from '../editor/define-schema'
4
+ import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
5
5
  import {createTestSnapshot} from '../internal-utils/create-test-snapshot'
6
6
  import {getSelectionText} from './selector.get-selection-text'
7
7
 
@@ -1,6 +1,6 @@
1
1
  import type {PortableTextBlock} from '@sanity/types'
2
2
  import {describe, expect, test} from 'vitest'
3
- import {compileSchemaDefinition, defineSchema} from '../editor/define-schema'
3
+ import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
4
4
  import {createTestSnapshot} from '../internal-utils/create-test-snapshot'
5
5
  import {parseBlock} from '../internal-utils/parse-blocks'
6
6
  import {createTestKeyGenerator} from '../internal-utils/test-key-generator'