1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-23 15:36:52 +00:00

#371 focus title field on edit

* enhanced edit-text widget with a "focus=true" attribute
* modified title template to make it focus and select by default
This commit is contained in:
Tobias Beer 2014-11-25 12:39:08 +01:00
parent 4134392841
commit c0834583a0
2 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,13 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
} }
// Fix height // Fix height
this.fixHeight(); this.fixHeight();
// Focus field
if(this.editFocus === "true") {
domNode.focus();
domNode.select();
}
}; };
/* /*
@ -140,6 +147,8 @@ EditTextWidget.prototype.execute = function() {
this.editAutoHeight = this.getAttribute("autoHeight","yes") === "yes"; this.editAutoHeight = this.getAttribute("autoHeight","yes") === "yes";
this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT); this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT);
this.editFocusPopup = this.getAttribute("focusPopup"); this.editFocusPopup = this.getAttribute("focusPopup");
this.editFocus = this.getAttribute("focus");
// Get the editor element tag and type // Get the editor element tag and type
var tag,type; var tag,type;
if(this.editField === "text") { if(this.editField === "text") {

View File

@ -1,4 +1,4 @@
title: $:/core/ui/EditTemplate/title title: $:/core/ui/EditTemplate/title
tags: $:/tags/EditTemplate tags: $:/tags/EditTemplate
<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor"/> <$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus="true"/>