mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
Update CodeMirror to version 5.17.1
This commit is contained in:
parent
b6ca8649af
commit
1490eafdd2
27 changed files with 351 additions and 152 deletions
24
public/vendor/codemirror/keymap/vim.js
vendored
24
public/vendor/codemirror/keymap/vim.js
vendored
|
@ -72,6 +72,7 @@
|
|||
{ keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },
|
||||
{ keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' },
|
||||
{ keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' },
|
||||
{ keys: '<Ins>', type: 'action', action: 'toggleOverwrite', context: 'insert' },
|
||||
// Motions
|
||||
{ keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }},
|
||||
{ keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }},
|
||||
|
@ -276,6 +277,7 @@
|
|||
|
||||
function cmKey(key, cm) {
|
||||
if (!cm) { return undefined; }
|
||||
if (this[key]) { return this[key]; }
|
||||
var vimKey = cmKeyToVimKey(key);
|
||||
if (!vimKey) {
|
||||
return false;
|
||||
|
@ -288,7 +290,7 @@
|
|||
}
|
||||
|
||||
var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'};
|
||||
var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'};
|
||||
var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del',Insert:'Ins'};
|
||||
function cmKeyToVimKey(key) {
|
||||
if (key.charAt(0) == '\'') {
|
||||
// Keypress character binding of format "'a'"
|
||||
|
@ -2174,6 +2176,17 @@
|
|||
var registerName = actionArgs.selectedCharacter;
|
||||
macroModeState.enterMacroRecordMode(cm, registerName);
|
||||
},
|
||||
toggleOverwrite: function(cm) {
|
||||
if (!cm.state.overwrite) {
|
||||
cm.toggleOverwrite(true);
|
||||
cm.setOption('keyMap', 'vim-replace');
|
||||
CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"});
|
||||
} else {
|
||||
cm.toggleOverwrite(false);
|
||||
cm.setOption('keyMap', 'vim-insert');
|
||||
CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"});
|
||||
}
|
||||
},
|
||||
enterInsertMode: function(cm, actionArgs, vim) {
|
||||
if (cm.getOption('readOnly')) { return; }
|
||||
vim.insertMode = true;
|
||||
|
@ -2219,7 +2232,6 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
cm.setOption('keyMap', 'vim-insert');
|
||||
cm.setOption('disableInput', false);
|
||||
if (actionArgs && actionArgs.replace) {
|
||||
// Handle Replace-mode as a special case of insert mode.
|
||||
|
@ -2227,6 +2239,7 @@
|
|||
cm.setOption('keyMap', 'vim-replace');
|
||||
CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"});
|
||||
} else {
|
||||
cm.toggleOverwrite(false);
|
||||
cm.setOption('keyMap', 'vim-insert');
|
||||
CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"});
|
||||
}
|
||||
|
@ -4771,13 +4784,6 @@
|
|||
CodeMirror.keyMap['vim-insert'] = {
|
||||
// TODO: override navigation keys so that Esc will cancel automatic
|
||||
// indentation from o, O, i_<CR>
|
||||
'Ctrl-N': 'autocomplete',
|
||||
'Ctrl-P': 'autocomplete',
|
||||
'Enter': function(cm) {
|
||||
var fn = CodeMirror.commands.newlineAndIndentContinueComment ||
|
||||
CodeMirror.commands.newlineAndIndent;
|
||||
fn(cm);
|
||||
},
|
||||
fallthrough: ['default'],
|
||||
attach: attachVimMap,
|
||||
detach: detachVimMap,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue