Skip to content

Commit

Permalink
fix: codemirror keymap (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-gorules authored Oct 4, 2024
1 parent a3a30f2 commit 2f05c46
Show file tree
Hide file tree
Showing 16 changed files with 1,302 additions and 1,265 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-empty-object-type": "off",
"file-progress/activate": "warn",
"react-hooks/exhaustive-deps": "off",
"react-hooks/rules-of-hooks": "off",
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
"pnpm": "~9"
},
"devDependencies": {
"@swc/core": "^1.5.7",
"@swc/core": "^1.7.26",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^20.12.12",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@types/node": "^22.7.4",
"@types/react": "^18.3.11",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-file-progress": "^1.4.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-file-progress": "^1.5.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2",
"lerna": "^8.1.3",
"lerna": "^8.1.8",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
"prettier": "^3.3.3",
"typescript": "^5.6.2"
},
"version": "0.1.0"
}
37 changes: 19 additions & 18 deletions packages/jdm-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,21 @@
"dependencies": {
"@ant-design/icons": "5.5.1",
"@codemirror/autocomplete": "^6.18.1",
"@codemirror/commands": "^6.6.2",
"@codemirror/language": "^6.10.3",
"@codemirror/lint": "^6.8.2",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.34.0",
"@codemirror/view": "^6.34.1",
"@gorules/lezer-zen": "workspace:*",
"@gorules/lezer-zen-template": "workspace:*",
"@lezer/common": "^1.2.1",
"@lezer/common": "^1.2.2",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.2",
"@monaco-editor/react": "^4.6.0",
"@tanstack/react-table": "8.20.5",
"@tanstack/react-virtual": "3.10.8",
"ace-builds": "^1.36.2",
"antd": "5.21.1",
"antd": "5.21.2",
"clsx": "2.1.1",
"dnd-core": "^16.0.1",
"exceljs": "^4.4.0",
Expand All @@ -52,38 +53,38 @@
"react-dnd-html5-backend": "16.0.1",
"react-json-tree": "^0.19.0",
"reactflow": "11.11.4",
"ts-pattern": "^5.3.1",
"ts-pattern": "^5.4.0",
"use-debounce": "^10.0.3",
"zod": "^3.23.8",
"zustand": "^4.5.5"
},
"devDependencies": {
"@gorules/zen-engine-wasm": "workspace:*",
"@storybook/addon-actions": "8.3.3",
"@storybook/addon-docs": "8.3.3",
"@storybook/addon-essentials": "8.3.3",
"@storybook/addon-interactions": "8.3.3",
"@storybook/addon-links": "8.3.3",
"@storybook/addon-storysource": "^8.3.3",
"@storybook/manager-api": "^8.3.3",
"@storybook/react": "^8.3.3",
"@storybook/react-vite": "^8.3.3",
"@storybook/test": "^8.3.3",
"@storybook/addon-actions": "8.3.5",
"@storybook/addon-docs": "8.3.5",
"@storybook/addon-essentials": "8.3.5",
"@storybook/addon-interactions": "8.3.5",
"@storybook/addon-links": "8.3.5",
"@storybook/addon-storysource": "^8.3.5",
"@storybook/manager-api": "^8.3.5",
"@storybook/react": "^8.3.5",
"@storybook/react-vite": "^8.3.5",
"@storybook/test": "^8.3.5",
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "16.0.1",
"@testing-library/user-event": "14.5.2",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@types/big.js": "^6.2.2",
"@types/react": "18.3.9",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.0",
"dayjs": "^1.11.13",
"react": "18.3.1",
"react-dom": "18.3.1",
"sass": "^1.79.3",
"storybook": "8.3.3",
"sass": "^1.79.4",
"storybook": "8.3.5",
"storybook-dark-mode": "^4.0.2",
"vite": "5.4.8",
"vite-plugin-dts": "^4.2.2",
"vite-plugin-dts": "^4.2.3",
"vite-plugin-wasm": "^3.3.0"
},
"jest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
closeBrackets,
closeBracketsKeymap,
} from '@codemirror/autocomplete';
import { history, historyKeymap, insertNewlineAndIndent } from '@codemirror/commands';
import { HighlightStyle, LRLanguage, LanguageSupport, syntaxHighlighting, syntaxTree } from '@codemirror/language';
import type { EditorView } from '@codemirror/view';
import { hoverTooltip, keymap } from '@codemirror/view';
Expand Down Expand Up @@ -269,5 +270,10 @@ export const zenExtensions = ({ type }: extensionOptions) => [
closeBrackets(),
zenLinter(type),
typeField,
keymap.of(closeBracketsKeymap),
history(),
keymap.of([
...closeBracketsKeymap,
...historyKeymap,
{ key: 'Enter', run: insertNewlineAndIndent, shift: insertNewlineAndIndent },
]),
];
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const GraphSimulator: React.FC<GraphSimulatorProps> = ({

onChange?.(formatted);
setRequestValue(formatted);
} catch (e) {
} catch {
notification.error({
message: 'Invalid format',
description: 'Unable to format request, invalid JSON format',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const Graph = forwardRef<GraphRef, GraphProps>(({ reactFlowProOptions, cl

try {
elementPosition = JSON.parse(event.dataTransfer.getData('relativePosition'));
} catch (e) {
} catch {
return;
}
const position = reactFlowInstance.current.project({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const useGraphClipboard = (
if (anchor) {
try {
await copyToClipboard(JSON.stringify({ nodes }));
} catch (e) {
} catch {
//
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export const DecisionNode: React.FC<DecisionNodeProps> = ({
<Typography.Text
className={clsx('grl-dn__header__text__name')}
onClick={() => {
!disabled && setContentEditing(true);
if (!disabled) {
setContentEditing(true);
}
}}
>
{name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const ExpressionItem: React.FC<ExpressionItemProps> = ({ expression, inde
<div className='expression-list-item__code'>
<LocalCodeEditor
placeholder='Expression'
maxRows={6}
maxRows={9}
disabled={disabled}
value={expression?.value}
onChange={(value) => onChange({ value })}
Expand Down
2 changes: 1 addition & 1 deletion packages/jdm-editor/src/helpers/excel-file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const parseSpreadsheetData = (spreadSheetData: any) => {

try {
headerMeta = JSON.parse(header.note);
} catch (error) {
} catch {
message.error('Header note can not be parsed!');
}

Expand Down
2 changes: 1 addition & 1 deletion packages/jdm-editor/src/helpers/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const copyToClipboard = async (content: string) => {
export const pasteFromClipboard = async (): Promise<string> => {
try {
return navigator.clipboard.readText();
} catch (e) {
} catch {
return '';
}
};
Expand Down
6 changes: 3 additions & 3 deletions packages/lezer-zen-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"license": "MIT",
"devDependencies": {
"@lezer/generator": "^1.7.1",
"@rollup/plugin-node-resolve": "^15.2.4",
"@rollup/plugin-node-resolve": "^15.3.0",
"mocha": "^10.7.3",
"rollup": "^4.22.4"
"rollup": "^4.24.0"
},
"repository": {
"type": "git",
Expand All @@ -33,7 +33,7 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@lezer/common": "^1.2.1",
"@lezer/common": "^1.2.2",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.2"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/lezer-zen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"license": "MIT",
"devDependencies": {
"@lezer/generator": "^1.7.1",
"@rollup/plugin-node-resolve": "^15.2.4",
"@rollup/plugin-node-resolve": "^15.3.0",
"mocha": "^10.7.3",
"rollup": "^4.22.4"
"rollup": "^4.24.0"
},
"repository": {
"type": "git",
Expand All @@ -33,7 +33,7 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@lezer/common": "^1.2.1",
"@lezer/common": "^1.2.2",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.2"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/zen-engine-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ crate-type = ["cdylib"]

[dependencies]
bumpalo = "3"
zen-expression = { version = "0.30", default-features = false, features = ["regex-lite"] }
zen-tmpl = { version = "0.30" }
zen-expression = { version = "0.30.3", default-features = false, features = ["regex-lite"] }
zen-tmpl = { version = "0.30.3" }
getrandom = { version = "0.2", features = ["js"] }
fastrand = { version = "2", features = ["js"] }

Expand Down
Loading

0 comments on commit 2f05c46

Please sign in to comment.