@portabletext/editor 1.48.13 → 1.48.14

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 (67) hide show
  1. package/lib/_chunks-cjs/editor-provider.cjs +633 -628
  2. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  3. package/lib/_chunks-es/editor-provider.js +634 -629
  4. package/lib/_chunks-es/editor-provider.js.map +1 -1
  5. package/lib/behaviors/index.cjs.map +1 -1
  6. package/lib/behaviors/index.d.cts +4 -2564
  7. package/lib/behaviors/index.d.ts +4 -2564
  8. package/lib/behaviors/index.js.map +1 -1
  9. package/lib/index.d.cts +5 -2564
  10. package/lib/index.d.ts +5 -2564
  11. package/lib/plugins/index.cjs +1 -7
  12. package/lib/plugins/index.cjs.map +1 -1
  13. package/lib/plugins/index.d.cts +4 -2569
  14. package/lib/plugins/index.d.ts +4 -2569
  15. package/lib/plugins/index.js +2 -8
  16. package/lib/plugins/index.js.map +1 -1
  17. package/lib/selectors/index.d.cts +3 -2563
  18. package/lib/selectors/index.d.ts +3 -2563
  19. package/lib/utils/index.d.cts +5 -2564
  20. package/lib/utils/index.d.ts +5 -2564
  21. package/package.json +1 -1
  22. package/src/behaviors/behavior.abstract.keyboard.ts +16 -0
  23. package/src/behaviors/{behavior.default.ts → behavior.abstract.ts} +3 -3
  24. package/src/behaviors/behavior.core.ts +0 -3
  25. package/src/behaviors/behavior.perform-event.ts +27 -51
  26. package/src/behaviors/behavior.types.action.ts +1 -11
  27. package/src/editor/PortableTextEditor.tsx +1 -1
  28. package/src/editor/editor-machine.ts +7 -4
  29. package/src/editor/mutation-machine.ts +6 -6
  30. package/src/editor/plugins/create-with-event-listeners.ts +25 -25
  31. package/src/editor/plugins/createWithEditableAPI.ts +3 -3
  32. package/src/editor/plugins/createWithPatches.ts +13 -5
  33. package/src/editor/plugins/createWithPortableTextMarkModel.ts +5 -5
  34. package/src/editor/plugins/createWithUndoRedo.ts +8 -8
  35. package/src/editor/with-applying-behavior-operations.ts +18 -0
  36. package/src/editor/{with-applying-behavior-actions.ts → with-undo-step.ts} +1 -19
  37. package/src/index.ts +1 -1
  38. package/src/{behavior-actions/behavior.action.annotation.add.ts → operations/behavior.operation.annotation.add.ts} +7 -7
  39. package/src/{behavior-actions/behavior.action.annotation.remove.ts → operations/behavior.operation.annotation.remove.ts} +6 -6
  40. package/src/{behavior-actions/behavior.action.block.set.ts → operations/behavior.operation.block.set.ts} +14 -14
  41. package/src/{behavior-actions/behavior.action.block.unset.ts → operations/behavior.operation.block.unset.ts} +19 -17
  42. package/src/{behavior-actions/behavior.action.decorator.add.ts → operations/behavior.operation.decorator.add.ts} +10 -10
  43. package/src/operations/behavior.operation.delete.backward.ts +8 -0
  44. package/src/operations/behavior.operation.delete.block.ts +24 -0
  45. package/src/operations/behavior.operation.delete.forward.ts +8 -0
  46. package/src/{behavior-actions/behavior.action.delete.ts → operations/behavior.operation.delete.ts} +8 -8
  47. package/src/{behavior-actions/behavior.action.insert-inline-object.ts → operations/behavior.operation.insert-inline-object.ts} +11 -11
  48. package/src/{behavior-actions/behavior.action.insert-span.ts → operations/behavior.operation.insert-span.ts} +15 -15
  49. package/src/{behavior-actions/behavior.action.insert.block.ts → operations/behavior.operation.insert.block.ts} +8 -8
  50. package/src/operations/behavior.operation.insert.text.ts +17 -0
  51. package/src/operations/behavior.operation.move.backward.ts +12 -0
  52. package/src/operations/behavior.operation.move.block.ts +16 -0
  53. package/src/operations/behavior.operation.move.forward.ts +11 -0
  54. package/src/operations/behavior.operation.select.ts +15 -0
  55. package/src/operations/behavior.operations.ts +239 -0
  56. package/src/plugins/index.ts +0 -1
  57. package/src/behavior-actions/behavior.action.delete.backward.ts +0 -7
  58. package/src/behavior-actions/behavior.action.delete.block.ts +0 -24
  59. package/src/behavior-actions/behavior.action.delete.forward.ts +0 -7
  60. package/src/behavior-actions/behavior.action.insert.text.ts +0 -17
  61. package/src/behavior-actions/behavior.action.move.backward.ts +0 -12
  62. package/src/behavior-actions/behavior.action.move.block.ts +0 -16
  63. package/src/behavior-actions/behavior.action.move.forward.ts +0 -11
  64. package/src/behavior-actions/behavior.action.select.ts +0 -15
  65. package/src/behavior-actions/behavior.actions.ts +0 -219
  66. package/src/behaviors/behavior.default.raise-soft-break.ts +0 -14
  67. package/src/plugins/plugin.core.tsx +0 -9
@@ -0,0 +1,239 @@
1
+ import type {
2
+ AbstractBehaviorEventType,
3
+ SyntheticBehaviorEvent,
4
+ } from '../behaviors/behavior.types.event'
5
+ import type {EditorContext} from '../editor/editor-snapshot'
6
+ import {removeDecoratorOperationImplementation} from '../editor/plugins/createWithPortableTextMarkModel'
7
+ import {
8
+ historyRedoOperationImplementation,
9
+ historyUndoOperationImplementation,
10
+ } from '../editor/plugins/createWithUndoRedo'
11
+ import type {OmitFromUnion, PickFromUnion} from '../type-utils'
12
+ import type {PortableTextSlateEditor} from '../types/editor'
13
+ import {addAnnotationOperationImplementation} from './behavior.operation.annotation.add'
14
+ import {removeAnnotationOperationImplementation} from './behavior.operation.annotation.remove'
15
+ import {blockSetOperationImplementation} from './behavior.operation.block.set'
16
+ import {blockUnsetOperationImplementation} from './behavior.operation.block.unset'
17
+ import {decoratorAddOperationImplementation} from './behavior.operation.decorator.add'
18
+ import {deleteOperationImplementation} from './behavior.operation.delete'
19
+ import {deleteBackwardOperationImplementation} from './behavior.operation.delete.backward'
20
+ import {deleteBlockOperationImplementation} from './behavior.operation.delete.block'
21
+ import {deleteForwardOperationImplementation} from './behavior.operation.delete.forward'
22
+ import {insertInlineObjectOperationImplementation} from './behavior.operation.insert-inline-object'
23
+ import {insertSpanOperationImplementation} from './behavior.operation.insert-span'
24
+ import {insertBlockOperationImplementation} from './behavior.operation.insert.block'
25
+ import {insertTextOperationImplementation} from './behavior.operation.insert.text'
26
+ import {moveBackwardOperationImplementation} from './behavior.operation.move.backward'
27
+ import {moveBlockOperationImplementation} from './behavior.operation.move.block'
28
+ import {moveForwardOperationImplementation} from './behavior.operation.move.forward'
29
+ import {selectOperationImplementation} from './behavior.operation.select'
30
+
31
+ export type BehaviorOperationImplementationContext = Pick<
32
+ EditorContext,
33
+ 'keyGenerator' | 'schema'
34
+ >
35
+
36
+ export type BehaviorOperationImplementation<
37
+ TBehaviorOperationType extends BehaviorOperation['type'],
38
+ TReturnType = void,
39
+ > = ({
40
+ context,
41
+ operation,
42
+ }: {
43
+ context: BehaviorOperationImplementationContext
44
+ operation: PickFromUnion<BehaviorOperation, 'type', TBehaviorOperationType>
45
+ }) => TReturnType
46
+
47
+ type BehaviorOperation = OmitFromUnion<
48
+ SyntheticBehaviorEvent,
49
+ 'type',
50
+ AbstractBehaviorEventType
51
+ > & {
52
+ editor: PortableTextSlateEditor
53
+ }
54
+
55
+ type BehaviorOperationImplementations = {
56
+ [TBehaviorOperationType in BehaviorOperation['type']]: BehaviorOperationImplementation<TBehaviorOperationType>
57
+ }
58
+
59
+ const behaviorOperationImplementations: BehaviorOperationImplementations = {
60
+ 'annotation.add': addAnnotationOperationImplementation,
61
+ 'annotation.remove': removeAnnotationOperationImplementation,
62
+ 'block.set': blockSetOperationImplementation,
63
+ 'block.unset': blockUnsetOperationImplementation,
64
+ 'decorator.add': decoratorAddOperationImplementation,
65
+ 'decorator.remove': removeDecoratorOperationImplementation,
66
+ 'delete': deleteOperationImplementation,
67
+ 'delete.backward': deleteBackwardOperationImplementation,
68
+ 'delete.forward': deleteForwardOperationImplementation,
69
+ 'delete.block': deleteBlockOperationImplementation,
70
+ 'history.redo': historyRedoOperationImplementation,
71
+ 'history.undo': historyUndoOperationImplementation,
72
+ 'insert.block': insertBlockOperationImplementation,
73
+ 'insert.inline object': insertInlineObjectOperationImplementation,
74
+ 'insert.span': insertSpanOperationImplementation,
75
+ 'insert.text': insertTextOperationImplementation,
76
+ 'move.backward': moveBackwardOperationImplementation,
77
+ 'move.block': moveBlockOperationImplementation,
78
+ 'move.forward': moveForwardOperationImplementation,
79
+ 'select': selectOperationImplementation,
80
+ }
81
+
82
+ export function performOperation({
83
+ context,
84
+ operation,
85
+ }: {
86
+ context: BehaviorOperationImplementationContext
87
+ operation: BehaviorOperation
88
+ }) {
89
+ try {
90
+ switch (operation.type) {
91
+ case 'annotation.add': {
92
+ behaviorOperationImplementations['annotation.add']({
93
+ context,
94
+ operation: operation,
95
+ })
96
+ break
97
+ }
98
+ case 'annotation.remove': {
99
+ behaviorOperationImplementations['annotation.remove']({
100
+ context,
101
+ operation: operation,
102
+ })
103
+ break
104
+ }
105
+ case 'block.set': {
106
+ behaviorOperationImplementations['block.set']({
107
+ context,
108
+ operation: operation,
109
+ })
110
+ break
111
+ }
112
+ case 'block.unset': {
113
+ behaviorOperationImplementations['block.unset']({
114
+ context,
115
+ operation: operation,
116
+ })
117
+ break
118
+ }
119
+ case 'decorator.add': {
120
+ behaviorOperationImplementations['decorator.add']({
121
+ context,
122
+ operation: operation,
123
+ })
124
+ break
125
+ }
126
+ case 'decorator.remove': {
127
+ behaviorOperationImplementations['decorator.remove']({
128
+ context,
129
+ operation: operation,
130
+ })
131
+ break
132
+ }
133
+ case 'delete': {
134
+ behaviorOperationImplementations.delete({
135
+ context,
136
+ operation: operation,
137
+ })
138
+ break
139
+ }
140
+ case 'delete.backward': {
141
+ behaviorOperationImplementations['delete.backward']({
142
+ context,
143
+ operation: operation,
144
+ })
145
+ break
146
+ }
147
+ case 'delete.block': {
148
+ behaviorOperationImplementations['delete.block']({
149
+ context,
150
+ operation: operation,
151
+ })
152
+ break
153
+ }
154
+ case 'delete.forward': {
155
+ behaviorOperationImplementations['delete.forward']({
156
+ context,
157
+ operation: operation,
158
+ })
159
+ break
160
+ }
161
+ case 'history.redo': {
162
+ behaviorOperationImplementations['history.redo']({
163
+ context,
164
+ operation: operation,
165
+ })
166
+ break
167
+ }
168
+ case 'history.undo': {
169
+ behaviorOperationImplementations['history.undo']({
170
+ context,
171
+ operation: operation,
172
+ })
173
+ break
174
+ }
175
+ case 'insert.block': {
176
+ behaviorOperationImplementations['insert.block']({
177
+ context,
178
+ operation: operation,
179
+ })
180
+ break
181
+ }
182
+ case 'insert.inline object': {
183
+ behaviorOperationImplementations['insert.inline object']({
184
+ context,
185
+ operation: operation,
186
+ })
187
+ break
188
+ }
189
+ case 'insert.span': {
190
+ behaviorOperationImplementations['insert.span']({
191
+ context,
192
+ operation: operation,
193
+ })
194
+ break
195
+ }
196
+ case 'insert.text': {
197
+ behaviorOperationImplementations['insert.text']({
198
+ context,
199
+ operation: operation,
200
+ })
201
+ break
202
+ }
203
+ case 'move.backward': {
204
+ behaviorOperationImplementations['move.backward']({
205
+ context,
206
+ operation: operation,
207
+ })
208
+ break
209
+ }
210
+ case 'move.block': {
211
+ behaviorOperationImplementations['move.block']({
212
+ context,
213
+ operation: operation,
214
+ })
215
+ break
216
+ }
217
+ case 'move.forward': {
218
+ behaviorOperationImplementations['move.forward']({
219
+ context,
220
+ operation: operation,
221
+ })
222
+ break
223
+ }
224
+ default: {
225
+ behaviorOperationImplementations.select({
226
+ context,
227
+ operation: operation,
228
+ })
229
+ break
230
+ }
231
+ }
232
+ } catch (error) {
233
+ console.error(
234
+ new Error(
235
+ `Executing "${operation.type}" failed due to: ${error.message}`,
236
+ ),
237
+ )
238
+ }
239
+ }
@@ -1,5 +1,4 @@
1
1
  export {BehaviorPlugin} from './plugin.behavior'
2
- export {CoreBehaviorsPlugin} from './plugin.core'
3
2
  export {DecoratorShortcutPlugin} from './plugin.decorator-shortcut'
4
3
  export {EditorRefPlugin} from './plugin.editor-ref'
5
4
  export {EventListenerPlugin} from './plugin.event-listener'
@@ -1,7 +0,0 @@
1
- import type {BehaviorActionImplementation} from './behavior.actions'
2
-
3
- export const deleteBackwardActionImplementation: BehaviorActionImplementation<
4
- 'delete.backward'
5
- > = ({action}) => {
6
- action.editor.deleteBackward(action.unit)
7
- }
@@ -1,24 +0,0 @@
1
- import {Transforms} from 'slate'
2
- import {toSlateRange} from '../internal-utils/ranges'
3
- import type {BehaviorActionImplementation} from './behavior.actions'
4
-
5
- export const deleteBlockActionImplementation: BehaviorActionImplementation<
6
- 'delete.block'
7
- > = ({action}) => {
8
- const range = toSlateRange(
9
- {
10
- anchor: {path: action.at, offset: 0},
11
- focus: {path: action.at, offset: 0},
12
- },
13
- action.editor,
14
- )
15
-
16
- if (!range) {
17
- console.error('Unable to find Slate range from selection points')
18
- return
19
- }
20
-
21
- Transforms.removeNodes(action.editor, {
22
- at: range,
23
- })
24
- }
@@ -1,7 +0,0 @@
1
- import type {BehaviorActionImplementation} from './behavior.actions'
2
-
3
- export const deleteForwardActionImplementation: BehaviorActionImplementation<
4
- 'delete.forward'
5
- > = ({action}) => {
6
- action.editor.deleteForward(action.unit)
7
- }
@@ -1,17 +0,0 @@
1
- import {Transforms} from 'slate'
2
- import type {BehaviorActionImplementation} from './behavior.actions'
3
-
4
- export const insertTextActionImplementation: BehaviorActionImplementation<
5
- 'insert.text'
6
- > = ({action}) => {
7
- if (action.editor.marks) {
8
- Transforms.insertNodes(action.editor, {
9
- text: action.text,
10
- ...action.editor.marks,
11
- })
12
- } else {
13
- Transforms.insertText(action.editor, action.text)
14
- }
15
-
16
- action.editor.marks = null
17
- }
@@ -1,12 +0,0 @@
1
- import {Transforms} from 'slate'
2
- import type {BehaviorActionImplementation} from './behavior.actions'
3
-
4
- export const moveBackwardActionImplementation: BehaviorActionImplementation<
5
- 'move.backward'
6
- > = ({action}) => {
7
- Transforms.move(action.editor, {
8
- unit: 'character',
9
- distance: action.distance,
10
- reverse: true,
11
- })
12
- }
@@ -1,16 +0,0 @@
1
- import {Transforms} from 'slate'
2
- import {toSlatePath} from '../internal-utils/paths'
3
- import type {BehaviorActionImplementation} from './behavior.actions'
4
-
5
- export const moveBlockActionImplementation: BehaviorActionImplementation<
6
- 'move.block'
7
- > = ({action}) => {
8
- const at = [toSlatePath(action.at, action.editor)[0]]
9
- const to = [toSlatePath(action.to, action.editor)[0]]
10
-
11
- Transforms.moveNodes(action.editor, {
12
- at,
13
- to,
14
- mode: 'highest',
15
- })
16
- }
@@ -1,11 +0,0 @@
1
- import {Transforms} from 'slate'
2
- import type {BehaviorActionImplementation} from './behavior.actions'
3
-
4
- export const moveForwardActionImplementation: BehaviorActionImplementation<
5
- 'move.forward'
6
- > = ({action}) => {
7
- Transforms.move(action.editor, {
8
- unit: 'character',
9
- distance: action.distance,
10
- })
11
- }
@@ -1,15 +0,0 @@
1
- import {Transforms} from 'slate'
2
- import {toSlateRange} from '../internal-utils/ranges'
3
- import type {BehaviorActionImplementation} from './behavior.actions'
4
-
5
- export const selectActionImplementation: BehaviorActionImplementation<
6
- 'select'
7
- > = ({action}) => {
8
- const newSelection = toSlateRange(action.at, action.editor)
9
-
10
- if (newSelection) {
11
- Transforms.select(action.editor, newSelection)
12
- } else {
13
- Transforms.deselect(action.editor)
14
- }
15
- }
@@ -1,219 +0,0 @@
1
- import type {InternalBehaviorAction} from '../behaviors/behavior.types.action'
2
- import type {EditorContext} from '../editor/editor-snapshot'
3
- import {removeDecoratorActionImplementation} from '../editor/plugins/createWithPortableTextMarkModel'
4
- import {
5
- historyRedoActionImplementation,
6
- historyUndoActionImplementation,
7
- } from '../editor/plugins/createWithUndoRedo'
8
- import type {PickFromUnion} from '../type-utils'
9
- import {addAnnotationActionImplementation} from './behavior.action.annotation.add'
10
- import {removeAnnotationActionImplementation} from './behavior.action.annotation.remove'
11
- import {blockSetBehaviorActionImplementation} from './behavior.action.block.set'
12
- import {blockUnsetBehaviorActionImplementation} from './behavior.action.block.unset'
13
- import {decoratorAddActionImplementation} from './behavior.action.decorator.add'
14
- import {deleteActionImplementation} from './behavior.action.delete'
15
- import {deleteBackwardActionImplementation} from './behavior.action.delete.backward'
16
- import {deleteBlockActionImplementation} from './behavior.action.delete.block'
17
- import {deleteForwardActionImplementation} from './behavior.action.delete.forward'
18
- import {insertInlineObjectActionImplementation} from './behavior.action.insert-inline-object'
19
- import {insertSpanActionImplementation} from './behavior.action.insert-span'
20
- import {insertBlockActionImplementation} from './behavior.action.insert.block'
21
- import {insertTextActionImplementation} from './behavior.action.insert.text'
22
- import {moveBackwardActionImplementation} from './behavior.action.move.backward'
23
- import {moveBlockActionImplementation} from './behavior.action.move.block'
24
- import {moveForwardActionImplementation} from './behavior.action.move.forward'
25
- import {selectActionImplementation} from './behavior.action.select'
26
-
27
- export type BehaviorActionImplementationContext = Pick<
28
- EditorContext,
29
- 'keyGenerator' | 'schema'
30
- >
31
-
32
- export type BehaviorActionImplementation<
33
- TBehaviorActionType extends InternalBehaviorAction['type'],
34
- TReturnType = void,
35
- > = ({
36
- context,
37
- action,
38
- }: {
39
- context: BehaviorActionImplementationContext
40
- action: PickFromUnion<InternalBehaviorAction, 'type', TBehaviorActionType>
41
- }) => TReturnType
42
-
43
- type BehaviorActionImplementations = {
44
- [TBehaviorActionType in InternalBehaviorAction['type']]: BehaviorActionImplementation<TBehaviorActionType>
45
- }
46
-
47
- const behaviorActionImplementations: BehaviorActionImplementations = {
48
- 'annotation.add': addAnnotationActionImplementation,
49
- 'annotation.remove': removeAnnotationActionImplementation,
50
- 'block.set': blockSetBehaviorActionImplementation,
51
- 'block.unset': blockUnsetBehaviorActionImplementation,
52
- 'decorator.add': decoratorAddActionImplementation,
53
- 'decorator.remove': removeDecoratorActionImplementation,
54
- 'delete': deleteActionImplementation,
55
- 'delete.backward': deleteBackwardActionImplementation,
56
- 'delete.forward': deleteForwardActionImplementation,
57
- 'delete.block': deleteBlockActionImplementation,
58
- 'history.redo': historyRedoActionImplementation,
59
- 'history.undo': historyUndoActionImplementation,
60
- 'insert.block': insertBlockActionImplementation,
61
- 'insert.inline object': insertInlineObjectActionImplementation,
62
- 'insert.span': insertSpanActionImplementation,
63
- 'insert.text': insertTextActionImplementation,
64
- 'move.backward': moveBackwardActionImplementation,
65
- 'move.block': moveBlockActionImplementation,
66
- 'move.forward': moveForwardActionImplementation,
67
- 'select': selectActionImplementation,
68
- }
69
-
70
- export function performAction({
71
- context,
72
- action,
73
- }: {
74
- context: BehaviorActionImplementationContext
75
- action: InternalBehaviorAction
76
- }) {
77
- switch (action.type) {
78
- case 'annotation.add': {
79
- behaviorActionImplementations['annotation.add']({
80
- context,
81
- action,
82
- })
83
- break
84
- }
85
- case 'annotation.remove': {
86
- behaviorActionImplementations['annotation.remove']({
87
- context,
88
- action,
89
- })
90
- break
91
- }
92
- case 'block.set': {
93
- behaviorActionImplementations['block.set']({
94
- context,
95
- action,
96
- })
97
- break
98
- }
99
- case 'block.unset': {
100
- behaviorActionImplementations['block.unset']({
101
- context,
102
- action,
103
- })
104
- break
105
- }
106
- case 'decorator.add': {
107
- behaviorActionImplementations['decorator.add']({
108
- context,
109
- action,
110
- })
111
- break
112
- }
113
- case 'decorator.remove': {
114
- behaviorActionImplementations['decorator.remove']({
115
- context,
116
- action,
117
- })
118
- break
119
- }
120
- case 'delete': {
121
- behaviorActionImplementations.delete({
122
- context,
123
- action,
124
- })
125
- break
126
- }
127
- case 'delete.backward': {
128
- behaviorActionImplementations['delete.backward']({
129
- context,
130
- action,
131
- })
132
- break
133
- }
134
- case 'delete.block': {
135
- behaviorActionImplementations['delete.block']({
136
- context,
137
- action,
138
- })
139
- break
140
- }
141
- case 'delete.forward': {
142
- behaviorActionImplementations['delete.forward']({
143
- context,
144
- action,
145
- })
146
- break
147
- }
148
- case 'history.redo': {
149
- behaviorActionImplementations['history.redo']({
150
- context,
151
- action,
152
- })
153
- break
154
- }
155
- case 'history.undo': {
156
- behaviorActionImplementations['history.undo']({
157
- context,
158
- action,
159
- })
160
- break
161
- }
162
- case 'insert.block': {
163
- behaviorActionImplementations['insert.block']({
164
- context,
165
- action,
166
- })
167
- break
168
- }
169
- case 'insert.inline object': {
170
- behaviorActionImplementations['insert.inline object']({
171
- context,
172
- action,
173
- })
174
- break
175
- }
176
- case 'insert.span': {
177
- behaviorActionImplementations['insert.span']({
178
- context,
179
- action,
180
- })
181
- break
182
- }
183
- case 'insert.text': {
184
- behaviorActionImplementations['insert.text']({
185
- context,
186
- action,
187
- })
188
- break
189
- }
190
- case 'move.backward': {
191
- behaviorActionImplementations['move.backward']({
192
- context,
193
- action,
194
- })
195
- break
196
- }
197
- case 'move.block': {
198
- behaviorActionImplementations['move.block']({
199
- context,
200
- action,
201
- })
202
- break
203
- }
204
- case 'move.forward': {
205
- behaviorActionImplementations['move.forward']({
206
- context,
207
- action,
208
- })
209
- break
210
- }
211
- default: {
212
- behaviorActionImplementations.select({
213
- context,
214
- action,
215
- })
216
- break
217
- }
218
- }
219
- }
@@ -1,14 +0,0 @@
1
- import {keyIs} from '../internal-utils/key-is'
2
- import {raise} from './behavior.types.action'
3
- import {defineBehavior} from './behavior.types.behavior'
4
-
5
- /**
6
- * On WebKit, Shift+Enter results in an `insertParagraph` input event rather
7
- * than an `insertLineBreak` input event. This Behavior makes sure we catch
8
- * that `keyboard.keydown` event beforehand and raise an `insert.soft break` manually.
9
- */
10
- export const raiseInsertSoftBreak = defineBehavior({
11
- on: 'keyboard.keydown',
12
- guard: ({event}) => keyIs.lineBreak(event.originEvent),
13
- actions: [() => [raise({type: 'insert.soft break'})]],
14
- })
@@ -1,9 +0,0 @@
1
- import {coreBehaviors} from '../behaviors/behavior.core'
2
- import {BehaviorPlugin} from './plugin.behavior'
3
-
4
- /**
5
- * @beta
6
- */
7
- export function CoreBehaviorsPlugin() {
8
- return <BehaviorPlugin behaviors={coreBehaviors} />
9
- }