mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-10 15:53:58 +00:00
Style tweaks
This commit is contained in:
parent
9539664e46
commit
951147d502
@ -13,18 +13,19 @@ Extend the edit-text widget to use CodeMirror
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var CODEMIRROR_OPTIONS = "$:/config/CodeMirror", configOptions;
|
var CODEMIRROR_OPTIONS = "$:/config/CodeMirror", configOptions;
|
||||||
/* e.g. to allow vim key bindings
|
/*
|
||||||
* {
|
e.g. to allow vim key bindings
|
||||||
* "require": [
|
{
|
||||||
* "$:/plugins/tiddlywiki/codemirror/addon/dialog.js",
|
"require": [
|
||||||
* "$:/plugins/tiddlywiki/codemirror/addon/searchcursor.js",
|
"$:/plugins/tiddlywiki/codemirror/addon/dialog.js",
|
||||||
* "$:/plugins/tiddlywiki/codemirror/keymap/vim.js"
|
"$:/plugins/tiddlywiki/codemirror/addon/searchcursor.js",
|
||||||
* ],
|
"$:/plugins/tiddlywiki/codemirror/keymap/vim.js"
|
||||||
* "configuration": {
|
],
|
||||||
* "keyMap": "vim",
|
"configuration": {
|
||||||
* "showCursorWhenSelecting": true
|
"keyMap": "vim",
|
||||||
* }
|
"showCursorWhenSelecting": true
|
||||||
*}
|
}
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var EditTextWidget = require("$:/core/modules/widgets/edit-text.js")["edit-text"];
|
var EditTextWidget = require("$:/core/modules/widgets/edit-text.js")["edit-text"];
|
||||||
@ -36,17 +37,16 @@ if($tw.browser) {
|
|||||||
|
|
||||||
if(configOptions) {
|
if(configOptions) {
|
||||||
if(configOptions["require"]) {
|
if(configOptions["require"]) {
|
||||||
if(typeof configOptions["require"] === 'object' &&
|
if($tw.utils.isArray(configOptions["require"]) {
|
||||||
Object.prototype.toString.call(configOptions["require"]) == '[object Array]') {
|
for (var index=0; index < configOptions["require"].length; index++) {
|
||||||
for (var idx=0; idx < configOptions["require"].length; idx++) {
|
require(configOptions["require"][index]);
|
||||||
require(configOptions["require"][idx]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
require(configOptions["require"]);
|
require(configOptions["require"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EditTextWidget._configuration = configOptions["configuration"];
|
EditTextWidget.configuration = configOptions["configuration"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,8 +61,8 @@ EditTextWidget.prototype.postRender = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if($tw.browser && window.CodeMirror && this.editTag === "textarea") {
|
if($tw.browser && window.CodeMirror && this.editTag === "textarea") {
|
||||||
if(EditTextWidget._configuration) {
|
if(EditTextWidget.configuration) {
|
||||||
for (cv in EditTextWidget._configuration) { cm_opts[cv] = EditTextWidget._configuration[cv]; }
|
for (cv in EditTextWidget.configuration) { cm_opts[cv] = EditTextWidget.configuration[cv]; }
|
||||||
}
|
}
|
||||||
cm = CodeMirror.fromTextArea(this.domNodes[0], cm_opts);
|
cm = CodeMirror.fromTextArea(this.domNodes[0], cm_opts);
|
||||||
cm.on("change",function() {
|
cm.on("change",function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user