Skip to content

Commit

Permalink
Upgrade to latest versions of Codemirror and Lezer packages
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Dec 6, 2023
1 parent 6f53b61 commit 146937a
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 78 deletions.
127 changes: 64 additions & 63 deletions package-lock.json

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

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@
"build_grammar": "lezer-generator src/editor/lang-heynote/heynote.grammar -o src/editor/lang-heynote/parser.js"
},
"devDependencies": {
"@codemirror/commands": "^6.2.1",
"@codemirror/commands": "^6.3.2",
"@codemirror/lang-cpp": "^6.0.2",
"@codemirror/lang-html": "^6.4.0",
"@codemirror/lang-html": "^6.4.7",
"@codemirror/lang-java": "^6.0.1",
"@codemirror/lang-javascript": "^6.1.2",
"@codemirror/lang-javascript": "^6.2.1",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-lezer": "^6.0.1",
"@codemirror/lang-markdown": "^6.0.5",
"@codemirror/lang-markdown": "^6.2.3",
"@codemirror/lang-php": "^6.0.1",
"@codemirror/lang-python": "^6.1.1",
"@codemirror/lang-python": "^6.1.3",
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/lang-sql": "^6.3.3",
"@codemirror/lang-sql": "^6.5.4",
"@codemirror/lang-xml": "^6.0.2",
"@codemirror/language": "^6.4.0",
"@codemirror/language": "^6.9.3",
"@codemirror/rangeset": "^0.19.9",
"@codemirror/search": "^6.2.3",
"@codemirror/search": "^6.5.5",
"@electron/asar": "^3.2.2",
"@lezer/generator": "^1.2.2",
"@lezer/generator": "^1.5.1",
"@rollup/plugin-node-resolve": "^15.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"codemirror": "^6.0.1",
Expand Down
4 changes: 2 additions & 2 deletions src/editor/emacs.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export function emacsKeymap(editor) {
["ArrowRight", emacsMoveCommand(cursorCharRight, selectCharRight)],
["ArrowUp", emacsMoveCommand(cursorLineUp, selectLineUp)],
["ArrowDown", emacsMoveCommand(cursorLineDown, selectLineDown)],
["Ctrl-ArrowLeft", emacsMoveCommand(cursorGroupLeft, selectGroupLeft)],
["Ctrl-ArrowRight", emacsMoveCommand(cursorGroupRight, selectGroupRight)],
{key: "Ctrl-ArrowLeft", run: emacsMoveCommand(cursorGroupLeft, selectGroupLeft), shift: selectGroupLeft},
{key: "Ctrl-ArrowRight", run: emacsMoveCommand(cursorGroupRight, selectGroupRight), shift: selectGroupRight},

["Ctrl-d", deleteCharForward],
["Ctrl-h", deleteCharBackward],
Expand Down
3 changes: 3 additions & 0 deletions src/editor/theme/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export const heynoteBase = EditorView.theme({
height:'19px !important',
marginTop:'-2px !important'
},
'.heynote-blocks-layer': {
width: '100%',
},
'.heynote-blocks-layer .block-even, .heynote-blocks-layer .block-odd': {
width: '100%',
boxSizing: 'content-box',
Expand Down
8 changes: 7 additions & 1 deletion src/editor/theme/dark.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const lineNumberColor = 'rgba(255,255,255, 0.15)';
const commentColor = '#888d97';
const matchingBracket = 'rgba(255,255,255,0.1)';
const selection = "#0865a9";
const selectionBlur = "#225377";


const darkTheme = EditorView.theme({
Expand All @@ -41,7 +42,12 @@ const darkTheme = EditorView.theme({
caretColor: cursor,
},
'.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': { backgroundColor: selection },
'.cm-selectionBackground': {
backgroundColor: selectionBlur,
},
'&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground': {
backgroundColor: selection,
},
'.cm-panels': {
backgroundColor: "#474747",
color: "#9c9c9c",
Expand Down
8 changes: 5 additions & 3 deletions src/editor/theme/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { EditorView } from "@codemirror/view";
import { HighlightStyle, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
import { tags } from '@lezer/highlight';

const selection = "#77baff8c"
const selectionBlur = "#b2c2ca85"

const lightTheme = EditorView.theme({
"&": {
Expand Down Expand Up @@ -42,10 +44,10 @@ const lightTheme = EditorView.theme({
backgroundColor: "rgba(0,0,0, 0.04)",
},
".cm-selectionBackground": {
background: "#b2c2ca85",
background: selectionBlur,
},
"&.cm-focused .cm-selectionBackground": {
background: "#77baff8c",
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
background: selection,
},

".heynote-blocks-layer .block-even": {
Expand Down

0 comments on commit 146937a

Please sign in to comment.