@portabletext/editor 1.48.13 → 1.48.15
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.
- package/lib/_chunks-cjs/editor-provider.cjs +682 -609
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +683 -610
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +226 -2772
- package/lib/behaviors/index.d.ts +226 -2772
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +22 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +227 -2780
- package/lib/index.d.ts +227 -2780
- package/lib/index.js +23 -7
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +1 -7
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +226 -2785
- package/lib/plugins/index.d.ts +226 -2785
- package/lib/plugins/index.js +2 -8
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +225 -2771
- package/lib/selectors/index.d.ts +225 -2771
- package/lib/utils/index.d.cts +227 -2772
- package/lib/utils/index.d.ts +227 -2772
- package/package.json +1 -1
- package/src/behaviors/behavior.abstract.keyboard.ts +16 -0
- package/src/behaviors/{behavior.default.ts → behavior.abstract.ts} +3 -3
- package/src/behaviors/behavior.config.ts +7 -0
- package/src/behaviors/behavior.core.ts +6 -5
- package/src/behaviors/behavior.perform-event.ts +27 -51
- package/src/behaviors/behavior.types.action.ts +1 -11
- package/src/editor/PortableTextEditor.tsx +1 -1
- package/src/editor/components/Element.tsx +30 -4
- package/src/editor/create-editor.ts +17 -5
- package/src/editor/editor-machine.ts +23 -17
- package/src/editor/mutation-machine.ts +6 -6
- package/src/editor/plugins/create-with-event-listeners.ts +25 -25
- package/src/editor/plugins/createWithEditableAPI.ts +3 -3
- package/src/editor/plugins/createWithPatches.ts +13 -5
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +5 -5
- package/src/editor/plugins/createWithUndoRedo.ts +8 -8
- package/src/editor/with-applying-behavior-operations.ts +18 -0
- package/src/editor/{with-applying-behavior-actions.ts → with-undo-step.ts} +1 -19
- package/src/index.ts +1 -1
- package/src/{behavior-actions/behavior.action.annotation.add.ts → operations/behavior.operation.annotation.add.ts} +7 -7
- package/src/{behavior-actions/behavior.action.annotation.remove.ts → operations/behavior.operation.annotation.remove.ts} +6 -6
- package/src/{behavior-actions/behavior.action.block.set.ts → operations/behavior.operation.block.set.ts} +14 -14
- package/src/{behavior-actions/behavior.action.block.unset.ts → operations/behavior.operation.block.unset.ts} +19 -17
- package/src/{behavior-actions/behavior.action.decorator.add.ts → operations/behavior.operation.decorator.add.ts} +10 -10
- package/src/operations/behavior.operation.delete.backward.ts +8 -0
- package/src/operations/behavior.operation.delete.block.ts +24 -0
- package/src/operations/behavior.operation.delete.forward.ts +8 -0
- package/src/{behavior-actions/behavior.action.delete.ts → operations/behavior.operation.delete.ts} +8 -8
- package/src/{behavior-actions/behavior.action.insert-inline-object.ts → operations/behavior.operation.insert-inline-object.ts} +11 -11
- package/src/{behavior-actions/behavior.action.insert-span.ts → operations/behavior.operation.insert-span.ts} +15 -15
- package/src/{behavior-actions/behavior.action.insert.block.ts → operations/behavior.operation.insert.block.ts} +8 -8
- package/src/operations/behavior.operation.insert.text.ts +17 -0
- package/src/operations/behavior.operation.move.backward.ts +12 -0
- package/src/operations/behavior.operation.move.block.ts +16 -0
- package/src/operations/behavior.operation.move.forward.ts +11 -0
- package/src/operations/behavior.operation.select.ts +15 -0
- package/src/operations/behavior.operations.ts +239 -0
- package/src/plugins/index.ts +0 -1
- package/src/priority/priority.core.ts +3 -0
- package/src/priority/priority.sort.test.ts +319 -0
- package/src/priority/priority.sort.ts +121 -0
- package/src/priority/priority.types.ts +24 -0
- package/src/behavior-actions/behavior.action.delete.backward.ts +0 -7
- package/src/behavior-actions/behavior.action.delete.block.ts +0 -24
- package/src/behavior-actions/behavior.action.delete.forward.ts +0 -7
- package/src/behavior-actions/behavior.action.insert.text.ts +0 -17
- package/src/behavior-actions/behavior.action.move.backward.ts +0 -12
- package/src/behavior-actions/behavior.action.move.block.ts +0 -16
- package/src/behavior-actions/behavior.action.move.forward.ts +0 -11
- package/src/behavior-actions/behavior.action.select.ts +0 -15
- package/src/behavior-actions/behavior.actions.ts +0 -219
- package/src/behaviors/behavior.default.raise-soft-break.ts +0 -14
- package/src/plugins/plugin.core.tsx +0 -9
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {Editor, Transforms} from 'slate'
|
|
2
|
-
import type {
|
|
2
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const insertSpanOperationImplementation: BehaviorOperationImplementation<
|
|
5
5
|
'insert.span'
|
|
6
|
-
> = ({context,
|
|
7
|
-
if (!
|
|
8
|
-
console.error('Unable to perform action without selection',
|
|
6
|
+
> = ({context, operation}) => {
|
|
7
|
+
if (!operation.editor.selection) {
|
|
8
|
+
console.error('Unable to perform action without selection', operation)
|
|
9
9
|
return
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const [focusBlock, focusBlockPath] = Array.from(
|
|
13
|
-
Editor.nodes(
|
|
14
|
-
at:
|
|
15
|
-
match: (node) =>
|
|
13
|
+
Editor.nodes(operation.editor, {
|
|
14
|
+
at: operation.editor.selection.focus.path,
|
|
15
|
+
match: (node) => operation.editor.isTextBlock(node),
|
|
16
16
|
}),
|
|
17
17
|
)[0] ?? [undefined, undefined]
|
|
18
18
|
|
|
19
19
|
if (!focusBlock || !focusBlockPath) {
|
|
20
|
-
console.error('Unable to perform action without focus block',
|
|
20
|
+
console.error('Unable to perform action without focus block', operation)
|
|
21
21
|
return
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const markDefs = focusBlock.markDefs ?? []
|
|
25
|
-
const annotations =
|
|
26
|
-
?
|
|
25
|
+
const annotations = operation.annotations
|
|
26
|
+
? operation.annotations.map((annotation) => ({
|
|
27
27
|
_type: annotation.name,
|
|
28
28
|
_key: context.keyGenerator(),
|
|
29
29
|
...annotation.value,
|
|
@@ -31,18 +31,18 @@ export const insertSpanActionImplementation: BehaviorActionImplementation<
|
|
|
31
31
|
: undefined
|
|
32
32
|
|
|
33
33
|
if (annotations && annotations.length > 0) {
|
|
34
|
-
Transforms.setNodes(
|
|
34
|
+
Transforms.setNodes(operation.editor, {
|
|
35
35
|
markDefs: [...markDefs, ...annotations],
|
|
36
36
|
})
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
Transforms.insertNodes(
|
|
39
|
+
Transforms.insertNodes(operation.editor, {
|
|
40
40
|
_type: 'span',
|
|
41
41
|
_key: context.keyGenerator(),
|
|
42
|
-
text:
|
|
42
|
+
text: operation.text,
|
|
43
43
|
marks: [
|
|
44
44
|
...(annotations?.map((annotation) => annotation._key) ?? []),
|
|
45
|
-
...(
|
|
45
|
+
...(operation.decorators ?? []),
|
|
46
46
|
],
|
|
47
47
|
})
|
|
48
48
|
}
|
|
@@ -11,19 +11,19 @@ import {
|
|
|
11
11
|
} from '../internal-utils/slate-utils'
|
|
12
12
|
import {isEqualToEmptyEditor, toSlateValue} from '../internal-utils/values'
|
|
13
13
|
import type {PortableTextSlateEditor} from '../types/editor'
|
|
14
|
-
import type {
|
|
14
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const insertBlockOperationImplementation: BehaviorOperationImplementation<
|
|
17
17
|
'insert.block'
|
|
18
|
-
> = ({context,
|
|
18
|
+
> = ({context, operation}) => {
|
|
19
19
|
const parsedBlock = parseBlock({
|
|
20
|
-
block:
|
|
20
|
+
block: operation.block,
|
|
21
21
|
context,
|
|
22
22
|
options: {refreshKeys: false},
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
if (!parsedBlock) {
|
|
26
|
-
throw new Error(`Failed to parse block ${JSON.stringify(
|
|
26
|
+
throw new Error(`Failed to parse block ${JSON.stringify(operation.block)}`)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const fragment = toSlateValue([parsedBlock], {schemaTypes: context.schema})[0]
|
|
@@ -36,9 +36,9 @@ export const insertBlockActionImplementation: BehaviorActionImplementation<
|
|
|
36
36
|
|
|
37
37
|
insertBlock({
|
|
38
38
|
block: fragment,
|
|
39
|
-
placement:
|
|
40
|
-
select:
|
|
41
|
-
editor:
|
|
39
|
+
placement: operation.placement,
|
|
40
|
+
select: operation.select ?? 'start',
|
|
41
|
+
editor: operation.editor,
|
|
42
42
|
schema: context.schema,
|
|
43
43
|
})
|
|
44
44
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {Transforms} from 'slate'
|
|
2
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
3
|
+
|
|
4
|
+
export const insertTextOperationImplementation: BehaviorOperationImplementation<
|
|
5
|
+
'insert.text'
|
|
6
|
+
> = ({operation}) => {
|
|
7
|
+
if (operation.editor.marks) {
|
|
8
|
+
Transforms.insertNodes(operation.editor, {
|
|
9
|
+
text: operation.text,
|
|
10
|
+
...operation.editor.marks,
|
|
11
|
+
})
|
|
12
|
+
} else {
|
|
13
|
+
Transforms.insertText(operation.editor, operation.text)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
operation.editor.marks = null
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {Transforms} from 'slate'
|
|
2
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
3
|
+
|
|
4
|
+
export const moveBackwardOperationImplementation: BehaviorOperationImplementation<
|
|
5
|
+
'move.backward'
|
|
6
|
+
> = ({operation}) => {
|
|
7
|
+
Transforms.move(operation.editor, {
|
|
8
|
+
unit: 'character',
|
|
9
|
+
distance: operation.distance,
|
|
10
|
+
reverse: true,
|
|
11
|
+
})
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {Transforms} from 'slate'
|
|
2
|
+
import {toSlatePath} from '../internal-utils/paths'
|
|
3
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
4
|
+
|
|
5
|
+
export const moveBlockOperationImplementation: BehaviorOperationImplementation<
|
|
6
|
+
'move.block'
|
|
7
|
+
> = ({operation}) => {
|
|
8
|
+
const at = [toSlatePath(operation.at, operation.editor)[0]]
|
|
9
|
+
const to = [toSlatePath(operation.to, operation.editor)[0]]
|
|
10
|
+
|
|
11
|
+
Transforms.moveNodes(operation.editor, {
|
|
12
|
+
at,
|
|
13
|
+
to,
|
|
14
|
+
mode: 'highest',
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {Transforms} from 'slate'
|
|
2
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
3
|
+
|
|
4
|
+
export const moveForwardOperationImplementation: BehaviorOperationImplementation<
|
|
5
|
+
'move.forward'
|
|
6
|
+
> = ({operation}) => {
|
|
7
|
+
Transforms.move(operation.editor, {
|
|
8
|
+
unit: 'character',
|
|
9
|
+
distance: operation.distance,
|
|
10
|
+
})
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {Transforms} from 'slate'
|
|
2
|
+
import {toSlateRange} from '../internal-utils/ranges'
|
|
3
|
+
import type {BehaviorOperationImplementation} from './behavior.operations'
|
|
4
|
+
|
|
5
|
+
export const selectOperationImplementation: BehaviorOperationImplementation<
|
|
6
|
+
'select'
|
|
7
|
+
> = ({operation}) => {
|
|
8
|
+
const newSelection = toSlateRange(operation.at, operation.editor)
|
|
9
|
+
|
|
10
|
+
if (newSelection) {
|
|
11
|
+
Transforms.select(operation.editor, newSelection)
|
|
12
|
+
} else {
|
|
13
|
+
Transforms.deselect(operation.editor)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -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
|
+
}
|
package/src/plugins/index.ts
CHANGED
|
@@ -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'
|