mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-21 08:50:05 +00:00
Add disabled parameter to select widget and browse widget (#8816)
* Add disabled parameter to select widget and browse widget * Add disabled attribute to edit-shortcut
This commit is contained in:
@@ -56,6 +56,9 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.nwdirectory) {
|
||||
domNode.setAttribute("nwdirectory",this.nwdirectory);
|
||||
}
|
||||
if(this.isDisabled === "yes") {
|
||||
domNode.setAttribute("disabled", true);
|
||||
}
|
||||
// Add a click event handler
|
||||
domNode.addEventListener("change",function (event) {
|
||||
if(self.message) {
|
||||
@@ -94,6 +97,7 @@ BrowseWidget.prototype.execute = function() {
|
||||
this.accept = this.getAttribute("accept");
|
||||
this.webkitdirectory = this.getAttribute("webkitdirectory");
|
||||
this.nwdirectory = this.getAttribute("nwdirectory");
|
||||
this.isDisabled = this.getAttribute("disabled", "no");
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -48,6 +48,9 @@ EditShortcutWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.shortcutAriaLabel) {
|
||||
this.inputNode.setAttribute("aria-label",this.shortcutAriaLabel);
|
||||
}
|
||||
if(this.isDisabled === "yes") {
|
||||
this.inputNode.setAttribute("disabled", true);
|
||||
}
|
||||
// Assign the current shortcut
|
||||
this.updateInputNode();
|
||||
// Add event handlers
|
||||
@@ -77,6 +80,7 @@ EditShortcutWidget.prototype.execute = function() {
|
||||
this.shortcutTooltip = this.getAttribute("tooltip");
|
||||
this.shortcutAriaLabel = this.getAttribute("aria-label");
|
||||
this.shortcutFocus = this.getAttribute("focus");
|
||||
this.isDisabled = this.getAttribute("disabled", "no");
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -138,7 +142,7 @@ Selectively refreshes the widget if needed. Returns true if the widget needed re
|
||||
*/
|
||||
EditShortcutWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"] || changedAttributes.focus) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"] || changedAttributes.focus || changedAttributes.disabled) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else if(changedTiddlers[this.shortcutTiddler]) {
|
||||
|
||||
@@ -53,6 +53,9 @@ SelectWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.selectMultiple) {
|
||||
domNode.setAttribute("multiple","multiple");
|
||||
}
|
||||
if(this.isDisabled === "yes") {
|
||||
domNode.setAttribute("disabled", true);
|
||||
}
|
||||
if(this.selectSize) {
|
||||
domNode.setAttribute("size",this.selectSize);
|
||||
}
|
||||
@@ -172,6 +175,7 @@ SelectWidget.prototype.execute = function() {
|
||||
this.selectTabindex = this.getAttribute("tabindex");
|
||||
this.selectTooltip = this.getAttribute("tooltip");
|
||||
this.selectFocus = this.getAttribute("focus");
|
||||
this.isDisabled = this.getAttribute("disabled","no");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
@@ -182,7 +186,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// If we're using a different tiddler/field/index then completely refresh ourselves
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex || changedAttributes.disabled) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user