mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-06 13:56:45 +00:00
Fix refreshing of global variables
Global variables access within attributes will automatically trigger a refresh if the attribute text changes, but that wasn't happening for transclusions.
This commit is contained in:
parent
006ae6e759
commit
613f4af20f
@ -360,7 +360,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
*/
|
*/
|
||||||
TranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
TranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(($tw.utils.count(changedAttributes) > 0) || (changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) {
|
if(($tw.utils.count(changedAttributes) > 0) || (this.transcludeTitle && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh()) || (this.transcludeVariable && changedTiddlers["$:/global/" + this.transcludeVariable])) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
31
editions/test/tiddlers/tests/data/globals/Refresh.tid
Normal file
31
editions/test/tiddlers/tests/data/globals/Refresh.tid
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
title: Globals/Refresh
|
||||||
|
description: Refreshing global procedures in shadow variables
|
||||||
|
type: text/vnd.tiddlywiki-multiple
|
||||||
|
tags: [[$:/tags/wiki-test-spec]]
|
||||||
|
|
||||||
|
title: Output
|
||||||
|
|
||||||
|
\whitespace trim
|
||||||
|
|
||||||
|
<<this-is-one>>
|
||||||
|
|
|
||||||
|
<<this-is-one blah>>
|
||||||
|
+
|
||||||
|
title: $:/global/this-is-one
|
||||||
|
|
||||||
|
\whitespace trim
|
||||||
|
|
||||||
|
\procedure example()
|
||||||
|
ONE
|
||||||
|
\end
|
||||||
|
|
||||||
|
\parameters (foo:"nothing")
|
||||||
|
<<example>>-<$text text=<<foo>>/>
|
||||||
|
+
|
||||||
|
title: Actions
|
||||||
|
|
||||||
|
<$action-setfield $tiddler="$:/global/this-is-one" $value="Jackdaw"/>
|
||||||
|
+
|
||||||
|
title: ExpectedResult
|
||||||
|
|
||||||
|
<p>Jackdaw</p><p>|Jackdaw</p>
|
@ -38,6 +38,8 @@ describe("Wiki-based tests", function() {
|
|||||||
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
|
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
|
||||||
// Render the widget node to the DOM
|
// Render the widget node to the DOM
|
||||||
var wrapper = renderWidgetNode(widgetNode);
|
var wrapper = renderWidgetNode(widgetNode);
|
||||||
|
// Clear changes queue
|
||||||
|
wiki.clearTiddlerEventQueue();
|
||||||
// Run the actions if provided
|
// Run the actions if provided
|
||||||
if(wiki.tiddlerExists("Actions")) {
|
if(wiki.tiddlerExists("Actions")) {
|
||||||
widgetNode.invokeActionString(wiki.getTiddlerText("Actions"));
|
widgetNode.invokeActionString(wiki.getTiddlerText("Actions"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user