vitest-prosemirror 1.1.0 → 1.1.1
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/dist/index.js
CHANGED
|
@@ -629,27 +629,29 @@ function tokenizeKeyboardInput(input) {
|
|
|
629
629
|
const output = [];
|
|
630
630
|
let currentGroupOpener = null;
|
|
631
631
|
let group = "";
|
|
632
|
+
let escaped = false;
|
|
632
633
|
for (const char of input) if (currentGroupOpener !== null) {
|
|
633
|
-
if (
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
634
|
+
if (escaped) {
|
|
635
|
+
group += char === matchingBrace(currentGroupOpener) || char === "\\" ? char : `\\${char}`;
|
|
636
|
+
escaped = false;
|
|
637
|
+
} else if (char === "\\") escaped = true;
|
|
638
|
+
else if (char === matchingBrace(currentGroupOpener)) {
|
|
639
|
+
assertSupported(group);
|
|
640
|
+
if (group.length === 4 && group.startsWith("Key")) output.push(group.slice(3).toLowerCase());
|
|
641
|
+
else output.push(group);
|
|
642
|
+
currentGroupOpener = null;
|
|
643
|
+
group = "";
|
|
641
644
|
} else if (group === "" && currentGroupOpener === char) {
|
|
642
645
|
output.push(char);
|
|
643
646
|
currentGroupOpener = null;
|
|
644
|
-
group = "";
|
|
645
647
|
} else group += char;
|
|
646
648
|
} else if (["[", "{"].includes(char)) currentGroupOpener = char;
|
|
647
649
|
else output.push(char);
|
|
648
|
-
|
|
650
|
+
if (currentGroupOpener !== null) throw new Error("Unterminated group in keyboard input");
|
|
649
651
|
return output;
|
|
650
652
|
}
|
|
651
|
-
function assertSupported(
|
|
652
|
-
if (/^\/.+/u.exec(
|
|
653
|
+
function assertSupported(group) {
|
|
654
|
+
if (/^\/.+/u.exec(group) || /.*[^-]>[\d]*\/?$/u.exec(group)) throw new Error("Unsupported keyboard input");
|
|
653
655
|
}
|
|
654
656
|
function matchingBrace(opener) {
|
|
655
657
|
return opener === "{" ? "}" : "]";
|
package/dist/setup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveSelection, i as containsRTL, n as cleanupEditors, t as ProseMirrorEditorImpl } from "./renderProseMirror-
|
|
1
|
+
import { a as resolveSelection, i as containsRTL, n as cleanupEditors, t as ProseMirrorEditorImpl } from "./renderProseMirror-BdkGkoiJ.js";
|
|
2
2
|
import { afterEach, expect } from "vitest";
|
|
3
3
|
import stringifyObject from "stringify-object";
|
|
4
4
|
//#region src/isProseMirrorNode.ts
|