Skip to content

Commit a27ce6e

Browse files
committed
Packages: Updated npm packages
Spent way too many hours debugging through issues from jsdom changes.
1 parent 64b06bc commit a27ce6e

File tree

11 files changed

+2071
-1277
lines changed

11 files changed

+2071
-1277
lines changed

package-lock.json

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

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,43 @@
1919
"test": "jest"
2020
},
2121
"devDependencies": {
22-
"@eslint/js": "^9.21.0",
23-
"@lezer/generator": "^1.7.2",
22+
"@eslint/js": "^9.34.0",
23+
"@lezer/generator": "^1.8.0",
2424
"@types/markdown-it": "^14.1.2",
2525
"@types/sortablejs": "^1.15.8",
2626
"chokidar-cli": "^3.0",
27-
"esbuild": "^0.25.0",
28-
"eslint": "^9.21.0",
29-
"eslint-plugin-import": "^2.31.0",
30-
"jest": "^29.7.0",
31-
"jest-environment-jsdom": "^29.7.0",
32-
"livereload": "^0.9.3",
27+
"esbuild": "^0.25.9",
28+
"eslint": "^9.34.0",
29+
"eslint-plugin-import": "^2.32.0",
30+
"jest": "^30.1.1",
31+
"jest-environment-jsdom": "^30.1.1",
32+
"livereload": "^0.10.3",
3333
"npm-run-all": "^4.1.5",
34-
"sass": "^1.85.0",
35-
"ts-jest": "^29.2.6",
34+
"sass": "^1.91.0",
35+
"ts-jest": "^29.4.1",
3636
"ts-node": "^10.9.2",
37-
"typescript": "5.7.*"
37+
"typescript": "5.9.*"
3838
},
3939
"dependencies": {
40-
"@codemirror/commands": "^6.8.0",
40+
"@codemirror/commands": "^6.8.1",
4141
"@codemirror/lang-css": "^6.3.1",
4242
"@codemirror/lang-html": "^6.4.9",
43-
"@codemirror/lang-javascript": "^6.2.3",
44-
"@codemirror/lang-json": "^6.0.1",
45-
"@codemirror/lang-markdown": "^6.3.2",
46-
"@codemirror/lang-php": "^6.0.1",
43+
"@codemirror/lang-javascript": "^6.2.4",
44+
"@codemirror/lang-json": "^6.0.2",
45+
"@codemirror/lang-markdown": "^6.3.4",
46+
"@codemirror/lang-php": "^6.0.2",
4747
"@codemirror/lang-xml": "^6.1.0",
48-
"@codemirror/language": "^6.10.8",
49-
"@codemirror/legacy-modes": "^6.4.3",
48+
"@codemirror/language": "^6.11.3",
49+
"@codemirror/legacy-modes": "^6.5.1",
5050
"@codemirror/state": "^6.5.2",
51-
"@codemirror/theme-one-dark": "^6.1.2",
52-
"@codemirror/view": "^6.36.3",
51+
"@codemirror/theme-one-dark": "^6.1.3",
52+
"@codemirror/view": "^6.38.1",
5353
"@lezer/highlight": "^1.2.1",
5454
"@ssddanbrown/codemirror-lang-smarty": "^1.0.0",
5555
"@ssddanbrown/codemirror-lang-twig": "^1.0.0",
56-
"@types/jest": "^29.5.14",
57-
"codemirror": "^6.0.1",
58-
"idb-keyval": "^6.2.1",
56+
"@types/jest": "^30.0.0",
57+
"codemirror": "^6.0.2",
58+
"idb-keyval": "^6.2.2",
5959
"markdown-it": "^14.1.0",
6060
"markdown-it-task-lists": "^2.1.1",
6161
"snabbdom": "^3.6.2",

resources/js/wysiwyg/lexical/core/LexicalSelection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,8 @@ export function updateDOMSelection(
27082708
const range = document.createRange();
27092709
range.selectNode(selectionTarget);
27102710
selectionRect = range.getBoundingClientRect();
2711+
} else if (selectionTarget instanceof Range) {
2712+
selectionRect = selectionTarget.getBoundingClientRect();
27112713
} else {
27122714
selectionRect = selectionTarget.getBoundingClientRect();
27132715
}

resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalEditor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,8 +2510,8 @@ describe('LexicalEditor tests', () => {
25102510
);
25112511
});
25122512

2513-
expect(onError).toBeCalledWith(updateError);
2514-
expect(textListener).toBeCalledWith('Hello\n\nworld');
2513+
expect(onError).toHaveBeenCalledWith(updateError);
2514+
expect(textListener).toHaveBeenCalledWith('Hello\n\nworld');
25152515
expect(updateListener.mock.lastCall[0].prevEditorState).toBe(editorState);
25162516
});
25172517

resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('LexicalNode tests', () => {
138138
const validNode = new TextNode(textNode.__text, textNode.__key);
139139
expect(textNode.getLatest()).toBe(textNode);
140140
expect(validNode.getLatest()).toBe(textNode);
141-
expect(() => new TestNode(textNode.__key)).toThrowError(
141+
expect(() => new TestNode(textNode.__key)).toThrow(
142142
/TestNode.*re-use key.*TextNode/,
143143
);
144144
});

resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,4 +864,26 @@ export function dispatchEditorMouseClick(editor: LexicalEditor, clientX: number,
864864
});
865865
dom?.dispatchEvent(event);
866866
editor.commitUpdates();
867+
}
868+
869+
export function patchRange() {
870+
const RangePrototype = Object.getPrototypeOf(document.createRange());
871+
RangePrototype.getBoundingClientRect = function (): DOMRect {
872+
const rect = {
873+
bottom: 0,
874+
height: 0,
875+
left: 0,
876+
right: 0,
877+
top: 0,
878+
width: 0,
879+
x: 0,
880+
y: 0,
881+
};
882+
return {
883+
...rect,
884+
toJSON() {
885+
return rect;
886+
},
887+
};
888+
};
867889
}

resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalElementNode.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ import {
1818
} from 'lexical';
1919

2020
import {
21-
$createTestElementNode,
22-
createTestEditor,
21+
$createTestElementNode,
22+
createTestEditor, patchRange,
2323
} from '../../../__tests__/utils';
2424

25+
patchRange();
26+
2527
describe('LexicalElementNode tests', () => {
2628
let container: HTMLElement;
2729

@@ -54,6 +56,7 @@ describe('LexicalElementNode tests', () => {
5456

5557
editor = createTestEditor();
5658
editor.setRootElement(root);
59+
root.focus();
5760

5861
// Insert initial block
5962
await update(() => {
@@ -63,11 +66,11 @@ describe('LexicalElementNode tests', () => {
6366
// Prevent text nodes from combining.
6467
text2.setMode('segmented');
6568
const text3 = $createTextNode('Baz');
66-
// Some operations require a selection to exist, hence
67-
// we make a selection in the setup code.
68-
text.select(0, 0);
6969
block.append(text, text2, text3);
7070
$getRoot().append(block);
71+
// Some operations require a selection to exist, hence
72+
// we make a selection in the setup code.
73+
text.select(0, 0);
7174
});
7275
}
7376

resources/js/wysiwyg/lexical/headless/__tests__/unit/LexicalHeadlessEditor.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ describe('LexicalHeadlessEditor', () => {
146146
editor.dispatchCommand(CONTROLLED_TEXT_INSERTION_COMMAND, 'foo');
147147
});
148148

149-
expect(onUpdate).toBeCalled();
150-
expect(onCommand).toBeCalledWith('foo', expect.anything());
151-
expect(onTransform).toBeCalledWith(
149+
expect(onUpdate).toHaveBeenCalled();
150+
expect(onCommand).toHaveBeenCalledWith('foo', expect.anything());
151+
expect(onTransform).toHaveBeenCalledWith(
152152
expect.objectContaining({__type: 'paragraph'}),
153153
);
154-
expect(onTextContent).toBeCalledWith('Helloworld');
154+
expect(onTextContent).toHaveBeenCalledWith('Helloworld');
155155
});
156156

157157
it('can preserve selection for pending editor state (within update loop)', async () => {

resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelection.test.ts

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ import {
3737
TextNode,
3838
} from 'lexical';
3939
import {
40-
$assertRangeSelection,
41-
$createTestDecoratorNode,
42-
$createTestElementNode,
43-
createTestEditor,
44-
initializeClipboard,
45-
invariant,
40+
$assertRangeSelection,
41+
$createTestDecoratorNode,
42+
$createTestElementNode,
43+
createTestEditor,
44+
initializeClipboard,
45+
invariant, patchRange,
4646
} from 'lexical/__tests__/utils';
4747

4848
import {
@@ -91,24 +91,7 @@ jest.mock('lexical/shared/environment', () => {
9191
return {...originalModule, IS_FIREFOX: true};
9292
});
9393

94-
Range.prototype.getBoundingClientRect = function (): DOMRect {
95-
const rect = {
96-
bottom: 0,
97-
height: 0,
98-
left: 0,
99-
right: 0,
100-
top: 0,
101-
width: 0,
102-
x: 0,
103-
y: 0,
104-
};
105-
return {
106-
...rect,
107-
toJSON() {
108-
return rect;
109-
},
110-
};
111-
};
94+
patchRange();
11295

11396
describe('LexicalSelection tests', () => {
11497
let container: HTMLElement;

resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,6 @@ export function setNativeSelection(
422422
range.setEnd(focusNode, focusOffset);
423423
domSelection.removeAllRanges();
424424
domSelection.addRange(range);
425-
Promise.resolve().then(() => {
426-
document.dispatchEvent(new Event('selectionchange'));
427-
});
428425
}
429426

430427
export function setNativeSelectionWithPaths(
@@ -647,6 +644,8 @@ export async function applySelectionInputs(
647644
editor: LexicalEditor,
648645
) {
649646
const rootElement = editor.getRootElement()!;
647+
// Set initial focus as if we're in the editor
648+
rootElement.focus();
650649

651650
for (let i = 0; i < inputs.length; i++) {
652651
const input = inputs[i];

0 commit comments

Comments
 (0)