Skip to content

Commit

Permalink
fix paste issue
Browse files Browse the repository at this point in the history
upgrade codemirror packages
  • Loading branch information
imolorhe committed Jan 5, 2025
1 parent 5ba92a2 commit d04e78e
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 112 deletions.
24 changes: 9 additions & 15 deletions packages/altair-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"@angular/platform-server": "18.2.13",
"@angular/router": "18.2.13",
"@apollo/client": "3.5.6",
"@codemirror/autocomplete": "6.2.0",
"@codemirror/commands": "6.3.3",
"@codemirror/lang-javascript": "6.1.0",
"@codemirror/lang-json": "6.0.1",
"@codemirror/language": "6.5.0",
"@codemirror/lint": "6.5.0",
"@codemirror/search": "6.5.0",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "6.18.0",
"@codemirror/autocomplete": "^6.18.4",
"@codemirror/commands": "^6.7.1",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/language": "^6.10.8",
"@codemirror/lint": "^6.8.4",
"@codemirror/search": "^6.5.8",
"@codemirror/state": "^6.5.0",
"@codemirror/view": "^6.36.1",
"@emotion/css": "^11.11.2",
"@fontsource/jetbrains-mono": "4.2.2",
"@lezer/common": "1.2.1",
Expand Down Expand Up @@ -176,12 +176,6 @@
"license": "MIT",
"main": "dist/main.js",
"private": true,
"resolutions": {
"@codemirror/language": "6.5.0",
"@codemirror/lint": "6.5.0",
"@codemirror/state": "6.4.1",
"@codemirror/view": "6.18.0"
},
"scripts": {
"analyze": "ng build --stats-json && npx webpack-bundle-analyzer dist/stats.json",
"analyze:prod": "ng build --aot --stats-json && npx webpack-bundle-analyzer dist/stats.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ export class XInputComponent implements AfterViewInit, ControlValueAccessor {

if (tr.isUserEvent('input.paste')) {
// For paste events, replace newlines with spaces
const changes = [
const changes: ChangeSpec = [
{
from: 0,
insert: tr.newDoc.toString().replace(/\n/g, ' '),
to: tr.newDoc.length,
insert: tr.newDoc.sliceString(0, undefined, ' '),
},
];
return [{ changes }];
return [tr, { changes, sequential: true }];
}

// Block multi-line input from other sources
Expand Down Expand Up @@ -382,6 +383,6 @@ export class XInputComponent implements AfterViewInit, ControlValueAccessor {
return ranges;
}

private onTouchedCallback: (_: unknown) => void = () => {};
private onChangeCallback: (_: unknown) => void = () => {};
private onTouchedCallback: (_: unknown) => void = () => undefined;
private onChangeCallback: (_: unknown) => void = () => undefined;
}
179 changes: 87 additions & 92 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d04e78e

Please sign in to comment.