1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-10 20:09:57 +00:00

Fix DataWidget to allow titles to be overwritten

See https://talk.tiddlywiki.org/t/can-innerwiki-only-show-exactly-current-wiki/10452/5
This commit is contained in:
Jeremy Ruston 2024-08-21 18:40:49 +01:00
parent 7fba40977b
commit b8fb9e6b21
3 changed files with 52 additions and 1 deletions

View File

@ -123,7 +123,6 @@ DataWidget.prototype.computeDataTiddlerValues = function() {
}
} else {
// Apply the item fields to each of the tiddlers
delete item.title; // Do not overwrite the title
if(Object.keys(item).length > 0) {
$tw.utils.each(tiddlers,function(tiddler,index) {
tiddlers[index] = new $tw.Tiddler(tiddler,item);

View File

@ -0,0 +1,23 @@
title: Data/ImportCustomTitle
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
description: Importing a payload tiddler and overwriting the title
title: Description
text: Importing a payload tiddler and overwriting the title
+
title: Output
\whitespace trim
<$testcase template="$:/core/ui/testcases/RawJSONTemplate">
<$data $tiddler="HelloThere" title="RealTitle"/>
</$testcase>
+
title: HelloThere
tags: Definitions
This is the tiddler HelloThere
+
title: ExpectedResult
<p><div><div>[{"title":"RealTitle","tags":"Definitions","text":"This is the tiddler HelloThere"}]</div></div></p>

View File

@ -0,0 +1,29 @@
title: TestCases/DataWidget/ImportCustomTitle
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
description: Importing a payload tiddler and overwriting the title
display-format: plaintext
title: Narrative
Importing a payload tiddler and overwriting the title
+
title: Output
\whitespace trim
<$data $tiddler="HelloThere" title="RealTitle"/>
+
title: HelloThere
tags: Definitions
This is the tiddler HelloThere
+
title: ExpectedResult
<p>[
{
"title": "RealTitle",
"tags": "Definitions",
"text": "This is the tiddler HelloThere"
}
]</p>