mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-22 19:04:38 +00:00
Compare commits
1 Commits
confetti-p
...
fail-ci-in
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fe17993dc |
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -60,7 +60,6 @@ jobs:
|
||||
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||
TW5_BUILD_OUTPUT: "./output"
|
||||
TW5_BUILD_ARCHIVE: "./output"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Default to the current version number for building the plugin library
|
||||
|
||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||
TW5_BUILD_VERSION=v5.3.3
|
||||
TW5_BUILD_VERSION=v5.3.2
|
||||
fi
|
||||
|
||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||
@@ -84,27 +84,10 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
|
||||
|
||||
######################################################
|
||||
#
|
||||
# Core distributions
|
||||
# Core distribution
|
||||
#
|
||||
######################################################
|
||||
|
||||
# Conditionally build archive if $TW5_BUILD_ARCHIVE variable is set, otherwise do nothing
|
||||
#
|
||||
# /archive/Empty-TiddlyWiki-<version>.html Empty archived version
|
||||
# /archive/TiddlyWiki-<version>.html Full archived version
|
||||
|
||||
if [ -n "$TW5_BUILD_ARCHIVE" ]; then
|
||||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
$TW5_BUILD_MAIN_EDITION \
|
||||
--verbose \
|
||||
--version \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_ARCHIVE \
|
||||
--build archive \
|
||||
|| exit 1
|
||||
fi
|
||||
|
||||
# /index.html Main site
|
||||
# /favicon.ico Favicon for main site
|
||||
# /static.html Static rendering of default tiddlers
|
||||
@@ -112,7 +95,6 @@ fi
|
||||
# /static/* Static single tiddlers
|
||||
# /static/static.css Static stylesheet
|
||||
# /static/favicon.ico Favicon for static pages
|
||||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
$TW5_BUILD_MAIN_EDITION \
|
||||
--verbose \
|
||||
@@ -156,28 +138,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
||||
--build index favicon static \
|
||||
|| exit 1
|
||||
|
||||
# /tour.html tour edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/tour \
|
||||
--verbose \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all tour.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /dev/index.html Developer docs
|
||||
# /dev/favicon.ico Favicon for dev site
|
||||
# /dev/static.html Static rendering of default tiddlers
|
||||
# /dev/alltiddlers.html Static rendering of all tiddlers
|
||||
# /dev/static/* Static single tiddlers
|
||||
# /dev/static/static.css Static stylesheet
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/dev \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/dev \
|
||||
--build index favicon static \
|
||||
|| exit 1
|
||||
|
||||
# /share.html Custom edition for sharing via the URL
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/share \
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
# test TiddlyWiki5 for tiddlywiki.com
|
||||
|
||||
npm install playwright @playwright/test
|
||||
npx playwright install chromium firefox --with-deps
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
./editions/test \
|
||||
--verbose \
|
||||
@@ -10,7 +13,4 @@ node ./tiddlywiki.js \
|
||||
--test \
|
||||
|| exit 1
|
||||
|
||||
npm install playwright @playwright/test
|
||||
npx playwright install chromium firefox --with-deps
|
||||
|
||||
npx playwright test
|
||||
|
||||
@@ -4,7 +4,7 @@ type: text/plain
|
||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||
|
||||
Copyright (c) 2004-2007, Jeremy Ruston
|
||||
Copyright (c) 2007-2024, UnaMesa Association
|
||||
Copyright (c) 2007-2023, UnaMesa Association
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,6 @@ _canonical_uri: The full URI of an external image tiddler
|
||||
author: Name of the author of a plugin
|
||||
bag: The name of the bag from which a tiddler came
|
||||
caption: The text to be displayed on a tab or button
|
||||
class: The CSS class applied to a tiddler when rendering it - see [[Custom styles by user-class]]. Also used for [[Modals]]
|
||||
code-body: The view template will display the tiddler as code if set to ''yes''
|
||||
color: The CSS color value associated with a tiddler
|
||||
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
||||
|
||||
@@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
|
||||
Examples
|
||||
|
||||
```
|
||||
--commands "[enlist:raw{$:/build-commands-as-text}]"
|
||||
--commands "[enlist{$:/build-commands-as-text}]"
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
@@ -46,7 +46,7 @@ Command.prototype.execute = function() {
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
||||
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
|
||||
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -213,18 +213,6 @@ function getDataItemType(data,indexes) {
|
||||
}
|
||||
}
|
||||
|
||||
function getItemAtIndex(item,index) {
|
||||
if($tw.utils.hop(item,index)) {
|
||||
return item[index];
|
||||
} else if($tw.utils.isArray(item)) {
|
||||
index = $tw.utils.parseInt(index);
|
||||
if(index < 0) { index = index + item.length };
|
||||
return item[index]; // Will be undefined if index was out-of-bounds
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Given a JSON data structure and an array of index strings, return the value at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||
*/
|
||||
@@ -237,7 +225,7 @@ function getDataItem(data,indexes) {
|
||||
for(var i=0; i<indexes.length; i++) {
|
||||
if(item !== undefined) {
|
||||
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
||||
item = getItemAtIndex(item,indexes[i]);
|
||||
item = item[indexes[i]];
|
||||
} else {
|
||||
item = undefined;
|
||||
}
|
||||
@@ -261,22 +249,17 @@ function setDataItem(data,indexes,value) {
|
||||
// Traverse the JSON data structure using the index chain
|
||||
var current = data;
|
||||
for(var i = 0; i < indexes.length - 1; i++) {
|
||||
current = getItemAtIndex(current,indexes[i]);
|
||||
if(current === undefined) {
|
||||
var index = indexes[i];
|
||||
if($tw.utils.hop(current,index)) {
|
||||
current = current[index];
|
||||
} else {
|
||||
// Return the original JSON data structure if any of the index strings are invalid
|
||||
return data;
|
||||
}
|
||||
}
|
||||
// Add the value to the end of the index chain
|
||||
var lastIndex = indexes[indexes.length - 1];
|
||||
if($tw.utils.isArray(current)) {
|
||||
lastIndex = $tw.utils.parseInt(lastIndex);
|
||||
if(lastIndex < 0) { lastIndex = lastIndex + current.length };
|
||||
}
|
||||
// Only set indexes on objects and arrays
|
||||
if(typeof current === "object") {
|
||||
current[lastIndex] = value;
|
||||
}
|
||||
current[lastIndex] = value;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ exports.tag = function(source,operator,options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
return $tw.browser ? results.reverse() : results;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -14,12 +14,10 @@ The plain text parser processes blocks of source text into a degenerate parse tr
|
||||
|
||||
var TextParser = function(type,text,options) {
|
||||
this.tree = [{
|
||||
type: "genesis",
|
||||
type: "codeblock",
|
||||
attributes: {
|
||||
$type: {name: "$type", type: "string", value: "$codeblock"},
|
||||
code: {name: "code", type: "string", value: text},
|
||||
language: {name: "language", type: "string", value: type},
|
||||
$remappable: {name: "$remappable", type:"string", value: "no"}
|
||||
code: {type: "string", value: text},
|
||||
language: {type: "string", value: type}
|
||||
}
|
||||
}];
|
||||
this.source = text;
|
||||
@@ -34,3 +32,4 @@ exports["text/css"] = TextParser;
|
||||
exports["application/x-tiddler-dictionary"] = TextParser;
|
||||
|
||||
})();
|
||||
|
||||
|
||||
@@ -49,11 +49,11 @@ exports.parse = function() {
|
||||
if(this.match[3]) {
|
||||
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
||||
}
|
||||
// Is the remainder of the line blank after the parameter close paren?
|
||||
// Is this a multiline definition?
|
||||
var reEnd;
|
||||
if(this.match[5]) {
|
||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
||||
reEnd = new RegExp("((:?^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||
// If so, the end of the body is marked with \end
|
||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||
} else {
|
||||
// Otherwise, the end of the definition is marked by the end of the line
|
||||
reEnd = /($|\r?\n)/mg;
|
||||
|
||||
@@ -54,11 +54,11 @@ exports.parse = function() {
|
||||
paramMatch = reParam.exec(paramString);
|
||||
}
|
||||
}
|
||||
// Is the remainder of the \define line blank after the parameter close paren?
|
||||
// Is this a multiline definition?
|
||||
var reEnd;
|
||||
if(this.match[3]) {
|
||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
||||
reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||
// If so, the end of the body is marked with \end
|
||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||
} else {
|
||||
// Otherwise, the end of the definition is marked by the end of the line
|
||||
reEnd = /($|\r?\n)/mg;
|
||||
|
||||
@@ -81,6 +81,9 @@ exports.parse = function() {
|
||||
}
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
// No template or text reference is provided, so we'll use a blank target. Otherwise we'll generate
|
||||
// a transclude widget that transcludes the current tiddler, often leading to recursion errors
|
||||
transcludeNode.attributes["$tiddler"] = {name: "$tiddler", type: "string", value: ""};
|
||||
return [transcludeNode];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,9 @@ exports.parse = function() {
|
||||
}
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
// No template or text reference is provided, so we'll use a blank target. Otherwise we'll generate
|
||||
// a transclude widget that transcludes the current tiddler, often leading to recursion errors
|
||||
transcludeNode.attributes["$tiddler"] = {name: "$tiddler", type: "string", value: ""};
|
||||
return [transcludeNode];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,6 @@ Parse any pragmas at the beginning of a block of parse text
|
||||
WikiParser.prototype.parsePragmas = function() {
|
||||
var currentTreeBranch = this.tree;
|
||||
while(true) {
|
||||
var savedPos = this.pos;
|
||||
// Skip whitespace
|
||||
this.skipWhitespace();
|
||||
// Check for the end of the text
|
||||
@@ -205,7 +204,6 @@ WikiParser.prototype.parsePragmas = function() {
|
||||
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
||||
// If not, just exit
|
||||
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
||||
this.pos = savedPos;
|
||||
break;
|
||||
}
|
||||
// Process the pragma rule
|
||||
@@ -216,8 +214,6 @@ WikiParser.prototype.parsePragmas = function() {
|
||||
subTree[0].children = [];
|
||||
currentTreeBranch = subTree[0].children;
|
||||
}
|
||||
// Skip whitespace after the pragma
|
||||
this.skipWhitespace();
|
||||
}
|
||||
return currentTreeBranch;
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
|
||||
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
|
||||
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
|
||||
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
|
||||
Syncer.prototype.taskTimerInterval = 0.25 * 1000; // Interval for sync timer
|
||||
Syncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer
|
||||
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.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
|
||||
@@ -74,11 +74,9 @@ function Syncer(options) {
|
||||
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
|
||||
// Timers
|
||||
this.taskTimerId = null; // Timer for task dispatch
|
||||
this.pollTimerId = null; // Timer for polling server
|
||||
// Number of outstanding requests
|
||||
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
|
||||
this.wiki.addEventListener("change",function(changes) {
|
||||
// Filter the changes to just include ones that are being synced
|
||||
@@ -205,37 +203,33 @@ Syncer.prototype.readTiddlerInfo = function() {
|
||||
Checks whether the wiki is dirty (ie the window shouldn't be closed)
|
||||
*/
|
||||
Syncer.prototype.isDirty = function() {
|
||||
var self = this;
|
||||
function checkIsDirty() {
|
||||
// Check tiddlers that are in the store and included in the filter function
|
||||
var titles = self.getSyncedTiddlers();
|
||||
for(var index=0; index<titles.length; index++) {
|
||||
var title = titles[index],
|
||||
tiddlerInfo = self.tiddlerInfo[title];
|
||||
if(self.wiki.tiddlerExists(title)) {
|
||||
if(tiddlerInfo) {
|
||||
// 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
|
||||
this.logger.log("Checking dirty status");
|
||||
// Check tiddlers that are in the store and included in the filter function
|
||||
var titles = this.getSyncedTiddlers();
|
||||
for(var index=0; index<titles.length; index++) {
|
||||
var title = titles[index],
|
||||
tiddlerInfo = this.tiddlerInfo[title];
|
||||
if(this.wiki.tiddlerExists(title)) {
|
||||
if(tiddlerInfo) {
|
||||
// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server
|
||||
if(this.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
} else {
|
||||
// If the tiddler isn't known on the server then it needs to be saved to the server
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var dirtyStatus = checkIsDirty();
|
||||
return dirtyStatus;
|
||||
// Check tiddlers that are known from the server but not currently in the store
|
||||
titles = Object.keys(this.tiddlerInfo);
|
||||
for(index=0; index<titles.length; index++) {
|
||||
if(!this.wiki.tiddlerExists(titles[index])) {
|
||||
// There must be a pending delete
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -299,16 +293,92 @@ 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
|
||||
*/
|
||||
Syncer.prototype.syncFromServer = function() {
|
||||
if(this.canSyncFromServer()) {
|
||||
this.forceSyncFromServer = true;
|
||||
this.processTaskQueue();
|
||||
var self = this,
|
||||
cancelNextSync = function() {
|
||||
if(self.pollTimerId) {
|
||||
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
|
||||
*/
|
||||
@@ -440,7 +510,7 @@ Syncer.prototype.processTaskQueue = function() {
|
||||
} else {
|
||||
self.updateDirtyStatus();
|
||||
// Process the next task
|
||||
self.processTaskQueue.call(self);
|
||||
self.processTaskQueue.call(self);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -448,39 +518,31 @@ Syncer.prototype.processTaskQueue = function() {
|
||||
this.updateDirtyStatus();
|
||||
// And trigger a timeout if there is a pending task
|
||||
if(task === true) {
|
||||
this.triggerTimeout(this.taskTimerInterval);
|
||||
} else if(this.canSyncFromServer()) {
|
||||
this.triggerTimeout(this.pollTimerInterval);
|
||||
this.triggerTimeout();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.updateDirtyStatus();
|
||||
this.triggerTimeout(this.taskTimerInterval);
|
||||
this.updateDirtyStatus();
|
||||
}
|
||||
};
|
||||
|
||||
Syncer.prototype.triggerTimeout = function(interval) {
|
||||
var self = this;
|
||||
if(this.taskTimerId) {
|
||||
clearTimeout(this.taskTimerId);
|
||||
if(!this.taskTimerId) {
|
||||
this.taskTimerId = setTimeout(function() {
|
||||
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 to the server, then getting updates from the server, then deletes to the server, then loads from the server
|
||||
Choose the next sync task. We prioritise saves, then deletes, then loads from the server
|
||||
|
||||
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)
|
||||
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
|
||||
*/
|
||||
Syncer.prototype.chooseNextTask = function() {
|
||||
var now = new Date(),
|
||||
thresholdLastSaved = now - this.throttleInterval,
|
||||
var thresholdLastSaved = (new Date()) - this.throttleInterval,
|
||||
havePending = null;
|
||||
// First we look for tiddlers that have been modified locally and need saving back to the server
|
||||
var titles = this.getSyncedTiddlers();
|
||||
@@ -494,18 +556,14 @@ Syncer.prototype.chooseNextTask = function() {
|
||||
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
||||
if(hasChanged) {
|
||||
if(isReadyToSave) {
|
||||
return new SaveTiddlerTask(this,title);
|
||||
return new SaveTiddlerTask(this,title);
|
||||
} else {
|
||||
havePending = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
// Second, 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);
|
||||
for(index=0; index<titles.length; index++) {
|
||||
title = titles[index];
|
||||
@@ -515,13 +573,13 @@ Syncer.prototype.chooseNextTask = function() {
|
||||
return new DeleteTiddlerTask(this,title);
|
||||
}
|
||||
}
|
||||
// Finally, check for tiddlers that need loading
|
||||
// Check for tiddlers that need loading
|
||||
title = Object.keys(this.titlesToBeLoaded)[0];
|
||||
if(title) {
|
||||
delete this.titlesToBeLoaded[title];
|
||||
return new LoadTiddlerTask(this,title);
|
||||
}
|
||||
// No tasks are ready now, but might be in the future
|
||||
// No tasks are ready
|
||||
return havePending;
|
||||
};
|
||||
|
||||
@@ -531,10 +589,6 @@ function SaveTiddlerTask(syncer,title) {
|
||||
this.type = "save";
|
||||
}
|
||||
|
||||
SaveTiddlerTask.prototype.toString = function() {
|
||||
return "SAVE " + this.title;
|
||||
}
|
||||
|
||||
SaveTiddlerTask.prototype.run = function(callback) {
|
||||
var self = this,
|
||||
changeCount = this.syncer.wiki.getChangeCount(this.title),
|
||||
@@ -559,6 +613,7 @@ SaveTiddlerTask.prototype.run = function(callback) {
|
||||
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
||||
});
|
||||
} else {
|
||||
this.syncer.logger.log(" Not Dispatching 'save' task:",this.title,"tiddler does not exist");
|
||||
$tw.utils.nextTick(callback(null));
|
||||
}
|
||||
};
|
||||
@@ -569,10 +624,6 @@ function DeleteTiddlerTask(syncer,title) {
|
||||
this.type = "delete";
|
||||
}
|
||||
|
||||
DeleteTiddlerTask.prototype.toString = function() {
|
||||
return "DELETE " + this.title;
|
||||
}
|
||||
|
||||
DeleteTiddlerTask.prototype.run = function(callback) {
|
||||
var self = this;
|
||||
this.syncer.logger.log("Dispatching 'delete' task:",this.title);
|
||||
@@ -596,10 +647,6 @@ function LoadTiddlerTask(syncer,title) {
|
||||
this.type = "load";
|
||||
}
|
||||
|
||||
LoadTiddlerTask.prototype.toString = function() {
|
||||
return "LOAD " + this.title;
|
||||
}
|
||||
|
||||
LoadTiddlerTask.prototype.run = function(callback) {
|
||||
var self = this;
|
||||
this.syncer.logger.log("Dispatching 'load' task:",this.title);
|
||||
@@ -617,91 +664,6 @@ 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.syncer,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;
|
||||
|
||||
})();
|
||||
|
||||
@@ -313,7 +313,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
||||
variables["dom-" + attribute.name] = attribute.value.toString();
|
||||
});
|
||||
|
||||
if("offsetLeft" in selectedNode) {
|
||||
if(selectedNode.offsetLeft) {
|
||||
// Add variables with a (relative and absolute) popup coordinate string for the selected node
|
||||
var nodeRect = {
|
||||
left: selectedNode.offsetLeft,
|
||||
@@ -338,12 +338,12 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
||||
}
|
||||
}
|
||||
|
||||
if(domNode && ("offsetWidth" in domNode)) {
|
||||
if(domNode && domNode.offsetWidth) {
|
||||
variables["tv-widgetnode-width"] = domNode.offsetWidth.toString();
|
||||
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
|
||||
}
|
||||
|
||||
if(event && ("clientX" in event) && ("clientY" in event)) {
|
||||
if(event && event.clientX && event.clientY) {
|
||||
if(selectedNode) {
|
||||
// Add variables for event X and Y position relative to selected node
|
||||
selectedNodeRect = selectedNode.getBoundingClientRect();
|
||||
|
||||
@@ -104,11 +104,7 @@ TW_Element.prototype.setAttribute = function(name,value) {
|
||||
if(this.isRaw) {
|
||||
throw "Cannot setAttribute on a raw TW_Element";
|
||||
}
|
||||
if(name === "style") {
|
||||
this.style = value;
|
||||
} else {
|
||||
this.attributes[name] = value + "";
|
||||
}
|
||||
this.attributes[name] = value + "";
|
||||
};
|
||||
|
||||
TW_Element.prototype.setAttributeNS = function(namespace,name,value) {
|
||||
|
||||
@@ -70,11 +70,6 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
||||
}
|
||||
return false;
|
||||
},false);
|
||||
// Assign data- attributes
|
||||
this.assignAttributes(domNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
// Insert element
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
@@ -100,11 +95,6 @@ BrowseWidget.prototype.execute = function() {
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
BrowseWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if($tw.utils.count(changedAttributes) > 0) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -59,11 +59,6 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
||||
$tw.utils.pushTop(classes,"tc-popup-handle");
|
||||
}
|
||||
domNode.className = classes.join(" ");
|
||||
// Assign data- attributes
|
||||
this.assignAttributes(domNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
// Assign other attributes
|
||||
if(this.style) {
|
||||
domNode.setAttribute("style",this.style);
|
||||
@@ -255,7 +250,7 @@ ButtonWidget.prototype.updateDomNodeClasses = function() {
|
||||
//Add new classes from updated class attribute.
|
||||
$tw.utils.pushTop(domNodeClasses,newClasses);
|
||||
this.domNode.className = domNodeClasses.join(" ");
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
@@ -265,15 +260,8 @@ 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"]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
if(changedAttributes["class"]) {
|
||||
this.updateDomNodeClasses();
|
||||
}
|
||||
this.assignAttributes(this.domNodes[0],{
|
||||
changedAttributes: changedAttributes,
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
} else if(changedAttributes["class"]) {
|
||||
this.updateDomNodeClasses();
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
@@ -53,11 +53,6 @@ CheckboxWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.labelDomNode.appendChild(this.inputDomNode);
|
||||
this.spanDomNode = this.document.createElement("span");
|
||||
this.labelDomNode.appendChild(this.spanDomNode);
|
||||
// Assign data- attributes
|
||||
this.assignAttributes(this.inputDomNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
// Add a click event handler
|
||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
||||
@@ -330,11 +325,6 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||
$tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked");
|
||||
}
|
||||
}
|
||||
this.assignAttributes(this.inputDomNode,{
|
||||
changedAttributes: changedAttributes,
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||
}
|
||||
};
|
||||
@@ -342,4 +332,3 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||
exports.checkbox = CheckboxWidget;
|
||||
|
||||
})();
|
||||
|
||||
@@ -52,11 +52,6 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||
classes.push("tc-draggable");
|
||||
}
|
||||
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
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
@@ -113,19 +108,13 @@ DraggableWidget.prototype.updateDomNodeClasses = function() {
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tag || changedAttributes.selector || changedAttributes.dragimagetype || changedAttributes.enable || changedAttributes.startactions || changedAttributes.endactions) {
|
||||
var changedAttributes = this.computeAttributes(),
|
||||
changedAttributesCount = $tw.utils.count(changedAttributes);
|
||||
if(changedAttributesCount === 1 && changedAttributes["class"]) {
|
||||
this.updateDomNodeClasses();
|
||||
} else if(changedAttributesCount > 0) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
if(changedAttributes["class"]) {
|
||||
this.assignDomNodeClasses();
|
||||
}
|
||||
this.assignAttributes(this.domNodes[0],{
|
||||
changedAttributes: changedAttributes,
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
@@ -42,11 +42,6 @@ DroppableWidget.prototype.render = function(parent,nextSibling) {
|
||||
domNode = this.document.createElement(tag);
|
||||
this.domNode = domNode;
|
||||
this.assignDomNodeClasses();
|
||||
// Assign data- attributes and style. attributes
|
||||
this.assignAttributes(domNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
// Add event handlers
|
||||
if(this.droppableEnable) {
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
@@ -171,15 +166,8 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) {
|
||||
if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
if(changedAttributes["class"]) {
|
||||
this.assignDomNodeClasses();
|
||||
}
|
||||
this.assignAttributes(this.domNodes[0],{
|
||||
changedAttributes: changedAttributes,
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
} else if(changedAttributes["class"]) {
|
||||
this.assignDomNodeClasses();
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (this.getEditorType() !== this.editorType)) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -100,9 +100,6 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.imageClass) {
|
||||
domNode.setAttribute("class",this.imageClass);
|
||||
}
|
||||
if(this.imageUsemap) {
|
||||
domNode.setAttribute("usemap",this.imageUsemap);
|
||||
}
|
||||
if(this.imageWidth) {
|
||||
domNode.setAttribute("width",this.imageWidth);
|
||||
}
|
||||
@@ -142,7 +139,6 @@ ImageWidget.prototype.execute = function() {
|
||||
this.imageWidth = this.getAttribute("width");
|
||||
this.imageHeight = this.getAttribute("height");
|
||||
this.imageClass = this.getAttribute("class");
|
||||
this.imageUsemap = this.getAttribute("usemap");
|
||||
this.imageTooltip = this.getAttribute("tooltip");
|
||||
this.imageAlt = this.getAttribute("alt");
|
||||
this.lazyLoading = this.getAttribute("loading");
|
||||
@@ -153,7 +149,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
ImageWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.source || changedAttributes.width || changedAttributes.height || changedAttributes["class"] || changedAttributes.usemap || changedAttributes.tooltip || changedTiddlers[this.imageSource]) {
|
||||
if(changedAttributes.source || changedAttributes.width || changedAttributes.height || changedAttributes["class"] || changedAttributes.tooltip || changedTiddlers[this.imageSource]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -43,11 +43,6 @@ LinkWidget.prototype.render = function(parent,nextSibling) {
|
||||
} else {
|
||||
// Just insert the link text
|
||||
var domNode = this.document.createElement("span");
|
||||
// Assign data- attributes
|
||||
this.assignAttributes(domNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
this.domNodes.push(domNode);
|
||||
@@ -143,11 +138,6 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
widget: this
|
||||
});
|
||||
}
|
||||
// Assign data- attributes
|
||||
this.assignAttributes(domNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
// Insert the link into the DOM and render any children
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
@@ -217,7 +207,8 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
LinkWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if($tw.utils.count(changedAttributes) > 0 || changedTiddlers[this.to]) {
|
||||
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip ||
|
||||
changedAttributes["class"] || changedAttributes.tabindex || changedAttributes.draggable || changedAttributes.tag) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
@@ -227,4 +218,3 @@ LinkWidget.prototype.refresh = function(changedTiddlers) {
|
||||
exports.link = LinkWidget;
|
||||
|
||||
})();
|
||||
|
||||
@@ -28,18 +28,6 @@ Inherit from the base widget class
|
||||
*/
|
||||
ListWidget.prototype = new Widget();
|
||||
|
||||
ListWidget.prototype.initialise = function(parseTreeNode,options) {
|
||||
// Bail if parseTreeNode is undefined, meaning that the ListWidget constructor was called without any arguments so that it can be subclassed
|
||||
if(parseTreeNode === undefined) {
|
||||
return;
|
||||
}
|
||||
// First call parent constructor to set everything else up
|
||||
Widget.prototype.initialise.call(this,parseTreeNode,options);
|
||||
// Now look for <$list-template> and <$list-empty> widgets as immediate child widgets
|
||||
// This is safe to do during initialization because parse trees never change after creation
|
||||
this.findExplicitTemplates();
|
||||
}
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
@@ -50,8 +38,8 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
||||
$tw.modules.applyMethods("storyview",this.storyViews);
|
||||
}
|
||||
this.parentDomNode = parent;
|
||||
var changedAttributes = this.computeAttributes();
|
||||
this.execute(changedAttributes);
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
// Construct the storyview
|
||||
var StoryView = this.storyViews[this.storyViewName];
|
||||
@@ -71,7 +59,7 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ListWidget.prototype.execute = function(changedAttributes) {
|
||||
ListWidget.prototype.execute = function() {
|
||||
var self = this;
|
||||
// Get our attributes
|
||||
this.template = this.getAttribute("template");
|
||||
@@ -80,10 +68,8 @@ ListWidget.prototype.execute = function(changedAttributes) {
|
||||
this.counterName = this.getAttribute("counter");
|
||||
this.storyViewName = this.getAttribute("storyview");
|
||||
this.historyTitle = this.getAttribute("history");
|
||||
// Create join template only if needed
|
||||
if(this.join === undefined || (changedAttributes && changedAttributes.join)) {
|
||||
this.join = this.makeJoinTemplate();
|
||||
}
|
||||
// Look for <$list-template> and <$list-empty> widgets as immediate child widgets
|
||||
this.findExplicitTemplates();
|
||||
// Compose the list elements
|
||||
this.list = this.getTiddlerList();
|
||||
var members = [],
|
||||
@@ -106,27 +92,18 @@ ListWidget.prototype.findExplicitTemplates = function() {
|
||||
var self = this;
|
||||
this.explicitListTemplate = null;
|
||||
this.explicitEmptyTemplate = null;
|
||||
this.explicitJoinTemplate = null;
|
||||
this.hasTemplateInBody = false;
|
||||
var searchChildren = function(childNodes) {
|
||||
var foundInlineTemplate = false;
|
||||
$tw.utils.each(childNodes,function(node) {
|
||||
if(node.type === "list-template") {
|
||||
self.explicitListTemplate = node.children;
|
||||
} else if(node.type === "list-empty") {
|
||||
self.explicitEmptyTemplate = node.children;
|
||||
} else if(node.type === "list-join") {
|
||||
self.explicitJoinTemplate = node.children;
|
||||
} else if(node.type === "element" && node.tag === "p") {
|
||||
searchChildren(node.children);
|
||||
foundInlineTemplate = true;
|
||||
} else {
|
||||
foundInlineTemplate = true;
|
||||
}
|
||||
});
|
||||
return foundInlineTemplate;
|
||||
};
|
||||
this.hasTemplateInBody = searchChildren(this.parseTreeNode.children);
|
||||
searchChildren(this.parseTreeNode.children);
|
||||
}
|
||||
|
||||
ListWidget.prototype.getTiddlerList = function() {
|
||||
@@ -162,24 +139,6 @@ 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
|
||||
*/
|
||||
@@ -188,7 +147,6 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
||||
var tiddler = this.wiki.getTiddler(title),
|
||||
isDraft = tiddler && tiddler.hasField("draft.of"),
|
||||
template = this.template,
|
||||
join = this.join,
|
||||
templateTree;
|
||||
if(isDraft && this.editTemplate) {
|
||||
template = this.editTemplate;
|
||||
@@ -202,11 +160,11 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
||||
// Check for a <$list-item> widget
|
||||
if(this.explicitListTemplate) {
|
||||
templateTree = this.explicitListTemplate;
|
||||
} else if(this.hasTemplateInBody) {
|
||||
} else if (!this.explicitEmptyTemplate) {
|
||||
templateTree = this.parseTreeNode.children;
|
||||
}
|
||||
}
|
||||
if(!templateTree || templateTree.length === 0) {
|
||||
if(!templateTree) {
|
||||
// Default template is a link to the title
|
||||
templateTree = [{type: "element", tag: this.parseTreeNode.isBlock ? "div" : "span", children: [{type: "link", attributes: {to: {type: "string", value: title}}, children: [
|
||||
{type: "text", text: title}
|
||||
@@ -214,12 +172,12 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
||||
}
|
||||
}
|
||||
// Return the list item
|
||||
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree, join: join};
|
||||
parseTreeNode.isLast = index === this.list.length - 1;
|
||||
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree};
|
||||
if(this.counterName) {
|
||||
parseTreeNode.counter = (index + 1).toString();
|
||||
parseTreeNode.counterName = this.counterName;
|
||||
parseTreeNode.isFirst = index === 0;
|
||||
parseTreeNode.isLast = index === this.list.length - 1;
|
||||
}
|
||||
return parseTreeNode;
|
||||
};
|
||||
@@ -235,7 +193,7 @@ ListWidget.prototype.refresh = function(changedTiddlers) {
|
||||
this.storyview.refreshStart(changedTiddlers,changedAttributes);
|
||||
}
|
||||
// Completely refresh if any of our attributes have changed
|
||||
if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.join || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {
|
||||
if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {
|
||||
this.refreshSelf();
|
||||
result = true;
|
||||
} else {
|
||||
@@ -339,29 +297,10 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
||||
}
|
||||
} else {
|
||||
// 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++) {
|
||||
isLast = t === this.list.length-1;
|
||||
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) {
|
||||
// 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]);
|
||||
hasRefreshed = true;
|
||||
} else {
|
||||
@@ -370,15 +309,9 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
||||
this.removeListItem(n);
|
||||
hasRefreshed = true;
|
||||
}
|
||||
// Refresh the item we're reusing, or recreate if necessary
|
||||
if(mustRecreateLastItem && (isLast || wasLast)) {
|
||||
this.removeListItem(t);
|
||||
this.insertListItem(t,this.list[t]);
|
||||
hasRefreshed = true;
|
||||
} else {
|
||||
var refreshed = this.children[t].refresh(changedTiddlers);
|
||||
hasRefreshed = hasRefreshed || refreshed;
|
||||
}
|
||||
// Refresh the item we're reusing
|
||||
var refreshed = this.children[t].refresh(changedTiddlers);
|
||||
hasRefreshed = hasRefreshed || refreshed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,17 +401,8 @@ ListItemWidget.prototype.execute = function() {
|
||||
this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "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
|
||||
this.makeChildWidgets(children);
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -490,37 +414,4 @@ ListItemWidget.prototype.refresh = function(changedTiddlers) {
|
||||
|
||||
exports.listitem = ListItemWidget;
|
||||
|
||||
/*
|
||||
Make <$list-template> and <$list-empty> widgets that do nothing
|
||||
*/
|
||||
var ListTemplateWidget = function(parseTreeNode,options) {
|
||||
// Main initialisation inherited from widget.js
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
ListTemplateWidget.prototype = new Widget();
|
||||
ListTemplateWidget.prototype.render = function() {}
|
||||
ListTemplateWidget.prototype.refresh = function() { return false; }
|
||||
|
||||
exports["list-template"] = ListTemplateWidget;
|
||||
|
||||
var ListEmptyWidget = function(parseTreeNode,options) {
|
||||
// Main initialisation inherited from widget.js
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
ListEmptyWidget.prototype = new Widget();
|
||||
ListEmptyWidget.prototype.render = function() {}
|
||||
ListEmptyWidget.prototype.refresh = function() { return false; }
|
||||
|
||||
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;
|
||||
|
||||
})();
|
||||
|
||||
@@ -40,10 +40,6 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
|
||||
);
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","radio");
|
||||
this.assignAttributes(this.inputDomNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
if(isChecked) {
|
||||
this.inputDomNode.checked = true;
|
||||
}
|
||||
|
||||
@@ -50,10 +50,6 @@ RangeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.inputDomNode.setAttribute("disabled",true);
|
||||
}
|
||||
this.inputDomNode.value = this.getValue();
|
||||
this.assignAttributes(this.inputDomNode,{
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
// Add a click event handler
|
||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||
{name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"},
|
||||
|
||||
@@ -12,8 +12,6 @@ Scrollable widget
|
||||
/*global $tw: false */
|
||||
"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 ScrollableWidget = function(parseTreeNode,options) {
|
||||
@@ -173,53 +171,6 @@ ScrollableWidget.prototype.render = function(parent,nextSibling) {
|
||||
parent.insertBefore(this.outerDomNode,nextSibling);
|
||||
this.renderChildren(this.innerDomNode,null);
|
||||
this.domNodes.push(this.outerDomNode);
|
||||
// If the scroll position is bound to a tiddler
|
||||
if(this.scrollableBind) {
|
||||
// After a delay for rendering, scroll to the bound position
|
||||
this.updateScrollPositionFromBoundTiddler();
|
||||
// Set up event listener
|
||||
this.currentListener = this.listenerFunction.bind(this);
|
||||
this.outerDomNode.addEventListener("scroll", this.currentListener);
|
||||
}
|
||||
};
|
||||
|
||||
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() {
|
||||
// Bail if we're running on the fakedom
|
||||
if(!this.outerDomNode.scrollTo) {
|
||||
return;
|
||||
}
|
||||
var tiddler = this.wiki.getTiddler(this.scrollableBind);
|
||||
if(tiddler) {
|
||||
var scrollLeftTo = this.outerDomNode.scrollLeft;
|
||||
if(parseFloat(tiddler.fields["scroll-left"]).toString() === tiddler.fields["scroll-left"]) {
|
||||
scrollLeftTo = parseFloat(tiddler.fields["scroll-left"]);
|
||||
}
|
||||
var scrollTopTo = this.outerDomNode.scrollTop;
|
||||
if(parseFloat(tiddler.fields["scroll-top"]).toString() === tiddler.fields["scroll-top"]) {
|
||||
scrollTopTo = parseFloat(tiddler.fields["scroll-top"]);
|
||||
}
|
||||
this.outerDomNode.scrollTo({
|
||||
top: scrollTopTo,
|
||||
left: scrollLeftTo,
|
||||
behavior: "instant"
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -227,7 +178,6 @@ Compute the internal state of the widget
|
||||
*/
|
||||
ScrollableWidget.prototype.execute = function() {
|
||||
// Get attributes
|
||||
this.scrollableBind = this.getAttribute("bind");
|
||||
this.fallthrough = this.getAttribute("fallthrough","yes");
|
||||
this["class"] = this.getAttribute("class");
|
||||
// Make child widgets
|
||||
@@ -243,22 +193,7 @@ ScrollableWidget.prototype.refresh = function(changedTiddlers) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
return result;
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
exports.scrollable = ScrollableWidget;
|
||||
|
||||
@@ -40,31 +40,7 @@ SelectWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
//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.parentDomNode.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
this.domNodes.push(domNode);
|
||||
this.renderChildren(parent,nextSibling);
|
||||
this.setSelectValue();
|
||||
if(this.selectFocus == "yes") {
|
||||
this.getSelectDomNode().focus();
|
||||
@@ -137,7 +113,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
||||
Get the DOM node of the select element
|
||||
*/
|
||||
SelectWidget.prototype.getSelectDomNode = function() {
|
||||
return this.domNodes[0];
|
||||
return this.children[0].domNodes[0];
|
||||
};
|
||||
|
||||
// Return an array of the selected opion values
|
||||
@@ -173,7 +149,27 @@ SelectWidget.prototype.execute = function() {
|
||||
this.selectTooltip = this.getAttribute("tooltip");
|
||||
this.selectFocus = this.getAttribute("focus");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
var selectNode = {
|
||||
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]);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -182,21 +178,17 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// If we're using a different tiddler/field/index then completely refresh ourselves
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
// If the target tiddler value has changed, just update setting and refresh the children
|
||||
} else {
|
||||
if(changedAttributes.class) {
|
||||
this.selectClass = this.getAttribute("class");
|
||||
this.getSelectDomNode().setAttribute("class",this.selectClass);
|
||||
}
|
||||
this.assignAttributes(this.getSelectDomNode(),{
|
||||
changedAttributes: changedAttributes,
|
||||
sourcePrefix: "data-",
|
||||
destPrefix: "data-"
|
||||
});
|
||||
|
||||
var childrenRefreshed = this.refreshChildren(changedTiddlers);
|
||||
// If the target tiddler value has changed, just update setting and refresh the children
|
||||
if(changedTiddlers[this.selectTitle] || childrenRefreshed) {
|
||||
this.setSelectValue();
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
||||
} else if(variable.isFunctionDefinition) {
|
||||
// Function evaluations
|
||||
params = self.resolveVariableParameters(variable.params,actualParams);
|
||||
var variables = options.variables || Object.create(null);
|
||||
var variables = Object.create(null);
|
||||
// Apply default parameter values
|
||||
$tw.utils.each(variable.params,function(param,index) {
|
||||
if(param["default"]) {
|
||||
@@ -413,34 +413,16 @@ Widget.prototype.getAttribute = function(name,defaultText) {
|
||||
};
|
||||
|
||||
/*
|
||||
Assign the common attributes of the widget to a domNode
|
||||
Assign the computed attributes of the widget to a domNode
|
||||
options include:
|
||||
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"
|
||||
excludeEventAttributes: ignores attributes whose name begins with "on"
|
||||
*/
|
||||
Widget.prototype.assignAttributes = function(domNode,options) {
|
||||
options = options || {};
|
||||
var self = this,
|
||||
changedAttributes = options.changedAttributes || this.attributes,
|
||||
sourcePrefix = options.sourcePrefix || "",
|
||||
destPrefix = options.destPrefix || "",
|
||||
EVENT_ATTRIBUTE_PREFIX = "on";
|
||||
var self = this;
|
||||
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
|
||||
if(options.excludeEventAttributes && name.substr(0,2).toLowerCase() === EVENT_ATTRIBUTE_PREFIX) {
|
||||
if(options.excludeEventAttributes && name.substr(0,2) === "on") {
|
||||
value = undefined;
|
||||
}
|
||||
if(value !== undefined) {
|
||||
@@ -450,24 +432,26 @@ Widget.prototype.assignAttributes = function(domNode,options) {
|
||||
namespace = "http://www.w3.org/1999/xlink";
|
||||
name = name.substr(6);
|
||||
}
|
||||
// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
|
||||
try {
|
||||
domNode.setAttributeNS(namespace,name,value);
|
||||
} catch(e) {
|
||||
// Handle styles
|
||||
if(name.substr(0,6) === "style." && name.length > 6) {
|
||||
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
|
||||
} else {
|
||||
// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
|
||||
try {
|
||||
domNode.setAttributeNS(namespace,name,value);
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// If the parse tree node has the orderedAttributes property then use that order
|
||||
}
|
||||
// Not all parse tree nodes have the orderedAttributes property
|
||||
if(this.parseTreeNode.orderedAttributes) {
|
||||
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
|
||||
if(attribute.name in changedAttributes) {
|
||||
assignAttribute(attribute.name,self.getAttribute(attribute.name));
|
||||
}
|
||||
});
|
||||
// Otherwise update each changed attribute irrespective of order
|
||||
assignAttribute(attribute.name,self.attributes[attribute.name]);
|
||||
});
|
||||
} else {
|
||||
$tw.utils.each(changedAttributes,function(value,name) {
|
||||
assignAttribute(name,self.getAttribute(name));
|
||||
$tw.utils.each(Object.keys(self.attributes).sort(),function(name) {
|
||||
assignAttribute(name,self.attributes[name]);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1287,7 +1287,7 @@ exports.search = function(text,options) {
|
||||
console.log("Regexp error parsing /(" + text + ")/" + flags + ": ",e);
|
||||
}
|
||||
} else if(options.some) {
|
||||
terms = text.trim().split(/[^\S\xA0]+/);
|
||||
terms = text.trim().split(/ +/);
|
||||
if(terms.length === 1 && terms[0] === "") {
|
||||
searchTermsRegExps = null;
|
||||
} else {
|
||||
@@ -1298,7 +1298,7 @@ exports.search = function(text,options) {
|
||||
searchTermsRegExps.push(new RegExp("(" + regExpStr + ")",flags));
|
||||
}
|
||||
} else { // default: words
|
||||
terms = text.split(/[^\S\xA0]+/);
|
||||
terms = text.split(/ +/);
|
||||
if(terms.length === 1 && terms[0] === "") {
|
||||
searchTermsRegExps = null;
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/core/templates/html-json-skinny-tiddler
|
||||
|
||||
<$text text=<<join>>/><$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes"/>
|
||||
<$list filter="[<numTiddlers>compare:number:gteq[1]] ~[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list>
|
||||
<$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes"/>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
title: $:/core/templates/html-json-tiddler
|
||||
|
||||
<$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes"/>
|
||||
<$list filter="[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list><$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes"/>
|
||||
@@ -6,12 +6,14 @@ title: $:/core/templates/store.area.template.html
|
||||
<$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 -->
|
||||
`<script class="tiddlywiki-tiddler-store" type="application/json">[`
|
||||
<$let newline={{{ [charcode[10]] }}} join=`,$(newline)$`>
|
||||
<$vars newline={{{ [charcode[10]] }}}>
|
||||
<$text text=<<newline>>/>
|
||||
<$list filter=<<saveTiddlerFilter>> join=<<join>> template="$:/core/templates/html-json-tiddler"/>
|
||||
<$list filter="[subfilter<skinnySaveTiddlerFilter>]" template="$:/core/templates/html-json-skinny-tiddler"/>
|
||||
<$list filter=<<saveTiddlerFilter>> counter="counter" template="$:/core/templates/html-json-tiddler"/>
|
||||
<$vars numTiddlers={{{ [subfilter<saveTiddlerFilter>count[]] }}}>
|
||||
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} counter="counter" template="$:/core/templates/html-json-skinny-tiddler"/>
|
||||
</$vars>
|
||||
<$text text=<<newline>>/>
|
||||
</$let>
|
||||
</$vars>
|
||||
`]</script>`
|
||||
`<div id="storeArea" style="display:none;">`
|
||||
`</div>`
|
||||
@@ -20,8 +22,8 @@ title: $:/core/templates/store.area.template.html
|
||||
<!-- Old-style DIV/PRE-based store area -->
|
||||
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
|
||||
`<div id="storeArea" style="display:none;">`
|
||||
<$list filter={{{ [<saveTiddlerFilter>] }}} template="$:/core/templates/html-div-tiddler"/>
|
||||
<$list filter="[subfilter<skinnySaveTiddlerFilter>]" template="$:/core/templates/html-div-skinny-tiddler"/>
|
||||
<$list filter=<<saveTiddlerFilter>> template="$:/core/templates/html-div-tiddler"/>
|
||||
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} template="$:/core/templates/html-div-skinny-tiddler"/>
|
||||
`</div>`
|
||||
</$reveal>
|
||||
</$list>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
title: $:/core/ui/EditTemplate/body/default
|
||||
|
||||
\function edit-preview-state()
|
||||
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] +[get[text]] :else[[no]]
|
||||
\end
|
||||
|
||||
\define config-visibility-title()
|
||||
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
\end
|
||||
@@ -10,16 +14,15 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
|
||||
\whitespace trim
|
||||
<$let
|
||||
editPreviewStateTiddler={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
||||
importTitle=<<qualify $:/ImportImage>>
|
||||
importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||
<div>
|
||||
<div class={{{ [<editPreviewStateTiddler>get[text]match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}>
|
||||
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}>
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
<$list filter="[<editPreviewStateTiddler>get[text]match[yes]]" variable="ignore">
|
||||
<$list filter="[function[edit-preview-state]match[yes]]" variable="ignore">
|
||||
|
||||
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
|
||||
\whitespace trim
|
||||
<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>
|
||||
<$reveal type="nomatch" text="" default=<<name>>>
|
||||
<$button tooltip={{$:/language/EditTemplate/Fields/Add/Button/Hint}}>
|
||||
<$button tooltip=<<lingo Fields/Add/Button/Hint>>>
|
||||
<$action-sendmessage $message="tm-add-field"
|
||||
$name=<<name>>
|
||||
$value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||
|
||||
@@ -9,8 +9,17 @@ button-classes: tc-text-editor-toolbar-item-start-group
|
||||
shortcuts: ((preview))
|
||||
|
||||
\whitespace trim
|
||||
<span>
|
||||
<$transclude $tiddler={{{ [<editPreviewStateTiddler>get[text]match[yes]then[$:/core/images/preview-open]else[$:/core/images/preview-closed]] }}} />
|
||||
</span>
|
||||
<$action-setfield $tiddler=<<editPreviewStateTiddler>> $value={{{ [<editPreviewStateTiddler>get[text]toggle[yes],[no]] }}} />
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||
<$let
|
||||
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
||||
>
|
||||
<$reveal state=<<edit-preview-state>> type="match" text="yes" tag="span">
|
||||
{{$:/core/images/preview-open}}
|
||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="no"/>
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||
</$reveal>
|
||||
<$reveal state=<<edit-preview-state>> type="nomatch" text="yes" tag="span">
|
||||
{{$:/core/images/preview-closed}}
|
||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="yes"/>
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||
</$reveal>
|
||||
</$let>
|
||||
|
||||
@@ -4,8 +4,11 @@ tags: $:/tags/ViewTemplate
|
||||
\whitespace trim
|
||||
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-subtitle">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler">
|
||||
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/><$list-join> </$list-join>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler" counter="indexSubtitleTiddler">
|
||||
<$list filter="[<indexSubtitleTiddler-first>match[no]]" variable="ignore">
|
||||
|
||||
</$list>
|
||||
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/>
|
||||
</$list>
|
||||
</div>
|
||||
</$reveal>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/library/v5.3.3/index.html
|
||||
url: https://tiddlywiki.com/library/v5.3.2/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}}
|
||||
|
||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||
|
||||
@@ -13,7 +13,7 @@ tags: $:/tags/Macro
|
||||
|
||||
$(colour-picker-update-recent)$
|
||||
|
||||
<$transclude $variable="__actions__"/>
|
||||
$actions$
|
||||
|
||||
<span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/>
|
||||
|
||||
@@ -23,7 +23,7 @@ $(colour-picker-update-recent)$
|
||||
\define colour-picker-recent-inner(actions)
|
||||
\whitespace trim
|
||||
<$set name="colour-picker-value" value="$(recentColour)$">
|
||||
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
|
||||
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
@@ -31,7 +31,7 @@ $(colour-picker-update-recent)$
|
||||
\whitespace trim
|
||||
{{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour">
|
||||
 
|
||||
<$macrocall $name="colour-picker-recent-inner" actions=<<__actions__>>/>
|
||||
<$macrocall $name="colour-picker-recent-inner" actions="""$actions$"""/>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
@@ -39,13 +39,13 @@ $(colour-picker-update-recent)$
|
||||
\whitespace trim
|
||||
<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">
|
||||
 
|
||||
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
|
||||
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/>
|
||||
</$list>
|
||||
|
||||
---
|
||||
@@ -54,7 +54,7 @@ $(colour-picker-update-recent)$
|
||||
 
|
||||
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
|
||||
<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}>
|
||||
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
|
||||
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/>
|
||||
</$set>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -5,13 +5,13 @@ title: $:/core/macros/image-picker
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define image-picker-thumbnail(actions)
|
||||
<$button tag="a" tooltip="""$(imageTitle)$"""><$transclude $variable="__actions__"/><$transclude tiddler=<<imageTitle>>/></$button>
|
||||
<$button tag="a" tooltip="""$(imageTitle)$""">$actions$<$transclude tiddler=<<imageTitle>>/></$button>
|
||||
\end
|
||||
|
||||
\define image-picker-list(filter,actions)
|
||||
\whitespace trim
|
||||
<$list filter="""$filter$""" variable="imageTitle">
|
||||
<$macrocall $name="image-picker-thumbnail" actions=<<__actions__>>/>
|
||||
<$macrocall $name="image-picker-thumbnail" actions="""$actions$"""/>
|
||||
 
|
||||
</$list>
|
||||
\end
|
||||
@@ -25,15 +25,15 @@ type: text/vnd.tiddlywiki
|
||||
{{$:/language/SystemTiddlers/Include/Prompt}}
|
||||
</$checkbox>
|
||||
<$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 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>
|
||||
</$vars>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\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
|
||||
|
||||
@@ -4,17 +4,17 @@ tags: $:/tags/Macro
|
||||
\define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption")
|
||||
\whitespace trim
|
||||
<$genesis $type=<<__type__>> class=<<__class__>>>
|
||||
<$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>>
|
||||
<$genesis $type=<<__subtype__>>>
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field=<<__field__>>>
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
</$link>
|
||||
</$genesis>
|
||||
</$list>
|
||||
<$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>>
|
||||
<$genesis $type=<<__subtype__>>>
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field=<<__field__>>>
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
</$link>
|
||||
</$genesis>
|
||||
</$list>
|
||||
</$genesis>
|
||||
\end
|
||||
|
||||
@@ -25,42 +25,34 @@ tags: $:/tags/Macro
|
||||
\define list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate)
|
||||
\whitespace trim
|
||||
<span class="tc-links-draggable-list">
|
||||
<$vars targetTiddler="""$tiddler$""" targetField="""$field$""">
|
||||
<$genesis $type=<<__type__>> class="$class$">
|
||||
<$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>>
|
||||
<$droppable
|
||||
actions=<<list-links-draggable-drop-actions>>
|
||||
tag="""$subtype$"""
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<div class="tc-droppable-placeholder"/>
|
||||
<div>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field="caption">
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
</$link>
|
||||
</$transclude>
|
||||
</div>
|
||||
</$droppable>
|
||||
</$list>
|
||||
<$tiddler tiddler="">
|
||||
<$droppable
|
||||
actions=<<list-links-draggable-drop-actions>>
|
||||
tag="div"
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<div class="tc-droppable-placeholder">
|
||||
{{$:/core/images/blank}}
|
||||
</div>
|
||||
<div style="height:0.5em;"/>
|
||||
</$droppable>
|
||||
</$tiddler>
|
||||
</$genesis>
|
||||
</$vars>
|
||||
<$vars targetTiddler="""$tiddler$""" targetField="""$field$""">
|
||||
<$genesis $type=<<__type__>> class="$class$">
|
||||
<$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>>
|
||||
<$droppable actions=<<list-links-draggable-drop-actions>> tag="""$subtype$""" enable=<<tv-enable-drag-and-drop>>>
|
||||
<div class="tc-droppable-placeholder"/>
|
||||
<div>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field="caption">
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
</$link>
|
||||
</$transclude>
|
||||
</div>
|
||||
</$droppable>
|
||||
</$list>
|
||||
<$tiddler tiddler="">
|
||||
<$droppable actions=<<list-links-draggable-drop-actions>> tag="div" enable=<<tv-enable-drag-and-drop>>>
|
||||
<div class="tc-droppable-placeholder">
|
||||
{{$:/core/images/blank}}
|
||||
</div>
|
||||
<div style="height:0.5em;"/>
|
||||
</$droppable>
|
||||
</$tiddler>
|
||||
</$genesis>
|
||||
</$vars>
|
||||
</span>
|
||||
\end
|
||||
|
||||
@@ -68,59 +60,50 @@ tags: $:/tags/Macro
|
||||
\whitespace trim
|
||||
<!-- Save the current ordering of the tiddlers with this tag -->
|
||||
<$set name="order" filter="[<__tag__>tagging[]]">
|
||||
<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->
|
||||
<$list filter="[<__tag__>tagging[]]">
|
||||
<$action-deletefield $field="list-before"/>
|
||||
<$action-deletefield $field="list-after"/>
|
||||
</$list>
|
||||
<!-- Save the new order to the Tag Tiddler -->
|
||||
<$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||
<!-- Make sure the newly added item has the right tag -->
|
||||
<!-- Removing this line makes dragging tags within the dropdown work as intended -->
|
||||
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
|
||||
<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->
|
||||
<$list filter="[<actionTiddler>!contains:tags<__tag__>]">
|
||||
<$fieldmangler tiddler=<<actionTiddler>>>
|
||||
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
|
||||
</$fieldmangler>
|
||||
</$list>
|
||||
<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->
|
||||
<$list filter="[<__tag__>tagging[]]">
|
||||
<$action-deletefield $field="list-before"/>
|
||||
<$action-deletefield $field="list-after"/>
|
||||
</$list>
|
||||
<!-- Save the new order to the Tag Tiddler -->
|
||||
<$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||
<!-- Make sure the newly added item has the right tag -->
|
||||
<!-- Removing this line makes dragging tags within the dropdown work as intended -->
|
||||
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
|
||||
<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->
|
||||
<$list filter="[<actionTiddler>!contains:tags<__tag__>]">
|
||||
<$fieldmangler tiddler=<<actionTiddler>>>
|
||||
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
|
||||
</$fieldmangler>
|
||||
</$list>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
|
||||
\whitespace trim
|
||||
<span class="tc-tagged-draggable-list">
|
||||
<$set name="tag" value=<<__tag__>>>
|
||||
<$list
|
||||
filter="[<__tag__>tagging[]$subFilter$]"
|
||||
emptyMessage=<<__emptyMessage__>>
|
||||
storyview=<<__storyview__>>
|
||||
>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-menu-list-item">
|
||||
<$droppable
|
||||
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<__elementTag__>>>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$link to={{!!title}}>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
</$transclude>
|
||||
</$genesis>
|
||||
</$droppable>
|
||||
</$genesis>
|
||||
</$list>
|
||||
<$tiddler tiddler="">
|
||||
<$droppable
|
||||
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<__elementTag__>> style="height:0.5em;"/>
|
||||
</$droppable>
|
||||
</$tiddler>
|
||||
</$set>
|
||||
<$set name="tag" value=<<__tag__>>>
|
||||
<$list filter="[<__tag__>tagging[]$subFilter$]" emptyMessage=<<__emptyMessage__>> storyview=<<__storyview__>>>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-menu-list-item">
|
||||
<$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<<tv-enable-drag-and-drop>>>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<__elementTag__>>>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$link to={{!!title}}>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
</$transclude>
|
||||
</$genesis>
|
||||
</$droppable>
|
||||
</$genesis>
|
||||
</$list>
|
||||
<$tiddler tiddler="">
|
||||
<$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<<tv-enable-drag-and-drop>>>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<__elementTag__>> style="height:0.5em;">
|
||||
</$genesis>
|
||||
</$droppable>
|
||||
</$tiddler>
|
||||
</$set>
|
||||
</span>
|
||||
\end
|
||||
|
||||
@@ -4,15 +4,7 @@ code-body: yes
|
||||
|
||||
\define tabs-button()
|
||||
\whitespace trim
|
||||
<$button
|
||||
set=<<tabsState>>
|
||||
setTo=<<currentTab>>
|
||||
default=<<__default__>>
|
||||
selectedClass="tc-tab-selected"
|
||||
tooltip={{!!tooltip}}
|
||||
role="switch"
|
||||
data-tab-title=<<currentTab>>
|
||||
>
|
||||
<$button set=<<tabsState>> setTo=<<currentTab>> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}} role="switch">
|
||||
<$tiddler tiddler=<<save-currentTiddler>>>
|
||||
<$set name="tv-wikilinks" value="no">
|
||||
<$transclude tiddler=<<__buttonTemplate__>> mode="inline">
|
||||
|
||||
@@ -16,7 +16,7 @@ second-search-filter: [tags[]is[system]search:title<userInput>sort[]]
|
||||
emptyMessage="<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter='-[<tag>]'/>"
|
||||
>
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
|
||||
<$transclude $variable="__actions__"/>
|
||||
$actions$
|
||||
</$list>
|
||||
</$set>
|
||||
<<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]] }}}>
|
||||
<$button set=<<newTagNameTiddler>> setTo="" class="">
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
|
||||
<$transclude $variable="__actions__"/>
|
||||
$actions$
|
||||
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
||||
<<delete-tag-state-tiddlers>><$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>>/>
|
||||
</$set>
|
||||
|
||||
@@ -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.
|
||||
|
||||
<div style="font-size:0.7em;text-align:center;margin-top:3em;margin-bottom:3em;">
|
||||
<a href="https://talk.tiddlywiki.org/" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank">
|
||||
{{$:/core/images/help}} ~TiddlyWiki Forum
|
||||
<a href="http://groups.google.com/group/TiddlyWiki" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank">
|
||||
{{$:/core/images/mail}} ~TiddlyWiki Mailing List
|
||||
</a>
|
||||
<a href="https://twitter.com/TiddlyWiki" class="tc-btn-big-green" style="background-color:#5E9FCA;" target="_blank">
|
||||
{{$:/core/images/twitter}} @~TiddlyWiki on Twitter
|
||||
|
||||
@@ -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.
|
||||
|
||||
* [[tiddlywiki.com/dev|https://tiddlywiki.com/dev]] Offizielle Entwickler Doku.
|
||||
* [[TiddlyWikiDev group|https://talk.tiddlywiki.org/c/devs/]] Diskussionsforum für Entwickler.
|
||||
* [[TiddlyWikiDev group|http://groups.google.com/group/TiddlyWikiDev]] Google Diskussionsforum für Entwickler.
|
||||
* https://github.com/Jermolene/TiddlyWiki5 .. Github Repository.
|
||||
|
||||
@@ -12,9 +12,7 @@ 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.
|
||||
|
||||
!! Usuarios
|
||||
|
||||
[[Foro oficial de TiddlyWiki| https://talk.tiddlywiki.org/]]
|
||||
!!Usuarios
|
||||
|
||||
[[Grupo principal de TiddlyWiki| http://groups.google.com/group/TiddlyWiki]]
|
||||
|
||||
@@ -27,7 +25,10 @@ o síguenos [[en Twitter|http://twitter.com/TiddlyWiki]] si quieres recibir las
|
||||
|
||||
!! Desarrolladores
|
||||
|
||||
[[Foro de desarrollo de TiddlyWiki|https://talk.tiddlywiki.org/c/devs]]
|
||||
[[Grupo de desarrollo de TiddlyWiki|http://groups.google.com/group/TiddlyWikiDev]]
|
||||
|
||||
>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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
<div style="font-size:0.7em;text-align:center;margin-top:3em;margin-bottom:3em;">
|
||||
<a href="https://talk.tiddlywiki.org/" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank" rel="noopener noreferrer">
|
||||
{{$:/core/images/mail}} Foro oficial de ~TiddlyWiki
|
||||
<a href="http://groups.google.com/group/TiddlyWiki" class="tc-btn-big-green" style="background-color:#FF8C19;" target="_blank" rel="noopener noreferrer">
|
||||
{{$:/core/images/mail}} ~TiddlyWiki en Google Groups
|
||||
</a>
|
||||
<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
|
||||
|
||||
@@ -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 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/]].
|
||||
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]].
|
||||
|
||||
Por el mismo motivo, se aconseja el uso de acentos graves <code>`...`</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.
|
||||
|
||||
|
||||
122
editions/prerelease/tiddlers/Release 5.3.2.tid
Normal file
122
editions/prerelease/tiddlers/Release 5.3.2.tid
Normal file
@@ -0,0 +1,122 @@
|
||||
caption: 5.3.2
|
||||
created: 20231016122502955
|
||||
modified: 20231016122502955
|
||||
tags: ReleaseNotes
|
||||
title: Release 5.3.2
|
||||
type: text/vnd.tiddlywiki
|
||||
description: Under development
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.3.1...master]]//
|
||||
|
||||
! Major Improvements
|
||||
|
||||
!! 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:
|
||||
|
||||
```
|
||||
<% if [<animal>match[Elephant]] %>
|
||||
It is an elephant
|
||||
<% elseif [<animal>match[Giraffe]] %>
|
||||
It is a giraffe
|
||||
<% else %>
|
||||
It is completely unknown
|
||||
<% endif %>
|
||||
```
|
||||
|
||||
!! 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:
|
||||
|
||||
```
|
||||
<$list filter=<<filter>>>
|
||||
<$list-template>
|
||||
<$text text=<<currentTiddler>>/>
|
||||
</$list-template>
|
||||
<$list-empty>
|
||||
None!
|
||||
</$list-empty>
|
||||
</$list>
|
||||
```
|
||||
|
||||
Note that the <<.attr "emptyMessage">> and <<.attr "template">> attributes take precedence if they are present.
|
||||
|
||||
!! jsonset operator
|
||||
|
||||
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7742">> [[jsonset Operator]] for setting values within JSON objects
|
||||
|
||||
!! QR Code Reader
|
||||
|
||||
<<.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
|
||||
|
||||
Improvements to the following translations:
|
||||
|
||||
* Chinese
|
||||
* Polish
|
||||
* Spanish
|
||||
|
||||
! Plugin Improvements
|
||||
|
||||
* <<.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
|
||||
|
||||
! Widget Improvements
|
||||
|
||||
*
|
||||
|
||||
! Usability Improvements
|
||||
|
||||
* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/pull/7747">> editor preview button to automatically focus the editor
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7764">> file type names in the export menu
|
||||
|
||||
! 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-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7690">> the default page layout to better support CSS grid and flexbox layouts
|
||||
|
||||
! Bug Fixes
|
||||
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7665">> `{{}}` generating a recursion error
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7758">> ordering of Vanilla stylesheets
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/fa9bfa07a095548eb2f8339b0b1b816d2e6794ef">> missing closing tag in tag-pill-inner macro
|
||||
* <<.link-badge-removed "https://github.com/Jermolene/TiddlyWiki5/issues/7732">> invalid "type" attribute from textarea elements generated by the EditTextWidget
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7749">> editor "type" dropdown state tiddlers
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7712">> handling of "counter-last" variable when appending items with the ListWidget
|
||||
* <<.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/7789">> resizing of height of textareas in control panel
|
||||
|
||||
! Node.js Improvements
|
||||
|
||||
*
|
||||
|
||||
! Performance Improvements
|
||||
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7702">> performance of predefined patterns with [[all Operator]]
|
||||
* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/issues/7671">> favicon format to PNG
|
||||
|
||||
! Developer Improvements
|
||||
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7751">> global hook handling to support removing hooks
|
||||
|
||||
! Acknowledgements
|
||||
|
||||
[[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki:
|
||||
|
||||
<<.contributors """
|
||||
AnthonyMuscio
|
||||
BramChen
|
||||
BuckarooBanzay
|
||||
BurningTreeC
|
||||
EvidentlyCube
|
||||
joebordes
|
||||
kookma
|
||||
linonetwo
|
||||
mateuszwilczek
|
||||
pmario
|
||||
rmunn
|
||||
simonbaird
|
||||
T1mL3arn
|
||||
""">>
|
||||
@@ -1,61 +0,0 @@
|
||||
caption: 5.3.4
|
||||
created: 20231223102229103
|
||||
modified: 20231223102229103
|
||||
tags: ReleaseNotes
|
||||
title: Release 5.3.4
|
||||
type: text/vnd.tiddlywiki
|
||||
description: Under development
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.3.3...master]]//
|
||||
|
||||
! Major Improvements
|
||||
|
||||
|
||||
! Translation improvements
|
||||
|
||||
Improvements to the following translations:
|
||||
|
||||
*
|
||||
|
||||
! Plugin Improvements
|
||||
|
||||
*
|
||||
|
||||
! Widget Improvements
|
||||
|
||||
*
|
||||
|
||||
! Usability Improvements
|
||||
|
||||
*
|
||||
|
||||
! Hackability Improvements
|
||||
|
||||
*
|
||||
|
||||
! Bug Fixes
|
||||
|
||||
*
|
||||
|
||||
! Node.js Improvements
|
||||
|
||||
*
|
||||
|
||||
! Performance Improvements
|
||||
|
||||
*
|
||||
|
||||
! Developer Improvements
|
||||
|
||||
*
|
||||
|
||||
! Infrastructure Improvements
|
||||
|
||||
*
|
||||
|
||||
! Acknowledgements
|
||||
|
||||
[[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki:
|
||||
|
||||
<<.contributors """
|
||||
""">>
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.3.3/index.html
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.3.2/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}} (Prerelease)
|
||||
|
||||
The prerelease version of the official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
title: $:/my-scroll-position
|
||||
scroll-left: 0
|
||||
scroll-top: 100
|
||||
@@ -14,10 +14,7 @@
|
||||
"tiddlywiki/dynannotate",
|
||||
"tiddlywiki/codemirror",
|
||||
"tiddlywiki/menubar",
|
||||
"tiddlywiki/jszip",
|
||||
"tiddlywiki/confetti",
|
||||
"tiddlywiki/dynannotate",
|
||||
"tiddlywiki/tour"
|
||||
"tiddlywiki/jszip"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
title: Functions/FunctionFilterrunVariables
|
||||
description: Functions in filter runs that set variables
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Idiosyncrasy
|
||||
caption: Idiosyncrasy Caption Field
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\procedure demo-subfilter() [<currentTiddler>]
|
||||
\function .demo-function() [<currentTiddler>]
|
||||
|
||||
<$let currentTiddler="Idiosyncrasy">
|
||||
<$text text={{{ [<currentTiddler>get[caption]!is[blank]else<currentTiddler>] :map[subfilter<demo-subfilter>] }}}/>,
|
||||
<$text text={{{ [<currentTiddler>get[caption]!is[blank]else<currentTiddler>] :map[.demo-function[]] }}}/>
|
||||
</$let>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Idiosyncrasy Caption Field,Idiosyncrasy Caption Field</p>
|
||||
@@ -1,20 +0,0 @@
|
||||
title: Functions/FunctionFilterrunVariables2
|
||||
description: Functions in filter runs that set variables
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Apple
|
||||
cost: 5
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\function .doublecost() [<currentTiddler>get[cost]multiply[2]]
|
||||
|
||||
<$text text={{{ [[Apple]] :map[.doublecost[]] }}}/>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
10
|
||||
@@ -1,13 +0,0 @@
|
||||
title: ListWidget/WithEmptyParagraphTemplate
|
||||
description: List widget with an empty paragraph as inline template
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$list filter="1"><p/></$list>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><p></p></p>
|
||||
@@ -1,30 +0,0 @@
|
||||
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>
|
||||
@@ -1,32 +0,0 @@
|
||||
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!
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Macros/EndInBody
|
||||
description: \end line starting with non-whitespace is part of macro body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Macros/IndentedEnd
|
||||
description: \end line starting with whitespace ends a macro body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Macros/MismatchedNamedEnd
|
||||
description: Mismatched named end is part of the body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define hello()
|
||||
\end goodbye
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: \end goodbye</p>
|
||||
@@ -1,18 +0,0 @@
|
||||
title: Macros/WhitespaceOnlyWithEnd
|
||||
description: The /end should be detected when macro definition contains only whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define max()
|
||||
\end
|
||||
Nothing
|
||||
\end
|
||||
|
||||
Out: <<max>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Nothing
|
||||
\end</p><p>Out: </p>
|
||||
@@ -1,15 +0,0 @@
|
||||
title: Macros/WhitespaceOnlyWithEnd2
|
||||
description: Line with \end can start with whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define empty()
|
||||
\end
|
||||
|
||||
Out: <<empty>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: </p>
|
||||
@@ -1,64 +0,0 @@
|
||||
title: Pragmas/WhitespaceAfterPragma
|
||||
description: parsermode pragma
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<$wikify name="parsetree" text={{Text}} mode="inline" output="parsetree">
|
||||
<$text text=<<parsetree>>/>
|
||||
</$wikify>
|
||||
+
|
||||
title: Text
|
||||
|
||||
\procedure this-is-a-definition() Something
|
||||
|
||||
|
||||
|
||||
|
||||
Now!
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
[
|
||||
{
|
||||
"type": "set",
|
||||
"attributes": {
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"value": "this-is-a-definition"
|
||||
},
|
||||
"value": {
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"value": "Something"
|
||||
}
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Now!\n",
|
||||
"start": 48,
|
||||
"end": 53
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"orderedAttributes": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"value": "this-is-a-definition"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "string",
|
||||
"value": "Something"
|
||||
}
|
||||
],
|
||||
"isProcedureDefinition": true
|
||||
}
|
||||
]
|
||||
</p>
|
||||
@@ -1,32 +0,0 @@
|
||||
title: Pragmas/WhitespaceNoPragma
|
||||
description: parsermode pragma
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<$wikify name="parsetree" text={{Text}} mode="inline" output="parsetree">
|
||||
<$text text=<<parsetree>>/>
|
||||
</$wikify>
|
||||
+
|
||||
title: Text
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Now!
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
[
|
||||
{
|
||||
"type": "text",
|
||||
"text": "\n\n\n\nNow!\n",
|
||||
"start": 0,
|
||||
"end": 9
|
||||
}
|
||||
]
|
||||
</p>
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Procedures/EndInBody
|
||||
description: \end line starting with non-whitespace is part of procedure body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Procedures/IndentedEnd
|
||||
description: \end line starting with whitespace ends a procedure body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Procedures/MismatchedNamedEnd
|
||||
description: Mismatched named end is part of the body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure hello()
|
||||
\end goodbye
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: \end goodbye</p>
|
||||
@@ -1,18 +0,0 @@
|
||||
title: Procedures/WhitespaceOnlyWithEnd
|
||||
description: The /end should be detected when procedure definition contains only whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure max()
|
||||
\end
|
||||
Nothing
|
||||
\end
|
||||
|
||||
Out: <<max>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Nothing
|
||||
\end</p><p>Out: </p>
|
||||
@@ -1,15 +0,0 @@
|
||||
title: Procedures/WhitespaceOnlyWithEnd2
|
||||
description: Line with \end can start with whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure empty()
|
||||
\end
|
||||
|
||||
Out: <<empty>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: </p>
|
||||
@@ -1,20 +0,0 @@
|
||||
title: Transclude/CustomWidget/CodeblockOverride-TextParser
|
||||
description: Test that overriding codeblock widget does not impact text parser
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\widget $codeblock(code)
|
||||
<$transclude $variable="copy-to-clipboard" src=<<code>>/>
|
||||
<$genesis $type="$codeblock" $remappable="no" code=<<code>>/>
|
||||
\end
|
||||
|
||||
\procedure myvariable() hello
|
||||
|
||||
<$transclude $variable="myvariable" $type="text/plain" $output="text/plain"/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>hello</p>
|
||||
@@ -1,27 +0,0 @@
|
||||
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>
|
||||
@@ -1,22 +0,0 @@
|
||||
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>
|
||||
@@ -1,27 +0,0 @@
|
||||
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>
|
||||
@@ -1,27 +0,0 @@
|
||||
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>
|
||||
@@ -1,27 +0,0 @@
|
||||
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>
|
||||
@@ -1,15 +0,0 @@
|
||||
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>
|
||||
@@ -1,27 +0,0 @@
|
||||
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' class="myclass" 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 class="myclass" 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>
|
||||
@@ -1,15 +0,0 @@
|
||||
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>
|
||||
@@ -1,15 +0,0 @@
|
||||
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>
|
||||
@@ -53,11 +53,6 @@ describe("json filter tests", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[2]]")).toEqual(["true"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[3]]")).toEqual(["false"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[4]]")).toEqual(["null"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[-5]]")).toEqual(["five"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[-4]]")).toEqual(["six"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[-3]]")).toEqual(["true"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[-2]]")).toEqual(["false"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[-1]]")).toEqual(["null"]);
|
||||
});
|
||||
|
||||
it("should support the jsonextract operator", function() {
|
||||
@@ -75,11 +70,6 @@ describe("json filter tests", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[2]]")).toEqual(["true"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[3]]")).toEqual(["false"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[4]]")).toEqual(["null"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[-5]]")).toEqual(['"five"']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[-4]]")).toEqual(['"six"']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[-3]]")).toEqual(["true"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[-2]]")).toEqual(["false"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonextract[d],[f],[-1]]")).toEqual(["null"]);
|
||||
});
|
||||
|
||||
it("should support the jsonindexes operator", function() {
|
||||
@@ -95,11 +85,6 @@ describe("json filter tests", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[2]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[3]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[4]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[-5]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[-4]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[-3]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[-2]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[-1]]")).toEqual([]);
|
||||
});
|
||||
|
||||
it("should support the jsontype operator", function() {
|
||||
@@ -116,15 +101,9 @@ describe("json filter tests", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[2]]")).toEqual(["boolean"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[3]]")).toEqual(["boolean"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[4]]")).toEqual(["null"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[-5]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[-4]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[-3]]")).toEqual(["boolean"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[-2]]")).toEqual(["boolean"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[-1]]")).toEqual(["null"]);
|
||||
});
|
||||
|
||||
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[],[Antelope]]")).toEqual(['"Antelope"']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:number[],[not a number]]")).toEqual(['0']);
|
||||
@@ -136,7 +115,6 @@ describe("json filter tests", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:null[id]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":null}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:array[d],[f],[5]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null,[]]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:object[d],[f],[5]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null,{}]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:number[d],[f],[-1],[42]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,42]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset[missing],[id],[Antelope]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:json[\"Antelope\"]]")).toEqual(['"Antelope"']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:json[id],[{\"a\":313}]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":{"a":313}}']);
|
||||
|
||||
@@ -527,45 +527,6 @@ describe("Widget module", function() {
|
||||
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) {
|
||||
return function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
@@ -1,3 +0,0 @@
|
||||
title: Asteroid (253) Mathilde Image
|
||||
type: image/png
|
||||
tags: Image
|
||||
@@ -1,17 +0,0 @@
|
||||
created: 20230720112554020
|
||||
modified: 20230720112827830
|
||||
title: Asteroid
|
||||
type: text/vnd.tiddlywiki
|
||||
tags: [[Solar System]]
|
||||
|
||||
[img class=hero-image [Asteroid (253) Mathilde Image]]
|
||||
|
||||
An asteroid is a space rock. It is a small object in the [[Solar System]] that travels around the [[Sun]]. It is like a [[planet|Planet]] but smaller. They range from very small (smaller than a car) to 600 miles (1000 km) across. A few asteroids have asteroid moons.
|
||||
|
||||
The name "asteroid" means "like a star" in the ancient Greek language. Asteroids may look like small stars in the sky, but they really do move around the [[Sun]], while stars only seem to move because the [[Earth]] spins. Like [[planets|Planet]], asteroids do not make their own light. Because of this, some people think "asteroids" is not a good name, and think that the name "planetoid" ("like a planet") would be a better name.
|
||||
|
||||
Giuseppe Piazzi found the first asteroid, in 1801. He called it Ceres, and it is the biggest object in the asteroid belt. Others, like Juno, Pallas, and Vesta were found later. In the 1850s so many had been found, that they were numbered by a Minor planet designation starting with 1 Ceres. Today, astronomers using computerized telescopes find thousands of asteroids every month. Asteroid impact prediction is one of the purposes.
|
||||
|
||||
Asteroids are the leftover rock and other material from the formation of the [[Solar System]]. These rocks were too small to come together to make a [[planet|Planet]]. Some are made of carbon or metal. Depending on what's on the surface, they are classified into various asteroid spectral types including Type M (metal), Type S (stone), and Type C (carbon).
|
||||
|
||||
Most asteroids in our [[Solar System]] are in the asteroid belt between [[Mars]] and [[Jupiter]]. Many are not in the main asteroid belt. The ones that come close to [[Earth]] are called Near-Earth asteroids. Many scientists think asteroids striking the [[Earth]] killed off all the dinosaurs and caused some of the other extinction events.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
@@ -1,3 +0,0 @@
|
||||
title: Comet Image
|
||||
type: image/png
|
||||
tags: Image
|
||||
@@ -1,15 +0,0 @@
|
||||
created: 20230720113501352
|
||||
modified: 20230720113633994
|
||||
title: Comet
|
||||
type: text/vnd.tiddlywiki
|
||||
tags: [[Solar System]]
|
||||
|
||||
[img class=hero-image [Comet Image]]
|
||||
|
||||
A comet is a ball of mostly ice that moves around in outer space. Comets are often described as "dirty snowballs". They are very different from [[asteroids|Asteroid]]. The orbital inclinations of comets are usually high and not near the ecliptic where most [[solar system|Solar System]] objects are found. Most of them are long-period comets and come from the [[Kuiper belt]]. That is very far away from the [[Sun]], but some of them also come near enough to [[Earth]] for us to see at night.
|
||||
|
||||
They have long "tails", because the [[Sun]] melts the ice. A comet's tail does not trail behind it, but points directly away from the [[Sun]], because it is blown by the solar wind. The hard centre of the comet is the nucleus. It is one of the blackest things (lowest albedo) in the [[solar system|Solar System]]. When light shone on the nucleus of Halley's Comet, the comet reflected only 4% of the light back to us.
|
||||
|
||||
Periodic comets visit again and again. Non-periodic or single-apparition comets visit only once.
|
||||
|
||||
Comets sometimes break up, as Comet Biela did in the 19th century. Comet Shoemaker-Levy 9 broke up, and the pieces hit [[Jupiter]] in 1994. Some comets orbit (go around) together in groups. Astronomers think these comets are broken pieces that used to be one object.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 330 KiB |
@@ -1,3 +0,0 @@
|
||||
title: Earth Image
|
||||
type: image/png
|
||||
tags: Image
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 135 KiB |
@@ -1,3 +0,0 @@
|
||||
title: Earth's Moon Image
|
||||
type: image/png
|
||||
tags: Image
|
||||
@@ -1,10 +0,0 @@
|
||||
created: 20230720105302348
|
||||
modified: 20230720105451528
|
||||
title: Earth's Moon
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
[img class=hero-image [Earth's Moon Image]]
|
||||
|
||||
The Moon is [[Earth]]'s only natural satellite. We usually see it in the night sky and also during the day. Some other planets also have moons or natural satellites.
|
||||
|
||||
Our moon is about one-fourth of the width of the [[Earth]]. Because it is far away it looks small, about half a degree wide. The gravity on the moon is one-sixth of the [[Earth]]'s gravity. It means that something will be one-sixth as heavy on the Moon than on [[Earth]]. The Moon is a rocky and dusty place. It moves slowly away from the [[Earth]] at a rate of 3.8 cm per year, due to the effect of tidal dissipation.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user