add options.hasDom to widgets, that create DOM elements
This commit is contained in:
parent
bb9c991ce3
commit
3c888992a8
|
@ -15,6 +15,7 @@ Browse widget for browsing for files to import
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var BrowseWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Checkbox widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var CheckboxWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Code block node widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var CodeBlockWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ var Widget = require("$:/core/modules/widgets/widget.js").widget,
|
|||
dmp = require("$:/core/modules/utils/diff-match-patch/diff_match_patch.js");
|
||||
|
||||
var DiffTextWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Draggable widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var DraggableWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Droppable widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var DroppableWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ var IMPORT_TITLE = "$:/Import";
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var DropZoneWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ var LINE_WIDTH_TITLE = "$:/config/BitmapEditor/LineWidth",
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var EditBitmapWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Widget to display an editable keyboard shortcut
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var EditShortcutWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Element widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ElementWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Error widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ErrorWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Event handler widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var EventWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ The width and height attributes are interpreted as a number of pixels, and do no
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ImageWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
@ -65,10 +66,10 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
|||
if(text) {
|
||||
// Render the appropriate element for the image type by looking up the encoding in the content type info
|
||||
var encoding = typeInfo.encoding || "utf8";
|
||||
if (encoding === "base64") {
|
||||
if(encoding === "base64") {
|
||||
// .pdf .png .jpg etc.
|
||||
src = "data:" + deserializerType + ";base64," + text;
|
||||
if (deserializerType === "application/pdf") {
|
||||
if(deserializerType === "application/pdf") {
|
||||
tag = "embed";
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -15,6 +15,7 @@ Keyboard shortcut widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var KeyboardWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
@ -53,7 +54,7 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) {
|
|||
};
|
||||
|
||||
KeyboardWidget.prototype.handleChangeEvent = function(event) {
|
||||
if ($tw.keyboardManager.handleKeydownEvent(event, {onlyPriority: true})) {
|
||||
if($tw.keyboardManager.handleKeydownEvent(event, {onlyPriority: true})) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Link widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var LinkWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Password widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var PasswordWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ Set a field or index at a given tiddler via radio buttons
|
|||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
var RadioWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Range widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var RangeWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
@ -114,8 +115,8 @@ RangeWidget.prototype.handleMouseUpEvent = function(event) {
|
|||
this.invokeActionString(this.actionsMouseUp,this,event,variables);
|
||||
}
|
||||
// TODO remove the following if() once IE is gone!
|
||||
if ($tw.browser.isIE) {
|
||||
if (this.startValue !== this.inputDomNode.value) {
|
||||
if($tw.browser.isIE) {
|
||||
if(this.startValue !== this.inputDomNode.value) {
|
||||
this.handleChangeEvent(event);
|
||||
this.startValue = this.inputDomNode.value;
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ RangeWidget.prototype.handleMouseUpEvent = function(event) {
|
|||
}
|
||||
|
||||
RangeWidget.prototype.handleChangeEvent = function(event) {
|
||||
if (this.mouseDown) { // TODO refactor this function once IE is gone.
|
||||
if(this.mouseDown) { // TODO refactor this function once IE is gone.
|
||||
this.handleInputEvent(event);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@ Raw widget
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var RawWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
|||
var Popup = require("$:/core/modules/utils/dom/popup.js");
|
||||
|
||||
var RevealWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
@ -96,9 +97,9 @@ RevealWidget.prototype.positionPopup = function(domNode) {
|
|||
left = Math.max(0,left);
|
||||
top = Math.max(0,top);
|
||||
}
|
||||
if (this.popup.absolute) {
|
||||
if(this.popup.absolute) {
|
||||
// Traverse the offsetParent chain and correct the offset to make it relative to the parent node.
|
||||
for (var offsetParentDomNode = domNode.offsetParent; offsetParentDomNode; offsetParentDomNode = offsetParentDomNode.offsetParent) {
|
||||
for(var offsetParentDomNode = domNode.offsetParent; offsetParentDomNode; offsetParentDomNode = offsetParentDomNode.offsetParent) {
|
||||
left -= offsetParentDomNode.offsetLeft;
|
||||
top -= offsetParentDomNode.offsetTop;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ var DEBOUNCE_INTERVAL = 100; // Delay after last scroll event before updating th
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ScrollableWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ Select widget:
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var SelectWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
@ -118,7 +119,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
|||
}
|
||||
}
|
||||
// Assign it to the select element if it's different than the current value
|
||||
if (this.selectMultiple) {
|
||||
if(this.selectMultiple) {
|
||||
value = value === undefined ? "" : value;
|
||||
var select = this.getSelectDomNode();
|
||||
var values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
|
||||
|
@ -147,9 +148,9 @@ SelectWidget.prototype.getSelectValues = function() {
|
|||
select = this.getSelectDomNode();
|
||||
result = [];
|
||||
options = select && select.options;
|
||||
for (var i=0; i<options.length; i++) {
|
||||
for(var i=0; i<options.length; i++) {
|
||||
opt = options[i];
|
||||
if (opt.selected) {
|
||||
if(opt.selected) {
|
||||
result.push(opt.value || opt.text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ Widget to wikify text into a variable
|
|||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var WikifyWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue