mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-10 20:56:39 +00:00
Merge branch 'master' into geospatial-plugin
This commit is contained in:
commit
1f73d70218
@ -26,7 +26,7 @@ Instantiate parse rule
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\parameters\s*\(([^)]*)\)\s*\r?\n/mg;
|
||||
this.matchRegExp = /^\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -80,7 +80,7 @@ ClassicStoryView.prototype.remove = function(widget) {
|
||||
if(duration) {
|
||||
var targetElement = widget.findFirstDomNode(),
|
||||
removeElement = function() {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
};
|
||||
// Abandon if the list entry isn't a DOM element (it might be a text node)
|
||||
if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) {
|
||||
@ -112,7 +112,7 @@ ClassicStoryView.prototype.remove = function(widget) {
|
||||
{opacity: "0.0"}
|
||||
]);
|
||||
} else {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ PopStoryView.prototype.remove = function(widget) {
|
||||
duration = $tw.utils.getAnimationDuration(),
|
||||
removeElement = function() {
|
||||
if(targetElement && targetElement.parentNode) {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
}
|
||||
};
|
||||
// Abandon if the list entry isn't a DOM element (it might be a text node)
|
||||
|
@ -154,7 +154,7 @@ ZoominListView.prototype.remove = function(widget) {
|
||||
var targetElement = widget.findFirstDomNode(),
|
||||
duration = $tw.utils.getAnimationDuration(),
|
||||
removeElement = function() {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
};
|
||||
// Abandon if the list entry isn't a DOM element (it might be a text node)
|
||||
if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) {
|
||||
|
@ -39,7 +39,7 @@ DiffTextWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.execute();
|
||||
// Create the diff
|
||||
var dmpObject = new dmp.diff_match_patch(),
|
||||
diffs = dmpObject.diff_main(this.getAttribute("source"),this.getAttribute("dest"));
|
||||
diffs = dmpObject.diff_main(this.getAttribute("source",""),this.getAttribute("dest",""));
|
||||
// Apply required cleanup
|
||||
switch(this.getAttribute("cleanup","semantic")) {
|
||||
case "none":
|
||||
|
@ -122,7 +122,7 @@ ImportVariablesWidget.prototype.refresh = function(changedTiddlers) {
|
||||
}
|
||||
if(changedAttributes.filter || !$tw.utils.isArrayEqual(this.tiddlerList,tiddlerList) || haveListedTiddlersChanged()) {
|
||||
// Compute the filter
|
||||
this.destroy();
|
||||
this.removeChildDomNodes();
|
||||
this.execute(tiddlerList);
|
||||
this.renderChildren(this.parentDomNode,this.findNextSiblingDomNode());
|
||||
return true;
|
||||
|
@ -219,7 +219,7 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
||||
} else {
|
||||
// If the list was empty then we need to remove the empty message
|
||||
if(prevList.length === 0) {
|
||||
this.destroy();
|
||||
this.removeChildDomNodes();
|
||||
this.children = [];
|
||||
}
|
||||
// If we are providing an counter variable then we must refresh the items, otherwise we can rearrange them
|
||||
@ -312,7 +312,7 @@ ListWidget.prototype.removeListItem = function(index) {
|
||||
if(this.storyview && this.storyview.remove) {
|
||||
this.storyview.remove(widget);
|
||||
} else {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
}
|
||||
// Remove the child widget
|
||||
this.children.splice(index,1);
|
||||
|
@ -403,7 +403,7 @@ Widget.prototype.computeAttribute = function(attribute) {
|
||||
if(attribute.type === "filtered") {
|
||||
value = this.wiki.filterTiddlers(attribute.filter,this)[0] || "";
|
||||
} else if(attribute.type === "indirect") {
|
||||
value = this.wiki.getTextReference(attribute.textReference,"",this.getVariable("currentTiddler"));
|
||||
value = this.wiki.getTextReference(attribute.textReference,"",this.getVariable("currentTiddler")) || "";
|
||||
} else if(attribute.type === "macro") {
|
||||
var variableInfo = this.getVariableInfo(attribute.value.name,{params: attribute.value.params});
|
||||
if(variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
||||
@ -688,7 +688,7 @@ Rebuild a previously rendered widget
|
||||
*/
|
||||
Widget.prototype.refreshSelf = function() {
|
||||
var nextSibling = this.findNextSiblingDomNode();
|
||||
this.removeChildDomNodes({ recursive: true });
|
||||
this.removeChildDomNodes();
|
||||
this.render(this.parentDomNode,nextSibling);
|
||||
};
|
||||
|
||||
@ -753,42 +753,19 @@ Widget.prototype.findFirstDomNode = function() {
|
||||
/*
|
||||
Remove any DOM nodes created by this widget or its children
|
||||
*/
|
||||
Widget.prototype.removeChildDomNodes = function(options) {
|
||||
var recursive = options && options.recursive;
|
||||
/**
|
||||
* If this widget has directly created DOM nodes, delete them and exit.
|
||||
* This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case
|
||||
*/
|
||||
Widget.prototype.removeChildDomNodes = function() {
|
||||
// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case
|
||||
if(this.domNodes.length > 0) {
|
||||
$tw.utils.each(this.domNodes,function(domNode) {
|
||||
domNode.parentNode.removeChild(domNode);
|
||||
});
|
||||
this.domNodes = [];
|
||||
return true;
|
||||
} else if(recursive) {
|
||||
} else {
|
||||
// Otherwise, ask the child widgets to delete their DOM nodes
|
||||
$tw.utils.each(this.children,function(childWidget) {
|
||||
childWidget.removeChildDomNodes(options);
|
||||
childWidget.removeChildDomNodes();
|
||||
});
|
||||
}
|
||||
return false
|
||||
};
|
||||
|
||||
/*
|
||||
Inform widget subclass that extends this widget and children widgets of this widget. Let them know this widget tree is about to destroy, and dom nodes are being unmounted from the document.
|
||||
*/
|
||||
Widget.prototype.destroy = function(options) {
|
||||
// removeDom by default
|
||||
var removeDom = (options && options.removeDom) || true;
|
||||
if (removeDom) {
|
||||
// prepare options for children, if we have removed the dom, child don't need to remove their dom
|
||||
removeDom = !this.removeChildDomNodes();
|
||||
}
|
||||
// nothing need to do, as dom is already removed in the removeChildDomNodes
|
||||
// we just need to inform the children
|
||||
$tw.utils.each(this.children,function(childWidget) {
|
||||
childWidget.destroy({ removeDom: removeDom });
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@ $button$
|
||||
<div class="tc-sidebar-tab-open">
|
||||
<$list filter="[list<tv-story-list>]" history=<<tv-history-list>> storyview="pop">
|
||||
<div class="tc-sidebar-tab-open-item">
|
||||
<$macrocall $name="droppable-item" button="<$button message='tm-close-tiddler' tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class='tc-btn-invisible tc-btn-mini tc-small-gap-right'>{{$:/core/images/close-button}}</$button><$link to={{!!title}}><$view field='title'/></$link>"/>
|
||||
<$macrocall $name="droppable-item" button="<$button message='tm-close-tiddler' tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class='tc-btn-invisible tc-btn-mini tc-small-gap-right'>{{$:/core/images/close-button}}</$button><$link/>"/>
|
||||
</div>
|
||||
</$list>
|
||||
<$tiddler tiddler="">
|
||||
|
@ -72,10 +72,11 @@ Improvements to the following translations:
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7380">> crashes when using an invalid CSS selector for [[WidgetMessage: tm-focus-selector]] and [[WidgetMessage: tm-scroll]]
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7401">> bug whereby scrolling occurs if the linkcatcher widget triggers an action-navigate and the $scroll attribute is set to "no"
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7409">> problem switching between LTR and RTL text
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7448">> bug when checkbox widget's listField attribute was given the name of a date field (like <<.field created>> or <<.field modified>>)
|
||||
|
||||
! Developer Improvements
|
||||
|
||||
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/6699">> support for a `destroy()` method for widgets, giving them a chance to dispose of any resources
|
||||
*
|
||||
|
||||
! Node.js Improvements
|
||||
|
||||
@ -101,6 +102,7 @@ Marxsal
|
||||
michsa
|
||||
muzimuzhi
|
||||
pmario
|
||||
rmunn
|
||||
saqimtiaz
|
||||
yaisog
|
||||
""">>
|
||||
|
@ -6,15 +6,15 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
!! Introduction
|
||||
|
||||
This tiddler describes the different ways in which [[macros|Procedures]] can be defined.
|
||||
This tiddler describes the different ways in which [[Procedures|Procedures]] can be defined.
|
||||
|
||||
!! Procedure Definition Pragma
|
||||
|
||||
Macros are created using the [[Pragma: \procedure]] at the start of a tiddler. The definitions are available in the rest of the tiddler that defines them, plus any tiddlers that it transcludes.
|
||||
Procedures are created using the [[Pragma: \procedure]] at the start of a tiddler. The definitions are available in the rest of the tiddler that defines them, plus any tiddlers that it transcludes.
|
||||
|
||||
```
|
||||
\define my-procedure(param)
|
||||
This is the macro text (param=<<param>>)
|
||||
This is the procedure text (param=<<param>>)
|
||||
\end
|
||||
```
|
||||
|
||||
|
@ -62,7 +62,7 @@ CecilyStoryView.prototype.remove = function(widget) {
|
||||
duration = $tw.utils.getAnimationDuration();
|
||||
// Remove the widget at the end of the transition
|
||||
setTimeout(function() {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
},duration);
|
||||
// Animate the closure
|
||||
$tw.utils.setStyle(targetElement,[
|
||||
|
@ -80,7 +80,7 @@ StackedListView.prototype.insert = function(widget) {
|
||||
};
|
||||
|
||||
StackedListView.prototype.remove = function(widget) {
|
||||
widget.destroy();
|
||||
widget.removeChildDomNodes();
|
||||
};
|
||||
|
||||
exports.stacked = StackedListView;
|
||||
|
Loading…
x
Reference in New Issue
Block a user