1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

rename from mode to keymap bindings (Vim and Emacs bindings)

This commit is contained in:
João Bolila 2014-01-12 19:38:27 +00:00
parent a704498155
commit 8f4e1587a2

View File

@ -13,21 +13,21 @@ Extend the edit-text widget to use CodeMirror
"use strict";
var CODEMIRROR_KEYMAP = "$:/CodeMirrorKeymap",
mode, modesAllowed = /^(vim|emacs)$/i;
kbinding, kbindingsAllowed = /^(vim|emacs)$/i;
var EditTextWidget = require("$:/core/modules/widgets/edit-text.js")["edit-text"];
if($tw.browser) {
require("$:/plugins/tiddlywiki/codemirror/codemirror.js");
mode = ($tw.wiki.getTiddlerText(CODEMIRROR_KEYMAP) || '').match(modesAllowed);
if (mode) {
kbinding = ($tw.wiki.getTiddlerText(CODEMIRROR_KEYMAP) || '').match(kbindingsAllowed);
if (kbinding) {
require("$:/plugins/tiddlywiki/codemirror/addon/dialog.js");
require("$:/plugins/tiddlywiki/codemirror/addon/searchcursor.js");
if (mode[0].toLowerCase() === 'emacs') {
if (kbinding[0].toLowerCase() === 'emacs') {
require("$:/plugins/tiddlywiki/codemirror/keymap/emacs.js");
EditTextWidget._codemirrorMode = 'emacs';
}
else {
else if (kbinding[0].toLowerCase() === 'vim') {
require("$:/plugins/tiddlywiki/codemirror/keymap/vim.js");
EditTextWidget._codemirrorMode = 'vim';
}