Skip to content

Commit 0692a29

Browse files
authored
fix: adjust input rules to be more tolerant to starting whitespace (#2341)
1 parent d126763 commit 0692a29

File tree

88 files changed

+225
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+225
-244
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ updates:
1616
- dependency-name: "@tiptap/core"
1717
- dependency-name: "@tiptap/pm"
1818
- dependency-name: "@tiptap/react"
19+
- dependency-name: "@tiptap/extensions"
1920
- dependency-name: "@tiptap/extension-bold"
2021
- dependency-name: "@tiptap/extension-code"
21-
- dependency-name: "@tiptap/extension-gapcursor"
2222
- dependency-name: "@tiptap/extension-horizontal-rule"
2323
- dependency-name: "@tiptap/extension-italic"
2424
- dependency-name: "@tiptap/extension-link"

packages/core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@
9090
},
9191
"dependencies": {
9292
"@emoji-mart/data": "^1.2.1",
93-
"@handlewithcare/prosemirror-inputrules": "^0.1.3",
93+
"@handlewithcare/prosemirror-inputrules": "^0.1.4",
9494
"@shikijs/types": "^3",
9595
"@tanstack/store": "^0.7.7",
9696
"@tiptap/core": "^3.13.0",
9797
"@tiptap/extension-bold": "^3.13.0",
9898
"@tiptap/extension-code": "^3.13.0",
99-
"@tiptap/extension-gapcursor": "^3.7.2",
100-
"@tiptap/extension-horizontal-rule": "^3.7.2",
99+
"@tiptap/extensions": "^3.13.0",
100+
"@tiptap/extension-horizontal-rule": "^3.13.0",
101101
"@tiptap/extension-italic": "^3.13.0",
102102
"@tiptap/extension-link": "^3.13.0",
103-
"@tiptap/extension-paragraph": "^3.7.2",
103+
"@tiptap/extension-paragraph": "^3.13.0",
104104
"@tiptap/extension-strike": "^3.13.0",
105105
"@tiptap/extension-text": "^3.13.0",
106106
"@tiptap/extension-underline": "^3.13.0",

packages/core/src/blocks/ListItem/BulletListItem/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createBulletListItemBlockSpec = createBlockSpec(
103103
},
104104
inputRules: [
105105
{
106-
find: new RegExp(`^[-+*]\\s$`),
106+
find: /^\s?[-+*]\s$/,
107107
replace({ editor }) {
108108
const blockInfo = getBlockInfoFromSelection(
109109
editor.prosemirrorState,

packages/core/src/blocks/ListItem/CheckListItem/block.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,18 @@ export const createCheckListItemBlockSpec = createBlockSpec(
151151
},
152152
inputRules: [
153153
{
154-
find: new RegExp(`^\\[\\s*\\]\\s$`),
154+
find: /^\s?\[\s*\]\s$/,
155155
replace() {
156156
return {
157157
type: "checkListItem",
158158
props: {
159159
checked: false,
160-
}
160+
},
161161
};
162162
},
163163
},
164164
{
165-
find: new RegExp(`^\\[[Xx]\\]\\s$`),
165+
find: /^\s?\[[Xx]\]\s$/,
166166
replace() {
167167
return {
168168
type: "checkListItem",

packages/core/src/blocks/ListItem/NumberedListItem/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const createNumberedListItemBlockSpec = createBlockSpec(
9595
key: "numbered-list-item-shortcuts",
9696
inputRules: [
9797
{
98-
find: new RegExp(`^(\\d+)\\.\\s$`),
98+
find: /^\s?(\d+)\.\s$/,
9999
replace({ match, editor }) {
100100
const blockInfo = getBlockInfoFromSelection(
101101
editor.prosemirrorState,

packages/core/src/editor/managers/ExtensionManager/extensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Node,
55
Extension as TiptapExtension,
66
} from "@tiptap/core";
7-
import { Gapcursor } from "@tiptap/extension-gapcursor";
7+
import { Gapcursor } from "@tiptap/extensions/gap-cursor";
88
import { Link } from "@tiptap/extension-link";
99
import { Text } from "@tiptap/extension-text";
1010
import { createDropFileExtension } from "../../../api/clipboard/fromClipboard/fileDropExtension.js";

pnpm-lock.yaml

Lines changed: 16 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-linux.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
"type": "blockContainer",
3333
"attrs": {
34-
"id": "2"
34+
"id": "1"
3535
},
3636
"content": [
3737
{
@@ -55,7 +55,7 @@
5555
{
5656
"type": "blockContainer",
5757
"attrs": {
58-
"id": "4"
58+
"id": "2"
5959
},
6060
"content": [
6161
{
@@ -79,7 +79,7 @@
7979
{
8080
"type": "blockContainer",
8181
"attrs": {
82-
"id": "6"
82+
"id": "3"
8383
},
8484
"content": [
8585
{
@@ -95,7 +95,7 @@
9595
{
9696
"type": "blockContainer",
9797
"attrs": {
98-
"id": "8"
98+
"id": "5"
9999
},
100100
"content": [
101101
{
@@ -119,7 +119,7 @@
119119
{
120120
"type": "blockContainer",
121121
"attrs": {
122-
"id": "9"
122+
"id": "6"
123123
},
124124
"content": [
125125
{
@@ -143,7 +143,7 @@
143143
{
144144
"type": "blockContainer",
145145
"attrs": {
146-
"id": "10"
146+
"id": "7"
147147
},
148148
"content": [
149149
{
@@ -167,7 +167,7 @@
167167
{
168168
"type": "blockContainer",
169169
"attrs": {
170-
"id": "11"
170+
"id": "8"
171171
},
172172
"content": [
173173
{

tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{
3030
"type": "blockContainer",
3131
"attrs": {
32-
"id": "3"
32+
"id": "2"
3333
},
3434
"content": [
3535
{
@@ -49,7 +49,7 @@
4949
{
5050
"type": "blockContainer",
5151
"attrs": {
52-
"id": "2"
52+
"id": "1"
5353
},
5454
"content": [
5555
{
@@ -65,7 +65,7 @@
6565
{
6666
"type": "blockContainer",
6767
"attrs": {
68-
"id": "5"
68+
"id": "4"
6969
},
7070
"content": [
7171
{
@@ -85,7 +85,7 @@
8585
{
8686
"type": "blockContainer",
8787
"attrs": {
88-
"id": "6"
88+
"id": "5"
8989
},
9090
"content": [
9191
{

tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-chromium-linux.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{
3131
"type": "blockContainer",
3232
"attrs": {
33-
"id": "3"
33+
"id": "2"
3434
},
3535
"content": [
3636
{
@@ -53,7 +53,7 @@
5353
{
5454
"type": "blockContainer",
5555
"attrs": {
56-
"id": "4"
56+
"id": "3"
5757
},
5858
"content": [
5959
{
@@ -83,7 +83,7 @@
8383
{
8484
"type": "blockContainer",
8585
"attrs": {
86-
"id": "2"
86+
"id": "1"
8787
},
8888
"content": [
8989
{
@@ -99,7 +99,7 @@
9999
{
100100
"type": "blockContainer",
101101
"attrs": {
102-
"id": "6"
102+
"id": "5"
103103
},
104104
"content": [
105105
{
@@ -122,7 +122,7 @@
122122
{
123123
"type": "blockContainer",
124124
"attrs": {
125-
"id": "7"
125+
"id": "6"
126126
},
127127
"content": [
128128
{
@@ -145,7 +145,7 @@
145145
{
146146
"type": "blockContainer",
147147
"attrs": {
148-
"id": "8"
148+
"id": "7"
149149
},
150150
"content": [
151151
{
@@ -175,7 +175,7 @@
175175
{
176176
"type": "blockContainer",
177177
"attrs": {
178-
"id": "9"
178+
"id": "8"
179179
},
180180
"content": [
181181
{

0 commit comments

Comments
 (0)