@portabletext/editor 1.33.1 → 1.33.2
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/plugin.event-listener.cjs +1 -1
- package/lib/_chunks-cjs/plugin.event-listener.cjs.map +1 -1
- package/lib/_chunks-es/plugin.event-listener.js +4 -4
- package/lib/_chunks-es/plugin.event-listener.js.map +1 -1
- package/package.json +1 -1
- package/src/behavior-actions/behavior.actions.ts +2 -8
- package/src/internal-utils/get-text-to-emphasize.test.ts +24 -0
package/package.json
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
deleteBackward,
|
|
3
|
-
deleteForward,
|
|
4
|
-
insertText,
|
|
5
|
-
Path,
|
|
6
|
-
Transforms,
|
|
7
|
-
} from 'slate'
|
|
1
|
+
import {deleteForward, insertText, Path, Transforms} from 'slate'
|
|
8
2
|
import {ReactEditor} from 'slate-react'
|
|
9
3
|
import type {
|
|
10
4
|
BehaviorAction,
|
|
@@ -95,7 +89,7 @@ const behaviorActionImplementations: BehaviorActionImplementations = {
|
|
|
95
89
|
},
|
|
96
90
|
'delete': deleteActionImplementation,
|
|
97
91
|
'delete.backward': ({action}) => {
|
|
98
|
-
|
|
92
|
+
action.editor.deleteBackward(action.unit)
|
|
99
93
|
},
|
|
100
94
|
'delete.forward': ({action}) => {
|
|
101
95
|
deleteForward(action.editor, action.unit)
|
|
@@ -7,6 +7,13 @@ test(getTextToItalic.name, () => {
|
|
|
7
7
|
expect(getTextToItalic('*Hello*world*')).toBe('*world*')
|
|
8
8
|
expect(getTextToItalic('_Hello_world_')).toBe('_world_')
|
|
9
9
|
|
|
10
|
+
expect(getTextToItalic('* Hello world *')).toBe(undefined)
|
|
11
|
+
expect(getTextToItalic('* Hello world*')).toBe(undefined)
|
|
12
|
+
expect(getTextToItalic('*Hello world *')).toBe(undefined)
|
|
13
|
+
expect(getTextToItalic('_ Hello world _')).toBe(undefined)
|
|
14
|
+
expect(getTextToItalic('_ Hello world_')).toBe(undefined)
|
|
15
|
+
expect(getTextToItalic('_Hello world _')).toBe(undefined)
|
|
16
|
+
|
|
10
17
|
expect(getTextToItalic('Hello *world')).toBe(undefined)
|
|
11
18
|
expect(getTextToItalic('Hello world*')).toBe(undefined)
|
|
12
19
|
expect(getTextToItalic('Hello *world* *')).toBe(undefined)
|
|
@@ -16,6 +23,11 @@ test(getTextToItalic.name, () => {
|
|
|
16
23
|
|
|
17
24
|
expect(getTextToItalic('*hello\nworld*')).toBe(undefined)
|
|
18
25
|
expect(getTextToItalic('_hello\nworld_')).toBe(undefined)
|
|
26
|
+
|
|
27
|
+
expect(getTextToItalic('*')).toBe(undefined)
|
|
28
|
+
expect(getTextToItalic('_')).toBe(undefined)
|
|
29
|
+
expect(getTextToItalic('**')).toBe(undefined)
|
|
30
|
+
expect(getTextToItalic('__')).toBe(undefined)
|
|
19
31
|
})
|
|
20
32
|
|
|
21
33
|
test(getTextToBold.name, () => {
|
|
@@ -24,6 +36,13 @@ test(getTextToBold.name, () => {
|
|
|
24
36
|
expect(getTextToBold('**Hello**world**')).toBe('**world**')
|
|
25
37
|
expect(getTextToBold('__Hello__world__')).toBe('__world__')
|
|
26
38
|
|
|
39
|
+
expect(getTextToBold('** Hello world **')).toBe(undefined)
|
|
40
|
+
expect(getTextToBold('** Hello world**')).toBe(undefined)
|
|
41
|
+
expect(getTextToBold('**Hello world **')).toBe(undefined)
|
|
42
|
+
expect(getTextToBold('__ Hello world __')).toBe(undefined)
|
|
43
|
+
expect(getTextToBold('__ Hello world__')).toBe(undefined)
|
|
44
|
+
expect(getTextToBold('__Hello world __')).toBe(undefined)
|
|
45
|
+
|
|
27
46
|
expect(getTextToBold('Hello **world')).toBe(undefined)
|
|
28
47
|
expect(getTextToBold('Hello world**')).toBe(undefined)
|
|
29
48
|
expect(getTextToBold('Hello **world** **')).toBe(undefined)
|
|
@@ -33,4 +52,9 @@ test(getTextToBold.name, () => {
|
|
|
33
52
|
|
|
34
53
|
expect(getTextToBold('**hello\nworld**')).toBe(undefined)
|
|
35
54
|
expect(getTextToBold('__hello\nworld__')).toBe(undefined)
|
|
55
|
+
|
|
56
|
+
expect(getTextToBold('**')).toBe(undefined)
|
|
57
|
+
expect(getTextToBold('__')).toBe(undefined)
|
|
58
|
+
expect(getTextToBold('****')).toBe(undefined)
|
|
59
|
+
expect(getTextToBold('____')).toBe(undefined)
|
|
36
60
|
})
|