mirror of
https://codeberg.org/uzu/strudel
synced 2026-08-13 00:50:31 -04:00
fix: undo redo key mapping
+ fix hidden line number style
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { defaultKeymap } from '@codemirror/commands';
|
||||
import { javascript } from '@codemirror/lang-javascript';
|
||||
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
||||
import { EditorState, Compartment } from '@codemirror/state';
|
||||
import { history } from '@codemirror/commands';
|
||||
import { EditorView, highlightActiveLineGutter, keymap, lineNumbers } from '@codemirror/view';
|
||||
import { Drawer, repl } from '@strudel.cycles/core';
|
||||
import { isFlashEnabled, flash } from './flash.mjs';
|
||||
@@ -12,7 +12,7 @@ import { keybindings } from './keybindings.mjs';
|
||||
|
||||
const extensions = {
|
||||
isLineWrappingEnabled: (on) => (on ? EditorView.lineWrapping : []),
|
||||
isLineNumbersDisplayed: (on) => (on ? lineNumbers() : lineNumbers({ formatNumber: () => '' })),
|
||||
isLineNumbersDisplayed: (on) => (on ? lineNumbers() : []),
|
||||
theme,
|
||||
isAutoCompletionEnabled,
|
||||
isPatternHighlightingEnabled,
|
||||
@@ -34,7 +34,7 @@ export function initEditor({ initialCode = '', onChange, onEvaluate, onStop, set
|
||||
javascript(),
|
||||
highlightActiveLineGutter(),
|
||||
syntaxHighlighting(defaultHighlightStyle),
|
||||
keymap.of(defaultKeymap),
|
||||
history(),
|
||||
EditorView.updateListener.of((v) => onChange(v)),
|
||||
keymap.of([
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ import { keymap, ViewPlugin } from '@codemirror/view';
|
||||
import { emacs } from '@replit/codemirror-emacs';
|
||||
import { vim } from '@replit/codemirror-vim';
|
||||
import { vscodeKeymap } from '@replit/codemirror-vscode-keymap';
|
||||
import { defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||
|
||||
const vscodePlugin = ViewPlugin.fromClass(
|
||||
class {
|
||||
@@ -14,7 +15,6 @@ const vscodePlugin = ViewPlugin.fromClass(
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const vscodeExtension = (options) => [vscodePlugin].concat(options ?? []);
|
||||
|
||||
const keymaps = {
|
||||
@@ -24,6 +24,6 @@ const keymaps = {
|
||||
};
|
||||
|
||||
export function keybindings(name) {
|
||||
const keymap = keymaps[name];
|
||||
return keymap ? keymap() : [];
|
||||
const active = keymaps[name];
|
||||
return [keymap.of(defaultKeymap), keymap.of(historyKeymap), active ? active() : []];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user