Skip to content

Commit

Permalink
Merge branch 'master' into testcase-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Jermolene committed Dec 11, 2023
2 parents 2c07310 + 4a9b300 commit 4401081
Show file tree
Hide file tree
Showing 72 changed files with 1,006 additions and 496 deletions.
2 changes: 1 addition & 1 deletion core/language/en-GB/Help/commands.tid
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
Examples

```
--commands "[enlist{$:/build-commands-as-text}]"
--commands "[enlist:raw{$:/build-commands-as-text}]"
```

```
Expand Down
2 changes: 1 addition & 1 deletion core/modules/commands/savetiddlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Command.prototype.execute = function() {
type = tiddler.fields.type || "text/vnd.tiddlywiki",
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
});
return null;
};
Expand Down
5 changes: 4 additions & 1 deletion core/modules/filters/json-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ function setDataItem(data,indexes,value) {
lastIndex = $tw.utils.parseInt(lastIndex);
if(lastIndex < 0) { lastIndex = lastIndex + current.length };
}
current[lastIndex] = value;
// Only set indexes on objects and arrays
if(typeof current === "object") {
current[lastIndex] = value;
}
return data;
}

Expand Down
14 changes: 7 additions & 7 deletions core/modules/startup/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ function openStartupTiddlers(options) {
var hash = $tw.locationHash.substr(1),
split = hash.indexOf(":");
if(split === -1) {
target = $tw.utils.decodeTWURITarget(hash.trim());
target = $tw.utils.decodeURIComponentSafe(hash.trim());
} else {
target = $tw.utils.decodeTWURITarget(hash.substr(0,split).trim());
storyFilter = $tw.utils.decodeTWURIList(hash.substr(split + 1).trim());
target = $tw.utils.decodeURIComponentSafe(hash.substr(0,split).trim());
storyFilter = $tw.utils.decodeURIComponentSafe(hash.substr(split + 1).trim());
}
}
// If the story wasn't specified use the current tiddlers or a blank story
Expand Down Expand Up @@ -198,19 +198,19 @@ function updateLocationHash(options) {
// Assemble the location hash
switch(options.updateAddressBar) {
case "permalink":
$tw.locationHash = "#" + $tw.utils.encodeTiddlerTitle(targetTiddler);
$tw.locationHash = "#" + encodeURIComponent(targetTiddler);
break;
case "permaview":
$tw.locationHash = "#" + $tw.utils.encodeTiddlerTitle(targetTiddler) + ":" + $tw.utils.encodeFilterPath($tw.utils.stringifyList(storyList));
$tw.locationHash = "#" + encodeURIComponent(targetTiddler) + ":" + encodeURIComponent($tw.utils.stringifyList(storyList));
break;
}
// Copy URL to the clipboard
switch(options.copyToClipboard) {
case "permalink":
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + $tw.utils.encodeTiddlerTitle(targetTiddler));
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler));
break;
case "permaview":
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + $tw.utils.encodeTiddlerTitle(targetTiddler) + ":" + $tw.utils.encodeFilterPath($tw.utils.stringifyList(storyList)));
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler) + ":" + encodeURIComponent($tw.utils.stringifyList(storyList)));
break;
}
// Only change the location hash if we must, thus avoiding unnecessary onhashchange events
Expand Down
Loading

0 comments on commit 4401081

Please sign in to comment.