mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-05-07 18:48:39 +00:00
make shortcut editor tab dependent
This commit is contained in:
@@ -36,7 +36,7 @@ const themes = { default: defaultCM5Theme, darkbrewery, ...themesImport };
|
|||||||
const themeCompartment = new Compartment();
|
const themeCompartment = new Compartment();
|
||||||
const highlightCompartment = new Compartment();
|
const highlightCompartment = new Compartment();
|
||||||
|
|
||||||
import customKeymap from './customKeyMap.js';
|
import { generalKeymap, markdownKeymap } from './customKeyMaps.js';
|
||||||
import pageFoldExtension from './customFolding.js';
|
import pageFoldExtension from './customFolding.js';
|
||||||
import { customHighlightStyle, tokenizeCustomMarkdown, tokenizeCustomCSS } from './customHighlight.js';
|
import { customHighlightStyle, tokenizeCustomMarkdown, tokenizeCustomCSS } from './customHighlight.js';
|
||||||
import { legacyCustomHighlightStyle, legacyTokenizeCustomMarkdown } from './legacyCustomHighlight.js';
|
import { legacyCustomHighlightStyle, legacyTokenizeCustomMarkdown } from './legacyCustomHighlight.js';
|
||||||
@@ -168,7 +168,8 @@ const CodeEditor = forwardRef(
|
|||||||
...(tab !== 'brewStyles' ? [autocompleteEmoji] : []),
|
...(tab !== 'brewStyles' ? [autocompleteEmoji] : []),
|
||||||
search(),
|
search(),
|
||||||
keymap.of([...defaultKeymap, foldKeymap, ...searchKeymap]),
|
keymap.of([...defaultKeymap, foldKeymap, ...searchKeymap]),
|
||||||
customKeymap,
|
generalKeymap,
|
||||||
|
...(tab !== 'brewStyles' ? [markdownKeymap] : []),
|
||||||
drawSelection(),
|
drawSelection(),
|
||||||
EditorState.allowMultipleSelections.of(true),
|
EditorState.allowMultipleSelections.of(true),
|
||||||
customClose,
|
customClose,
|
||||||
|
|||||||
@@ -207,8 +207,13 @@ const newPage = (view)=>{
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default keymap.of([
|
export const generalKeymap = keymap.of([
|
||||||
{ key: 'Tab', run: insertTabAtCursor },
|
{ key: 'Tab', run: insertTabAtCursor },
|
||||||
|
{ key: 'Mod-z', run: undo }, //i think it may be unnecessary
|
||||||
|
{ key: 'Mod-Shift-z', run: redo },
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const markdownKeymap = keymap.of([
|
||||||
//{ key: 'Shift-Tab', run: indentMore },
|
//{ key: 'Shift-Tab', run: indentMore },
|
||||||
{ key: 'Shift-Tab', run: indentLess },
|
{ key: 'Shift-Tab', run: indentLess },
|
||||||
{ key: 'Mod-b', run: makeBold },
|
{ key: 'Mod-b', run: makeBold },
|
||||||
@@ -233,6 +238,4 @@ export default keymap.of([
|
|||||||
{ key: 'Shift-Mod-6', run: makeHeader(6) },
|
{ key: 'Shift-Mod-6', run: makeHeader(6) },
|
||||||
{ key: 'Shift-Mod-Enter', run: newColumn },
|
{ key: 'Shift-Mod-Enter', run: newColumn },
|
||||||
{ key: 'Mod-Enter', run: newPage },
|
{ key: 'Mod-Enter', run: newPage },
|
||||||
{ key: 'Mod-z', run: undo }, //i think it may be unnecessary
|
|
||||||
{ key: 'Mod-Shift-z', run: redo },
|
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user