@portabletext/editor 1.0.11 → 1.0.13
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/index.esm.js +208 -216
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +204 -212
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +208 -216
- package/lib/index.mjs.map +1 -1
- package/package.json +19 -17
- package/src/editor/__tests__/PortableTextEditor.test.tsx +15 -1
- package/src/editor/__tests__/handleClick.test.tsx +40 -20
- package/src/editor/__tests__/utils.ts +14 -15
- package/src/editor/plugins/__tests__/withEditableAPIDelete.test.tsx +62 -20
- package/src/editor/plugins/__tests__/withEditableAPIGetFragment.test.tsx +19 -0
- package/src/editor/plugins/__tests__/withEditableAPIInsert.test.tsx +259 -134
- package/src/editor/plugins/__tests__/withHotkeys.test.tsx +1 -1
- package/src/editor/plugins/__tests__/withInsertBreak.test.tsx +18 -2
- package/src/editor/plugins/__tests__/withPortableTextMarkModel.test.tsx +176 -154
- package/src/editor/plugins/__tests__/withUndoRedo.test.tsx +17 -0
- package/src/editor/plugins/createWithObjectKeys.ts +23 -8
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +68 -14
- package/src/editor/plugins/createWithUndoRedo.ts +5 -7
- package/src/editor/plugins/index.ts +5 -1
- package/src/utils/__tests__/values.test.ts +1 -0
- package/src/utils/operationToPatches.ts +0 -1
- package/src/utils/withPreserveKeys.ts +7 -0
|
@@ -78,7 +78,11 @@ export const withPlugins = <T extends Editor>(
|
|
|
78
78
|
patches$,
|
|
79
79
|
blockSchemaType: schemaTypes.block,
|
|
80
80
|
})
|
|
81
|
-
const withPortableTextMarkModel = createWithPortableTextMarkModel(
|
|
81
|
+
const withPortableTextMarkModel = createWithPortableTextMarkModel(
|
|
82
|
+
schemaTypes,
|
|
83
|
+
change$,
|
|
84
|
+
keyGenerator,
|
|
85
|
+
)
|
|
82
86
|
const withPortableTextBlockStyle = createWithPortableTextBlockStyle(schemaTypes)
|
|
83
87
|
|
|
84
88
|
const withPlaceholderBlock = createWithPlaceholderBlock()
|
|
@@ -28,7 +28,6 @@ import {debugWithName} from './debug'
|
|
|
28
28
|
import {fromSlateValue} from './values'
|
|
29
29
|
|
|
30
30
|
const debug = debugWithName('operationToPatches')
|
|
31
|
-
debug.enabled = false
|
|
32
31
|
|
|
33
32
|
export function createOperationToPatches(types: PortableTextMemberSchemaTypes): PatchFunctions {
|
|
34
33
|
const textBlockName = types.block.name
|
|
@@ -9,6 +9,13 @@ export function withPreserveKeys(editor: Editor, fn: () => void): void {
|
|
|
9
9
|
PRESERVE_KEYS.set(editor, prev)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export function withoutPreserveKeys(editor: Editor, fn: () => void): void {
|
|
13
|
+
const prev = isPreservingKeys(editor)
|
|
14
|
+
PRESERVE_KEYS.set(editor, false)
|
|
15
|
+
fn()
|
|
16
|
+
PRESERVE_KEYS.set(editor, prev)
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export function isPreservingKeys(editor: Editor): boolean | undefined {
|
|
13
20
|
return PRESERVE_KEYS.get(editor)
|
|
14
21
|
}
|