Merge 0e7caca935
into 64f5dd942c
This commit is contained in:
commit
dc7b1b0e1f
|
@ -37,6 +37,7 @@ Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection
|
|||
Error/PutEditConflict: File changed on server
|
||||
Error/PutForbidden: Permission denied
|
||||
Error/PutUnauthorized: Authentication required
|
||||
Error/RecursiveButton: Possible Recursive Error: Button in button is not allowed
|
||||
Error/RecursiveTransclusion: Recursive transclusion error in transclude widget
|
||||
Error/RetrievingSkinny: Error retrieving skinny tiddler list
|
||||
Error/SavingToTWEdit: Error saving to TWEdit
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*\
|
||||
title: $:/core/modules/macros/get_UNSAFE_max_widget_tree_depth.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
||||
Macro to return the parents widget parentWidget.UNSAFE_max_widget_tree_depth variable
|
||||
|
||||
\*/
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Information about this macro
|
||||
*/
|
||||
|
||||
exports.name = "get_UNSAFE_max_widget_tree_depth";
|
||||
|
||||
exports.params = [];
|
||||
|
||||
/*
|
||||
Run the macro
|
||||
*/
|
||||
exports.run = function() {
|
||||
return (this.parentWidget) ? this.parentWidget.UNSAFE_max_widget_tree_depth + "" : "";
|
||||
};
|
|
@ -0,0 +1,26 @@
|
|||
/*\
|
||||
title: $:/core/modules/macros/parent-ancestorcount-dom.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
||||
Macro to return the parent widget this.ancestors variable
|
||||
|
||||
\*/
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Information about this macro
|
||||
*/
|
||||
|
||||
exports.name = "parent-ancestorcount-dom";
|
||||
|
||||
exports.params = [];
|
||||
|
||||
/*
|
||||
Run the macro
|
||||
*/
|
||||
exports.run = function() {
|
||||
return (this.parentWidget) ? this.parentWidget.getAncestorCountDom() + "" : "";
|
||||
};
|
|
@ -0,0 +1,26 @@
|
|||
/*\
|
||||
title: $:/core/modules/macros/parent-ancestorcount.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
||||
Macro to return the parent widget this.ancestors variable
|
||||
|
||||
\*/
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Information about this macro
|
||||
*/
|
||||
|
||||
exports.name = "parent-ancestorcount";
|
||||
|
||||
exports.params = [];
|
||||
|
||||
/*
|
||||
Run the macro
|
||||
*/
|
||||
exports.run = function() {
|
||||
return (this.parentWidget) ? this.parentWidget.getAncestorCount() + "" : "";
|
||||
};
|
|
@ -0,0 +1,34 @@
|
|||
/*\
|
||||
title: $:/core/modules/macros/set_UNSAFE_max_widget_tree_depth.js
|
||||
type: application/javascript
|
||||
module-type: macro
|
||||
|
||||
Macro to set the parents widget UNSAFE_max_widget_tree_depth variable
|
||||
|
||||
\*/
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Information about this macro
|
||||
*/
|
||||
|
||||
exports.name = "set_UNSAFE_max_widget_tree_depth";
|
||||
|
||||
exports.params = [
|
||||
{name: "number"}
|
||||
];
|
||||
|
||||
/*
|
||||
Run the macro
|
||||
*/
|
||||
exports.run = function(number) {
|
||||
var iNumber = parseInt(number,10);
|
||||
if(!isNaN(iNumber) && iNumber >= 100) {
|
||||
if(this.parentWidget) {
|
||||
this.parentWidget.UNSAFE_max_widget_tree_depth = iNumber;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
|||
var Popup = require("$:/core/modules/utils/dom/popup.js");
|
||||
|
||||
var ButtonWidget = function(parseTreeNode,options) {
|
||||
options.hasDom = true;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
|
@ -25,6 +26,23 @@ Inherit from the base widget class
|
|||
*/
|
||||
ButtonWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Detect nested buttons
|
||||
*/
|
||||
ButtonWidget.prototype.isNestedButton = function() {
|
||||
var pointer = this.parentWidget,
|
||||
depth = 0;
|
||||
while(pointer) {
|
||||
if(pointer instanceof ButtonWidget) {
|
||||
// we allow 1 nested button
|
||||
if(depth > 1) return true;
|
||||
depth += 1;
|
||||
}
|
||||
pointer = pointer.parentWidget;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
|
@ -37,6 +55,19 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||
// Compute attributes and execute state
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
// Check "button in button". Return early with an error message
|
||||
// This check also prevents fatal recursion errors using the transclusion widget
|
||||
if(this.getVariable("tv-limit-nested-buttons") === "yes") {
|
||||
if(this.isNestedButton()) {
|
||||
var domNode = this.document.createElement("span");
|
||||
var textNode = this.document.createTextNode($tw.language.getString("Error/RecursiveButton"));
|
||||
domNode.appendChild(textNode);
|
||||
domNode.className = "tc-error";
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.domNodes.push(domNode);
|
||||
return; // an error message
|
||||
}
|
||||
}
|
||||
// Create element
|
||||
if(this.buttonTag && $tw.config.htmlUnsafeElements.indexOf(this.buttonTag) === -1) {
|
||||
tag = this.buttonTag;
|
||||
|
@ -44,7 +75,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||
domNode = this.document.createElement(tag);
|
||||
this.domNode = domNode;
|
||||
// Assign classes
|
||||
var classes = this["class"].split(" ") || [],
|
||||
var classes = (this["class"]) ? this["class"].split(" ") : [],
|
||||
isPoppedUp = (this.popup || this.popupTitle) && this.isPoppedUp();
|
||||
if(this.selectedClass) {
|
||||
if((this.set || this.setTitle) && this.setTo && this.isSelected()) {
|
||||
|
@ -58,7 +89,9 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||
if(isPoppedUp) {
|
||||
$tw.utils.pushTop(classes,"tc-popup-handle");
|
||||
}
|
||||
domNode.className = classes.join(" ");
|
||||
if(classes.length > 0) {
|
||||
domNode.className = classes.join(" ");
|
||||
}
|
||||
// Assign data- attributes
|
||||
this.assignAttributes(domNode,{
|
||||
sourcePrefix: "data-",
|
||||
|
@ -74,7 +107,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||
if(this["aria-label"]) {
|
||||
domNode.setAttribute("aria-label",this["aria-label"]);
|
||||
}
|
||||
if (this.role) {
|
||||
if(this.role) {
|
||||
domNode.setAttribute("role", this.role);
|
||||
}
|
||||
if(this.popup || this.popupTitle) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ Widget base class
|
|||
|
||||
/* Maximum permitted depth of the widget tree for recursion detection */
|
||||
var MAX_WIDGET_TREE_DEPTH = 1000;
|
||||
var MAX_DOM_TREE_DEPTH = 100;
|
||||
|
||||
/*
|
||||
Create a widget object for a parse tree node
|
||||
|
@ -65,6 +66,23 @@ Widget.prototype.initialise = function(parseTreeNode,options) {
|
|||
}
|
||||
});
|
||||
}
|
||||
// Increment ancestorCountDom if options.hasDom = true otherwise set it to the "old" value
|
||||
this.getAncestorCountDom(options.hasDom);
|
||||
};
|
||||
|
||||
Widget.prototype.getAncestorCountDom = function(createsDomNode) {
|
||||
if(this.ancestorCountDom === undefined) {
|
||||
if(this.parentWidget) {
|
||||
if(createsDomNode) {
|
||||
this.ancestorCountDom = this.parentWidget.getAncestorCountDom() + 1;
|
||||
} else {
|
||||
this.ancestorCountDom = this.parentWidget.getAncestorCountDom();
|
||||
}
|
||||
} else {
|
||||
this.ancestorCountDom = 0;
|
||||
}
|
||||
}
|
||||
return this.ancestorCountDom;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -479,8 +497,10 @@ Widget.prototype.getAncestorCount = function() {
|
|||
if(this.ancestorCount === undefined) {
|
||||
if(this.parentWidget) {
|
||||
this.ancestorCount = this.parentWidget.getAncestorCount() + 1;
|
||||
this.UNSAFE_max_widget_tree_depth = this.parentWidget.UNSAFE_max_widget_tree_depth || MAX_WIDGET_TREE_DEPTH;
|
||||
} else {
|
||||
this.ancestorCount = 0;
|
||||
this.UNSAFE_max_widget_tree_depth = MAX_WIDGET_TREE_DEPTH;
|
||||
}
|
||||
}
|
||||
return this.ancestorCount;
|
||||
|
@ -494,10 +514,18 @@ Widget.prototype.makeChildWidgets = function(parseTreeNodes,options) {
|
|||
this.children = [];
|
||||
var self = this;
|
||||
// Check for too much recursion
|
||||
if(this.getAncestorCount() > MAX_WIDGET_TREE_DEPTH) {
|
||||
this.children.push(this.makeChildWidget({type: "error", attributes: {
|
||||
"$message": {type: "string", value: $tw.language.getString("Error/RecursiveTransclusion")}
|
||||
}}));
|
||||
// if(this.getAncestorCount() > this.UNSAFE_max_widget_tree_depth) {
|
||||
// if(this.getAncestorCount() > MAX_WIDGET_TREE_DEPTH) {
|
||||
if((this.getAncestorCountDom() > MAX_DOM_TREE_DEPTH) || (this.getAncestorCount() > this.UNSAFE_max_widget_tree_depth)) {
|
||||
this.children.push(this.makeChildWidget({
|
||||
type: "error", attributes: {
|
||||
"$message": {
|
||||
type: "string",
|
||||
value: this.getAncestorCount() + " - " + (this.getAncestorCountDom() + 1 ) + " - " +
|
||||
$tw.language.getString("Error/RecursiveTransclusion")
|
||||
}
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
// Create set variable widgets for each variable
|
||||
$tw.utils.each(options.variables,function(value,name) {
|
||||
|
@ -682,7 +710,7 @@ Refresh all the children of a widget
|
|||
Widget.prototype.refreshChildren = function(changedTiddlers) {
|
||||
var children = this.children,
|
||||
refreshed = false;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
for(var i = 0; i < children.length; i++) {
|
||||
refreshed = children[i].refresh(changedTiddlers) || refreshed;
|
||||
}
|
||||
return refreshed;
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
title: Transclude/Recursion/Button
|
||||
description: Transclusion recursion inside a button
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$button>
|
||||
<$transclude/>
|
||||
</$button>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><button><span class="tc-error">202 - 102 - Recursive transclusion error in transclude widget</span></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></button></p>
|
|
@ -0,0 +1,15 @@
|
|||
title: Transclude/Recursion/ButtonInButton
|
||||
description: Button in Button
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$button>Test Button
|
||||
<$button>Second button
|
||||
</$button>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><button>Test Button<button>Second button</button></button></p>
|
|
@ -0,0 +1,18 @@
|
|||
title: Transclude/Recursion/Variables
|
||||
description: Transclusion recursion variables
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<<get_UNSAFE_max_widget_tree_depth>> - {{Button}}
|
||||
+
|
||||
title: Button
|
||||
|
||||
<$button><<parent-ancestorcount>></$button>
|
||||
<$button><<parent-ancestorcount-dom>></$button>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>1000 - <button>6</button>
|
||||
<button>2</button></p>
|
|
@ -10,4 +10,4 @@ title: Output
|
|||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><span class="tc-error">Recursive transclusion error in transclude widget</span></p>
|
||||
<p><span class="tc-error">1001 - 2 - Recursive transclusion error in transclude widget</span></p>
|
|
@ -157,7 +157,7 @@ describe("Widget module", function() {
|
|||
// Render the widget node to the DOM
|
||||
var wrapper = renderWidgetNode(widgetNode);
|
||||
// Test the rendering
|
||||
expect(wrapper.innerHTML).toBe("<span class=\"tc-error\">Recursive transclusion error in transclude widget</span>");
|
||||
expect(wrapper.innerHTML).toBe("<span class=\"tc-error\">1001 - 1 - Recursive transclusion error in transclude widget</span>");
|
||||
});
|
||||
|
||||
it("should deal with SVG elements", function() {
|
||||
|
@ -799,7 +799,7 @@ describe("Widget module", function() {
|
|||
// Render the widget node to the DOM
|
||||
renderWidgetNode(widgetNode);
|
||||
var childNode = widgetNode;
|
||||
while (childNode.children.length > 0) {
|
||||
while(childNode.children.length > 0) {
|
||||
childNode = childNode.children[0];
|
||||
}
|
||||
// First make sure A and B imported
|
||||
|
@ -813,7 +813,7 @@ describe("Widget module", function() {
|
|||
wiki.addTiddler({title: "DE", text: "\\define D() D2"});
|
||||
widgetNode.refresh({"ABC": {modified: true}, "DE": {modified: true}});
|
||||
var childNode = widgetNode;
|
||||
while (childNode.children.length > 0) {
|
||||
while(childNode.children.length > 0) {
|
||||
childNode = childNode.children[0];
|
||||
}
|
||||
// Make sure \import recognized changes and deletions
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
created: 20131127215321439
|
||||
modified: 20140912135951542
|
||||
modified: 20240416092903807
|
||||
title: $:/DefaultTiddlers
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
HelloThere
|
||||
GettingStarted
|
||||
Community
|
||||
[list[$:/StoryList]]
|
|
@ -0,0 +1,19 @@
|
|||
created: 20240415102801809
|
||||
modified: 20240425142244830
|
||||
tags:
|
||||
title: test-collatz
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\procedure collatz(n)
|
||||
<% if [<n>match[1]] %>
|
||||
1
|
||||
<% elseif [<n>remainder[2]match[1]] %>
|
||||
<<n>> - ^^@@<<parent-ancestorcount>>@@^^ → <$transclude $variable="collatz" n = {{{ [<n>multiply[3]add[1]] }}}/>
|
||||
<% else %>
|
||||
<<n>> - ^^@@<<parent-ancestorcount>>@@^^ → <$transclude $variable="collatz" n = {{{ [<n>divide[2]] }}}/>
|
||||
<% endif %>
|
||||
\end
|
||||
|
||||
<<set_UNSAFE_max_widget_tree_depth 5000>>
|
||||
|
||||
<<collatz 9780657630>>
|
|
@ -0,0 +1,16 @@
|
|||
created: 20240425123038613
|
||||
modified: 20240425142745826
|
||||
tags:
|
||||
title: test-div
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
||||
<div><div><div><div><div><div><div><div><div><div>10
|
|
@ -0,0 +1,23 @@
|
|||
created: 20240417070900019
|
||||
modified: 20240425133540950
|
||||
tags:
|
||||
title: test-new-set-get-macros
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\import test-collatz
|
||||
|
||||
ancestor count: <<parent-ancestorcount>>
|
||||
|
||||
ancestor dom count: <<parent-ancestorcount-dom>>
|
||||
|
||||
UNSAFE_max_widget_tree_depth: <<get_UNSAFE_max_widget_tree_depth>>
|
||||
|
||||
<<set_UNSAFE_max_widget_tree_depth 2000>>
|
||||
UNSAFE_max_widget_tree_depth was set to: <<get_UNSAFE_max_widget_tree_depth>>
|
||||
|
||||
<$transclude $variable=collatz n="77031"/>
|
||||
|
||||
<<set_UNSAFE_max_widget_tree_depth 1000>>
|
||||
UNSAFE_max_widget_tree_depth was set to: <<get_UNSAFE_max_widget_tree_depth>>
|
||||
|
||||
<$transclude $variable=collatz n="77031"/>
|
|
@ -0,0 +1,14 @@
|
|||
created: 20240425142531569
|
||||
modified: 20240425142540369
|
||||
tags:
|
||||
title: test-recursive button limited
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\whitespace trim
|
||||
\define tv-limit-nested-buttons() yes
|
||||
|
||||
<<parent-ancestorcount-dom>>
|
||||
|
||||
<$button>
|
||||
<$transclude/>
|
||||
</$button>
|
|
@ -0,0 +1,13 @@
|
|||
created: 20240415124530887
|
||||
modified: 20240425142547412
|
||||
tags:
|
||||
title: test-recursive button
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<<parent-ancestorcount-dom>>
|
||||
|
||||
<$button>
|
||||
<$transclude/>
|
||||
</$button>
|
Loading…
Reference in New Issue