1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add control panel setting for disabling the new editor toolbar

This commit is contained in:
Jermolene 2016-05-09 10:33:12 -06:00
parent 848a65d840
commit c8777ea012
3 changed files with 21 additions and 3 deletions

View File

@ -99,6 +99,9 @@ Settings/CamelCase/Caption: Camel Case Wiki Links
Settings/CamelCase/Hint: You can globally disable automatic linking of ~CamelCase phrases. Requires reload to take effect
Settings/CamelCase/Description: Enable automatic ~CamelCase linking
Settings/Caption: Settings
Settings/EditorToolbar/Caption: Editor Toolbar
Settings/EditorToolbar/Hint: Enable or disable the editor toolbar:
Settings/EditorToolbar/Description: Show editor toolbar
Settings/Hint: These settings let you customise the behaviour of TiddlyWiki.
Settings/NavigationAddressBar/Caption: Navigation Address Bar
Settings/NavigationAddressBar/Hint: Behaviour of the browser address bar when navigating to a tiddler:

View File

@ -16,6 +16,7 @@ var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pi
// Configuration tiddlers
var HEIGHT_MODE_TITLE = "$:/config/TextEditor/EditorHeight/Mode";
var ENABLE_TOOLBAR_TITLE = "$:/config/TextEditor/EnableToolbar";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
@ -196,7 +197,8 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
// Make the child widgets
this.makeChildWidgets();
// Determine whether to show the toolbar
this.editShowToolbar = !!(this.children && this.children.length > 0);
this.editShowToolbar = this.wiki.getTiddlerText(ENABLE_TOOLBAR_TITLE,"yes");
this.editShowToolbar = (this.editShowToolbar === "yes") && !!(this.children && this.children.length > 0);
};
/*
@ -205,7 +207,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
EditTextWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
// Completely rerender if any of our attributes have changed
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedTiddlers[HEIGHT_MODE_TITLE]) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
this.refreshSelf();
return true;
} else if(changedTiddlers[this.editTitle]) {
@ -213,7 +215,11 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
this.updateEditor(editInfo.value,editInfo.type);
}
this.engine.fixHeight();
return this.refreshChildren(changedTiddlers);
if(this.editShowToolbar) {
return this.refreshChildren(changedTiddlers);
} else {
return false;
}
};
/*

View File

@ -0,0 +1,9 @@
title: $:/core/ui/ControlPanel/Settings/EditorToolbar
tags: $:/tags/ControlPanel/Settings
caption: {{$:/language/ControlPanel/Settings/EditorToolbar/Caption}}
\define lingo-base() $:/language/ControlPanel/Settings/EditorToolbar/
<<lingo Hint>>
<$checkbox tiddler="$:/config/TextEditor/EnableToolbar" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/TextEditor/EnableToolbar"><<lingo Description>></$link> </$checkbox>