@portabletext/editor 1.50.4 → 1.50.6

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 (43) hide show
  1. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +4 -14
  2. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  3. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +4 -14
  4. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  5. package/lib/behaviors/index.d.cts +9 -1
  6. package/lib/behaviors/index.d.ts +9 -1
  7. package/lib/index.cjs +271 -205
  8. package/lib/index.cjs.map +1 -1
  9. package/lib/index.d.cts +9 -1
  10. package/lib/index.d.ts +9 -1
  11. package/lib/index.js +280 -214
  12. package/lib/index.js.map +1 -1
  13. package/lib/plugins/index.d.cts +9 -1
  14. package/lib/plugins/index.d.ts +9 -1
  15. package/lib/selectors/index.d.cts +9 -1
  16. package/lib/selectors/index.d.ts +9 -1
  17. package/lib/utils/index.d.cts +9 -1
  18. package/lib/utils/index.d.ts +9 -1
  19. package/package.json +3 -3
  20. package/src/behaviors/behavior.abstract.delete.ts +6 -2
  21. package/src/behaviors/behavior.abstract.ts +1 -1
  22. package/src/editor/create-slate-editor.tsx +2 -0
  23. package/src/editor/editor-selector.ts +10 -4
  24. package/src/editor/editor-snapshot.ts +12 -5
  25. package/src/editor/get-active-annotations.ts +15 -0
  26. package/src/editor/get-active-decorators.ts +23 -9
  27. package/src/editor/plugins/create-with-event-listeners.ts +9 -3
  28. package/src/editor/plugins/createWithEditableAPI.ts +16 -14
  29. package/src/editor/plugins/createWithPortableTextMarkModel.ts +26 -190
  30. package/src/editor/plugins/slate-plugin.update-mark-state.ts +21 -0
  31. package/src/editor/plugins/slate-plugin.update-value.ts +1 -4
  32. package/src/editor/plugins/with-plugins.ts +8 -1
  33. package/src/internal-utils/create-test-snapshot.ts +2 -1
  34. package/src/internal-utils/mark-state.ts +172 -0
  35. package/src/internal-utils/slate-utils.ts +52 -0
  36. package/src/operations/behavior.operation.decorator.add.ts +7 -11
  37. package/src/operations/behavior.operation.insert.text.ts +48 -8
  38. package/src/selectors/selector.get-active-annotations.ts +2 -1
  39. package/src/selectors/selector.is-active-annotation.ts +7 -39
  40. package/src/selectors/selector.is-active-decorator.ts +1 -1
  41. package/src/types/editor.ts +3 -0
  42. package/src/editor/get-value.ts +0 -18
  43. package/src/selectors/selector.get-active-annotations.test.ts +0 -141
package/lib/index.d.cts CHANGED
@@ -806,7 +806,6 @@ export declare type EditorConfig = {
806
806
  * @public
807
807
  */
808
808
  export declare type EditorContext = {
809
- activeDecorators: Array<string>
810
809
  converters: Array<Converter>
811
810
  keyGenerator: () => string
812
811
  readOnly: boolean
@@ -2770,6 +2769,8 @@ export declare type EditorSnapshot = {
2770
2769
  * Do not rely on this externally
2771
2770
  */
2772
2771
  beta: {
2772
+ activeAnnotations: Array<string>
2773
+ activeDecorators: Array<string>
2773
2774
  hasTag: HasTag
2774
2775
  internalDrag:
2775
2776
  | {
@@ -2991,6 +2992,11 @@ export declare type LoadingChange = {
2991
2992
  isLoading: boolean
2992
2993
  }
2993
2994
 
2995
+ declare type MarkState = {
2996
+ state: 'changed' | 'unchanged'
2997
+ marks: Array<string>
2998
+ }
2999
+
2994
3000
  declare type MIMEType = `${string}/${string}`
2995
3001
 
2996
3002
  declare type MouseBehaviorEvent = {
@@ -3743,6 +3749,8 @@ declare interface PortableTextSlateEditor extends ReactEditor {
3743
3749
  isTextSpan: (value: unknown) => value is PortableTextSpan
3744
3750
  isListBlock: (value: unknown) => value is PortableTextListBlock
3745
3751
  value: Array<PortableTextBlock>
3752
+ decoratorState: Record<string, boolean | undefined>
3753
+ markState: MarkState | undefined
3746
3754
  /**
3747
3755
  * Use hotkeys
3748
3756
  */
package/lib/index.d.ts CHANGED
@@ -806,7 +806,6 @@ export declare type EditorConfig = {
806
806
  * @public
807
807
  */
808
808
  export declare type EditorContext = {
809
- activeDecorators: Array<string>
810
809
  converters: Array<Converter>
811
810
  keyGenerator: () => string
812
811
  readOnly: boolean
@@ -2770,6 +2769,8 @@ export declare type EditorSnapshot = {
2770
2769
  * Do not rely on this externally
2771
2770
  */
2772
2771
  beta: {
2772
+ activeAnnotations: Array<string>
2773
+ activeDecorators: Array<string>
2773
2774
  hasTag: HasTag
2774
2775
  internalDrag:
2775
2776
  | {
@@ -2991,6 +2992,11 @@ export declare type LoadingChange = {
2991
2992
  isLoading: boolean
2992
2993
  }
2993
2994
 
2995
+ declare type MarkState = {
2996
+ state: 'changed' | 'unchanged'
2997
+ marks: Array<string>
2998
+ }
2999
+
2994
3000
  declare type MIMEType = `${string}/${string}`
2995
3001
 
2996
3002
  declare type MouseBehaviorEvent = {
@@ -3743,6 +3749,8 @@ declare interface PortableTextSlateEditor extends ReactEditor {
3743
3749
  isTextSpan: (value: unknown) => value is PortableTextSpan
3744
3750
  isListBlock: (value: unknown) => value is PortableTextListBlock
3745
3751
  value: Array<PortableTextBlock>
3752
+ decoratorState: Record<string, boolean | undefined>
3753
+ markState: MarkState | undefined
3746
3754
  /**
3747
3755
  * Use hotkeys
3748
3756
  */