Merge branch 'master' into testcase-widget

This commit is contained in:
Jeremy Ruston 2023-12-11 15:21:15 +00:00
commit 44010812bd
72 changed files with 1006 additions and 496 deletions

View File

@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
Examples Examples
``` ```
--commands "[enlist{$:/build-commands-as-text}]" --commands "[enlist:raw{$:/build-commands-as-text}]"
``` ```
``` ```

View File

@ -46,7 +46,7 @@ Command.prototype.execute = function() {
type = tiddler.fields.type || "text/vnd.tiddlywiki", type = tiddler.fields.type || "text/vnd.tiddlywiki",
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"}, contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title)); 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; return null;
}; };

View File

@ -273,7 +273,10 @@ function setDataItem(data,indexes,value) {
lastIndex = $tw.utils.parseInt(lastIndex); lastIndex = $tw.utils.parseInt(lastIndex);
if(lastIndex < 0) { lastIndex = lastIndex + current.length }; 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; return data;
} }

View File

@ -122,10 +122,10 @@ function openStartupTiddlers(options) {
var hash = $tw.locationHash.substr(1), var hash = $tw.locationHash.substr(1),
split = hash.indexOf(":"); split = hash.indexOf(":");
if(split === -1) { if(split === -1) {
target = $tw.utils.decodeTWURITarget(hash.trim()); target = $tw.utils.decodeURIComponentSafe(hash.trim());
} else { } else {
target = $tw.utils.decodeTWURITarget(hash.substr(0,split).trim()); target = $tw.utils.decodeURIComponentSafe(hash.substr(0,split).trim());
storyFilter = $tw.utils.decodeTWURIList(hash.substr(split + 1).trim()); storyFilter = $tw.utils.decodeURIComponentSafe(hash.substr(split + 1).trim());
} }
} }
// If the story wasn't specified use the current tiddlers or a blank story // If the story wasn't specified use the current tiddlers or a blank story
@ -198,19 +198,19 @@ function updateLocationHash(options) {
// Assemble the location hash // Assemble the location hash
switch(options.updateAddressBar) { switch(options.updateAddressBar) {
case "permalink": case "permalink":
$tw.locationHash = "#" + $tw.utils.encodeTiddlerTitle(targetTiddler); $tw.locationHash = "#" + encodeURIComponent(targetTiddler);
break; break;
case "permaview": 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; break;
} }
// Copy URL to the clipboard // Copy URL to the clipboard
switch(options.copyToClipboard) { switch(options.copyToClipboard) {
case "permalink": case "permalink":
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + $tw.utils.encodeTiddlerTitle(targetTiddler)); $tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler));
break; break;
case "permaview": 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; break;
} }
// Only change the location hash if we must, thus avoiding unnecessary onhashchange events // Only change the location hash if we must, thus avoiding unnecessary onhashchange events

View File

@ -24,7 +24,7 @@ Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading"; Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done"; Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval"; Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
Syncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer Syncer.prototype.taskTimerInterval = 0.25 * 1000; // Interval for sync timer
Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s... Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
@ -74,9 +74,11 @@ function Syncer(options) {
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
// Timers // Timers
this.taskTimerId = null; // Timer for task dispatch this.taskTimerId = null; // Timer for task dispatch
this.pollTimerId = null; // Timer for polling server
// Number of outstanding requests // Number of outstanding requests
this.numTasksInProgress = 0; this.numTasksInProgress = 0;
// True when we want to force an immediate sync from the server
this.forceSyncFromServer = false;
this.timestampLastSyncFromServer = new Date();
// Listen out for changes to tiddlers // Listen out for changes to tiddlers
this.wiki.addEventListener("change",function(changes) { this.wiki.addEventListener("change",function(changes) {
// Filter the changes to just include ones that are being synced // Filter the changes to just include ones that are being synced
@ -203,33 +205,37 @@ Syncer.prototype.readTiddlerInfo = function() {
Checks whether the wiki is dirty (ie the window shouldn't be closed) Checks whether the wiki is dirty (ie the window shouldn't be closed)
*/ */
Syncer.prototype.isDirty = function() { Syncer.prototype.isDirty = function() {
this.logger.log("Checking dirty status"); var self = this;
// Check tiddlers that are in the store and included in the filter function function checkIsDirty() {
var titles = this.getSyncedTiddlers(); // Check tiddlers that are in the store and included in the filter function
for(var index=0; index<titles.length; index++) { var titles = self.getSyncedTiddlers();
var title = titles[index], for(var index=0; index<titles.length; index++) {
tiddlerInfo = this.tiddlerInfo[title]; var title = titles[index],
if(this.wiki.tiddlerExists(title)) { tiddlerInfo = self.tiddlerInfo[title];
if(tiddlerInfo) { if(self.wiki.tiddlerExists(title)) {
// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server if(tiddlerInfo) {
if(this.wiki.getChangeCount(title) > tiddlerInfo.changeCount) { // If the tiddler is known on the server and has been modified locally then it needs to be saved to the server
if(self.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
return true;
}
} else {
// If the tiddler isn't known on the server then it needs to be saved to the server
return true; return true;
} }
} else { }
// If the tiddler isn't known on the server then it needs to be saved to the server }
// Check tiddlers that are known from the server but not currently in the store
titles = Object.keys(self.tiddlerInfo);
for(index=0; index<titles.length; index++) {
if(!self.wiki.tiddlerExists(titles[index])) {
// There must be a pending delete
return true; return true;
} }
} }
return false;
} }
// Check tiddlers that are known from the server but not currently in the store var dirtyStatus = checkIsDirty();
titles = Object.keys(this.tiddlerInfo); return dirtyStatus;
for(index=0; index<titles.length; index++) {
if(!this.wiki.tiddlerExists(titles[index])) {
// There must be a pending delete
return true;
}
}
return false;
}; };
/* /*
@ -293,92 +299,16 @@ Syncer.prototype.getStatus = function(callback) {
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
*/ */
Syncer.prototype.syncFromServer = function() { Syncer.prototype.syncFromServer = function() {
var self = this, if(this.canSyncFromServer()) {
cancelNextSync = function() { this.forceSyncFromServer = true;
if(self.pollTimerId) { this.processTaskQueue();
clearTimeout(self.pollTimerId);
self.pollTimerId = null;
}
},
triggerNextSync = function() {
self.pollTimerId = setTimeout(function() {
self.pollTimerId = null;
self.syncFromServer.call(self);
},self.pollTimerInterval);
},
syncSystemFromServer = (self.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
if(this.syncadaptor && this.syncadaptor.getUpdatedTiddlers) {
this.logger.log("Retrieving updated tiddler list");
cancelNextSync();
this.syncadaptor.getUpdatedTiddlers(self,function(err,updates) {
triggerNextSync();
if(err) {
self.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
return;
}
if(updates) {
$tw.utils.each(updates.modifications,function(title) {
self.titlesToBeLoaded[title] = true;
});
$tw.utils.each(updates.deletions,function(title) {
if(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {
delete self.tiddlerInfo[title];
self.logger.log("Deleting tiddler missing from server:",title);
self.wiki.deleteTiddler(title);
}
});
if(updates.modifications.length > 0 || updates.deletions.length > 0) {
self.processTaskQueue();
}
}
});
} else if(this.syncadaptor && this.syncadaptor.getSkinnyTiddlers) {
this.logger.log("Retrieving skinny tiddler list");
cancelNextSync();
this.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {
triggerNextSync();
// Check for errors
if(err) {
self.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
return;
}
// Keep track of which tiddlers we already know about have been reported this time
var previousTitles = Object.keys(self.tiddlerInfo);
// Process each incoming tiddler
for(var t=0; t<tiddlers.length; t++) {
// Get the incoming tiddler fields, and the existing tiddler
var tiddlerFields = tiddlers[t],
incomingRevision = tiddlerFields.revision + "",
tiddler = self.wiki.tiddlerExists(tiddlerFields.title) && self.wiki.getTiddler(tiddlerFields.title),
tiddlerInfo = self.tiddlerInfo[tiddlerFields.title],
currRevision = tiddlerInfo ? tiddlerInfo.revision : null,
indexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);
if(indexInPreviousTitles !== -1) {
previousTitles.splice(indexInPreviousTitles,1);
}
// Ignore the incoming tiddler if it's the same as the revision we've already got
if(currRevision !== incomingRevision) {
// Only load the skinny version if we don't already have a fat version of the tiddler
if(!tiddler || tiddler.fields.text === undefined) {
self.storeTiddler(tiddlerFields);
}
// Do a full load of this tiddler
self.titlesToBeLoaded[tiddlerFields.title] = true;
}
}
// Delete any tiddlers that were previously reported but missing this time
$tw.utils.each(previousTitles,function(title) {
if(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {
delete self.tiddlerInfo[title];
self.logger.log("Deleting tiddler missing from server:",title);
self.wiki.deleteTiddler(title);
}
});
self.processTaskQueue();
});
} }
}; };
Syncer.prototype.canSyncFromServer = function() {
return !!this.syncadaptor.getUpdatedTiddlers || !!this.syncadaptor.getSkinnyTiddlers;
}
/* /*
Force load a tiddler from the server Force load a tiddler from the server
*/ */
@ -510,7 +440,7 @@ Syncer.prototype.processTaskQueue = function() {
} else { } else {
self.updateDirtyStatus(); self.updateDirtyStatus();
// Process the next task // Process the next task
self.processTaskQueue.call(self); self.processTaskQueue.call(self);
} }
}); });
} else { } else {
@ -518,31 +448,39 @@ Syncer.prototype.processTaskQueue = function() {
this.updateDirtyStatus(); this.updateDirtyStatus();
// And trigger a timeout if there is a pending task // And trigger a timeout if there is a pending task
if(task === true) { if(task === true) {
this.triggerTimeout(); this.triggerTimeout(this.taskTimerInterval);
} else if(this.canSyncFromServer()) {
this.triggerTimeout(this.pollTimerInterval);
} }
} }
} else { } else {
this.updateDirtyStatus(); this.updateDirtyStatus();
this.triggerTimeout(this.taskTimerInterval);
} }
}; };
Syncer.prototype.triggerTimeout = function(interval) { Syncer.prototype.triggerTimeout = function(interval) {
var self = this; var self = this;
if(!this.taskTimerId) { if(this.taskTimerId) {
this.taskTimerId = setTimeout(function() { clearTimeout(this.taskTimerId);
self.taskTimerId = null;
self.processTaskQueue.call(self);
},interval || self.taskTimerInterval);
} }
this.taskTimerId = setTimeout(function() {
self.taskTimerId = null;
self.processTaskQueue.call(self);
},interval || self.taskTimerInterval);
}; };
/* /*
Choose the next sync task. We prioritise saves, then deletes, then loads from the server Choose the next sync task. We prioritise saves to the server, then getting updates from the server, then deletes to the server, then loads from the server
Returns either a task object, null if there's no upcoming tasks, or the boolean true if there are pending tasks that aren't yet due Returns either:
* a task object
* the boolean true if there are pending sync tasks that aren't yet due
* null if there's no pending sync tasks (just the next poll)
*/ */
Syncer.prototype.chooseNextTask = function() { Syncer.prototype.chooseNextTask = function() {
var thresholdLastSaved = (new Date()) - this.throttleInterval, var now = new Date(),
thresholdLastSaved = now - this.throttleInterval,
havePending = null; havePending = null;
// First we look for tiddlers that have been modified locally and need saving back to the server // First we look for tiddlers that have been modified locally and need saving back to the server
var titles = this.getSyncedTiddlers(); var titles = this.getSyncedTiddlers();
@ -556,14 +494,18 @@ Syncer.prototype.chooseNextTask = function() {
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved; isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
if(hasChanged) { if(hasChanged) {
if(isReadyToSave) { if(isReadyToSave) {
return new SaveTiddlerTask(this,title); return new SaveTiddlerTask(this,title);
} else { } else {
havePending = true; havePending = true;
} }
} }
} }
} }
// Second, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server // Second we check for an outstanding sync from server
if(this.forceSyncFromServer || (this.timestampLastSyncFromServer && (now.valueOf() >= (this.timestampLastSyncFromServer.valueOf() + this.pollTimerInterval)))) {
return new SyncFromServerTask(this);
}
// Third, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server
titles = Object.keys(this.tiddlerInfo); titles = Object.keys(this.tiddlerInfo);
for(index=0; index<titles.length; index++) { for(index=0; index<titles.length; index++) {
title = titles[index]; title = titles[index];
@ -573,13 +515,13 @@ Syncer.prototype.chooseNextTask = function() {
return new DeleteTiddlerTask(this,title); return new DeleteTiddlerTask(this,title);
} }
} }
// Check for tiddlers that need loading // Finally, check for tiddlers that need loading
title = Object.keys(this.titlesToBeLoaded)[0]; title = Object.keys(this.titlesToBeLoaded)[0];
if(title) { if(title) {
delete this.titlesToBeLoaded[title]; delete this.titlesToBeLoaded[title];
return new LoadTiddlerTask(this,title); return new LoadTiddlerTask(this,title);
} }
// No tasks are ready // No tasks are ready now, but might be in the future
return havePending; return havePending;
}; };
@ -589,6 +531,10 @@ function SaveTiddlerTask(syncer,title) {
this.type = "save"; this.type = "save";
} }
SaveTiddlerTask.prototype.toString = function() {
return "SAVE " + this.title;
}
SaveTiddlerTask.prototype.run = function(callback) { SaveTiddlerTask.prototype.run = function(callback) {
var self = this, var self = this,
changeCount = this.syncer.wiki.getChangeCount(this.title), changeCount = this.syncer.wiki.getChangeCount(this.title),
@ -613,7 +559,6 @@ SaveTiddlerTask.prototype.run = function(callback) {
tiddlerInfo: self.syncer.tiddlerInfo[self.title] tiddlerInfo: self.syncer.tiddlerInfo[self.title]
}); });
} else { } else {
this.syncer.logger.log(" Not Dispatching 'save' task:",this.title,"tiddler does not exist");
$tw.utils.nextTick(callback(null)); $tw.utils.nextTick(callback(null));
} }
}; };
@ -624,6 +569,10 @@ function DeleteTiddlerTask(syncer,title) {
this.type = "delete"; this.type = "delete";
} }
DeleteTiddlerTask.prototype.toString = function() {
return "DELETE " + this.title;
}
DeleteTiddlerTask.prototype.run = function(callback) { DeleteTiddlerTask.prototype.run = function(callback) {
var self = this; var self = this;
this.syncer.logger.log("Dispatching 'delete' task:",this.title); this.syncer.logger.log("Dispatching 'delete' task:",this.title);
@ -647,6 +596,10 @@ function LoadTiddlerTask(syncer,title) {
this.type = "load"; this.type = "load";
} }
LoadTiddlerTask.prototype.toString = function() {
return "LOAD " + this.title;
}
LoadTiddlerTask.prototype.run = function(callback) { LoadTiddlerTask.prototype.run = function(callback) {
var self = this; var self = this;
this.syncer.logger.log("Dispatching 'load' task:",this.title); this.syncer.logger.log("Dispatching 'load' task:",this.title);
@ -664,6 +617,91 @@ LoadTiddlerTask.prototype.run = function(callback) {
}); });
}; };
function SyncFromServerTask(syncer) {
this.syncer = syncer;
this.type = "syncfromserver";
}
SyncFromServerTask.prototype.toString = function() {
return "SYNCFROMSERVER";
}
SyncFromServerTask.prototype.run = function(callback) {
var self = this;
var syncSystemFromServer = (self.syncer.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
var successCallback = function() {
self.syncer.forceSyncFromServer = false;
self.syncer.timestampLastSyncFromServer = new Date();
callback(null);
};
if(this.syncer.syncadaptor.getUpdatedTiddlers) {
this.syncer.syncadaptor.getUpdatedTiddlers(self,function(err,updates) {
if(err) {
self.syncer.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
return callback(err);
}
if(updates) {
$tw.utils.each(updates.modifications,function(title) {
self.syncer.titlesToBeLoaded[title] = true;
});
$tw.utils.each(updates.deletions,function(title) {
if(syncSystemFromServer || !self.syncer.wiki.isSystemTiddler(title)) {
delete self.syncer.tiddlerInfo[title];
self.syncer.logger.log("Deleting tiddler missing from server:",title);
self.syncer.wiki.deleteTiddler(title);
}
});
}
return successCallback();
});
} else if(this.syncer.syncadaptor.getSkinnyTiddlers) {
this.syncer.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {
// Check for errors
if(err) {
self.syncer.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
return callback(err);
}
// Keep track of which tiddlers we already know about have been reported this time
var previousTitles = Object.keys(self.syncer.tiddlerInfo);
// Process each incoming tiddler
for(var t=0; t<tiddlers.length; t++) {
// Get the incoming tiddler fields, and the existing tiddler
var tiddlerFields = tiddlers[t],
incomingRevision = tiddlerFields.revision + "",
tiddler = self.syncer.wiki.tiddlerExists(tiddlerFields.title) && self.syncer.wiki.getTiddler(tiddlerFields.title),
tiddlerInfo = self.syncer.tiddlerInfo[tiddlerFields.title],
currRevision = tiddlerInfo ? tiddlerInfo.revision : null,
indexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);
if(indexInPreviousTitles !== -1) {
previousTitles.splice(indexInPreviousTitles,1);
}
// Ignore the incoming tiddler if it's the same as the revision we've already got
if(currRevision !== incomingRevision) {
// Only load the skinny version if we don't already have a fat version of the tiddler
if(!tiddler || tiddler.fields.text === undefined) {
self.syncer.storeTiddler(tiddlerFields);
}
// Do a full load of this tiddler
self.syncer.titlesToBeLoaded[tiddlerFields.title] = true;
}
}
// Delete any tiddlers that were previously reported but missing this time
$tw.utils.each(previousTitles,function(title) {
if(syncSystemFromServer || !self.syncer.wiki.isSystemTiddler(title)) {
delete self.syncer.tiddlerInfo[title];
self.syncer.logger.log("Deleting tiddler missing from server:",title);
self.syncer.wiki.deleteTiddler(title);
}
});
self.syncer.forceSyncFromServer = false;
self.syncer.timestampLastSyncFromServer = new Date();
return successCallback();
});
} else {
return successCallback();
}
};
exports.Syncer = Syncer; exports.Syncer = Syncer;
})(); })();

View File

@ -104,7 +104,11 @@ TW_Element.prototype.setAttribute = function(name,value) {
if(this.isRaw) { if(this.isRaw) {
throw "Cannot setAttribute on a raw TW_Element"; throw "Cannot setAttribute on a raw TW_Element";
} }
this.attributes[name] = value + ""; if(name === "style") {
this.style = value;
} else {
this.attributes[name] = value + "";
}
}; };
TW_Element.prototype.setAttributeNS = function(namespace,name,value) { TW_Element.prototype.setAttributeNS = function(namespace,name,value) {

View File

@ -1,128 +0,0 @@
/*\
title: $:/core/modules/utils/twuri-encoding.js
type: application/javascript
module-type: utils
Utility functions related to permalink/permaview encoding/decoding.
\*/
(function(){
// The character that will substitute for a space in the URL
var SPACE_SUBSTITUTE = "_";
// The character added to the end to avoid ending with `.`, `?`, `!` or the like
var TRAILER = "_";
// The character that will separate out the list elements in the URL
var CONJUNCTION = ";";
// Those of the allowed url characters claimed by TW
var CLAIMED = [SPACE_SUBSTITUTE, ":", CONJUNCTION];
// Non-alphanumeric characters allowed in a URL fragment
// More information at https://www.rfc-editor.org/rfc/rfc3986#appendix-A
var VALID_IN_URL_FRAGMENT = "-._~!$&'()*+,;=:@/?".split("");
// The subset of the pchars we will not percent-encode in permalinks/permaviews
var SUBSTITUTES = []
$tw.utils.each(VALID_IN_URL_FRAGMENT, function(c) {
if (CLAIMED.indexOf(c) === -1) {
SUBSTITUTES.push(c)
}
});
// A regex to match the percent-encoded characters we will want to replace.
// Something similar to the following, depending on SPACE and CONJUNCTION
// /(%2D|%2E|%7E|%21|%24|%26|%27|%28|%29|%2A|%2B|%3B|%3D|%40|%2F|%3F)/g
var CHAR_MATCH_STR = []
$tw.utils.each(SUBSTITUTES, function(c) {
CHAR_MATCH_STR.push("%" + c.charCodeAt(0).toString(16).toUpperCase())
})
var CHAR_MATCH = new RegExp("(" + CHAR_MATCH_STR.join("|") + ")", "g");
// A regex to match the SPACE_SUBSTITUTE character
var SPACE_MATCH = new RegExp("(\\" + SPACE_SUBSTITUTE + ")", "g");
// A regex to match URLs ending with sentence-ending punctuation
var SENTENCE_ENDING = new RegExp("(\\.|\\!|\\?|\\" + TRAILER + ")$", "g");
// A regex to match URLs ending with sentence-ending punctuation plus the TRAILER
var SENTENCE_TRAILING = new RegExp("(\\.|\\!|\\?|\\" + TRAILER + ")\\" + TRAILER + "$", "g");
// An object mapping the percent encodings back to their source characters
var PCT_CHAR_MAP = SUBSTITUTES.reduce(function (a, c) {
a["%" + c.charCodeAt(0).toString(16).toUpperCase()] = c
return a
}, {});
// Convert a URI List Component encoded string (with the `SPACE_SUBSTITUTE`
// value as an allowed replacement for the space character) to a string
exports.decodeTWURIList = function(s) {
var parts = s.replace(SENTENCE_TRAILING, "$1").split(CONJUNCTION);
var withSpaces = []
$tw.utils.each(parts, function(s) {
withSpaces.push(s.replace(SPACE_MATCH, " "))
});
var withBrackets = []
$tw.utils.each(withSpaces, function(s) {
withBrackets .push(s.indexOf(" ") >= 0 ? "[[" + s + "]]" : s)
});
return $tw.utils.decodeURIComponentSafe(withBrackets.join(" "));
};
// Convert a URI Target Component encoded string (with the `SPACE_SUBSTITUTE`
// value as an allowed replacement for the space character) to a string
exports.decodeTWURITarget = function(s) {
return $tw.utils.decodeURIComponentSafe(
s.replace(SENTENCE_TRAILING, "$1").replace(SPACE_MATCH, " ")
)
};
// Convert a URIComponent encoded title string (with the `SPACE_SUBSTITUTE`
// value as an allowed replacement for the space character) to a string
exports.encodeTiddlerTitle = function(s) {
var extended = s.replace(SENTENCE_ENDING, "$1" + TRAILER)
var encoded = encodeURIComponent(extended);
var substituted = encoded.replace(/\%20/g, SPACE_SUBSTITUTE);
return substituted.replace(CHAR_MATCH, function(_, c) {
return PCT_CHAR_MAP[c];
});
};
// Convert a URIComponent encoded filter string (with the `SPACE_SUBSTITUTE`
// value as an allowed replacement for the space character) to a string
exports.encodeFilterPath = function(s) {
var parts = s.replace(SENTENCE_ENDING, "$1" + TRAILER)
.replace(/\[\[(.+?)\]\]/g, function (_, t) {return t.replace(/ /g, SPACE_SUBSTITUTE )})
.split(" ");
var nonEmptyParts = []
$tw.utils.each(parts, function(p) {
if (p) {
nonEmptyParts.push (p)
}
});
var trimmed = [];
$tw.utils.each(nonEmptyParts, function(s) {
trimmed.push(s.trim())
});
var encoded = [];
$tw.utils.each(trimmed, function(s) {
encoded.push(encodeURIComponent(s))
});
var substituted = [];
$tw.utils.each(encoded, function(s) {
substituted.push(s.replace(/\%20/g, SPACE_SUBSTITUTE))
});
var replaced = []
$tw.utils.each(substituted, function(s) {
replaced.push(s.replace(CHAR_MATCH, function(_, c) {
return PCT_CHAR_MAP[c];
}))
});
return replaced.join(CONJUNCTION);
};
})();

View File

@ -70,6 +70,11 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
} }
return false; return false;
},false); },false);
// Assign data- attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Insert element // Insert element
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null); this.renderChildren(domNode,null);
@ -95,6 +100,11 @@ BrowseWidget.prototype.execute = function() {
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/ */
BrowseWidget.prototype.refresh = function(changedTiddlers) { BrowseWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if($tw.utils.count(changedAttributes) > 0) {
this.refreshSelf();
return true;
}
return false; return false;
}; };

View File

@ -59,6 +59,11 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
$tw.utils.pushTop(classes,"tc-popup-handle"); $tw.utils.pushTop(classes,"tc-popup-handle");
} }
domNode.className = classes.join(" "); domNode.className = classes.join(" ");
// Assign data- attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Assign other attributes // Assign other attributes
if(this.style) { if(this.style) {
domNode.setAttribute("style",this.style); domNode.setAttribute("style",this.style);
@ -250,7 +255,7 @@ ButtonWidget.prototype.updateDomNodeClasses = function() {
//Add new classes from updated class attribute. //Add new classes from updated class attribute.
$tw.utils.pushTop(domNodeClasses,newClasses); $tw.utils.pushTop(domNodeClasses,newClasses);
this.domNode.className = domNodeClasses.join(" "); this.domNode.className = domNodeClasses.join(" ");
} };
/* /*
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
@ -260,8 +265,15 @@ ButtonWidget.prototype.refresh = function(changedTiddlers) {
if(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) { if(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} else if(changedAttributes["class"]) { } else {
this.updateDomNodeClasses(); if(changedAttributes["class"]) {
this.updateDomNodeClasses();
}
this.assignAttributes(this.domNodes[0],{
changedAttributes: changedAttributes,
sourcePrefix: "data-",
destPrefix: "data-"
});
} }
return this.refreshChildren(changedTiddlers); return this.refreshChildren(changedTiddlers);
}; };

View File

@ -53,6 +53,11 @@ CheckboxWidget.prototype.render = function(parent,nextSibling) {
this.labelDomNode.appendChild(this.inputDomNode); this.labelDomNode.appendChild(this.inputDomNode);
this.spanDomNode = this.document.createElement("span"); this.spanDomNode = this.document.createElement("span");
this.labelDomNode.appendChild(this.spanDomNode); this.labelDomNode.appendChild(this.spanDomNode);
// Assign data- attributes
this.assignAttributes(this.inputDomNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Add a click event handler // Add a click event handler
$tw.utils.addEventListeners(this.inputDomNode,[ $tw.utils.addEventListeners(this.inputDomNode,[
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"} {name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
@ -325,6 +330,11 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
$tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked"); $tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked");
} }
} }
this.assignAttributes(this.inputDomNode,{
changedAttributes: changedAttributes,
sourcePrefix: "data-",
destPrefix: "data-"
});
return this.refreshChildren(changedTiddlers) || refreshed; return this.refreshChildren(changedTiddlers) || refreshed;
} }
}; };
@ -332,3 +342,4 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
exports.checkbox = CheckboxWidget; exports.checkbox = CheckboxWidget;
})(); })();

View File

@ -52,6 +52,11 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
classes.push("tc-draggable"); classes.push("tc-draggable");
} }
domNode.setAttribute("class",classes.join(" ")); domNode.setAttribute("class",classes.join(" "));
// Assign data- attributes and style. attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Insert the node into the DOM and render any children // Insert the node into the DOM and render any children
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null); this.renderChildren(domNode,null);
@ -108,13 +113,19 @@ DraggableWidget.prototype.updateDomNodeClasses = function() {
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/ */
DraggableWidget.prototype.refresh = function(changedTiddlers) { DraggableWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(), var changedAttributes = this.computeAttributes();
changedAttributesCount = $tw.utils.count(changedAttributes); if(changedAttributes.tag || changedAttributes.selector || changedAttributes.dragimagetype || changedAttributes.enable || changedAttributes.startactions || changedAttributes.endactions) {
if(changedAttributesCount === 1 && changedAttributes["class"]) {
this.updateDomNodeClasses();
} else if(changedAttributesCount > 0) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} else {
if(changedAttributes["class"]) {
this.assignDomNodeClasses();
}
this.assignAttributes(this.domNodes[0],{
changedAttributes: changedAttributes,
sourcePrefix: "data-",
destPrefix: "data-"
});
} }
return this.refreshChildren(changedTiddlers); return this.refreshChildren(changedTiddlers);
}; };

View File

@ -42,6 +42,11 @@ DroppableWidget.prototype.render = function(parent,nextSibling) {
domNode = this.document.createElement(tag); domNode = this.document.createElement(tag);
this.domNode = domNode; this.domNode = domNode;
this.assignDomNodeClasses(); this.assignDomNodeClasses();
// Assign data- attributes and style. attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Add event handlers // Add event handlers
if(this.droppableEnable) { if(this.droppableEnable) {
$tw.utils.addEventListeners(domNode,[ $tw.utils.addEventListeners(domNode,[
@ -166,8 +171,15 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) {
if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) { if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} else if(changedAttributes["class"]) { } else {
this.assignDomNodeClasses(); if(changedAttributes["class"]) {
this.assignDomNodeClasses();
}
this.assignAttributes(this.domNodes[0],{
changedAttributes: changedAttributes,
sourcePrefix: "data-",
destPrefix: "data-"
});
} }
return this.refreshChildren(changedTiddlers); return this.refreshChildren(changedTiddlers);
}; };

View File

@ -43,6 +43,11 @@ LinkWidget.prototype.render = function(parent,nextSibling) {
} else { } else {
// Just insert the link text // Just insert the link text
var domNode = this.document.createElement("span"); var domNode = this.document.createElement("span");
// Assign data- attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null); this.renderChildren(domNode,null);
this.domNodes.push(domNode); this.domNodes.push(domNode);
@ -138,6 +143,11 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
widget: this widget: this
}); });
} }
// Assign data- attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Insert the link into the DOM and render any children // Insert the link into the DOM and render any children
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null); this.renderChildren(domNode,null);
@ -207,8 +217,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/ */
LinkWidget.prototype.refresh = function(changedTiddlers) { LinkWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); var changedAttributes = this.computeAttributes();
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip || if($tw.utils.count(changedAttributes) > 0) {
changedAttributes["class"] || changedAttributes.tabindex || changedAttributes.draggable || changedAttributes.tag) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} }
@ -218,3 +227,4 @@ LinkWidget.prototype.refresh = function(changedTiddlers) {
exports.link = LinkWidget; exports.link = LinkWidget;
})(); })();

View File

@ -50,8 +50,8 @@ ListWidget.prototype.render = function(parent,nextSibling) {
$tw.modules.applyMethods("storyview",this.storyViews); $tw.modules.applyMethods("storyview",this.storyViews);
} }
this.parentDomNode = parent; this.parentDomNode = parent;
this.computeAttributes(); var changedAttributes = this.computeAttributes();
this.execute(); this.execute(changedAttributes);
this.renderChildren(parent,nextSibling); this.renderChildren(parent,nextSibling);
// Construct the storyview // Construct the storyview
var StoryView = this.storyViews[this.storyViewName]; var StoryView = this.storyViews[this.storyViewName];
@ -71,7 +71,7 @@ ListWidget.prototype.render = function(parent,nextSibling) {
/* /*
Compute the internal state of the widget Compute the internal state of the widget
*/ */
ListWidget.prototype.execute = function() { ListWidget.prototype.execute = function(changedAttributes) {
var self = this; var self = this;
// Get our attributes // Get our attributes
this.template = this.getAttribute("template"); this.template = this.getAttribute("template");
@ -80,6 +80,10 @@ ListWidget.prototype.execute = function() {
this.counterName = this.getAttribute("counter"); this.counterName = this.getAttribute("counter");
this.storyViewName = this.getAttribute("storyview"); this.storyViewName = this.getAttribute("storyview");
this.historyTitle = this.getAttribute("history"); this.historyTitle = this.getAttribute("history");
// Create join template only if needed
if(this.join === undefined || (changedAttributes && changedAttributes.join)) {
this.join = this.makeJoinTemplate();
}
// Compose the list elements // Compose the list elements
this.list = this.getTiddlerList(); this.list = this.getTiddlerList();
var members = [], var members = [],
@ -102,6 +106,7 @@ ListWidget.prototype.findExplicitTemplates = function() {
var self = this; var self = this;
this.explicitListTemplate = null; this.explicitListTemplate = null;
this.explicitEmptyTemplate = null; this.explicitEmptyTemplate = null;
this.explicitJoinTemplate = null;
this.hasTemplateInBody = false; this.hasTemplateInBody = false;
var searchChildren = function(childNodes) { var searchChildren = function(childNodes) {
$tw.utils.each(childNodes,function(node) { $tw.utils.each(childNodes,function(node) {
@ -109,6 +114,8 @@ ListWidget.prototype.findExplicitTemplates = function() {
self.explicitListTemplate = node.children; self.explicitListTemplate = node.children;
} else if(node.type === "list-empty") { } else if(node.type === "list-empty") {
self.explicitEmptyTemplate = node.children; self.explicitEmptyTemplate = node.children;
} else if(node.type === "list-join") {
self.explicitJoinTemplate = node.children;
} else if(node.type === "element" && node.tag === "p") { } else if(node.type === "element" && node.tag === "p") {
searchChildren(node.children); searchChildren(node.children);
} else { } else {
@ -152,6 +159,24 @@ ListWidget.prototype.getEmptyMessage = function() {
} }
}; };
/*
Compose the template for a join between list items
*/
ListWidget.prototype.makeJoinTemplate = function() {
var parser,
join = this.getAttribute("join","");
if(join) {
parser = this.wiki.parseText("text/vnd.tiddlywiki",join,{parseAsInline:true})
if(parser) {
return parser.tree;
} else {
return [];
}
} else {
return this.explicitJoinTemplate; // May be null, and that's fine
}
};
/* /*
Compose the template for a list item Compose the template for a list item
*/ */
@ -160,6 +185,7 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
var tiddler = this.wiki.getTiddler(title), var tiddler = this.wiki.getTiddler(title),
isDraft = tiddler && tiddler.hasField("draft.of"), isDraft = tiddler && tiddler.hasField("draft.of"),
template = this.template, template = this.template,
join = this.join,
templateTree; templateTree;
if(isDraft && this.editTemplate) { if(isDraft && this.editTemplate) {
template = this.editTemplate; template = this.editTemplate;
@ -185,12 +211,12 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
} }
} }
// Return the list item // Return the list item
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree}; var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree, join: join};
parseTreeNode.isLast = index === this.list.length - 1;
if(this.counterName) { if(this.counterName) {
parseTreeNode.counter = (index + 1).toString(); parseTreeNode.counter = (index + 1).toString();
parseTreeNode.counterName = this.counterName; parseTreeNode.counterName = this.counterName;
parseTreeNode.isFirst = index === 0; parseTreeNode.isFirst = index === 0;
parseTreeNode.isLast = index === this.list.length - 1;
} }
return parseTreeNode; return parseTreeNode;
}; };
@ -206,7 +232,7 @@ ListWidget.prototype.refresh = function(changedTiddlers) {
this.storyview.refreshStart(changedTiddlers,changedAttributes); this.storyview.refreshStart(changedTiddlers,changedAttributes);
} }
// Completely refresh if any of our attributes have changed // Completely refresh if any of our attributes have changed
if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) { if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.join || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {
this.refreshSelf(); this.refreshSelf();
result = true; result = true;
} else { } else {
@ -310,10 +336,29 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
} }
} else { } else {
// Cycle through the list, inserting and removing list items as needed // Cycle through the list, inserting and removing list items as needed
var mustRecreateLastItem = false;
if(this.join && this.join.length) {
if(this.children.length !== this.list.length) {
mustRecreateLastItem = true;
} else if(prevList[prevList.length-1] !== this.list[this.list.length-1]) {
mustRecreateLastItem = true;
}
}
var isLast = false, wasLast = false;
for(t=0; t<this.list.length; t++) { for(t=0; t<this.list.length; t++) {
isLast = t === this.list.length-1;
var index = this.findListItem(t,this.list[t]); var index = this.findListItem(t,this.list[t]);
wasLast = index === this.children.length-1;
if(wasLast && (index !== t || this.children.length !== this.list.length)) {
mustRecreateLastItem = !!(this.join && this.join.length);
}
if(index === undefined) { if(index === undefined) {
// The list item must be inserted // The list item must be inserted
if(isLast && mustRecreateLastItem && t>0) {
// First re-create previosly-last item that will no longer be last
this.removeListItem(t-1);
this.insertListItem(t-1,this.list[t-1]);
}
this.insertListItem(t,this.list[t]); this.insertListItem(t,this.list[t]);
hasRefreshed = true; hasRefreshed = true;
} else { } else {
@ -322,9 +367,15 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
this.removeListItem(n); this.removeListItem(n);
hasRefreshed = true; hasRefreshed = true;
} }
// Refresh the item we're reusing // Refresh the item we're reusing, or recreate if necessary
var refreshed = this.children[t].refresh(changedTiddlers); if(mustRecreateLastItem && (isLast || wasLast)) {
hasRefreshed = hasRefreshed || refreshed; this.removeListItem(t);
this.insertListItem(t,this.list[t]);
hasRefreshed = true;
} else {
var refreshed = this.children[t].refresh(changedTiddlers);
hasRefreshed = hasRefreshed || refreshed;
}
} }
} }
} }
@ -414,8 +465,17 @@ ListItemWidget.prototype.execute = function() {
this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "yes" : "no"); this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "yes" : "no");
this.setVariable(this.parseTreeNode.counterName + "-last",this.parseTreeNode.isLast ? "yes" : "no"); this.setVariable(this.parseTreeNode.counterName + "-last",this.parseTreeNode.isLast ? "yes" : "no");
} }
// Add join if needed
var children = this.parseTreeNode.children,
join = this.parseTreeNode.join;
if(join && join.length && !this.parseTreeNode.isLast) {
children = children.slice(0);
$tw.utils.each(join,function(joinNode) {
children.push(joinNode);
})
}
// Construct the child widgets // Construct the child widgets
this.makeChildWidgets(); this.makeChildWidgets(children);
}; };
/* /*
@ -450,4 +510,14 @@ ListEmptyWidget.prototype.refresh = function() { return false; }
exports["list-empty"] = ListEmptyWidget; exports["list-empty"] = ListEmptyWidget;
var ListJoinWidget = function(parseTreeNode,options) {
// Main initialisation inherited from widget.js
this.initialise(parseTreeNode,options);
};
ListJoinWidget.prototype = new Widget();
ListJoinWidget.prototype.render = function() {}
ListJoinWidget.prototype.refresh = function() { return false; }
exports["list-join"] = ListJoinWidget;
})(); })();

View File

@ -40,6 +40,10 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
); );
this.inputDomNode = this.document.createElement("input"); this.inputDomNode = this.document.createElement("input");
this.inputDomNode.setAttribute("type","radio"); this.inputDomNode.setAttribute("type","radio");
this.assignAttributes(this.inputDomNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
if(isChecked) { if(isChecked) {
this.inputDomNode.checked = true; this.inputDomNode.checked = true;
} }

View File

@ -50,6 +50,10 @@ RangeWidget.prototype.render = function(parent,nextSibling) {
this.inputDomNode.setAttribute("disabled",true); this.inputDomNode.setAttribute("disabled",true);
} }
this.inputDomNode.value = this.getValue(); this.inputDomNode.value = this.getValue();
this.assignAttributes(this.inputDomNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
// Add a click event handler // Add a click event handler
$tw.utils.addEventListeners(this.inputDomNode,[ $tw.utils.addEventListeners(this.inputDomNode,[
{name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"}, {name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"},

View File

@ -12,6 +12,8 @@ Scrollable widget
/*global $tw: false */ /*global $tw: false */
"use strict"; "use strict";
var DEBOUNCE_INTERVAL = 100; // Delay after last scroll event before updating the bound tiddler
var Widget = require("$:/core/modules/widgets/widget.js").widget; var Widget = require("$:/core/modules/widgets/widget.js").widget;
var ScrollableWidget = function(parseTreeNode,options) { var ScrollableWidget = function(parseTreeNode,options) {
@ -174,22 +176,29 @@ ScrollableWidget.prototype.render = function(parent,nextSibling) {
// If the scroll position is bound to a tiddler // If the scroll position is bound to a tiddler
if(this.scrollableBind) { if(this.scrollableBind) {
// After a delay for rendering, scroll to the bound position // After a delay for rendering, scroll to the bound position
setTimeout(this.updateScrollPositionFromBoundTiddler.bind(this),50); this.updateScrollPositionFromBoundTiddler();
// Save scroll position on DOM scroll event // Set up event listener
this.outerDomNode.addEventListener("scroll",function(event) { this.currentListener = this.listenerFunction.bind(this);
var existingTiddler = self.wiki.getTiddler(self.scrollableBind), this.outerDomNode.addEventListener("scroll", this.currentListener);
newTiddlerFields = {
title: self.scrollableBind,
"scroll-left": self.outerDomNode.scrollLeft.toString(),
"scroll-top": self.outerDomNode.scrollTop.toString()
};
if(!existingTiddler || (existingTiddler.fields["scroll-left"] !== newTiddlerFields["scroll-left"] || existingTiddler.fields["scroll-top"] !== newTiddlerFields["scroll-top"])) {
self.wiki.addTiddler(new $tw.Tiddler(existingTiddler,newTiddlerFields));
}
});
} }
}; };
ScrollableWidget.prototype.listenerFunction = function(event) {
self = this;
clearTimeout(this.timeout);
this.timeout = setTimeout(function() {
var existingTiddler = self.wiki.getTiddler(self.scrollableBind),
newTiddlerFields = {
title: self.scrollableBind,
"scroll-left": self.outerDomNode.scrollLeft.toString(),
"scroll-top": self.outerDomNode.scrollTop.toString()
};
if(!existingTiddler || (existingTiddler.fields["title"] !== newTiddlerFields["title"]) || (existingTiddler.fields["scroll-left"] !== newTiddlerFields["scroll-left"] || existingTiddler.fields["scroll-top"] !== newTiddlerFields["scroll-top"])) {
self.wiki.addTiddler(new $tw.Tiddler(existingTiddler,newTiddlerFields));
}
}, DEBOUNCE_INTERVAL);
}
ScrollableWidget.prototype.updateScrollPositionFromBoundTiddler = function() { ScrollableWidget.prototype.updateScrollPositionFromBoundTiddler = function() {
// Bail if we're running on the fakedom // Bail if we're running on the fakedom
if(!this.outerDomNode.scrollTo) { if(!this.outerDomNode.scrollTo) {
@ -234,10 +243,22 @@ ScrollableWidget.prototype.refresh = function(changedTiddlers) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} }
if(changedAttributes.bind || changedTiddlers[this.getAttribute("bind")]) { // If the bound tiddler has changed, update the eventListener and update scroll position
if(changedAttributes["bind"]) {
if(this.currentListener) {
this.outerDomNode.removeEventListener("scroll", this.currentListener, false);
}
this.scrollableBind = this.getAttribute("bind");
this.currentListener = this.listenerFunction.bind(this);
this.outerDomNode.addEventListener("scroll", this.currentListener);
}
// Refresh children
var result = this.refreshChildren(changedTiddlers);
// If the bound tiddler has changed, update scroll position
if(changedAttributes["bind"] || changedTiddlers[this.getAttribute("bind")]) {
this.updateScrollPositionFromBoundTiddler(); this.updateScrollPositionFromBoundTiddler();
} }
return this.refreshChildren(changedTiddlers); return result;
}; };
exports.scrollable = ScrollableWidget; exports.scrollable = ScrollableWidget;

View File

@ -40,7 +40,31 @@ SelectWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent; this.parentDomNode = parent;
this.computeAttributes(); this.computeAttributes();
this.execute(); this.execute();
this.renderChildren(parent,nextSibling); //Create element
var domNode = this.document.createElement("select");
if(this.selectClass) {
domNode.classname = this.selectClass;
}
// Assign data- attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",
destPrefix: "data-"
});
if(this.selectMultiple) {
domNode.setAttribute("multiple","multiple");
}
if(this.selectSize) {
domNode.setAttribute("size",this.selectSize);
}
if(this.selectTabindex) {
domNode.setAttribute("tabindex",this.selectTabindex);
}
if(this.selectTooltip) {
domNode.setAttribute("title",this.selectTooltip);
}
this.renderChildren(domNode,nextSibling);
this.parentDomNode.insertBefore(domNode,nextSibling);
this.domNodes.push(domNode);
this.setSelectValue(); this.setSelectValue();
if(this.selectFocus == "yes") { if(this.selectFocus == "yes") {
this.getSelectDomNode().focus(); this.getSelectDomNode().focus();
@ -113,7 +137,7 @@ SelectWidget.prototype.setSelectValue = function() {
Get the DOM node of the select element Get the DOM node of the select element
*/ */
SelectWidget.prototype.getSelectDomNode = function() { SelectWidget.prototype.getSelectDomNode = function() {
return this.children[0].domNodes[0]; return this.domNodes[0];
}; };
// Return an array of the selected opion values // Return an array of the selected opion values
@ -149,27 +173,7 @@ SelectWidget.prototype.execute = function() {
this.selectTooltip = this.getAttribute("tooltip"); this.selectTooltip = this.getAttribute("tooltip");
this.selectFocus = this.getAttribute("focus"); this.selectFocus = this.getAttribute("focus");
// Make the child widgets // Make the child widgets
var selectNode = { this.makeChildWidgets();
type: "element",
tag: "select",
children: this.parseTreeNode.children
};
if(this.selectClass) {
$tw.utils.addAttributeToParseTreeNode(selectNode,"class",this.selectClass);
}
if(this.selectMultiple) {
$tw.utils.addAttributeToParseTreeNode(selectNode,"multiple","multiple");
}
if(this.selectSize) {
$tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize);
}
if(this.selectTabindex) {
$tw.utils.addAttributeToParseTreeNode(selectNode,"tabindex",this.selectTabindex);
}
if(this.selectTooltip) {
$tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip);
}
this.makeChildWidgets([selectNode]);
}; };
/* /*
@ -178,17 +182,21 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
SelectWidget.prototype.refresh = function(changedTiddlers) { SelectWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); var changedAttributes = this.computeAttributes();
// If we're using a different tiddler/field/index then completely refresh ourselves // If we're using a different tiddler/field/index then completely refresh ourselves
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip) { if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
// If the target tiddler value has changed, just update setting and refresh the children
} else { } else {
if(changedAttributes.class) { if(changedAttributes.class) {
this.selectClass = this.getAttribute("class"); this.selectClass = this.getAttribute("class");
this.getSelectDomNode().setAttribute("class",this.selectClass); this.getSelectDomNode().setAttribute("class",this.selectClass);
} }
this.assignAttributes(this.getSelectDomNode(),{
changedAttributes: changedAttributes,
sourcePrefix: "data-",
destPrefix: "data-"
});
var childrenRefreshed = this.refreshChildren(changedTiddlers); var childrenRefreshed = this.refreshChildren(changedTiddlers);
// If the target tiddler value has changed, just update setting and refresh the children
if(changedTiddlers[this.selectTitle] || childrenRefreshed) { if(changedTiddlers[this.selectTitle] || childrenRefreshed) {
this.setSelectValue(); this.setSelectValue();
} }

View File

@ -413,16 +413,34 @@ Widget.prototype.getAttribute = function(name,defaultText) {
}; };
/* /*
Assign the computed attributes of the widget to a domNode Assign the common attributes of the widget to a domNode
options include: options include:
excludeEventAttributes: ignores attributes whose name begins with "on" sourcePrefix: prefix of attributes that are to be directly assigned (defaults to the empty string meaning all attributes)
destPrefix: prefix to be applied to attribute names that are to be directly assigned (defaults to the emtpy string which means no prefix is added)
changedAttributes: hashmap by attribute name of attributes to process (if missing, process all attributes)
excludeEventAttributes: ignores attributes whose name would begin with "on"
*/ */
Widget.prototype.assignAttributes = function(domNode,options) { Widget.prototype.assignAttributes = function(domNode,options) {
options = options || {}; options = options || {};
var self = this; var self = this,
changedAttributes = options.changedAttributes || this.attributes,
sourcePrefix = options.sourcePrefix || "",
destPrefix = options.destPrefix || "",
EVENT_ATTRIBUTE_PREFIX = "on";
var assignAttribute = function(name,value) { var assignAttribute = function(name,value) {
// Process any style attributes before considering sourcePrefix and destPrefix
if(name.substr(0,6) === "style." && name.length > 6) {
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
return;
}
// Check if the sourcePrefix is a match
if(name.substr(0,sourcePrefix.length) === sourcePrefix) {
name = destPrefix + name.substr(sourcePrefix.length);
} else {
value = undefined;
}
// Check for excluded attribute names // Check for excluded attribute names
if(options.excludeEventAttributes && name.substr(0,2) === "on") { if(options.excludeEventAttributes && name.substr(0,2).toLowerCase() === EVENT_ATTRIBUTE_PREFIX) {
value = undefined; value = undefined;
} }
if(value !== undefined) { if(value !== undefined) {
@ -432,26 +450,24 @@ Widget.prototype.assignAttributes = function(domNode,options) {
namespace = "http://www.w3.org/1999/xlink"; namespace = "http://www.w3.org/1999/xlink";
name = name.substr(6); name = name.substr(6);
} }
// Handle styles // Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
if(name.substr(0,6) === "style." && name.length > 6) { try {
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value; domNode.setAttributeNS(namespace,name,value);
} else { } catch(e) {
// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
try {
domNode.setAttributeNS(namespace,name,value);
} catch(e) {
}
} }
} }
} };
// Not all parse tree nodes have the orderedAttributes property // If the parse tree node has the orderedAttributes property then use that order
if(this.parseTreeNode.orderedAttributes) { if(this.parseTreeNode.orderedAttributes) {
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) { $tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
assignAttribute(attribute.name,self.attributes[attribute.name]); if(attribute.name in changedAttributes) {
}); assignAttribute(attribute.name,self.getAttribute(attribute.name));
}
});
// Otherwise update each changed attribute irrespective of order
} else { } else {
$tw.utils.each(Object.keys(self.attributes).sort(),function(name) { $tw.utils.each(changedAttributes,function(value,name) {
assignAttribute(name,self.attributes[name]); assignAttribute(name,self.getAttribute(name));
}); });
} }
}; };

View File

@ -1,4 +1,3 @@
title: $:/core/templates/html-json-skinny-tiddler title: $:/core/templates/html-json-skinny-tiddler
<$list filter="[<numTiddlers>compare:number:gteq[1]] ~[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list>
<$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes"/> <$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes"/>

View File

@ -1,3 +1,3 @@
title: $:/core/templates/html-json-tiddler title: $:/core/templates/html-json-tiddler
<$list filter="[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list><$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes"/> <$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes"/>

View File

@ -6,14 +6,14 @@ title: $:/core/templates/store.area.template.html
<$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]"> <$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]">
<!-- New-style JSON store area, with an old-style store area for compatibility with v5.1.x tooling --> <!-- New-style JSON store area, with an old-style store area for compatibility with v5.1.x tooling -->
`<script class="tiddlywiki-tiddler-store" type="application/json">[` `<script class="tiddlywiki-tiddler-store" type="application/json">[`
<$vars newline={{{ [charcode[10]] }}}> <$let newline={{{ [charcode[10]] }}} join=`,$(newline)$`>
<$text text=<<newline>>/> <$text text=<<newline>>/>
<$list filter=<<saveTiddlerFilter>> counter="counter" template="$:/core/templates/html-json-tiddler"/> <$list filter=<<saveTiddlerFilter>> join=<<join>> template="$:/core/templates/html-json-tiddler"/>
<$vars numTiddlers={{{ [subfilter<saveTiddlerFilter>count[]] }}}> <$vars numTiddlers={{{ [subfilter<saveTiddlerFilter>count[]] }}}>
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} counter="counter" template="$:/core/templates/html-json-skinny-tiddler"/> <$list filter={{{ [<skinnySaveTiddlerFilter>] }}} join=<<join>> template="$:/core/templates/html-json-skinny-tiddler"/>
</$vars> </$vars>
<$text text=<<newline>>/> <$text text=<<newline>>/>
</$vars> </$let>
`]</script>` `]</script>`
`<div id="storeArea" style="display:none;">` `<div id="storeArea" style="display:none;">`
`</div>` `</div>`

View File

@ -4,11 +4,8 @@ tags: $:/tags/ViewTemplate
\whitespace trim \whitespace trim
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes"> <$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-subtitle"> <div class="tc-subtitle">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler" counter="indexSubtitleTiddler"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler">
<$list filter="[<indexSubtitleTiddler-first>match[no]]" variable="ignore"> <$transclude tiddler=<<subtitleTiddler>> mode="inline"/><$list-join>&nbsp;</$list-join>
&nbsp;
</$list>
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/>
</$list> </$list>
</div> </div>
</$reveal> </$reveal>

View File

@ -13,7 +13,7 @@ tags: $:/tags/Macro
$(colour-picker-update-recent)$ $(colour-picker-update-recent)$
$actions$ <$transclude $variable="__actions__"/>
<span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/> <span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/>
@ -23,7 +23,7 @@ $actions$
\define colour-picker-recent-inner(actions) \define colour-picker-recent-inner(actions)
\whitespace trim \whitespace trim
<$set name="colour-picker-value" value="$(recentColour)$"> <$set name="colour-picker-value" value="$(recentColour)$">
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> <$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
</$set> </$set>
\end \end
@ -31,7 +31,7 @@ $actions$
\whitespace trim \whitespace trim
{{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour"> {{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour">
&#32; &#32;
<$macrocall $name="colour-picker-recent-inner" actions="""$actions$"""/> <$macrocall $name="colour-picker-recent-inner" actions=<<__actions__>>/>
</$list> </$list>
\end \end
@ -39,13 +39,13 @@ $actions$
\whitespace trim \whitespace trim
<div class="tc-colour-chooser"> <div class="tc-colour-chooser">
<$macrocall $name="colour-picker-recent" actions="""$actions$"""/> <$macrocall $name="colour-picker-recent" actions=<<__actions__>>/>
--- ---
<$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value"> <$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value">
&#32; &#32;
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> <$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
</$list> </$list>
--- ---
@ -54,7 +54,7 @@ $actions$
&#32; &#32;
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/> <$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}> <$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}>
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> <$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
</$set> </$set>
</div> </div>

View File

@ -5,13 +5,13 @@ title: $:/core/macros/image-picker
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
\define image-picker-thumbnail(actions) \define image-picker-thumbnail(actions)
<$button tag="a" tooltip="""$(imageTitle)$""">$actions$<$transclude tiddler=<<imageTitle>>/></$button> <$button tag="a" tooltip="""$(imageTitle)$"""><$transclude $variable="__actions__"/><$transclude tiddler=<<imageTitle>>/></$button>
\end \end
\define image-picker-list(filter,actions) \define image-picker-list(filter,actions)
\whitespace trim \whitespace trim
<$list filter="""$filter$""" variable="imageTitle"> <$list filter="""$filter$""" variable="imageTitle">
<$macrocall $name="image-picker-thumbnail" actions="""$actions$"""/> <$macrocall $name="image-picker-thumbnail" actions=<<__actions__>>/>
&#32; &#32;
</$list> </$list>
\end \end
@ -25,15 +25,15 @@ type: text/vnd.tiddlywiki
{{$:/language/SystemTiddlers/Include/Prompt}} {{$:/language/SystemTiddlers/Include/Prompt}}
</$checkbox> </$checkbox>
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div"> <$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">
<$macrocall $name="image-picker-list" filter="""$filter$ +[!is[system]]""" actions="""$actions$"""/> <$macrocall $name="image-picker-list" filter="""$filter$ +[!is[system]]""" actions=<<__actions__>>/>
</$reveal> </$reveal>
<$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div"> <$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div">
<$macrocall $name="image-picker-list" filter="""$filter$""" actions="""$actions$"""/> <$macrocall $name="image-picker-list" filter="""$filter$""" actions=<<__actions__>>/>
</$reveal> </$reveal>
</$vars> </$vars>
</div> </div>
\end \end
\define image-picker-include-tagged-images(actions) \define image-picker-include-tagged-images(actions)
<$macrocall $name="image-picker" filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]" actions="""$actions$"""/> <$macrocall $name="image-picker" filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]" actions=<<__actions__>>/>
\end \end

View File

@ -4,7 +4,15 @@ code-body: yes
\define tabs-button() \define tabs-button()
\whitespace trim \whitespace trim
<$button set=<<tabsState>> setTo=<<currentTab>> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}} role="switch"> <$button
set=<<tabsState>>
setTo=<<currentTab>>
default=<<__default__>>
selectedClass="tc-tab-selected"
tooltip={{!!tooltip}}
role="switch"
data-tab-title=<<currentTab>>
>
<$tiddler tiddler=<<save-currentTiddler>>> <$tiddler tiddler=<<save-currentTiddler>>>
<$set name="tv-wikilinks" value="no"> <$set name="tv-wikilinks" value="no">
<$transclude tiddler=<<__buttonTemplate__>> mode="inline"> <$transclude tiddler=<<__buttonTemplate__>> mode="inline">

View File

@ -16,7 +16,7 @@ second-search-filter: [tags[]is[system]search:title<userInput>sort[]]
emptyMessage="<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter='-[<tag>]'/>" emptyMessage="<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter='-[<tag>]'/>"
> >
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/> <$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
$actions$ <$transclude $variable="__actions__"/>
</$list> </$list>
</$set> </$set>
<<delete-tag-state-tiddlers>> <<delete-tag-state-tiddlers>>
@ -102,7 +102,7 @@ second-search-filter: [tags[]is[system]search:title<userInput>sort[]]
<$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}> <$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}>
<$button set=<<newTagNameTiddler>> setTo="" class=""> <$button set=<<newTagNameTiddler>> setTo="" class="">
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/> <$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
$actions$ <$transclude $variable="__actions__"/>
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}> <$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
<<delete-tag-state-tiddlers>><$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>>/> <<delete-tag-state-tiddlers>><$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>>/>
</$set> </$set>

View File

@ -21,8 +21,8 @@ Willkommen bei ''~TiddlyWiki'', dem einzigartigen [[nicht-linearen|Philosophy vo
Anders, als bei herkömmlichen Online-Diensten, lässt Ihnen ~TiddlyWiki die Freiheit, wo sie ihre Daten speichern. Da ~TiddlyWiki alle Daten als simplen Text speichert, sind Notizen, die Sie heute machen, garantiert in Jahrzehnten noch einfach lesbar. Anders, als bei herkömmlichen Online-Diensten, lässt Ihnen ~TiddlyWiki die Freiheit, wo sie ihre Daten speichern. Da ~TiddlyWiki alle Daten als simplen Text speichert, sind Notizen, die Sie heute machen, garantiert in Jahrzehnten noch einfach lesbar.
<div style="font-size:0.7em;text-align:center;margin-top:3em;margin-bottom:3em;"> <div style="font-size:0.7em;text-align:center;margin-top:3em;margin-bottom:3em;">
<a href="http://groups.google.com/group/TiddlyWiki" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank"> <a href="https://talk.tiddlywiki.org/" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank">
{{$:/core/images/mail}} ~TiddlyWiki Mailing List {{$:/core/images/help}} ~TiddlyWiki Forum
</a> </a>
<a href="https://twitter.com/TiddlyWiki" class="tc-btn-big-green" style="background-color:#5E9FCA;" target="_blank"> <a href="https://twitter.com/TiddlyWiki" class="tc-btn-big-green" style="background-color:#5E9FCA;" target="_blank">
{{$:/core/images/twitter}} @~TiddlyWiki on Twitter {{$:/core/images/twitter}} @~TiddlyWiki on Twitter

View File

@ -7,5 +7,5 @@ type: text/vnd.tiddlywiki
Es gibt mehrere Ressourcen für Entwickler, um mehr über das TiddlyWiki Projekt zu erfahren, zu diskutieren und vor allem mitzuhelfen. Es gibt mehrere Ressourcen für Entwickler, um mehr über das TiddlyWiki Projekt zu erfahren, zu diskutieren und vor allem mitzuhelfen.
* [[tiddlywiki.com/dev|https://tiddlywiki.com/dev]] Offizielle Entwickler Doku. * [[tiddlywiki.com/dev|https://tiddlywiki.com/dev]] Offizielle Entwickler Doku.
* [[TiddlyWikiDev group|http://groups.google.com/group/TiddlyWikiDev]] Google Diskussionsforum für Entwickler. * [[TiddlyWikiDev group|https://talk.tiddlywiki.org/c/devs/]] Diskussionsforum für Entwickler.
* https://github.com/Jermolene/TiddlyWiki5 .. Github Repository. * https://github.com/Jermolene/TiddlyWiki5 .. Github Repository.

View File

@ -12,7 +12,9 @@ Son listas de correo en las que hablamos de ~TiddlyWiki: pedimos ayuda, anunciam
Puedes participar a través de la página web asociada, o suscribirte via mail. Puedes participar a través de la página web asociada, o suscribirte via mail.
!!Usuarios !! Usuarios
[[Foro oficial de TiddlyWiki| https://talk.tiddlywiki.org/]]
[[Grupo principal de TiddlyWiki| http://groups.google.com/group/TiddlyWiki]] [[Grupo principal de TiddlyWiki| http://groups.google.com/group/TiddlyWiki]]
@ -25,10 +27,7 @@ o síguenos [[en Twitter|http://twitter.com/TiddlyWiki]] si quieres recibir las
!! Desarrolladores !! Desarrolladores
[[Grupo de desarrollo de TiddlyWiki|http://groups.google.com/group/TiddlyWikiDev]] [[Foro de desarrollo de TiddlyWiki|https://talk.tiddlywiki.org/c/devs]]
>No necesitas tener cuenta en Google para acceder al grupo. Suscríbete igualmente enviando un mail a:
*mailto:tiddlywikidev+subscribe@googlegroups.com.
Accede a nuestra [[página de desarrollo|https://github.com/Jermolene/TiddlyWiki5]] en GitHub y haz tu contribución. Accede a nuestra [[página de desarrollo|https://github.com/Jermolene/TiddlyWiki5]] en GitHub y haz tu contribución.

View File

@ -20,8 +20,8 @@ BIenvenido a TiddlyWiki, un bloc de notas [[no lineal|Philosophy of Tiddlers]]
Al revés que los servicios online convencionales, TiddlyWiki te deja escoger dónde quieres guardar tus datos, garantizándote que, por más que pase el tiempo, podrás seguir usando en el futuro las notas que tomes hoy. Al revés que los servicios online convencionales, TiddlyWiki te deja escoger dónde quieres guardar tus datos, garantizándote que, por más que pase el tiempo, podrás seguir usando en el futuro las notas que tomes hoy.
<div style="font-size:0.7em;text-align:center;margin-top:3em;margin-bottom:3em;"> <div style="font-size:0.7em;text-align:center;margin-top:3em;margin-bottom:3em;">
<a href="http://groups.google.com/group/TiddlyWiki" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank" rel="noopener noreferrer"> <a href="https://talk.tiddlywiki.org/" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank" rel="noopener noreferrer">
{{$:/core/images/mail}} ~TiddlyWiki en Google Groups {{$:/core/images/mail}} Foro oficial de ~TiddlyWiki
</a> </a>
<a href="https://www.youtube.com/c/JeremyRuston" class="tc-btn-big-green" style="background-color:#e52d27;" target="_blank" rel="noopener noreferrer"> <a href="https://www.youtube.com/c/JeremyRuston" class="tc-btn-big-green" style="background-color:#e52d27;" target="_blank" rel="noopener noreferrer">
{{$:/core/images/video}} ~TiddlyWiki en ~YouTube {{$:/core/images/video}} ~TiddlyWiki en ~YouTube

View File

@ -8,7 +8,7 @@ type: text/vnd.tiddlywiki
Se recomienda el uso de las [[macros de documentación|Documentation Macros]] para facilitar las futuras tareas de mantenimiento del texto frente a nuevos cambios y actualizaciones. Se recomienda el uso de las [[macros de documentación|Documentation Macros]] para facilitar las futuras tareas de mantenimiento del texto frente a nuevos cambios y actualizaciones.
Se recomienda precaución en el uso arbitrario de estilos directos de formato (''negrita'', //cursiva// ...etc). Si se puede usar una macro, conviene usarla. Si no existe la macro adecuada, se puede crear o, si no se sabe cómo, pedir su creación en el [[Grupo de Google|http://groups.google.com/group/TiddlyWiki]]. Se recomienda precaución en el uso arbitrario de estilos directos de formato (''negrita'', //cursiva// ...etc). Si se puede usar una macro, conviene usarla. Si no existe la macro adecuada, se puede crear o, si no se sabe cómo, pedir su creación en el [[Foro de TiddlyWiki|https://talk.tiddlywiki.org/]].
Por el mismo motivo, se aconseja el uso de acentos graves <code>&#96;...&#96;</code> para transcribir fragmentos de código y ~WikiText, pero no para nombres de cosas tales como campos, operadores, variables o widgets. Estas tienen su macro correspondiente. Por el mismo motivo, se aconseja el uso de acentos graves <code>&#96;...&#96;</code> para transcribir fragmentos de código y ~WikiText, pero no para nombres de cosas tales como campos, operadores, variables o widgets. Estas tienen su macro correspondiente.

View File

@ -12,7 +12,9 @@ description: Under development
!! Conditional Shortcut Syntax !! Conditional Shortcut Syntax
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7710">> a new [[shortcut syntax|Conditional Shortcut Syntax]] for concisely expressing if-then-else logic. For example: <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7710">> a new [[shortcut syntax|Conditional Shortcut Syntax]] for concisely expressing if-then-else logic. This is the first of a new type of wikitext syntax based on tokens delimited with `<%` and `%>`. We plan to introduce other structures using the same format such as a "case" statement.
These new token-based shortcuts allow a richer structure and expressivity than existing features such as widgets or pragmas. For example:
``` ```
<% if [<animal>match[Elephant]] %> <% if [<animal>match[Elephant]] %>
@ -24,9 +26,15 @@ description: Under development
<% endif %> <% endif %>
``` ```
Behind the scenes, the conditional shortcut syntax is rendered as the equivalent [[ListWidgets|ListWidget]].
!! Explicit Templates for the ListWidget !! Explicit Templates for the ListWidget
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7784">> support for `<$list-template>` and `<$list-empty>` as immediate children of the <<.wid "ListWidget">> widget to specify the list item template and/or the empty template. For example: <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7784">> support for `<$list-template>` and `<$list-empty>` as immediate children of the <<.wid "ListWidget">> widget to specify the list item template and/or the empty template.
This new feature is designed to replace a common pattern of using the `emptyMessage` attribute of the ListWidget to render complex wikitext that thus has to be quoted. Working with wikitext within quotes is awkward and error prone. The new structure can be somewhat faster because it allows the empty message to be parsed in advanced of rendering.
For example:
``` ```
<$list filter=<<filter>>> <$list filter=<<filter>>>
@ -41,6 +49,28 @@ description: Under development
Note that the <<.attr "emptyMessage">> and <<.attr "template">> attributes take precedence if they are present. Note that the <<.attr "emptyMessage">> and <<.attr "template">> attributes take precedence if they are present.
!! Joiners for the ListWidget
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7694">> a <<.attr "join">> attribute to the <<.wid "ListWidget">> widget to insert a short piece of text between list items. This is both easier to use and faster than using the <<.attr "counter">> attribute for the same purpose. So if your list looked like this:
```
<$list filter=<<filter>> counter="counter" variable="item">
<$text text=<<item>>/><$list filter="[<counter-last>match[no]]" variable="ignore"><$text text=", "/></$list>
</$list>
```
You can replace it with:
```
<$list filter=<<filter>> variable="item" join=", "><$text text=<<item>>/></$list>
```
If the joiner text that you need is long and awkward to write in an attribute, you can use the new `<$list-join>` widget. Like `<$list-template>` and `<$list-empty>`, it must be an immediate child of the <<.wid "ListWidget">>:
```
<$list filter=<<filter>> variable="item"><$text text=<<item>>/><$list-join>, and <em>also</em> let's not forget </$list-join></$list>
```
!! jsonset operator !! jsonset operator
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7742">> [[jsonset Operator]] for setting values within JSON objects <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7742">> [[jsonset Operator]] for setting values within JSON objects
@ -49,7 +79,7 @@ Note that the <<.attr "emptyMessage">> and <<.attr "template">> attributes take
<<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7746">> QR Code plugin to be able to read QR codes and a number of other bar code formats <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7746">> QR Code plugin to be able to read QR codes and a number of other bar code formats
! Translation improvement ! Translation improvements
Improvements to the following translations: Improvements to the following translations:
@ -61,10 +91,13 @@ Improvements to the following translations:
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/1be8f0a9336952d4745d2bd4f2327e353580a272">> Comments Plugin to use predefined palette colours * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/1be8f0a9336952d4745d2bd4f2327e353580a272">> Comments Plugin to use predefined palette colours
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7785">> Evernote Importer Plugin to support images and other attachments * <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7785">> Evernote Importer Plugin to support images and other attachments
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7790">> `$floating` attribute to Dynannotate Plugin to support popups that do not disappear when another part of the screen is clicked. Instead they have to dismissed manually
! Widget Improvements ! Widget Improvements
* * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7734">> ImageWidget encoding for more image types
* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7634">> ImageWidget to add a "usemap" attribute
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7649">> the ScrollableWidget to allow the scroll position to be bound to a tiddler, so that changes to the tiddler affect the scroll position, and vice versa
! Usability Improvements ! Usability Improvements
@ -73,8 +106,10 @@ Improvements to the following translations:
! Hackability Improvements ! Hackability Improvements
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7737">> an automatic build of the external core TiddlyWiki at https://tiddlywiki.com/empty-external-core.html * <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7769">> all the relevant core widgets to allow arbitrary `data-*` attributes and `style.*` attributes to be applied to the generated DOM nodes. This is useful for passing data to the EventCatcherWidget
* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7849">> [[jsonextract Operator]], [[jsonget Operator]], [[jsonset Operator]] and [[jsontype Operator]] to allow negative indexes into arrays to be counted from the end of the array
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7690">> the default page layout to better support CSS grid and flexbox layouts * <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7690">> the default page layout to better support CSS grid and flexbox layouts
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7787">> the editor to use grid layout, simplifying customisation
! Bug Fixes ! Bug Fixes
@ -87,10 +122,20 @@ Improvements to the following translations:
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/6088">> upgrade download link in Firefox * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/6088">> upgrade download link in Firefox
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7698">> refreshing of transcluded functions * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7698">> refreshing of transcluded functions
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7789">> resizing of height of textareas in control panel * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7789">> resizing of height of textareas in control panel
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7683">> [[encodebase64 Operator]] and [[decodebase64 Operator]] to work properly with binary data
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7708">> [[WidgetMessage: tm-open-window]] when opening an existing window to bring it to the front and focus it
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7809">> behaviour of [[last Operator]] when zero items selected
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7806">> incorrectly setting focus on field name input field when deleting field using the delete field button
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7802">> [[Table-of-Contents Macros]] to not show expander icon for a sublist that has all children excluded
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7794">> overflow of [[CodeMirror Plugin]] editor within grid container
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7835">> wikitest parser removing whitespace when parsing pragmas
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7842">> tooltip for editor add field button
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7844">> plain text parser being susceptible to the CodeBlockWidget being redefined
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7855">> pragmas not working within the action string of several core macros
! Node.js Improvements ! Node.js Improvements
* * <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7843">> a significant flaw in the synchronisation algorithm used by the client-server configuration. The flaw could lead to tiddlers temporarily disappearing from the browser
! Performance Improvements ! Performance Improvements
@ -100,6 +145,12 @@ Improvements to the following translations:
! Developer Improvements ! Developer Improvements
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7751">> global hook handling to support removing hooks * <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7751">> global hook handling to support removing hooks
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7539">> some useful npm scripts to `package.json`
! Infrastructure Improvements
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7820">> Continuous Integration tests to use Playwright to run our browser-based tests
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7737">> an automatic build of the external core TiddlyWiki at https://tiddlywiki.com/empty-external-core.html
! Acknowledgements ! Acknowledgements
@ -110,13 +161,19 @@ AnthonyMuscio
BramChen BramChen
BuckarooBanzay BuckarooBanzay
BurningTreeC BurningTreeC
CrossEye
EvidentlyCube EvidentlyCube
Gk0Wk
joebordes joebordes
kookma kookma
linonetwo linonetwo
mateuszwilczek mateuszwilczek
oflg
pille1842
pmario pmario
rmunn rmunn
saqimtiaz
simonbaird simonbaird
T1mL3arn T1mL3arn
yaisog
""">> """>>

View File

@ -0,0 +1,30 @@
title: ListWidget/WithJoinTemplate
description: List widget with join template and $list-empty
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
+
title: Output
\whitespace trim
\procedure test(filter)
<$list filter=<<filter>>>
Item:<<currentTiddler>>
<$list-empty>
None!
</$list-empty>
<$list-join>,</$list-join>
</$list>
\end
<<test "1 2 3">>
<<test "">>
+
title: ExpectedResult
<p>Item:1,Item:2,Item:3</p><p>None!</p>

View File

@ -0,0 +1,32 @@
title: ListWidget/WithJoinTemplateInBlockMode
description: List widget with join template and $list-empty in block mode
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
+
title: Output
\whitespace trim
\procedure test(filter)
<$list filter=<<filter>>>
Item:<<currentTiddler>>
<$list-empty>
None!
</$list-empty>
<$list-join><br></$list-join>
</$list>
\end
<<test "1 2 3">>
<<test "">>
+
title: ExpectedResult
comment: I wish there was a good way to get rid of these extraneous paragraph elements
<p>Item:1</p><p></p><p></p><br><p>Item:2</p><p></p><p></p><br><p>Item:3</p><p></p><p></p>None!

View File

@ -0,0 +1,27 @@
title: Widgets/DataAttributes/ButtonWidget
description: Data Attributes for ButtonWidget
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$button tag="div" class="myclass" data-title="mytiddler" style.color="red" onclick="clicked">
my tiddler
</$button>
<$button tag="div" class="myclass" data-title={{Temp}} style.color={{{ [[Temp]get[color]] }}}>
hello
</$button>
+
title: Actions
<$action-setfield $tiddler="Temp" $field="text" $value="Title2" color="red"/>
+
title: Temp
color: black
Title1
+
title: ExpectedResult
<p><div class="myclass" data-title="mytiddler" style="color:red;">my tiddler</div><div class="myclass" data-title="Title2" style="color:red;">hello</div></p>

View File

@ -0,0 +1,22 @@
title: Widgets/DataAttributes/CheckboxWidget
description: Data Attributes for CheckboxWidget
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$checkbox tag="done" data-title={{Temp}} style.color={{{ [[Temp]get[color]] }}} onclick="clicked"> Is it done?</$checkbox>
+
title: Actions
<$action-setfield $tiddler="Temp" $field="text" $value="Title2" color="red"/>
+
title: Temp
color: black
Title1
+
title: ExpectedResult
<p><label class="tc-checkbox "><input data-title="Title2" type="checkbox" style="color:red;"><span>Is it done?</span></label></p>

View File

@ -0,0 +1,27 @@
title: Widgets/DataAttributes/DraggableWidget
description: Data Attributes for DraggableWidget
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$draggable tag="div" class="myclass" data-title="mytiddler" style.color="red" onclick="clicked">
my tiddler
</$draggable>
<$draggable tag="div" class="myclass" data-title={{Temp}} style.color={{{ [[Temp]get[color]] }}}>
hello
</$draggable>
+
title: Actions
<$action-setfield $tiddler="Temp" $field="text" $value="Title2" color="red"/>
+
title: Temp
color: black
Title1
+
title: ExpectedResult
<p><div class="myclass tc-draggable" data-title="mytiddler" draggable="true" style="color:red;">my tiddler</div><div class="myclass tc-draggable" data-title="Title2" draggable="true" style="color:red;">hello</div></p>

View File

@ -0,0 +1,27 @@
title: Widgets/DataAttributes/DroppableWidget
description: Data Attributes for DroppableWidget
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$droppable tag="div" class="myclass" data-title="mytiddler" style.color="red" onclick="clicked">
my tiddler
</$droppable>
<$droppable tag="div" class="myclass" data-title={{Temp}} style.color={{{ [[Temp]get[color]] }}}>
hello
</$droppable>
+
title: Actions
<$action-setfield $tiddler="Temp" $field="text" $value="Title2" color="red"/>
+
title: Temp
color: black
Title1
+
title: ExpectedResult
<p><div class="myclass tc-droppable" data-title="mytiddler" style="color:red;">my tiddler</div><div class="myclass tc-droppable" data-title="Title2" style="color:red;">hello</div></p>

View File

@ -0,0 +1,27 @@
title: Widgets/DataAttributes/LinkWidget
description: Data Attributes for LinkWidget
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$link data-id="mytiddler" style.color="red" to="Temp" onclick="clicked">
link to Temp
</$link>
<$link tag="button" data-id={{Temp}} style.color={{{ [[Temp]get[color]] }}} to="SomeTiddler">
some tiddler
</$link>
+
title: Actions
<$action-setfield $tiddler="Temp" $field="text" $value="Title2" color="red"/>
+
title: Temp
color: black
Title1
+
title: ExpectedResult
<p><a class="tc-tiddlylink tc-tiddlylink-resolves" data-id="mytiddler" href="#Temp" style="color:red;">link to Temp</a><button class="tc-tiddlylink tc-tiddlylink-missing" data-id="Title2" draggable="true" style="color:red;">some tiddler</button></p>

View File

@ -0,0 +1,15 @@
title: Widgets/DataAttributes/OrderedStyleAttributes
description: Ordered style attributes
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<div style="background:red;color:blue;" style.background="green">
hello
</div>
+
title: ExpectedResult
<p><div style="background:green;color:blue;">hello</div></p>

View File

@ -0,0 +1,27 @@
title: Widgets/DataAttributes/SelectWidget
description: Data Attributes for SelectWidget
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$select tiddler='New Tiddler' field='text' default='Choose a new text' data-title={{Temp}} style.color={{{ [[Temp]get[color]] }}} onclick="clicked">
<option disabled>Choose a new text</option>
<option>A Tale of Two Cities</option>
<option>A New Kind of Science</option>
<option>The Dice Man</option>
</$select>
+
title: Actions
<$action-setfield $tiddler="Temp" $field="text" $value="Title2" color="red"/>
+
title: Temp
color: black
Title1
+
title: ExpectedResult
<p><select data-title="Title2" value="Choose a new text" style="color:red;"><option disabled="true">Choose a new text</option><option>A Tale of Two Cities</option><option>A New Kind of Science</option><option>The Dice Man</option></select></p>

View File

@ -0,0 +1,15 @@
title: Widgets/ElementWidgetEventAttributes
description: Element widget should not support event attributes starting with "on"
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<div class="hello" onclick="clicked">
TiddlyWiki
</div>
+
title: ExpectedResult
<p><div class="hello">TiddlyWiki</div></p>

View File

@ -0,0 +1,15 @@
title: Widgets/ElementWidgetStyleAttributes
description: Element widget should support style.* attributes
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<div class="hello" onclick="clicked" style.color="blue" style.color="red" style.background="yellow">
TiddlyWiki
</div>
+
title: ExpectedResult
<p><div class="hello" style="color:red;background:yellow;">TiddlyWiki</div></p>

View File

@ -124,6 +124,7 @@ describe("json filter tests", function() {
}); });
it("should support the jsonset operator", function() { it("should support the jsonset operator", function() {
expect(wiki.filterTiddlers("[jsonset[a],[aa]]")).toEqual(['"First"','"Second"','"Third"']);
expect(wiki.filterTiddlers("[{First}jsonset[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']); expect(wiki.filterTiddlers("[{First}jsonset[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
expect(wiki.filterTiddlers("[{First}jsonset[],[Antelope]]")).toEqual(['"Antelope"']); expect(wiki.filterTiddlers("[{First}jsonset[],[Antelope]]")).toEqual(['"Antelope"']);
expect(wiki.filterTiddlers("[{First}jsonset:number[],[not a number]]")).toEqual(['0']); expect(wiki.filterTiddlers("[{First}jsonset:number[],[not a number]]")).toEqual(['0']);

View File

@ -527,6 +527,45 @@ describe("Widget module", function() {
expect(wrapper.children[0].children[15].sequenceNumber).toBe(53); expect(wrapper.children[0].children[15].sequenceNumber).toBe(53);
}); });
var testListJoin = function(oldList, newList) {
return function() {
var wiki = new $tw.Wiki();
// Add some tiddlers
wiki.addTiddler({title: "Numbers", text: "", list: oldList});
var text = "<$list filter='[list[Numbers]]' variable='item' join=', '><<item>></$list>";
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);
// Test the rendering
expect(wrapper.innerHTML).toBe("<p>" + oldList.split(' ').join(', ') + "</p>");
// Change the list and ensure new rendering is still right
wiki.addTiddler({title: "Numbers", text: "", list: newList});
refreshWidgetNode(widgetNode,wrapper,["Numbers"]);
expect(wrapper.innerHTML).toBe("<p>" + newList.split(' ').join(', ') + "</p>");
}
}
it("the list widget with join should update correctly when empty list gets one item", testListJoin("", "1"));
it("the list widget with join should update correctly when empty list gets two items", testListJoin("", "1 2"));
it("the list widget with join should update correctly when single-item list is appended to", testListJoin("1", "1 2"));
it("the list widget with join should update correctly when single-item list is prepended to", testListJoin("1", "2 1"));
it("the list widget with join should update correctly when list is appended", testListJoin("1 2 3 4", "1 2 3 4 5"));
it("the list widget with join should update correctly when last item is removed", testListJoin("1 2 3 4", "1 2 3"));
it("the list widget with join should update correctly when first item is inserted", testListJoin("1 2 3 4", "0 1 2 3 4"));
it("the list widget with join should update correctly when first item is removed", testListJoin("1 2 3 4", "2 3 4"));
it("the list widget with join should update correctly when first two items are swapped", testListJoin("1 2 3 4", "2 1 3 4"));
it("the list widget with join should update correctly when last two items are swapped", testListJoin("1 2 3 4", "1 2 4 3"));
it("the list widget with join should update correctly when last item is moved to the front", testListJoin("1 2 3 4", "4 1 2 3"));
it("the list widget with join should update correctly when last item is moved to the middle", testListJoin("1 2 3 4", "1 4 2 3"));
it("the list widget with join should update correctly when first item is moved to the back", testListJoin("1 2 3 4", "2 3 4 1"));
it("the list widget with join should update correctly when middle item is moved to the back", testListJoin("1 2 3 4", "1 3 4 2"));
it("the list widget with join should update correctly when the last item disappears at the same time as other edits 1", testListJoin("1 3 4", "1 2 3"));
it("the list widget with join should update correctly when the last item disappears at the same time as other edits 2", testListJoin("1 3 4", "1 3 2"));
it("the list widget with join should update correctly when the last item disappears at the same time as other edits 3", testListJoin("1 3 4", "2 1 3"));
it("the list widget with join should update correctly when the last item disappears at the same time as other edits 4", testListJoin("1 3 4", "2 3 1"));
it("the list widget with join should update correctly when the last item disappears at the same time as other edits 5", testListJoin("1 3 4", "3 1 2"));
it("the list widget with join should update correctly when the last item disappears at the same time as other edits 6", testListJoin("1 3 4", "3 2 1"));
var testCounterLast = function(oldList, newList) { var testCounterLast = function(oldList, newList) {
return function() { return function() {
var wiki = new $tw.Wiki(); var wiki = new $tw.Wiki();

View File

@ -40,22 +40,6 @@ There are technical restrictions on the legal characters in an URL fragment. To
Both the target tiddler title and the story filter should be URL encoded (but not the separating colon). TiddlyWiki generates properly encoded URLs which can look quite ugly. However, in practice browsers will usually perfectly happily process arbitrary characters in URL fragments. Thus when creating permalinks manually you can choose to ignore URL encoding. Both the target tiddler title and the story filter should be URL encoded (but not the separating colon). TiddlyWiki generates properly encoded URLs which can look quite ugly. However, in practice browsers will usually perfectly happily process arbitrary characters in URL fragments. Thus when creating permalinks manually you can choose to ignore URL encoding.
!! Simpler URLS
<<.from-version "5.3.2">> The URLs generated are simplified from the hard-to-read percent encoding when feasible. Spaces are replaced with underscores (`_`), many punctuation characters are allowed to remain unencoded, and permaview filters receive a simpler encoding. For example the tiddler "Hard Linebreaks with CSS - Example", which percent-encoded would look like
> @@font-family:monospace;#Hard%20Linebreaks%20with%20CSS%20-%20Example@@
instead looks like
> @@font-family:monospace;#Hard_Linebreaks_with_CSS_-_Example@@
Existing story filter URLs like
> @@font-family:monospace;#:[tag[Features]]%20+[limit[5]]@@
will continue to work.
! Permalink Behaviour ! Permalink Behaviour
Two important aspects of TiddlyWiki's behaviour with permalinks can be controlled via options in the [[control panel|$:/ControlPanel]] <<.icon $:/core/images/options-button>> ''Settings'' tab: Two important aspects of TiddlyWiki's behaviour with permalinks can be controlled via options in the [[control panel|$:/ControlPanel]] <<.icon $:/core/images/options-button>> ''Settings'' tab:

View File

@ -0,0 +1,59 @@
created: 20231204112944341
modified: 20231204115056732
tags: [[Operator Examples]] [[jsonset Operator]]
title: jsonset Operator (Examples)
<$let object-a="""{
"a": "one",
"b": "",
"c": "three",
"d": {
"e": "four",
"f": [
"five",
"six",
true,
false,
null
],
"g": {
"x": "max",
"y": "may",
"z": "maize"
}
}
}
"""
object-b="""{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}""">
The examples below assume the following JSON object is contained in the variable `object-a`:
<pre><<object-a>></pre>
<<.operator-example 1 "[<object-a>jsonset[d],[Jaguar]]">>
<<.operator-example 2 "[<object-a>jsonset[d],[f],[Panther]]">>
<<.operator-example 3 "[<object-a>jsonset[d],[f],[-1],[Elephant]]">>
<<.operator-example 4 "[<object-a>jsonset[d],[f],[-2],[Elephant]]">>
<<.operator-example 5 "[<object-a>jsonset[d],[f],[-4],[Elephant]]">>
<<.operator-example 6 "[<object-a>jsonset[Panther]]" "If only a single parameter is specified, it replaces the entire JSON object">>
<<.operator-example 7 "[<object-a>jsonset[]]" "If only a single blank parameter is specified, no changes are made to the JSON object">>
The examples below assume the following JSON object is contained in the variable `object-b`:
<pre><<object-b>></pre>
<<.operator-example 8 "[<object-b>jsonset[]]" "If only a single blank parameter is specified, no changes are made to the JSON object">>
<<.operator-example 9 "[<object-b>jsonset[],[Antelope]]" "If the property to be set is blank, the entire JSON object is replaced">>
<<.operator-example 10 "[<object-b>jsonset:number[],[not a number]]" "invalid numbers are interpreted as zero">>
<<.operator-example 11 "[<object-b>jsonset[id],[Antelope]]" "nonexistent top level properties are added to the object">>
<<.operator-example 19 "[<object-b>jsonset[missing],[id],[Antelope]]" "nonexistent nested properties are are ignored">>
<<.operator-example 12 "[<object-b>jsonset:notatype[id],[Antelope]]" "invalid type suffix is interpreted as the default string type">>
<<.operator-example 13 "[<object-b>jsonset:boolean[id],[false]]">>
<<.operator-example 14 "[<object-b>jsonset:boolean[id],[Antelope]]" "invalid boolean value causes no assignment to be made">>
<<.operator-example 15 "[<object-b>jsonset:number[id],[42]]">>
<<.operator-example 16 "[<object-b>jsonset:null[id]]">>
<<.operator-example 17 "[<object-b>jsonset:array[d],[f],[5]]">>
<<.operator-example 18 "[<object-b>jsonset:object[d],[f],[5]]">>
<<.operator-example 20 "[<object-a>] [<object-b>] :and[jsonset[b],[two]]" "If the input consists of multiple JSON objects with matching properties, the value is set for all of them">>

View File

@ -1,22 +1,31 @@
caption: jsonset
created: 20230915121010948 created: 20230915121010948
modified: 20230915121010948 modified: 20231204115203428
op-input: a selection of JSON objects
op-output: the JSON objects with the specified value assigned to the specified property
op-parameter: one or more indexes of the property to modify, if applicable followed by the value to be assigned
op-purpose: set the value of a property in JSON objects
op-suffix: data type of the value to be assigned to the property
tags: [[Filter Operators]] [[JSON Operators]] tags: [[Filter Operators]] [[JSON Operators]]
title: jsonset Operator title: jsonset Operator
caption: jsonset
op-purpose: set the value of a property in JSON strings
op-input: a selection of JSON strings
op-parameter: one or more indexes of the property to retrieve and sometimes a value to assign
op-output: the JSON strings with the specified property assigned
<<.from-version "5.3.2">> See [[JSON in TiddlyWiki]] for background. <<.from-version "5.3.2">> The <<.op jsonset>> operator is used to set a property value in JSON strings. See [[JSON in TiddlyWiki]] for background. See also the following related operators:
The <<.op jsonset>> operator is used to set a property value in JSON strings. See also the following related operators:
* <<.olink jsonget>> to retrieve the values of a property in JSON data * <<.olink jsonget>> to retrieve the values of a property in JSON data
* <<.olink jsontype>> to retrieve the type of a JSON value * <<.olink jsontype>> to retrieve the type of a JSON value
* <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array * <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array
* <<.olink jsonextract>> to retrieve a JSON value as a string of JSON * <<.olink jsonextract>> to retrieve a JSON value as a string of JSON
The type of the value to be assigned to the property can be optionally specified with a suffix:
* ''string'': default, the string is specified as the final operand
* ''boolean'': the boolean value is true if the final operand is the string "true" and false if the final operand is the string "false", any other value for the final string results prevents the property from being assigned
* ''number'': the numeric value is taken from the final operand, invalid numbers are interpreted as zero
* ''json'': the JSON string value is taken from the final operand, invalid JSON prevents the property from being assigned
* ''object'': an empty object is assigned to the property, the final operand is ignored
* ''array'': an empty array is assigned to the property, the final operand is ignored
* ''null'': the special value null is assigned to the property, the final operand is ignored
Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`. Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`.
``` ```
@ -42,63 +51,14 @@ Properties within a JSON object are identified by a sequence of indexes. In the
} }
``` ```
The following examples assume that this JSON data is contained in a variable called `jsondata`. The <<.op jsonset>> operator uses multiple parameters to specify the indexes of the property to set. When used to assign strings (default behaviour if no suffix is specified) the final operand is interpreted as the value to assign.
The <<.op jsonset>> operator uses multiple operands to specify the indexes of the property to set. When used to assign strings the final operand is interpreted as the value to assign. For example: Negative indexes are counted from the end, so -1 means the last item, -2 the next-to-last item, and so on.
``` Indexes can be dynamically composed from variables and transclusions, e.g. `[<jsondata>jsonset<variable>,{!!field},[0],{CurrentResult}]`.
[<jsondata>jsonset[d],[Jaguar]] --> {"a": "one","b": "","c": "three","d": "Jaguar"}
[<jsondata>jsonset[d],[f],[Panther]] --> {"a": "one","b": "","c": "three","d": "{"e": "four","f": "Panther","g": {"x": "max","y": "may","z": "maize"}}"}
```
Negative indexes into an array are counted from the end, so -1 means the last item, -2 the next-to-last item, and so on: In the special case where only a single parameter is defined, the operator replaces the entire input object with the the value of that parameter. If the single parameter is blank, the operation is ignored and no assignment takes place.
``` If the input consists of multiple JSON objects with matching properties, the value is set for all of them.
[<jsondata>jsonset[d],[f],[-1],[Elephant]] --> {"a": "one","b": "","c": "three","d": "{"e": "four","f": ["five","six",true,false,"Elephant"],"g": {"x": "max","y": "may","z": "maize"}}"}
[<jsondata>jsonset[d],[f],[-2],[Elephant]] --> {"a": "one","b": "","c": "three","d": "{"e": "four","f": ["five","six",true,"Elephant",null],"g": {"x": "max","y": "may","z": "maize"}}"}
[<jsondata>jsonset[d],[f],[-4],[Elephant]] --> {"a": "one","b": "","c": "three","d": "{"e": "four","f": ["five","Elephant",true,false,null],"g": {"x": "max","y": "may","z": "maize"}}"}
```
Indexes can be dynamically composed from variables and transclusions: <<.operator-examples "jsonset">>
```
[<jsondata>jsonset<variable>,{!!field},[0],{CurrentResult}]
```
The data type of the value to be assigned to the property can be specified with an optional suffix:
|!Suffix |!Description |
|''string'' |The string is specified as the final operand |
|''boolean'' |The boolean value is true if the final operand is the string "true" and false if the final operand is the string "false". Any other value for the final string results prevents the property from being assigned |
|''number'' |The numeric value is taken from the final operand. Invalid numbers are interpreted as zero |
|''json'' |The JSON string value is taken from the final operand. Invalid JSON prevents the property from being assigned |
|''object'' |An empty object is assigned to the property. The final operand is not used as a value |
|''array'' |An empty array is assigned to the property. The final operand is not used as a value |
|''null'' |The special value null is assigned to the property. The final operand is not used as a value |
For example:
```
Input string:
{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}
[jsonset[]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}
[jsonset[],[Antelope]] --> "Antelope"
[jsonset:number[],[not a number]] --> 0
[jsonset[id],[Antelope]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":"Antelope"}
[jsonset:notatype[id],[Antelope]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":"Antelope"}
[jsonset:boolean[id],[false]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":false}
[jsonset:boolean[id],[Antelope]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}
[jsonset:number[id],[42]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":42}
[jsonset:null[id]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":null}
[jsonset:array[d],[f],[5]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null,[]]}}
[jsonset:object[d],[f],[5]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null,{}]}}
[jsonset[missing],[id],[Antelope]] --> {"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}
```
A subtlety is that the special case of a single operand sets the value of that operand as the new JSON string, entirely replacing the input object. If that operand is blank, the operation is ignored and no assignment takes place. Thus:
```
[<jsondata>jsonset[Panther]] --> "Panther"
[<jsondata>jsonset[]] --> {"a": "one","b": "","c": "three","d": "{"e": "four","f": ["five", "six", true, false, null],"g": {"x": "max","y": "may","z": "maize"}}"}
```

View File

@ -1,6 +1,6 @@
caption: browse caption: browse
created: 20131024141900000 created: 20131024141900000
modified: 20200421221304177 modified: 20231113093304323
tags: Widgets tags: Widgets
title: BrowseWidget title: BrowseWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -20,6 +20,8 @@ The content of the <<.wid BrowseWidget>> widget is ignored.
|accept |<<.from-version "5.1.23">> Optional comma delimited [[list of file accepted extensions|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers]] and/or MIME types | |accept |<<.from-version "5.1.23">> Optional comma delimited [[list of file accepted extensions|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers]] and/or MIME types |
|message |Optional override of widget message to be generated. The files will be passed in the JavaScript object `event.target.files` | |message |Optional override of widget message to be generated. The files will be passed in the JavaScript object `event.target.files` |
|param |Optional parameter to be passed with the custom message | |param |Optional parameter to be passed with the custom message |
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML element |
On iPhone/iPad choosing the multiple option will remove the ability to take photographs/videos directly into TiddlyWiki. On iPhone/iPad choosing the multiple option will remove the ability to take photographs/videos directly into TiddlyWiki.

View File

@ -1,6 +1,6 @@
caption: button caption: button
created: 20131024141900000 created: 20131024141900000
modified: 20220810192251345 modified: 20231113093304323
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: ButtonWidget title: ButtonWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -41,6 +41,8 @@ The content of the `<$button>` widget is displayed within the button.
|aria-label |Optional [[Accessibility]] label | |aria-label |Optional [[Accessibility]] label |
|tooltip |Optional tooltip | |tooltip |Optional tooltip |
|class |An optional CSS class name to be assigned to the HTML element| |class |An optional CSS class name to be assigned to the HTML element|
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML element |
|style |An optional CSS style attribute to be assigned to the HTML element | |style |An optional CSS style attribute to be assigned to the HTML element |
|tag |An optional html tag to use instead of the default "button" | |tag |An optional html tag to use instead of the default "button" |
|dragTiddler |An optional tiddler title making the button draggable and identifying the payload tiddler. See DraggableWidget for details | |dragTiddler |An optional tiddler title making the button draggable and identifying the payload tiddler. See DraggableWidget for details |

View File

@ -3,7 +3,7 @@ colors: red orange yellow blue
created: 20131024141900000 created: 20131024141900000
fruits: bananas oranges grapes fruits: bananas oranges grapes
list: [[CheckboxWidget (tag Mode)]] [[CheckboxWidget (field Mode)]] [[CheckboxWidget (listField Mode)]] [[CheckboxWidget (index Mode)]] [[CheckboxWidget (listIndex Mode)]] [[CheckboxWidget (filter Mode)]] [[CheckboxWidget (indeterminate)]] list: [[CheckboxWidget (tag Mode)]] [[CheckboxWidget (field Mode)]] [[CheckboxWidget (listField Mode)]] [[CheckboxWidget (index Mode)]] [[CheckboxWidget (listIndex Mode)]] [[CheckboxWidget (filter Mode)]] [[CheckboxWidget (indeterminate)]]
modified: 20230316192632667 modified: 20231113093304323
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: CheckboxWidget title: CheckboxWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -38,5 +38,7 @@ The content of the `<$checkbox>` widget is displayed within an HTML `<label>` el
|<<.attr uncheckactions>> |<<.from-version "5.1.16">> A string containing ActionWidgets to be triggered when the checkbox is unchecked | |<<.attr uncheckactions>> |<<.from-version "5.1.16">> A string containing ActionWidgets to be triggered when the checkbox is unchecked |
|<<.attr checkactions>> |<<.from-version "5.1.20">> A string containing ActionWidgets to be triggered when the checkbox is checked | |<<.attr checkactions>> |<<.from-version "5.1.20">> A string containing ActionWidgets to be triggered when the checkbox is checked |
|<<.attr disabled>> |<<.from-version "5.1.23">> Optionally disables the checkbox if set to <<.value yes>> (defaults to <<.value no>>)| |<<.attr disabled>> |<<.from-version "5.1.23">> Optionally disables the checkbox if set to <<.value yes>> (defaults to <<.value no>>)|
|<<.attr data-*>> |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML `<input>` element |
|<<.attr style.*>> |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML `<input>` element |
<<.doc-tabs>> <<.doc-tabs>>

View File

@ -1,6 +1,6 @@
caption: draggable caption: draggable
created: 20170406081938627 created: 20170406081938627
modified: 20220715120213777 modified: 20231121101431149
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: DraggableWidget title: DraggableWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -20,10 +20,11 @@ See DragAndDropMechanism for an overview.
|selector|<<.from-version 5.2.2>> Optional CSS Selector to identify a DOM element within the widget that will be used as the drag handle | |selector|<<.from-version 5.2.2>> Optional CSS Selector to identify a DOM element within the widget that will be used as the drag handle |
|class |Optional CSS classes to assign to the DOM element created by the widget. The class `tc-draggable` is added to the the DOM element created by the widget unless the <<.param selector>> attribute is used. The class `tc-dragging` is applied to the DOM element created by the widget while the element is being dragged | |class |Optional CSS classes to assign to the DOM element created by the widget. The class `tc-draggable` is added to the the DOM element created by the widget unless the <<.param selector>> attribute is used. The class `tc-dragging` is applied to the DOM element created by the widget while the element is being dragged |
|enable |<<.from-version 5.2.3>> Optional value "no" to disable the draggable functionality (defaults to "yes") | |enable |<<.from-version 5.2.3>> Optional value "no" to disable the draggable functionality (defaults to "yes") |
|startactions |Optional action string that gets invoked when dragging ''starts'' | |startactions |Optional action string that gets invoked when dragging ''starts'' |
|endactions |Optional action string that gets invoked when dragging ''ends'' | |endactions |Optional action string that gets invoked when dragging ''ends'' |
|dragimagetype |<<.from-version "5.2.0">> Optional type of drag image: `dom` (the default) or `blank` to disable the drag image | |dragimagetype |<<.from-version "5.2.0">> Optional type of drag image: `dom` (the default) or `blank` to disable the drag image |
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML element |
Either or both of the ''tiddler'' and ''filter'' attributes must be specified in order for there to be a payload to drag. Either or both of the ''tiddler'' and ''filter'' attributes must be specified in order for there to be a payload to drag.

View File

@ -1,6 +1,6 @@
caption: droppable caption: droppable
created: 20170406082820317 created: 20170406082820317
modified: 20211009122023265 modified: 20231121101447359
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: DroppableWidget title: DroppableWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -31,6 +31,8 @@ See DragAndDropMechanism for an overview.
|class |Optional CSS classes to assign to the draggable element. The class `tc-droppable` is added automatically, and the class `tc-dragover` is applied while an item is being dragged over the droppable element | |class |Optional CSS classes to assign to the draggable element. The class `tc-droppable` is added automatically, and the class `tc-dragover` is applied while an item is being dragged over the droppable element |
|tag |Optional tag to override the default of a "div" element when the widget is rendered in block mode, or a "span" element when it is rendered in inline mode | |tag |Optional tag to override the default of a "div" element when the widget is rendered in block mode, or a "span" element when it is rendered in inline mode |
|enable |<<.from-version "5.1.22">> Optional value "no" to disable the droppable functionality (defaults to "yes") | |enable |<<.from-version "5.1.22">> Optional value "no" to disable the droppable functionality (defaults to "yes") |
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML element |
Within the action string, there are two Variables generated by the DroppableWidget: Within the action string, there are two Variables generated by the DroppableWidget:

View File

@ -1,6 +1,6 @@
caption: link caption: link
created: 20131024141900000 created: 20131024141900000
modified: 20190610195105615 modified: 20231113093304323
tags: Widgets tags: Widgets
title: LinkWidget title: LinkWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -23,6 +23,8 @@ The content of the link widget is rendered within the `<a>` tag representing the
|tag |Optional tag to override the default "a" element | |tag |Optional tag to override the default "a" element |
|class|Optional CSS classes //in addition to// the default classes (see below)| |class|Optional CSS classes //in addition to// the default classes (see below)|
|overrideClass|<<.from-version "5.1.16">> Optional CSS classes //instead of// the default classes | |overrideClass|<<.from-version "5.1.16">> Optional CSS classes //instead of// the default classes |
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML element |
The draggable functionality is equivalent to using the DraggableWidget with the ''tiddler'' attribute set to the link target. The draggable functionality is equivalent to using the DraggableWidget with the ''tiddler'' attribute set to the link target.

View File

@ -84,6 +84,7 @@ The action of the list widget depends on the results of the filter combined with
|limit |<<.from-version "5.3.2">> Optional numeric limit for the number of results that are returned. Negative values will return the results from the end of the list | |limit |<<.from-version "5.3.2">> Optional numeric limit for the number of results that are returned. Negative values will return the results from the end of the list |
|template |The title of a template tiddler for transcluding each tiddler in the list. When no template is specified, the body of the ListWidget serves as the item template. With no body, a simple link to the tiddler is returned. | |template |The title of a template tiddler for transcluding each tiddler in the list. When no template is specified, the body of the ListWidget serves as the item template. With no body, a simple link to the tiddler is returned. |
|editTemplate |An alternative template to use for [[DraftTiddlers|DraftMechanism]] in edit mode | |editTemplate |An alternative template to use for [[DraftTiddlers|DraftMechanism]] in edit mode |
|join |<<.from-version "5.3.2">> Text to include between each list item |
|variable |The name for a [[variable|Variables]] in which the title of each listed tiddler is stored. Defaults to ''currentTiddler'' | |variable |The name for a [[variable|Variables]] in which the title of each listed tiddler is stored. Defaults to ''currentTiddler'' |
|counter |<<.from-version "5.2.0">> Optional name for a [[variable|Variables]] in which the 1-based numeric index of each listed tiddler is stored (see below) | |counter |<<.from-version "5.2.0">> Optional name for a [[variable|Variables]] in which the 1-based numeric index of each listed tiddler is stored (see below) |
|emptyMessage |Message to be displayed when the list is empty | |emptyMessage |Message to be displayed when the list is empty |
@ -120,10 +121,29 @@ Displays as:
</$list> </$list>
<<< <<<
Note that using the `counter` attribute can reduce performance when working with list items that dynamically reorder or update themselves. The best advice is only to use it when it is really necessary: to obtain a numeric index, or to detect the first or last entries in the list. Note that using the `counter` attribute can reduce performance when working with list items that dynamically reorder or update themselves. The best advice is only to use it when it is really necessary: to obtain a numeric index, or to detect the first or last entries in the list. Note that if you are only using it to insert something (like a comma) between list items, the `join` attribute performs much better and you should use it instead of `counter`.
Setting `counter="transclusion"` is a handy way to make child elements for each list element be identified as unique. A common use case are multiple [[tag macros|tag Macro]] for the same tag generated by a list widget. Refer to [[tag macro examples|tag Macro (Examples)]] for more details. Setting `counter="transclusion"` is a handy way to make child elements for each list element be identified as unique. A common use case are multiple [[tag macros|tag Macro]] for the same tag generated by a list widget. Refer to [[tag macro examples|tag Macro (Examples)]] for more details.
!! `join` attribute
<<.from-version "5.3.2">> The optional `join` attribute allow you to insert some [[WikiText]] between each list item without needing to use the `counter` attribute, which can become quite slow if the list is updated frequently.
<<.from-version "5.3.2">> If the widget `<$list-join>` is found as an immediate child of the <<.wid "ListWidget">> widget then the content of that widget is used as the "join" template, included between two list items. Note that the <<.attr "join">> attribute takes precedence if it is present.
For example:
```
<$list filter="[tag[About]sort[title]]" join=", " variable="item"><<item>></$list>
```
Displays as:
<<<
<$list filter="[tag[About]sort[title]]" join=", " variable="item"><<item>></$list>
<<<
!! Edit mode !! Edit mode
The `<$list>` widget can optionally render draft tiddlers through a different template to handle editing, see DraftMechanism. The `<$list>` widget can optionally render draft tiddlers through a different template to handle editing, see DraftMechanism.

View File

@ -1,6 +1,6 @@
caption: radio caption: radio
created: 20131212195353929 created: 20131212195353929
modified: 20211009121654734 modified: 20231113093304323
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: RadioWidget title: RadioWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -22,6 +22,8 @@ The content of the `<$radio>` widget is displayed within an HTML `<label>` eleme
|class |The CSS classes assigned to the label around the radio button <<.from-version "5.1.14">> `tc-radio` is always applied by default, as well as `tc-radio-selected` when selected | |class |The CSS classes assigned to the label around the radio button <<.from-version "5.1.14">> `tc-radio` is always applied by default, as well as `tc-radio-selected` when selected |
|actions|<<.from-version "5.1.23">> Optional string containing ActionWidgets to be triggered when the value changes. <br>The variable: ''actionValue'' is available for the actions | |actions|<<.from-version "5.1.23">> Optional string containing ActionWidgets to be triggered when the value changes. <br>The variable: ''actionValue'' is available for the actions |
|disabled|<<.from-version "5.1.23">> Optional. Set to "yes" to disable the radio input. Defaults to "no" | |disabled|<<.from-version "5.1.23">> Optional. Set to "yes" to disable the radio input. Defaults to "no" |
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the `<input>` HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the `<input>` HTML element |
!! Field Mode !! Field Mode

View File

@ -1,6 +1,6 @@
caption: range caption: range
created: 20171102134825376 created: 20171102134825376
modified: 20211009121606405 modified: 20231113093304323
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: RangeWidget title: RangeWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -26,6 +26,8 @@ The content of the `<$range>` widget is ignored.
|actionsStart|<<.from-version "5.1.23">> Optional, A string containing ~ActionWidgets to be triggered when the "handle" is ''clicked''. <br>The variable: ''actionValueHasChanged'' is always `no` here| |actionsStart|<<.from-version "5.1.23">> Optional, A string containing ~ActionWidgets to be triggered when the "handle" is ''clicked''. <br>The variable: ''actionValueHasChanged'' is always `no` here|
|actionsStop|<<.from-version "5.1.23">> Optional, A string containing ~ActionWidgets to be triggered when the "handle" is ''released''. <br>The variable: ''actionValueHasChanged'' is `yes`, ''if'' the new-value is different to the start-value | |actionsStop|<<.from-version "5.1.23">> Optional, A string containing ~ActionWidgets to be triggered when the "handle" is ''released''. <br>The variable: ''actionValueHasChanged'' is `yes`, ''if'' the new-value is different to the start-value |
|disabled|<<.from-version "5.1.23">> Optional, disables the range input if set to "yes". Defaults to "no"| |disabled|<<.from-version "5.1.23">> Optional, disables the range input if set to "yes". Defaults to "no"|
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the `<input>` HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the `<input>` HTML element |
! Examples ! Examples

View File

@ -18,7 +18,7 @@ The content of the `<$scrollable>` widget is displayed within a pair of wrapper
|fallthrough |See below | |fallthrough |See below |
|bind |<<.from-version "5.3.2">> Optional title of tiddler to which the scroll position should be bound | |bind |<<.from-version "5.3.2">> Optional title of tiddler to which the scroll position should be bound |
Binding the scroll position to a tiddler automatically copies the scroll coordinates into the `scroll-left` and `scroll-top` fields as scrolling occurs. Conversely, setting those field values will automatically cause the scrollable to scroll if it can. Binding the scroll position to a tiddler automatically copies the scroll coordinates into the `scroll-left` and `scroll-top` fields after scrolling occurs. Conversely, setting those field values will automatically cause the scrollable to scroll if it can.
<$macrocall $name=".note" _="""If a scrollable widget can't handle the `tm-scroll` message because the inner DIV fits within the outer DIV, then by default the message falls through to the parent widget. Setting the ''fallthrough'' attribute to `no` prevents this behaviour."""/> <$macrocall $name=".note" _="""If a scrollable widget can't handle the `tm-scroll` message because the inner DIV fits within the outer DIV, then by default the message falls through to the parent widget. Setting the ''fallthrough'' attribute to `no` prevents this behaviour."""/>

View File

@ -1,6 +1,6 @@
caption: select caption: select
created: 20131024141900000 created: 20131024141900000
modified: 20211108165037846 modified: 20231113093304323
tags: TriggeringWidgets Widgets tags: TriggeringWidgets Widgets
title: SelectWidget title: SelectWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -42,6 +42,9 @@ The content of the `<$select>` widget should be one or more HTML `<option>` or `
|actions |A string containing ActionWidgets to be triggered when the key combination is detected | |actions |A string containing ActionWidgets to be triggered when the key combination is detected |
|focus |<<.from-version "5.2.4">> Optional. Set to "yes" to automatically focus the HTML select element after creation | |focus |<<.from-version "5.2.4">> Optional. Set to "yes" to automatically focus the HTML select element after creation |
|tabindex |<<.from-version "5.3.1">> Optional. Sets the `tabindex` attribute of the HTML select element to the given value | |tabindex |<<.from-version "5.3.1">> Optional. Sets the `tabindex` attribute of the HTML select element to the given value |
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the HTML element |
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the HTML element |
! Examples ! Examples
!! Simple Lists !! Simple Lists

View File

@ -4,12 +4,14 @@ tags: WikiText
title: Conditional Shortcut Syntax title: Conditional Shortcut Syntax
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
<<.from-version "5.3.2">> The conditional shortcut syntax provides a convenient way to express if-then-else logic within WikiText. It evaluates a filter and considers the condition to be true if there is at least one result (regardless of the value of that result). <<.from-version "5.3.2">> The conditional shortcut syntax provides a convenient way to express if-then-else logic within WikiText. It evaluates a [[filter expression|Filter Expression]] and considers the condition to be true if there is at least one result (regardless of the value of that result).
Within an "if" or "elseif" clause, the variable `condition` contains the value of the first result of evaluating the filter condition.
A simple example: A simple example:
<$macrocall $name='wikitext-example-without-html' <$macrocall $name='wikitext-example-without-html'
src='<% if [{$:/$:/info/url/protocol}match[file:]] %> src='<% if [{$:/info/url/protocol}match[file:]] %>
Loaded from a file URI Loaded from a file URI
<% else %> <% else %>
Not loaded from a file URI Not loaded from a file URI
@ -19,11 +21,11 @@ src='<% if [{$:/$:/info/url/protocol}match[file:]] %>
One or more `<% elseif %>` clauses may be included before the `<% else %>` clause: One or more `<% elseif %>` clauses may be included before the `<% else %>` clause:
<$macrocall $name='wikitext-example-without-html' <$macrocall $name='wikitext-example-without-html'
src='<% if [{$:/$:/info/url/protocol}match[file:]] %> src='<% if [{$:/info/url/protocol}match[file:]] %>
Loaded from a file URI Loaded from a file URI
<% elseif [{$:/$:/info/url/protocol}match[https:]] %> <% elseif [{$:/info/url/protocol}match[https:]] %>
Loaded from an HTTPS URI Loaded from an HTTPS URI
<% elseif [{$:/$:/info/url/protocol}match[http:]] %> <% elseif [{$:/info/url/protocol}match[http:]] %>
Loaded from an HTTP URI Loaded from an HTTP URI
<% else %> <% else %>
Loaded from an unknown protocol Loaded from an unknown protocol
@ -55,7 +57,6 @@ src='\procedure test(animal)
Notes: Notes:
* Clauses are parsed in inline mode by default. Force block mode parsing by following the opening `<% if %>`, `<% elseif %>` or `<% else %>` with two line breaks * Clauses are parsed in inline mode by default. Force block mode parsing by following the opening `<% if %>`, `<% elseif %>` or `<% else %>` with two line breaks
* Within an "if" or "elseif" clause, the variable `condition` contains the value of the first result of evaluating the filter condition
* Widgets and HTML elements must be within a single conditional clause; it is not possible to start an element in one conditional clause and end it in another * Widgets and HTML elements must be within a single conditional clause; it is not possible to start an element in one conditional clause and end it in another
* The conditional shortcut syntax cannot contain pragmas such as procedure definitions * The conditional shortcut syntax cannot contain pragmas such as procedure definitions

View File

@ -3,4 +3,4 @@ title: $:/language/Exporters/
StaticRiver: HTML - Statisch StaticRiver: HTML - Statisch
JsonFile: JSON - Format JsonFile: JSON - Format
CsvFile: CSV - Format CsvFile: CSV - Format
TidFile: .tid - Format TidFile: TID - Text Format

View File

@ -1,7 +1,7 @@
title: $:/language/Help/commands title: $:/language/Help/commands
description: Ausführen von Befehlen aus einem Tiddler description: Ausführen von Befehlen aus einem Tiddler
Sequentielle Abarbeitung von Befehlen aus einem Tiddler. Sequentielle Abarbeitung von Befehlen aus einem Tiddler.
``` ```
--commands <filter> --commands <filter>
@ -9,6 +9,6 @@ Sequentielle Abarbeitung von Befehlen aus einem Tiddler.
Beispiele Beispiele
`--commands "[enlist{$:/build-commands-as-text}]"` `--commands "[enlist:raw{$:/build-commands-as-text}]"`
`--commands "[{$:/build-commands-as-json}jsonindexes[]] :map[{$:/build-commands-as-json}jsonget<currentTiddler>]"` `--commands "[{$:/build-commands-as-json}jsonindexes[]] :map[{$:/build-commands-as-json}jsonget<currentTiddler>]"`

View File

@ -1,5 +1,5 @@
title: $:/language/Help/server title: $:/language/Help/server
description: Stellt einen HTTP server für TiddlyWiki zur Verfügung. (Dieser Befehl ist abgekündigt! - Neu ist: "listen") description: (Dieser Befehl ist abgekündigt! - Neu ist: "listen") -- Stellt einen HTTP server für TiddlyWiki zur Verfügung.
TiddlyWiki bringt einen einfachen Web-Server mit. TiddlyWiki bringt einen einfachen Web-Server mit.

View File

@ -1,4 +1,4 @@
title: $:/language/Docs/Types/image/x-icon title: $:/language/Docs/Types/image/x-icon
description: ICO - Piktogramm Format description: ICO - Piktogramm (Icon)
name: image/x-icon name: image/x-icon
group: Bilder group: Bilder

View File

@ -10,7 +10,7 @@ Uruchamia komendy zwrócone przez filtr.
Dla przykładu: Dla przykładu:
``` ```
--commands "[enlist{$:/build-commands-as-text}]" --commands "[enlist:raw{$:/build-commands-as-text}]"
``` ```
``` ```

View File

@ -10,7 +10,7 @@ description: 运行从筛选器传回的命令
示例 示例
``` ```
--commands "[enlist{$:/build-commands-as-text}]" --commands "[enlist:raw{$:/build-commands-as-text}]"
``` ```
``` ```

View File

@ -10,7 +10,7 @@ description: 執行從篩選器傳回的命令
範例 範例
``` ```
--commands "[enlist{$:/build-commands-as-text}]" --commands "[enlist:raw{$:/build-commands-as-text}]"
``` ```
``` ```

View File

@ -55,7 +55,7 @@ describe("Wiki-based tests", function() {
}); });
function readMultipleTiddlersTiddler(title) { function readMultipleTiddlersTiddler(title) {
var rawTiddlers = $tw.wiki.getTiddlerText(title).split("\n+\n"); var rawTiddlers = $tw.wiki.getTiddlerText(title).split(/\r?\n\+\r?\n/mg);
var tiddlers = []; var tiddlers = [];
$tw.utils.each(rawTiddlers,function(rawTiddler) { $tw.utils.each(rawTiddlers,function(rawTiddler) {
var fields = Object.create(null), var fields = Object.create(null),

View File

@ -1,4 +1,3 @@
title: $:/core/templates/html-json-skinny-tiddler title: $:/core/templates/html-json-skinny-tiddler
<$list filter="[<numTiddlers>compare:number:gteq[1]] ~[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list>
<$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes" $revision=<<changecount>> $bag="default" $_is_skinny=""/> <$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes" $revision=<<changecount>> $bag="default" $_is_skinny=""/>

View File

@ -1,4 +1,3 @@
title: $:/core/templates/html-json-tiddler title: $:/core/templates/html-json-tiddler
<$list filter="[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list> <$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes" $revision=<<changecount>> $bag="default"/>
<$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes" $revision=<<changecount>> $bag="default">/>

View File

@ -44,7 +44,7 @@ Make sure that you keep a safe copy of your previous ~TiddlyWiki file.
Close this browser window to prevent others from being able to access your data. Close this browser window to prevent others from being able to access your data.
For help and support, visit [[the TiddlyWiki discussion forum|http://groups.google.com/group/TiddlyWiki]]. For help and support, visit [[the TiddlyWiki discussion forum|https://talk.tiddlywiki.org]].
</$reveal> </$reveal>