mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-27 13:23:42 +00:00
Compare commits
1 Commits
plugin-sta
...
add-jsrepl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8663dd51d6 |
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_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||||
TW5_BUILD_OUTPUT: "./output"
|
TW5_BUILD_OUTPUT: "./output"
|
||||||
TW5_BUILD_ARCHIVE: "./output"
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,4 +8,3 @@ node_modules/
|
|||||||
/test-results/
|
/test-results/
|
||||||
/playwright-report/
|
/playwright-report/
|
||||||
/playwright/.cache/
|
/playwright/.cache/
|
||||||
$__StoryList.tid
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Default to the current version number for building the plugin library
|
# Default to the current version number for building the plugin library
|
||||||
|
|
||||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||||
TW5_BUILD_VERSION=v5.3.3
|
TW5_BUILD_VERSION=v5.3.2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
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
|
# /index.html Main site
|
||||||
# /favicon.ico Favicon for main site
|
# /favicon.ico Favicon for main site
|
||||||
# /static.html Static rendering of default tiddlers
|
# /static.html Static rendering of default tiddlers
|
||||||
@@ -112,7 +95,6 @@ fi
|
|||||||
# /static/* Static single tiddlers
|
# /static/* Static single tiddlers
|
||||||
# /static/static.css Static stylesheet
|
# /static/static.css Static stylesheet
|
||||||
# /static/favicon.ico Favicon for static pages
|
# /static/favicon.ico Favicon for static pages
|
||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
--verbose \
|
--verbose \
|
||||||
@@ -156,28 +138,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--build index favicon static \
|
--build index favicon static \
|
||||||
|| exit 1
|
|| 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
|
# /share.html Custom edition for sharing via the URL
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/share \
|
./editions/share \
|
||||||
|
|||||||
40
boot/boot.js
40
boot/boot.js
@@ -177,7 +177,6 @@ document: defaults to current document
|
|||||||
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
|
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
|
||||||
*/
|
*/
|
||||||
$tw.utils.domMaker = function(tag,options) {
|
$tw.utils.domMaker = function(tag,options) {
|
||||||
var options = options || {};
|
|
||||||
var doc = options.document || document;
|
var doc = options.document || document;
|
||||||
var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
|
var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
|
||||||
if(options["class"]) {
|
if(options["class"]) {
|
||||||
@@ -219,34 +218,9 @@ $tw.utils.error = function(err) {
|
|||||||
heading = dm("h1",{text: errHeading}),
|
heading = dm("h1",{text: errHeading}),
|
||||||
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
||||||
message = dm("div",{text: err, "class":"tc-error-message"}),
|
message = dm("div",{text: err, "class":"tc-error-message"}),
|
||||||
closeButton = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
||||||
downloadButton = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "download tiddlers" : $tw.language.getString("Buttons/EmergencyDownload/Caption") )})], "class": "tc-error-prompt"}),
|
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"});
|
||||||
form = dm("form",{children: [heading,prompt,downloadButton,message,closeButton], "class": "tc-error-form"});
|
|
||||||
document.body.insertBefore(form,document.body.firstChild);
|
document.body.insertBefore(form,document.body.firstChild);
|
||||||
downloadButton.addEventListener("click",function(event) {
|
|
||||||
if($tw && $tw.wiki) {
|
|
||||||
var tiddlers = [];
|
|
||||||
$tw.wiki.each(function(tiddler,title) {
|
|
||||||
tiddlers.push(tiddler.fields);
|
|
||||||
});
|
|
||||||
var link = dm("a"),
|
|
||||||
text = JSON.stringify(tiddlers);
|
|
||||||
if(Blob !== undefined) {
|
|
||||||
var blob = new Blob([text], {type: "text/html"});
|
|
||||||
link.setAttribute("href", URL.createObjectURL(blob));
|
|
||||||
} else {
|
|
||||||
link.setAttribute("href","data:text/html," + encodeURIComponent(text));
|
|
||||||
}
|
|
||||||
link.setAttribute("download","emergency-tiddlers-" + (new Date()) + ".json");
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
document.body.removeChild(link);
|
|
||||||
} else {
|
|
||||||
alert("Emergency tiddler download is not available");
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
return false;
|
|
||||||
},true);
|
|
||||||
form.addEventListener("submit",function(event) {
|
form.addEventListener("submit",function(event) {
|
||||||
document.body.removeChild(form);
|
document.body.removeChild(form);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -812,7 +786,6 @@ $tw.utils.Crypto = function() {
|
|||||||
}
|
}
|
||||||
return outputText;
|
return outputText;
|
||||||
};
|
};
|
||||||
$tw.sjcl = sjcl;
|
|
||||||
this.setPassword = function(newPassword) {
|
this.setPassword = function(newPassword) {
|
||||||
currentPassword = newPassword;
|
currentPassword = newPassword;
|
||||||
this.updateCryptoStateTiddler();
|
this.updateCryptoStateTiddler();
|
||||||
@@ -1994,10 +1967,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
var value = tiddler[name];
|
var value = tiddler[name];
|
||||||
switch(fieldInfo.source) {
|
switch(fieldInfo.source) {
|
||||||
case "subdirectories":
|
case "subdirectories":
|
||||||
value = path.relative(rootPath, filename).split(path.sep).slice(0, -1);
|
value = path.relative(rootPath, filename).split('/').slice(0, -1);
|
||||||
break;
|
break;
|
||||||
case "filepath":
|
case "filepath":
|
||||||
value = path.relative(rootPath, filename).split(path.sep).join('/');
|
value = path.relative(rootPath, filename);
|
||||||
break;
|
break;
|
||||||
case "filename":
|
case "filename":
|
||||||
value = path.basename(filename);
|
value = path.basename(filename);
|
||||||
@@ -2465,7 +2438,6 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("application/wasm","base64",".wasm");
|
|
||||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||||
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
||||||
@@ -2480,12 +2452,8 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
||||||
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
||||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
||||||
$tw.utils.registerFileType("application/msword","base64",".doc");
|
|
||||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
||||||
$tw.utils.registerFileType("application/excel","base64",".xls");
|
|
||||||
$tw.utils.registerFileType("application/vnd.ms-excel","base64",".xls");
|
|
||||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
||||||
$tw.utils.registerFileType("application/mspowerpoint","base64",".ppt");
|
|
||||||
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
||||||
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
||||||
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type: text/plain
|
|||||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||||
|
|
||||||
Copyright (c) 2004-2007, Jeremy Ruston
|
Copyright (c) 2004-2007, Jeremy Ruston
|
||||||
Copyright (c) 2007-2024, UnaMesa Association
|
Copyright (c) 2007-2023, UnaMesa Association
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
title: $:/core/images/default-layout
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
\parameters (size:"22pt")
|
|
||||||
<svg width=<<size>> height=<<size>> class="tc-image-default-layout tc-image-button" viewBox="0 0 128 128">
|
|
||||||
<path d="M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z"/>
|
|
||||||
</svg>
|
|
||||||
@@ -28,7 +28,6 @@ Encryption/ClearPassword/Caption: clear password
|
|||||||
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
|
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
|
||||||
Encryption/SetPassword/Caption: set password
|
Encryption/SetPassword/Caption: set password
|
||||||
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
|
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
|
||||||
EmergencyDownload/Caption: download tiddlers as json
|
|
||||||
ExportPage/Caption: export all
|
ExportPage/Caption: export all
|
||||||
ExportPage/Hint: Export all tiddlers
|
ExportPage/Hint: Export all tiddlers
|
||||||
ExportTiddler/Caption: export tiddler
|
ExportTiddler/Caption: export tiddler
|
||||||
|
|||||||
@@ -206,12 +206,6 @@ Stylesheets/Caption: Stylesheets
|
|||||||
Stylesheets/Expand/Caption: Expand All
|
Stylesheets/Expand/Caption: Expand All
|
||||||
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
|
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
|
||||||
Stylesheets/Restore/Caption: Restore
|
Stylesheets/Restore/Caption: Restore
|
||||||
TestCases/Caption: Test Cases
|
|
||||||
TestCases/Hint: Test cases are self contained examples for testing and learning
|
|
||||||
TestCases/All/Caption: All Test Cases
|
|
||||||
TestCases/All/Hint: All Test Cases
|
|
||||||
TestCases/Failed/Caption: Failed Test Cases
|
|
||||||
TestCases/Failed/Hint: Only Failed Test Cases
|
|
||||||
Theme/Caption: Theme
|
Theme/Caption: Theme
|
||||||
Theme/Prompt: Current theme:
|
Theme/Prompt: Current theme:
|
||||||
TiddlerFields/Caption: Tiddler Fields
|
TiddlerFields/Caption: Tiddler Fields
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ config: Data to be inserted into `$tw.config`.
|
|||||||
filteroperator: Individual filter operator methods.
|
filteroperator: Individual filter operator methods.
|
||||||
global: Global data to be inserted into `$tw`.
|
global: Global data to be inserted into `$tw`.
|
||||||
info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin.
|
info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin.
|
||||||
isfilteroperator: Parameters for the ''is'' filter operator.
|
isfilteroperator: Operands for the ''is'' filter operator.
|
||||||
library: Generic module type for general purpose JavaScript modules.
|
library: Generic module type for general purpose JavaScript modules.
|
||||||
macro: JavaScript macro definitions.
|
macro: JavaScript macro definitions.
|
||||||
parser: Parsers for different content types.
|
parser: Parsers for different content types.
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ sidebar-tab-foreground-selected: Sidebar tab foreground for selected tabs
|
|||||||
sidebar-tab-foreground: Sidebar tab foreground
|
sidebar-tab-foreground: Sidebar tab foreground
|
||||||
sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover
|
sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover
|
||||||
sidebar-tiddler-link-foreground: Sidebar tiddler link foreground
|
sidebar-tiddler-link-foreground: Sidebar tiddler link foreground
|
||||||
testcase-accent-level-1: Test case accent colour with no nesting
|
|
||||||
testcase-accent-level-2: Test case accent colour with 2nd level nesting
|
|
||||||
testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher
|
|
||||||
site-title-foreground: Site title foreground
|
site-title-foreground: Site title foreground
|
||||||
static-alert-foreground: Static alert foreground
|
static-alert-foreground: Static alert foreground
|
||||||
tab-background-selected: Tab background for selected tabs
|
tab-background-selected: Tab background for selected tabs
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ _canonical_uri: The full URI of an external image tiddler
|
|||||||
author: Name of the author of a plugin
|
author: Name of the author of a plugin
|
||||||
bag: The name of the bag from which a tiddler came
|
bag: The name of the bag from which a tiddler came
|
||||||
caption: The text to be displayed on a tab or button
|
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''
|
code-body: The view template will display the tiddler as code if set to ''yes''
|
||||||
color: The CSS color value associated with a tiddler
|
color: The CSS color value associated with a tiddler
|
||||||
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
||||||
@@ -30,7 +29,6 @@ name: The human readable name associated with a plugin tiddler
|
|||||||
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
|
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
|
||||||
plugin-priority: A numerical value indicating the priority of a plugin tiddler
|
plugin-priority: A numerical value indicating the priority of a plugin tiddler
|
||||||
plugin-type: The type of plugin in a plugin tiddler
|
plugin-type: The type of plugin in a plugin tiddler
|
||||||
stability: The development status of a plugin: deprecated, experimental, stable, or legacy
|
|
||||||
revision: The revision of the tiddler held at the server
|
revision: The revision of the tiddler held at the server
|
||||||
released: Date of a TiddlyWiki release
|
released: Date of a TiddlyWiki release
|
||||||
source: The source URL associated with a tiddler
|
source: The source URL associated with a tiddler
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
|
|||||||
Examples
|
Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
--commands "[enlist:raw{$:/build-commands-as-text}]"
|
--commands "[enlist{$:/build-commands-as-text}]"
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Error/DeserializeOperator/UnknownDeserializer: Filter Error: Unknown deserialize
|
|||||||
Error/Filter: Filter error
|
Error/Filter: Filter error
|
||||||
Error/FilterSyntax: Syntax error in filter expression
|
Error/FilterSyntax: Syntax error in filter expression
|
||||||
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
||||||
Error/IsFilterOperator: Filter Error: Unknown parameter for the 'is' filter operator
|
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
||||||
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
||||||
Error/LoadingPluginLibrary: Error loading plugin library
|
Error/LoadingPluginLibrary: Error loading plugin library
|
||||||
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
||||||
|
|||||||
46
core/modules/commands/jsrepl.js
Normal file
46
core/modules/commands/jsrepl.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/commands/jsrepl.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: command
|
||||||
|
|
||||||
|
Command to launch node.js REPL with access to $tw
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.info = {
|
||||||
|
name: "jsrepl",
|
||||||
|
synchronous: true
|
||||||
|
};
|
||||||
|
|
||||||
|
var Command = function(params,commander,callback) {
|
||||||
|
var self = this;
|
||||||
|
this.params = params;
|
||||||
|
this.commander = commander;
|
||||||
|
this.callback = callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
Command.prototype.execute = function() {
|
||||||
|
var self = this;
|
||||||
|
var repl = require("repl");
|
||||||
|
this.runtime = repl.start({
|
||||||
|
prompt: this.params.length ? this.params[0] : "$tw-jsrepl> ",
|
||||||
|
useColors: true,
|
||||||
|
ignoreUndefined: true
|
||||||
|
});
|
||||||
|
// If REPL is reset (.clear) - context needs resetting
|
||||||
|
this.runtime.on("reset", function() {
|
||||||
|
self.runtime.context.$tw = $tw;
|
||||||
|
});
|
||||||
|
// Initial context settings
|
||||||
|
this.runtime.context.$tw = $tw;
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Command = Command;
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -18,7 +18,7 @@ exports.info = {
|
|||||||
name: "listen",
|
name: "listen",
|
||||||
synchronous: true,
|
synchronous: true,
|
||||||
namedParameterMode: true,
|
namedParameterMode: true,
|
||||||
mandatoryParameters: []
|
mandatoryParameters: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
var Command = function(params,commander,callback) {
|
var Command = function(params,commander,callback) {
|
||||||
|
|||||||
@@ -27,8 +27,33 @@ var Command = function(params,commander,callback) {
|
|||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
var wiki = this.commander.wiki,
|
var wiki = this.commander.wiki,
|
||||||
|
fs = require("fs"),
|
||||||
|
path = require("path"),
|
||||||
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
|
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
|
||||||
tiddlers = $tw.utils.getAllPlugins();
|
tiddlers = {};
|
||||||
|
// Collect up the library plugins
|
||||||
|
var collectPlugins = function(folder) {
|
||||||
|
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
|
||||||
|
for(var p=0; p<pluginFolders.length; p++) {
|
||||||
|
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
|
||||||
|
pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
|
||||||
|
if(pluginFields && pluginFields.title) {
|
||||||
|
tiddlers[pluginFields.title] = pluginFields;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
collectPublisherPlugins = function(folder) {
|
||||||
|
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
|
||||||
|
for(var t=0; t<publisherFolders.length; t++) {
|
||||||
|
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
|
||||||
|
collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins);
|
||||||
|
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins);
|
||||||
|
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins);
|
||||||
// Save the upgrade library tiddler
|
// Save the upgrade library tiddler
|
||||||
var pluginFields = {
|
var pluginFields = {
|
||||||
title: upgradeLibraryTitle,
|
title: upgradeLibraryTitle,
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
|
|||||||
directory: path.resolve(self.commander.outputPath),
|
directory: path.resolve(self.commander.outputPath),
|
||||||
pathFilters: [filenameFilter],
|
pathFilters: [filenameFilter],
|
||||||
wiki: wiki,
|
wiki: wiki,
|
||||||
fileInfo: {
|
fileInfo: {}
|
||||||
overwrite: true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if(self.commander.verbose) {
|
if(self.commander.verbose) {
|
||||||
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Command.prototype.execute = function() {
|
|||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||||
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
||||||
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
|
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -176,10 +176,7 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
|
|||||||
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
||||||
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
||||||
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
||||||
$tw.utils.each(pluginTiddlers,function(tiddler,title) {
|
$tw.utils.each(pluginTiddlers,function(tiddler) {
|
||||||
if(!tiddler.title) {
|
|
||||||
tiddler.title = title;
|
|
||||||
}
|
|
||||||
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/backtranscludes.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operator for returning all the backtranscludes from a tiddler
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.backtranscludes = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
$tw.utils.pushTop(results,options.wiki.getTiddlerBacktranscludes(title));
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -14,9 +14,12 @@ Filter operators for cryptography, using the Stanford JavaScript library
|
|||||||
|
|
||||||
exports.sha256 = function(source,operator,options) {
|
exports.sha256 = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
length = parseInt(operator.operand,10) || 20;
|
length = parseInt(operator.operand,10) || 20,
|
||||||
|
sha256 = function(text) {
|
||||||
|
return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(text)).substr(0,length);
|
||||||
|
};
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.sha256(title,{length: length}));
|
results.push(sha256(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
|
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++) {
|
for(var i=0; i<indexes.length; i++) {
|
||||||
if(item !== undefined) {
|
if(item !== undefined) {
|
||||||
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
||||||
item = getItemAtIndex(item,indexes[i]);
|
item = item[indexes[i]];
|
||||||
} else {
|
} else {
|
||||||
item = undefined;
|
item = undefined;
|
||||||
}
|
}
|
||||||
@@ -261,22 +249,17 @@ function setDataItem(data,indexes,value) {
|
|||||||
// Traverse the JSON data structure using the index chain
|
// Traverse the JSON data structure using the index chain
|
||||||
var current = data;
|
var current = data;
|
||||||
for(var i = 0; i < indexes.length - 1; i++) {
|
for(var i = 0; i < indexes.length - 1; i++) {
|
||||||
current = getItemAtIndex(current,indexes[i]);
|
var index = indexes[i];
|
||||||
if(current === undefined) {
|
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 the original JSON data structure if any of the index strings are invalid
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add the value to the end of the index chain
|
// Add the value to the end of the index chain
|
||||||
var lastIndex = indexes[indexes.length - 1];
|
var lastIndex = indexes[indexes.length - 1];
|
||||||
if($tw.utils.isArray(current)) {
|
current[lastIndex] = value;
|
||||||
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;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/transcludes.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operator for returning all the transcludes from a tiddler
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.transcludes = function(source,operator,options) {
|
|
||||||
var results = new $tw.utils.LinkedList();
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.pushTop(options.wiki.getTiddlerTranscludes(title));
|
|
||||||
});
|
|
||||||
return results.toArray();
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -202,7 +202,7 @@ Extended filter operators to manipulate the current list.
|
|||||||
}
|
}
|
||||||
if(resultsIndex !== -1) {
|
if(resultsIndex !== -1) {
|
||||||
i = i + step;
|
i = i + step;
|
||||||
nextOperandIndex = (i < opLength ? i : i % opLength);
|
nextOperandIndex = (i < opLength ? i : i - opLength);
|
||||||
if(operands.length > 1) {
|
if(operands.length > 1) {
|
||||||
results.splice(resultsIndex,1,operands[nextOperandIndex]);
|
results.splice(resultsIndex,1,operands[nextOperandIndex]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/indexers/back-indexer.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: indexer
|
|
||||||
|
|
||||||
By parsing the tiddler text, indexes the tiddlers' back links, back transclusions, block level back links.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
function BackIndexer(wiki) {
|
|
||||||
this.wiki = wiki;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackIndexer.prototype.init = function() {
|
|
||||||
this.subIndexers = {
|
|
||||||
link: new BackSubIndexer(this,"extractLinks"),
|
|
||||||
transclude: new BackSubIndexer(this,"extractTranscludes"),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
BackIndexer.prototype.rebuild = function() {
|
|
||||||
$tw.utils.each(this.subIndexers,function(subIndexer) {
|
|
||||||
subIndexer.rebuild();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
BackIndexer.prototype.update = function(updateDescriptor) {
|
|
||||||
$tw.utils.each(this.subIndexers,function(subIndexer) {
|
|
||||||
subIndexer.update(updateDescriptor);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
function BackSubIndexer(indexer,extractor) {
|
|
||||||
this.wiki = indexer.wiki;
|
|
||||||
this.indexer = indexer;
|
|
||||||
this.extractor = extractor;
|
|
||||||
/**
|
|
||||||
* {
|
|
||||||
* [target title, e.g. tiddler title being linked to]:
|
|
||||||
* {
|
|
||||||
* [source title, e.g. tiddler title that has link syntax in its text]: true
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
this.index = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.init = function() {
|
|
||||||
// lazy init until first lookup
|
|
||||||
this.index = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype._init = function() {
|
|
||||||
this.index = Object.create(null);
|
|
||||||
var self = this;
|
|
||||||
this.wiki.forEachTiddler(function(sourceTitle,tiddler) {
|
|
||||||
var newTargets = self._getTarget(tiddler);
|
|
||||||
$tw.utils.each(newTargets, function(target) {
|
|
||||||
if(!self.index[target]) {
|
|
||||||
self.index[target] = Object.create(null);
|
|
||||||
}
|
|
||||||
self.index[target][sourceTitle] = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.rebuild = function() {
|
|
||||||
this.index = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get things that is being referenced in the text, e.g. tiddler names in the link syntax.
|
|
||||||
*/
|
|
||||||
BackSubIndexer.prototype._getTarget = function(tiddler) {
|
|
||||||
var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {});
|
|
||||||
if(parser) {
|
|
||||||
return this.wiki[this.extractor](parser.tree);
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.update = function(updateDescriptor) {
|
|
||||||
// lazy init/update until first lookup
|
|
||||||
if(!this.index) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var newTargets = [],
|
|
||||||
oldTargets = [],
|
|
||||||
self = this;
|
|
||||||
if(updateDescriptor.old.exists) {
|
|
||||||
oldTargets = this._getTarget(updateDescriptor.old.tiddler);
|
|
||||||
}
|
|
||||||
if(updateDescriptor.new.exists) {
|
|
||||||
newTargets = this._getTarget(updateDescriptor.new.tiddler);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tw.utils.each(oldTargets,function(target) {
|
|
||||||
if(self.index[target]) {
|
|
||||||
delete self.index[target][updateDescriptor.old.tiddler.fields.title];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$tw.utils.each(newTargets,function(target) {
|
|
||||||
if(!self.index[target]) {
|
|
||||||
self.index[target] = Object.create(null);
|
|
||||||
}
|
|
||||||
self.index[target][updateDescriptor.new.tiddler.fields.title] = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.lookup = function(title) {
|
|
||||||
if(!this.index) {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
if(this.index[title]) {
|
|
||||||
return Object.keys(this.index[title]);
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.BackIndexer = BackIndexer;
|
|
||||||
86
core/modules/indexers/backlinks-index.js
Normal file
86
core/modules/indexers/backlinks-index.js
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/indexers/backlinks-indexer.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: indexer
|
||||||
|
|
||||||
|
Indexes the tiddlers' backlinks
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global modules: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
|
function BacklinksIndexer(wiki) {
|
||||||
|
this.wiki = wiki;
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.init = function() {
|
||||||
|
this.index = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.rebuild = function() {
|
||||||
|
this.index = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype._getLinks = function(tiddler) {
|
||||||
|
var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {});
|
||||||
|
if(parser) {
|
||||||
|
return this.wiki.extractLinks(parser.tree);
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.update = function(updateDescriptor) {
|
||||||
|
if(!this.index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var newLinks = [],
|
||||||
|
oldLinks = [],
|
||||||
|
self = this;
|
||||||
|
if(updateDescriptor.old.exists) {
|
||||||
|
oldLinks = this._getLinks(updateDescriptor.old.tiddler);
|
||||||
|
}
|
||||||
|
if(updateDescriptor.new.exists) {
|
||||||
|
newLinks = this._getLinks(updateDescriptor.new.tiddler);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tw.utils.each(oldLinks,function(link) {
|
||||||
|
if(self.index[link]) {
|
||||||
|
delete self.index[link][updateDescriptor.old.tiddler.fields.title];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$tw.utils.each(newLinks,function(link) {
|
||||||
|
if(!self.index[link]) {
|
||||||
|
self.index[link] = Object.create(null);
|
||||||
|
}
|
||||||
|
self.index[link][updateDescriptor.new.tiddler.fields.title] = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.lookup = function(title) {
|
||||||
|
if(!this.index) {
|
||||||
|
this.index = Object.create(null);
|
||||||
|
var self = this;
|
||||||
|
this.wiki.forEachTiddler(function(title,tiddler) {
|
||||||
|
var links = self._getLinks(tiddler);
|
||||||
|
$tw.utils.each(links, function(link) {
|
||||||
|
if(!self.index[link]) {
|
||||||
|
self.index[link] = Object.create(null);
|
||||||
|
}
|
||||||
|
self.index[link][title] = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(this.index[title]) {
|
||||||
|
return Object.keys(this.index[title]);
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.BacklinksIndexer = BacklinksIndexer;
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -35,11 +35,9 @@ exports.run = function(filter,format) {
|
|||||||
// Collect all the fields
|
// Collect all the fields
|
||||||
for(t=0;t<tiddlers.length; t++) {
|
for(t=0;t<tiddlers.length; t++) {
|
||||||
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
||||||
if(tiddler) {
|
for(f in tiddler.fields) {
|
||||||
for(f in tiddler.fields) {
|
if(fields.indexOf(f) === -1) {
|
||||||
if(fields.indexOf(f) === -1) {
|
fields.push(f);
|
||||||
fields.push(f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,10 +60,8 @@ exports.run = function(filter,format) {
|
|||||||
for(var t=0;t<tiddlers.length; t++) {
|
for(var t=0;t<tiddlers.length; t++) {
|
||||||
row = [];
|
row = [];
|
||||||
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
||||||
if(tiddler) {
|
for(f=0; f<fields.length; f++) {
|
||||||
for(f=0; f<fields.length; f++) {
|
row.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || "" : ""));
|
||||||
row.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || "" : ""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
output.push(row.join(","));
|
output.push(row.join(","));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,10 @@ The plain text parser processes blocks of source text into a degenerate parse tr
|
|||||||
|
|
||||||
var TextParser = function(type,text,options) {
|
var TextParser = function(type,text,options) {
|
||||||
this.tree = [{
|
this.tree = [{
|
||||||
type: "genesis",
|
type: "codeblock",
|
||||||
attributes: {
|
attributes: {
|
||||||
$type: {name: "$type", type: "string", value: "$codeblock"},
|
code: {type: "string", value: text},
|
||||||
code: {name: "code", type: "string", value: text},
|
language: {type: "string", value: type}
|
||||||
language: {name: "language", type: "string", value: type},
|
|
||||||
$remappable: {name: "$remappable", type:"string", value: "no"}
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
this.source = text;
|
this.source = text;
|
||||||
@@ -34,3 +32,4 @@ exports["text/css"] = TextParser;
|
|||||||
exports["application/x-tiddler-dictionary"] = TextParser;
|
exports["application/x-tiddler-dictionary"] = TextParser;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ exports.parse = function() {
|
|||||||
if(this.match[3]) {
|
if(this.match[3]) {
|
||||||
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
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;
|
var reEnd;
|
||||||
if(this.match[5]) {
|
if(this.match[5]) {
|
||||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
// 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");
|
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ exports.parse = function() {
|
|||||||
paramMatch = reParam.exec(paramString);
|
paramMatch = reParam.exec(paramString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Is the remainder of the \define line blank after the parameter close paren?
|
// Is this a multiline definition?
|
||||||
var reEnd;
|
var reEnd;
|
||||||
if(this.match[3]) {
|
if(this.match[3]) {
|
||||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
// 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");
|
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
|||||||
@@ -3,7 +3,30 @@ title: $:/core/modules/parsers/wikiparser/rules/quoteblock.js
|
|||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikirule
|
||||||
|
|
||||||
Wiki text rule for quote blocks.
|
Wiki text rule for quote blocks. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
<<<.optionalClass(es) optional cited from
|
||||||
|
a quote
|
||||||
|
<<<
|
||||||
|
|
||||||
|
<<<.optionalClass(es)
|
||||||
|
a quote
|
||||||
|
<<< optional cited from
|
||||||
|
```
|
||||||
|
|
||||||
|
Quotes can be quoted by putting more <s
|
||||||
|
|
||||||
|
```
|
||||||
|
<<<
|
||||||
|
Quote Level 1
|
||||||
|
|
||||||
|
<<<<
|
||||||
|
QuoteLevel 2
|
||||||
|
<<<<
|
||||||
|
|
||||||
|
<<<
|
||||||
|
```
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -24,15 +47,16 @@ exports.init = function(parser) {
|
|||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
var classes = ["tc-quote"];
|
var classes = ["tc-quote"];
|
||||||
// Get all the details of the match
|
// Get all the details of the match
|
||||||
var reEndString = "^\\s*" + this.match[1] + "(?!<)";
|
var reEndString = "^" + this.match[1] + "(?!<)";
|
||||||
// Move past the <s
|
// Move past the <s
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
|
|
||||||
// Parse any classes, whitespace and then the optional cite itself
|
// Parse any classes, whitespace and then the optional cite itself
|
||||||
classes.push.apply(classes, this.parser.parseClasses());
|
classes.push.apply(classes, this.parser.parseClasses());
|
||||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||||
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||||
// before handling the cite, parse the body of the quote
|
// before handling the cite, parse the body of the quote
|
||||||
var tree = this.parser.parseBlocks(reEndString);
|
var tree= this.parser.parseBlocks(reEndString);
|
||||||
// If we got a cite, put it before the text
|
// If we got a cite, put it before the text
|
||||||
if(cite.length > 0) {
|
if(cite.length > 0) {
|
||||||
tree.unshift({
|
tree.unshift({
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ exports.parse = function() {
|
|||||||
}
|
}
|
||||||
return [tiddlerNode];
|
return [tiddlerNode];
|
||||||
} else {
|
} 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];
|
return [transcludeNode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ exports.parse = function() {
|
|||||||
}
|
}
|
||||||
return [tiddlerNode];
|
return [tiddlerNode];
|
||||||
} else {
|
} 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];
|
return [transcludeNode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,8 +216,6 @@ WikiParser.prototype.parsePragmas = function() {
|
|||||||
subTree[0].children = [];
|
subTree[0].children = [];
|
||||||
currentTreeBranch = subTree[0].children;
|
currentTreeBranch = subTree[0].children;
|
||||||
}
|
}
|
||||||
// Skip whitespace after the pragma
|
|
||||||
this.skipWhitespace();
|
|
||||||
}
|
}
|
||||||
return currentTreeBranch;
|
return currentTreeBranch;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -140,11 +140,6 @@ function sendResponse(request,response,statusCode,headers,data,encoding) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// RFC 7231, 6.1. Overview of Status Codes:
|
|
||||||
// Browser clients may cache 200, 203, 204, 206, 300, 301,
|
|
||||||
// 404, 405, 410, 414, and 501 unless given explicit cache controls
|
|
||||||
headers["Cache-Control"] = headers["Cache-Control"] || "no-store";
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
If the gzip=yes is set, check if the user agent permits compression. If so,
|
If the gzip=yes is set, check if the user agent permits compression. If so,
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ exports.startup = function() {
|
|||||||
deferredChanges = Object.create(null);
|
deferredChanges = Object.create(null);
|
||||||
$tw.hooks.invokeHook("th-page-refreshed");
|
$tw.hooks.invokeHook("th-page-refreshed");
|
||||||
}
|
}
|
||||||
var throttledRefresh = $tw.perf.report("throttledRefresh",refresh);
|
|
||||||
|
|
||||||
// Add the change event handler
|
// Add the change event handler
|
||||||
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
||||||
// Check if only tiddlers that are throttled have changed
|
// Check if only tiddlers that are throttled have changed
|
||||||
@@ -103,7 +101,7 @@ exports.startup = function() {
|
|||||||
if(isNaN(timeout)) {
|
if(isNaN(timeout)) {
|
||||||
timeout = THROTTLE_REFRESH_TIMEOUT;
|
timeout = THROTTLE_REFRESH_TIMEOUT;
|
||||||
}
|
}
|
||||||
timerId = setTimeout(throttledRefresh,timeout);
|
timerId = setTimeout(refresh,timeout);
|
||||||
$tw.utils.extend(deferredChanges,changes);
|
$tw.utils.extend(deferredChanges,changes);
|
||||||
} else {
|
} else {
|
||||||
$tw.utils.extend(deferredChanges,changes);
|
$tw.utils.extend(deferredChanges,changes);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ exports.startup = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Initialise the document
|
// Initialise the document
|
||||||
srcDocument.write("<!DOCTYPE html><head></head><body class='tc-body tc-single-tiddler-window'></body></html>");
|
srcDocument.write("<html><head></head><body class='tc-body tc-single-tiddler-window'></body></html>");
|
||||||
srcDocument.close();
|
srcDocument.close();
|
||||||
srcDocument.title = windowTitle;
|
srcDocument.title = windowTitle;
|
||||||
srcWindow.addEventListener("beforeunload",function(event) {
|
srcWindow.addEventListener("beforeunload",function(event) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
|
|||||||
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
|
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
|
||||||
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
|
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
|
||||||
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
|
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
|
||||||
Syncer.prototype.taskTimerInterval = 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.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...
|
||||||
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
|
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
|
||||||
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
|
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
|
||||||
@@ -74,11 +74,9 @@ function Syncer(options) {
|
|||||||
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
|
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
|
||||||
// Timers
|
// Timers
|
||||||
this.taskTimerId = null; // Timer for task dispatch
|
this.taskTimerId = null; // Timer for task dispatch
|
||||||
|
this.pollTimerId = null; // Timer for polling server
|
||||||
// Number of outstanding requests
|
// Number of outstanding requests
|
||||||
this.numTasksInProgress = 0;
|
this.numTasksInProgress = 0;
|
||||||
// True when we want to force an immediate sync from the server
|
|
||||||
this.forceSyncFromServer = false;
|
|
||||||
this.timestampLastSyncFromServer = new Date();
|
|
||||||
// Listen out for changes to tiddlers
|
// Listen out for changes to tiddlers
|
||||||
this.wiki.addEventListener("change",function(changes) {
|
this.wiki.addEventListener("change",function(changes) {
|
||||||
// Filter the changes to just include ones that are being synced
|
// Filter the changes to just include ones that are being synced
|
||||||
@@ -205,37 +203,33 @@ Syncer.prototype.readTiddlerInfo = function() {
|
|||||||
Checks whether the wiki is dirty (ie the window shouldn't be closed)
|
Checks whether the wiki is dirty (ie the window shouldn't be closed)
|
||||||
*/
|
*/
|
||||||
Syncer.prototype.isDirty = function() {
|
Syncer.prototype.isDirty = function() {
|
||||||
var self = this;
|
this.logger.log("Checking dirty status");
|
||||||
function checkIsDirty() {
|
// Check tiddlers that are in the store and included in the filter function
|
||||||
// Check tiddlers that are in the store and included in the filter function
|
var titles = this.getSyncedTiddlers();
|
||||||
var titles = self.getSyncedTiddlers();
|
for(var index=0; index<titles.length; index++) {
|
||||||
for(var index=0; index<titles.length; index++) {
|
var title = titles[index],
|
||||||
var title = titles[index],
|
tiddlerInfo = this.tiddlerInfo[title];
|
||||||
tiddlerInfo = self.tiddlerInfo[title];
|
if(this.wiki.tiddlerExists(title)) {
|
||||||
if(self.wiki.tiddlerExists(title)) {
|
if(tiddlerInfo) {
|
||||||
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 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) {
|
||||||
if(self.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If the tiddler isn't known on the server then it needs to be saved to the server
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
// If the tiddler isn't known on the server then it needs to be saved to the server
|
||||||
// Check tiddlers that are known from the server but not currently in the store
|
|
||||||
titles = Object.keys(self.tiddlerInfo);
|
|
||||||
for(index=0; index<titles.length; index++) {
|
|
||||||
if(!self.wiki.tiddlerExists(titles[index])) {
|
|
||||||
// There must be a pending delete
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
var dirtyStatus = checkIsDirty();
|
// Check tiddlers that are known from the server but not currently in the store
|
||||||
return dirtyStatus;
|
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
|
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
|
||||||
*/
|
*/
|
||||||
Syncer.prototype.syncFromServer = function() {
|
Syncer.prototype.syncFromServer = function() {
|
||||||
if(this.canSyncFromServer()) {
|
var self = this,
|
||||||
this.forceSyncFromServer = true;
|
cancelNextSync = function() {
|
||||||
this.processTaskQueue();
|
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
|
Force load a tiddler from the server
|
||||||
*/
|
*/
|
||||||
@@ -440,7 +510,7 @@ Syncer.prototype.processTaskQueue = function() {
|
|||||||
} else {
|
} else {
|
||||||
self.updateDirtyStatus();
|
self.updateDirtyStatus();
|
||||||
// Process the next task
|
// Process the next task
|
||||||
self.processTaskQueue.call(self);
|
self.processTaskQueue.call(self);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -448,39 +518,31 @@ Syncer.prototype.processTaskQueue = function() {
|
|||||||
this.updateDirtyStatus();
|
this.updateDirtyStatus();
|
||||||
// And trigger a timeout if there is a pending task
|
// And trigger a timeout if there is a pending task
|
||||||
if(task === true) {
|
if(task === true) {
|
||||||
this.triggerTimeout(this.taskTimerInterval);
|
this.triggerTimeout();
|
||||||
} else if(this.canSyncFromServer()) {
|
|
||||||
this.triggerTimeout(this.pollTimerInterval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.updateDirtyStatus();
|
this.updateDirtyStatus();
|
||||||
this.triggerTimeout(this.taskTimerInterval);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Syncer.prototype.triggerTimeout = function(interval) {
|
Syncer.prototype.triggerTimeout = function(interval) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if(this.taskTimerId) {
|
if(!this.taskTimerId) {
|
||||||
clearTimeout(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:
|
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
|
||||||
* a task object
|
|
||||||
* the boolean true if there are pending sync tasks that aren't yet due
|
|
||||||
* null if there's no pending sync tasks (just the next poll)
|
|
||||||
*/
|
*/
|
||||||
Syncer.prototype.chooseNextTask = function() {
|
Syncer.prototype.chooseNextTask = function() {
|
||||||
var now = new Date(),
|
var thresholdLastSaved = (new Date()) - this.throttleInterval,
|
||||||
thresholdLastSaved = now - this.throttleInterval,
|
|
||||||
havePending = null;
|
havePending = null;
|
||||||
// First we look for tiddlers that have been modified locally and need saving back to the server
|
// First we look for tiddlers that have been modified locally and need saving back to the server
|
||||||
var titles = this.getSyncedTiddlers();
|
var titles = this.getSyncedTiddlers();
|
||||||
@@ -494,18 +556,14 @@ Syncer.prototype.chooseNextTask = function() {
|
|||||||
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
||||||
if(hasChanged) {
|
if(hasChanged) {
|
||||||
if(isReadyToSave) {
|
if(isReadyToSave) {
|
||||||
return new SaveTiddlerTask(this,title);
|
return new SaveTiddlerTask(this,title);
|
||||||
} else {
|
} else {
|
||||||
havePending = true;
|
havePending = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Second we check for an outstanding sync from server
|
// Second, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server
|
||||||
if(this.forceSyncFromServer || (this.timestampLastSyncFromServer && (now.valueOf() >= (this.timestampLastSyncFromServer.valueOf() + this.pollTimerInterval)))) {
|
|
||||||
return new SyncFromServerTask(this);
|
|
||||||
}
|
|
||||||
// Third, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server
|
|
||||||
titles = Object.keys(this.tiddlerInfo);
|
titles = Object.keys(this.tiddlerInfo);
|
||||||
for(index=0; index<titles.length; index++) {
|
for(index=0; index<titles.length; index++) {
|
||||||
title = titles[index];
|
title = titles[index];
|
||||||
@@ -515,13 +573,13 @@ Syncer.prototype.chooseNextTask = function() {
|
|||||||
return new DeleteTiddlerTask(this,title);
|
return new DeleteTiddlerTask(this,title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Finally, check for tiddlers that need loading
|
// Check for tiddlers that need loading
|
||||||
title = Object.keys(this.titlesToBeLoaded)[0];
|
title = Object.keys(this.titlesToBeLoaded)[0];
|
||||||
if(title) {
|
if(title) {
|
||||||
delete this.titlesToBeLoaded[title];
|
delete this.titlesToBeLoaded[title];
|
||||||
return new LoadTiddlerTask(this,title);
|
return new LoadTiddlerTask(this,title);
|
||||||
}
|
}
|
||||||
// No tasks are ready now, but might be in the future
|
// No tasks are ready
|
||||||
return havePending;
|
return havePending;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -531,10 +589,6 @@ function SaveTiddlerTask(syncer,title) {
|
|||||||
this.type = "save";
|
this.type = "save";
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveTiddlerTask.prototype.toString = function() {
|
|
||||||
return "SAVE " + this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveTiddlerTask.prototype.run = function(callback) {
|
SaveTiddlerTask.prototype.run = function(callback) {
|
||||||
var self = this,
|
var self = this,
|
||||||
changeCount = this.syncer.wiki.getChangeCount(this.title),
|
changeCount = this.syncer.wiki.getChangeCount(this.title),
|
||||||
@@ -559,6 +613,7 @@ SaveTiddlerTask.prototype.run = function(callback) {
|
|||||||
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.syncer.logger.log(" Not Dispatching 'save' task:",this.title,"tiddler does not exist");
|
||||||
$tw.utils.nextTick(callback(null));
|
$tw.utils.nextTick(callback(null));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -569,10 +624,6 @@ function DeleteTiddlerTask(syncer,title) {
|
|||||||
this.type = "delete";
|
this.type = "delete";
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteTiddlerTask.prototype.toString = function() {
|
|
||||||
return "DELETE " + this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteTiddlerTask.prototype.run = function(callback) {
|
DeleteTiddlerTask.prototype.run = function(callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.syncer.logger.log("Dispatching 'delete' task:",this.title);
|
this.syncer.logger.log("Dispatching 'delete' task:",this.title);
|
||||||
@@ -596,10 +647,6 @@ function LoadTiddlerTask(syncer,title) {
|
|||||||
this.type = "load";
|
this.type = "load";
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadTiddlerTask.prototype.toString = function() {
|
|
||||||
return "LOAD " + this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadTiddlerTask.prototype.run = function(callback) {
|
LoadTiddlerTask.prototype.run = function(callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.syncer.logger.log("Dispatching 'load' task:",this.title);
|
this.syncer.logger.log("Dispatching 'load' task:",this.title);
|
||||||
@@ -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;
|
exports.Syncer = Syncer;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|||||||
variables["dom-" + attribute.name] = attribute.value.toString();
|
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
|
// Add variables with a (relative and absolute) popup coordinate string for the selected node
|
||||||
var nodeRect = {
|
var nodeRect = {
|
||||||
left: selectedNode.offsetLeft,
|
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-width"] = domNode.offsetWidth.toString();
|
||||||
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
|
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event && ("clientX" in event) && ("clientY" in event)) {
|
if(event && event.clientX && event.clientY) {
|
||||||
if(selectedNode) {
|
if(selectedNode) {
|
||||||
// Add variables for event X and Y position relative to selected node
|
// Add variables for event X and Y position relative to selected node
|
||||||
selectedNodeRect = selectedNode.getBoundingClientRect();
|
selectedNodeRect = selectedNode.getBoundingClientRect();
|
||||||
|
|||||||
@@ -283,13 +283,13 @@ exports.httpRequest = function(options) {
|
|||||||
// Set up the state change handler
|
// Set up the state change handler
|
||||||
request.onreadystatechange = function() {
|
request.onreadystatechange = function() {
|
||||||
if(this.readyState === 4) {
|
if(this.readyState === 4) {
|
||||||
if(this.status >= 200 && this.status < 300) {
|
if(this.status === 200 || this.status === 201 || this.status === 204) {
|
||||||
// Success!
|
// Success!
|
||||||
options.callback(null,this[returnProp],this);
|
options.callback(null,this[returnProp],this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Something went wrong
|
// Something went wrong
|
||||||
options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,this[returnProp],this);
|
options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Handle progress
|
// Handle progress
|
||||||
|
|||||||
@@ -104,11 +104,7 @@ TW_Element.prototype.setAttribute = function(name,value) {
|
|||||||
if(this.isRaw) {
|
if(this.isRaw) {
|
||||||
throw "Cannot setAttribute on a raw TW_Element";
|
throw "Cannot setAttribute on a raw TW_Element";
|
||||||
}
|
}
|
||||||
if(name === "style") {
|
this.attributes[name] = value + "";
|
||||||
this.style = value;
|
|
||||||
} else {
|
|
||||||
this.attributes[name] = value + "";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TW_Element.prototype.setAttributeNS = function(namespace,name,value) {
|
TW_Element.prototype.setAttributeNS = function(namespace,name,value) {
|
||||||
|
|||||||
@@ -316,13 +316,11 @@ Options include:
|
|||||||
pathFilters: optional array of filters to be used to generate the base path
|
pathFilters: optional array of filters to be used to generate the base path
|
||||||
wiki: optional wiki for evaluating the pathFilters
|
wiki: optional wiki for evaluating the pathFilters
|
||||||
fileInfo: an existing fileInfo object to check against
|
fileInfo: an existing fileInfo object to check against
|
||||||
fileInfo.overwrite: if true, turns off filename clash numbers (defaults to false)
|
|
||||||
*/
|
*/
|
||||||
exports.generateTiddlerFilepath = function(title,options) {
|
exports.generateTiddlerFilepath = function(title,options) {
|
||||||
var directory = options.directory || "",
|
var directory = options.directory || "",
|
||||||
extension = options.extension || "",
|
extension = options.extension || "",
|
||||||
originalpath = (options.fileInfo && options.fileInfo.originalpath) ? options.fileInfo.originalpath : "",
|
originalpath = (options.fileInfo && options.fileInfo.originalpath) ? options.fileInfo.originalpath : "",
|
||||||
overwrite = options.fileInfo && options.fileInfo.overwrite || false,
|
|
||||||
filepath;
|
filepath;
|
||||||
// Check if any of the pathFilters applies
|
// Check if any of the pathFilters applies
|
||||||
if(options.pathFilters && options.wiki) {
|
if(options.pathFilters && options.wiki) {
|
||||||
@@ -383,20 +381,19 @@ exports.generateTiddlerFilepath = function(title,options) {
|
|||||||
filepath += char.charCodeAt(0).toString();
|
filepath += char.charCodeAt(0).toString();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Add a uniquifier if the file already exists (default)
|
// Add a uniquifier if the file already exists
|
||||||
var fullPath = path.resolve(directory, filepath + extension);
|
var fullPath, oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,
|
||||||
if (!overwrite) {
|
|
||||||
var oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,
|
|
||||||
count = 0;
|
count = 0;
|
||||||
do {
|
do {
|
||||||
fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension);
|
fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension);
|
||||||
if(oldPath && oldPath == fullPath) break;
|
if(oldPath && oldPath == fullPath) {
|
||||||
count++;
|
break;
|
||||||
} while(fs.existsSync(fullPath));
|
}
|
||||||
}
|
count++;
|
||||||
|
} while(fs.existsSync(fullPath));
|
||||||
// If the last write failed with an error, or if path does not start with:
|
// If the last write failed with an error, or if path does not start with:
|
||||||
// the resolved options.directory, the resolved wikiPath directory, the wikiTiddlersPath directory,
|
// the resolved options.directory, the resolved wikiPath directory, the wikiTiddlersPath directory,
|
||||||
// or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to options.directory.
|
// or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to tiddler directory.
|
||||||
var writePath = $tw.hooks.invokeHook("th-make-tiddler-path",fullPath,fullPath),
|
var writePath = $tw.hooks.invokeHook("th-make-tiddler-path",fullPath,fullPath),
|
||||||
encode = (options.fileInfo || {writeError: false}).writeError == true;
|
encode = (options.fileInfo || {writeError: false}).writeError == true;
|
||||||
if(!encode) {
|
if(!encode) {
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/utils/repository.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: utils
|
|
||||||
|
|
||||||
Utilities for working with the TiddlyWiki repository file structure
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Get an object containing all the plugins as a hashmap by title of the JSON representation of the plugin
|
|
||||||
*/
|
|
||||||
exports.getAllPlugins = function() {
|
|
||||||
var fs = require("fs"),
|
|
||||||
path = require("path"),
|
|
||||||
tiddlers = {};
|
|
||||||
// Collect up the library plugins
|
|
||||||
var collectPlugins = function(folder) {
|
|
||||||
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
|
|
||||||
for(var p=0; p<pluginFolders.length; p++) {
|
|
||||||
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
|
|
||||||
var pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
|
|
||||||
if(pluginFields && pluginFields.title) {
|
|
||||||
tiddlers[pluginFields.title] = pluginFields;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
collectPublisherPlugins = function(folder) {
|
|
||||||
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
|
|
||||||
for(var t=0; t<publisherFolders.length; t++) {
|
|
||||||
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
|
|
||||||
collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins);
|
|
||||||
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins);
|
|
||||||
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins);
|
|
||||||
return tiddlers;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -819,15 +819,6 @@ exports.hashString = function(str) {
|
|||||||
},0);
|
},0);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Cryptographic hash function as used by sha256 filter operator
|
|
||||||
options.length .. number of characters returned defaults to 64
|
|
||||||
*/
|
|
||||||
exports.sha256 = function(str, options) {
|
|
||||||
options = options || {}
|
|
||||||
return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(str)).substr(0,options.length || 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Base64 utility functions that work in either browser or Node.js
|
Base64 utility functions that work in either browser or Node.js
|
||||||
*/
|
*/
|
||||||
@@ -931,7 +922,7 @@ IE does not have sign function
|
|||||||
*/
|
*/
|
||||||
exports.sign = Math.sign || function(x) {
|
exports.sign = Math.sign || function(x) {
|
||||||
x = +x; // convert to a number
|
x = +x; // convert to a number
|
||||||
if(x === 0 || isNaN(x)) {
|
if (x === 0 || isNaN(x)) {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
return x > 0 ? 1 : -1;
|
return x > 0 ? 1 : -1;
|
||||||
@@ -944,7 +935,7 @@ exports.strEndsWith = function(str,ending,position) {
|
|||||||
if(str.endsWith) {
|
if(str.endsWith) {
|
||||||
return str.endsWith(ending,position);
|
return str.endsWith(ending,position);
|
||||||
} else {
|
} else {
|
||||||
if(typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) {
|
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) {
|
||||||
position = str.length;
|
position = str.length;
|
||||||
}
|
}
|
||||||
position -= ending.length;
|
position -= ending.length;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ Compute the internal state of the widget
|
|||||||
DeleteFieldWidget.prototype.execute = function() {
|
DeleteFieldWidget.prototype.execute = function() {
|
||||||
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
||||||
this.actionField = this.getAttribute("$field",null);
|
this.actionField = this.getAttribute("$field",null);
|
||||||
this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -70,15 +69,11 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
|||||||
$tw.utils.each(this.attributes,function(attribute,name) {
|
$tw.utils.each(this.attributes,function(attribute,name) {
|
||||||
if(name.charAt(0) !== "$" && name !== "title") {
|
if(name.charAt(0) !== "$" && name !== "title") {
|
||||||
removeFields[name] = undefined;
|
removeFields[name] = undefined;
|
||||||
if(name in tiddler.fields) {
|
hasChanged = true;
|
||||||
hasChanged = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(hasChanged) {
|
if(hasChanged) {
|
||||||
var creationFields = this.actionTimestamp ? this.wiki.getCreationFields() : {};
|
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));
|
||||||
var modificationFields = this.actionTimestamp ? this.wiki.getModificationFields() : {};
|
|
||||||
this.wiki.addTiddler(new $tw.Tiddler(creationFields,tiddler,removeFields,modificationFields));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true; // Action was invoked
|
return true; // Action was invoked
|
||||||
|
|||||||
@@ -70,11 +70,6 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},false);
|
},false);
|
||||||
// Assign data- attributes
|
|
||||||
this.assignAttributes(domNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Insert element
|
// Insert element
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
@@ -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
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
*/
|
*/
|
||||||
BrowseWidget.prototype.refresh = function(changedTiddlers) {
|
BrowseWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
|
||||||
if($tw.utils.count(changedAttributes) > 0) {
|
|
||||||
this.refreshSelf();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,11 +59,6 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
$tw.utils.pushTop(classes,"tc-popup-handle");
|
$tw.utils.pushTop(classes,"tc-popup-handle");
|
||||||
}
|
}
|
||||||
domNode.className = classes.join(" ");
|
domNode.className = classes.join(" ");
|
||||||
// Assign data- attributes
|
|
||||||
this.assignAttributes(domNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Assign other attributes
|
// Assign other attributes
|
||||||
if(this.style) {
|
if(this.style) {
|
||||||
domNode.setAttribute("style",this.style);
|
domNode.setAttribute("style",this.style);
|
||||||
@@ -255,7 +250,7 @@ ButtonWidget.prototype.updateDomNodeClasses = function() {
|
|||||||
//Add new classes from updated class attribute.
|
//Add new classes from updated class attribute.
|
||||||
$tw.utils.pushTop(domNodeClasses,newClasses);
|
$tw.utils.pushTop(domNodeClasses,newClasses);
|
||||||
this.domNode.className = domNodeClasses.join(" ");
|
this.domNode.className = domNodeClasses.join(" ");
|
||||||
};
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
@@ -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"]) {
|
if(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else if(changedAttributes["class"]) {
|
||||||
if(changedAttributes["class"]) {
|
this.updateDomNodeClasses();
|
||||||
this.updateDomNodeClasses();
|
|
||||||
}
|
|
||||||
this.assignAttributes(this.domNodes[0],{
|
|
||||||
changedAttributes: changedAttributes,
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,11 +53,6 @@ CheckboxWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.labelDomNode.appendChild(this.inputDomNode);
|
this.labelDomNode.appendChild(this.inputDomNode);
|
||||||
this.spanDomNode = this.document.createElement("span");
|
this.spanDomNode = this.document.createElement("span");
|
||||||
this.labelDomNode.appendChild(this.spanDomNode);
|
this.labelDomNode.appendChild(this.spanDomNode);
|
||||||
// Assign data- attributes
|
|
||||||
this.assignAttributes(this.inputDomNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Add a click event handler
|
// Add a click event handler
|
||||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||||
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
||||||
@@ -330,11 +325,6 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
$tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked");
|
$tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.assignAttributes(this.inputDomNode,{
|
|
||||||
changedAttributes: changedAttributes,
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -342,4 +332,3 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
exports.checkbox = CheckboxWidget;
|
exports.checkbox = CheckboxWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/widgets/data.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: widget
|
|
||||||
|
|
||||||
Widget to dynamically represent one or more tiddlers
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
|
||||||
|
|
||||||
var DataWidget = function(parseTreeNode,options) {
|
|
||||||
this.dataWidgetTag = parseTreeNode.type;
|
|
||||||
this.initialise(parseTreeNode,options);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Inherit from the base widget class
|
|
||||||
*/
|
|
||||||
DataWidget.prototype = new Widget();
|
|
||||||
|
|
||||||
/*
|
|
||||||
Render this widget into the DOM
|
|
||||||
*/
|
|
||||||
DataWidget.prototype.render = function(parent,nextSibling) {
|
|
||||||
this.parentDomNode = parent;
|
|
||||||
this.computeAttributes();
|
|
||||||
this.execute();
|
|
||||||
var jsonPayload = JSON.stringify(this.readDataTiddlerValues(),null,4);
|
|
||||||
var textNode = this.document.createTextNode(jsonPayload);
|
|
||||||
parent.insertBefore(textNode,nextSibling);
|
|
||||||
this.domNodes.push(textNode);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Compute the internal state of the widget
|
|
||||||
*/
|
|
||||||
DataWidget.prototype.execute = function() {
|
|
||||||
// Construct the child widgets
|
|
||||||
this.makeChildWidgets();
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Read the tiddler value(s) from a data widget – must be called after the .render() method
|
|
||||||
*/
|
|
||||||
DataWidget.prototype.readDataTiddlerValues = function() {
|
|
||||||
var self = this;
|
|
||||||
// Start with a blank object
|
|
||||||
var item = Object.create(null);
|
|
||||||
// Read any attributes not prefixed with $
|
|
||||||
$tw.utils.each(this.attributes,function(value,name) {
|
|
||||||
if(name.charAt(0) !== "$") {
|
|
||||||
item[name] = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
item = new $tw.Tiddler(item);
|
|
||||||
// Deal with $tiddler, $filter or $compound-tiddler attributes
|
|
||||||
var tiddlers = [],title;
|
|
||||||
if(this.hasAttribute("$tiddler")) {
|
|
||||||
title = this.getAttribute("$tiddler");
|
|
||||||
if(title) {
|
|
||||||
var tiddler = this.wiki.getTiddler(title);
|
|
||||||
if(tiddler) {
|
|
||||||
tiddlers.push(tiddler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(this.hasAttribute("$filter")) {
|
|
||||||
var filter = this.getAttribute("$filter");
|
|
||||||
if(filter) {
|
|
||||||
var titles = this.wiki.filterTiddlers(filter);
|
|
||||||
$tw.utils.each(titles,function(title) {
|
|
||||||
var tiddler = self.wiki.getTiddler(title);
|
|
||||||
tiddlers.push(tiddler);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(this.hasAttribute("$compound-tiddler")) {
|
|
||||||
title = this.getAttribute("$compound-tiddler");
|
|
||||||
if(title) {
|
|
||||||
tiddlers.push.apply(tiddlers,this.extractCompoundTiddler(title));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Convert the literal item to field strings
|
|
||||||
item = item.getFieldStrings();
|
|
||||||
if(tiddlers.length === 0) {
|
|
||||||
if(Object.keys(item).length > 0 && !!item.title) {
|
|
||||||
return [item];
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var results = [];
|
|
||||||
$tw.utils.each(tiddlers,function(tiddler,index) {
|
|
||||||
var fields = tiddler.getFieldStrings();
|
|
||||||
results.push($tw.utils.extend({},fields,item));
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Helper to extract tiddlers from text/vnd.tiddlywiki-multiple tiddlers
|
|
||||||
*/
|
|
||||||
DataWidget.prototype.extractCompoundTiddler = function(title) {
|
|
||||||
var tiddler = this.wiki.getTiddler(title);
|
|
||||||
if(tiddler && tiddler.fields.type === "text/vnd.tiddlywiki-multiple") {
|
|
||||||
var text = tiddler.fields.text || "",
|
|
||||||
rawTiddlers = text.split(/\r?\n\+\r?\n/),
|
|
||||||
tiddlers = [];
|
|
||||||
$tw.utils.each(rawTiddlers,function(rawTiddler) {
|
|
||||||
var fields = Object.create(null),
|
|
||||||
split = rawTiddler.split(/\r?\n\r?\n/mg);
|
|
||||||
if(split.length >= 1) {
|
|
||||||
fields = $tw.utils.parseFields(split[0],fields);
|
|
||||||
}
|
|
||||||
if(split.length >= 2) {
|
|
||||||
fields.text = split.slice(1).join("\n\n");
|
|
||||||
}
|
|
||||||
tiddlers.push(new $tw.Tiddler(fields));
|
|
||||||
});
|
|
||||||
return tiddlers;
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
|
||||||
*/
|
|
||||||
DataWidget.prototype.refresh = function(changedTiddlers) {
|
|
||||||
// It would be expensive to calculate whether the changedTiddlers impact the filter
|
|
||||||
// identified by the $filter attribute so we just refresh ourselves unconditionally
|
|
||||||
this.refreshSelf();
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.data = DataWidget;
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -52,11 +52,6 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
classes.push("tc-draggable");
|
classes.push("tc-draggable");
|
||||||
}
|
}
|
||||||
domNode.setAttribute("class",classes.join(" "));
|
domNode.setAttribute("class",classes.join(" "));
|
||||||
// Assign data- attributes and style. attributes
|
|
||||||
this.assignAttributes(domNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Insert the node into the DOM and render any children
|
// Insert the node into the DOM and render any children
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
@@ -113,23 +108,17 @@ DraggableWidget.prototype.updateDomNodeClasses = function() {
|
|||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
*/
|
*/
|
||||||
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes(),
|
||||||
if(changedAttributes.tag || changedAttributes.selector || changedAttributes.dragimagetype || changedAttributes.enable || changedAttributes.startactions || changedAttributes.endactions) {
|
changedAttributesCount = $tw.utils.count(changedAttributes);
|
||||||
|
if(changedAttributesCount === 1 && changedAttributes["class"]) {
|
||||||
|
this.updateDomNodeClasses();
|
||||||
|
} else if(changedAttributesCount > 0) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
if(changedAttributes["class"]) {
|
|
||||||
this.updateDomNodeClasses();
|
|
||||||
}
|
|
||||||
this.assignAttributes(this.domNodes[0],{
|
|
||||||
changedAttributes: changedAttributes,
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.draggable = DraggableWidget;
|
exports.draggable = DraggableWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@@ -42,11 +42,6 @@ DroppableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
domNode = this.document.createElement(tag);
|
domNode = this.document.createElement(tag);
|
||||||
this.domNode = domNode;
|
this.domNode = domNode;
|
||||||
this.assignDomNodeClasses();
|
this.assignDomNodeClasses();
|
||||||
// Assign data- attributes and style. attributes
|
|
||||||
this.assignAttributes(domNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Add event handlers
|
// Add event handlers
|
||||||
if(this.droppableEnable) {
|
if(this.droppableEnable) {
|
||||||
$tw.utils.addEventListeners(domNode,[
|
$tw.utils.addEventListeners(domNode,[
|
||||||
@@ -171,15 +166,8 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
|
if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else if(changedAttributes["class"]) {
|
||||||
if(changedAttributes["class"]) {
|
this.assignDomNodeClasses();
|
||||||
this.assignDomNodeClasses();
|
|
||||||
}
|
|
||||||
this.assignAttributes(this.domNodes[0],{
|
|
||||||
changedAttributes: changedAttributes,
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
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) {
|
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
// 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();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -100,9 +100,6 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
if(this.imageClass) {
|
if(this.imageClass) {
|
||||||
domNode.setAttribute("class",this.imageClass);
|
domNode.setAttribute("class",this.imageClass);
|
||||||
}
|
}
|
||||||
if(this.imageUsemap) {
|
|
||||||
domNode.setAttribute("usemap",this.imageUsemap);
|
|
||||||
}
|
|
||||||
if(this.imageWidth) {
|
if(this.imageWidth) {
|
||||||
domNode.setAttribute("width",this.imageWidth);
|
domNode.setAttribute("width",this.imageWidth);
|
||||||
}
|
}
|
||||||
@@ -142,7 +139,6 @@ ImageWidget.prototype.execute = function() {
|
|||||||
this.imageWidth = this.getAttribute("width");
|
this.imageWidth = this.getAttribute("width");
|
||||||
this.imageHeight = this.getAttribute("height");
|
this.imageHeight = this.getAttribute("height");
|
||||||
this.imageClass = this.getAttribute("class");
|
this.imageClass = this.getAttribute("class");
|
||||||
this.imageUsemap = this.getAttribute("usemap");
|
|
||||||
this.imageTooltip = this.getAttribute("tooltip");
|
this.imageTooltip = this.getAttribute("tooltip");
|
||||||
this.imageAlt = this.getAttribute("alt");
|
this.imageAlt = this.getAttribute("alt");
|
||||||
this.lazyLoading = this.getAttribute("loading");
|
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) {
|
ImageWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
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();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
|||||||
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
||||||
// Accumulate the <$set> widgets from each tiddler
|
// Accumulate the <$set> widgets from each tiddler
|
||||||
$tw.utils.each(this.tiddlerList,function(title) {
|
$tw.utils.each(this.tiddlerList,function(title) {
|
||||||
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:false});
|
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:true});
|
||||||
if(parser) {
|
if(parser) {
|
||||||
var parseTreeNode = parser.tree[0];
|
var parseTreeNode = parser.tree[0];
|
||||||
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
||||||
|
|||||||
@@ -43,11 +43,6 @@ LinkWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
} else {
|
} else {
|
||||||
// Just insert the link text
|
// Just insert the link text
|
||||||
var domNode = this.document.createElement("span");
|
var domNode = this.document.createElement("span");
|
||||||
// Assign data- attributes
|
|
||||||
this.assignAttributes(domNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
this.domNodes.push(domNode);
|
this.domNodes.push(domNode);
|
||||||
@@ -143,11 +138,6 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
|||||||
widget: this
|
widget: this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Assign data- attributes
|
|
||||||
this.assignAttributes(domNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Insert the link into the DOM and render any children
|
// Insert the link into the DOM and render any children
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
@@ -217,7 +207,8 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
*/
|
*/
|
||||||
LinkWidget.prototype.refresh = function(changedTiddlers) {
|
LinkWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if($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();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -227,4 +218,3 @@ LinkWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
exports.link = LinkWidget;
|
exports.link = LinkWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
$tw.modules.applyMethods("storyview",this.storyViews);
|
$tw.modules.applyMethods("storyview",this.storyViews);
|
||||||
}
|
}
|
||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
var changedAttributes = this.computeAttributes();
|
this.computeAttributes();
|
||||||
this.execute(changedAttributes);
|
this.execute();
|
||||||
this.renderChildren(parent,nextSibling);
|
this.renderChildren(parent,nextSibling);
|
||||||
// Construct the storyview
|
// Construct the storyview
|
||||||
var StoryView = this.storyViews[this.storyViewName];
|
var StoryView = this.storyViews[this.storyViewName];
|
||||||
@@ -71,7 +71,7 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
/*
|
/*
|
||||||
Compute the internal state of the widget
|
Compute the internal state of the widget
|
||||||
*/
|
*/
|
||||||
ListWidget.prototype.execute = function(changedAttributes) {
|
ListWidget.prototype.execute = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
// Get our attributes
|
// Get our attributes
|
||||||
this.template = this.getAttribute("template");
|
this.template = this.getAttribute("template");
|
||||||
@@ -80,10 +80,6 @@ ListWidget.prototype.execute = function(changedAttributes) {
|
|||||||
this.counterName = this.getAttribute("counter");
|
this.counterName = this.getAttribute("counter");
|
||||||
this.storyViewName = this.getAttribute("storyview");
|
this.storyViewName = this.getAttribute("storyview");
|
||||||
this.historyTitle = this.getAttribute("history");
|
this.historyTitle = this.getAttribute("history");
|
||||||
// Create join template only if needed
|
|
||||||
if(this.join === undefined || (changedAttributes && changedAttributes.join)) {
|
|
||||||
this.join = this.makeJoinTemplate();
|
|
||||||
}
|
|
||||||
// Compose the list elements
|
// Compose the list elements
|
||||||
this.list = this.getTiddlerList();
|
this.list = this.getTiddlerList();
|
||||||
var members = [],
|
var members = [],
|
||||||
@@ -106,27 +102,21 @@ ListWidget.prototype.findExplicitTemplates = function() {
|
|||||||
var self = this;
|
var self = this;
|
||||||
this.explicitListTemplate = null;
|
this.explicitListTemplate = null;
|
||||||
this.explicitEmptyTemplate = null;
|
this.explicitEmptyTemplate = null;
|
||||||
this.explicitJoinTemplate = null;
|
|
||||||
this.hasTemplateInBody = false;
|
this.hasTemplateInBody = false;
|
||||||
var searchChildren = function(childNodes) {
|
var searchChildren = function(childNodes) {
|
||||||
var foundInlineTemplate = false;
|
|
||||||
$tw.utils.each(childNodes,function(node) {
|
$tw.utils.each(childNodes,function(node) {
|
||||||
if(node.type === "list-template") {
|
if(node.type === "list-template") {
|
||||||
self.explicitListTemplate = node.children;
|
self.explicitListTemplate = node.children;
|
||||||
} else if(node.type === "list-empty") {
|
} else if(node.type === "list-empty") {
|
||||||
self.explicitEmptyTemplate = node.children;
|
self.explicitEmptyTemplate = node.children;
|
||||||
} else if(node.type === "list-join") {
|
|
||||||
self.explicitJoinTemplate = node.children;
|
|
||||||
} else if(node.type === "element" && node.tag === "p") {
|
} else if(node.type === "element" && node.tag === "p") {
|
||||||
searchChildren(node.children);
|
searchChildren(node.children);
|
||||||
foundInlineTemplate = true;
|
|
||||||
} else {
|
} else {
|
||||||
foundInlineTemplate = true;
|
self.hasTemplateInBody = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return foundInlineTemplate;
|
|
||||||
};
|
};
|
||||||
this.hasTemplateInBody = searchChildren(this.parseTreeNode.children);
|
searchChildren(this.parseTreeNode.children);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListWidget.prototype.getTiddlerList = function() {
|
ListWidget.prototype.getTiddlerList = function() {
|
||||||
@@ -162,24 +152,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
|
Compose the template for a list item
|
||||||
*/
|
*/
|
||||||
@@ -188,7 +160,6 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
|||||||
var tiddler = this.wiki.getTiddler(title),
|
var tiddler = this.wiki.getTiddler(title),
|
||||||
isDraft = tiddler && tiddler.hasField("draft.of"),
|
isDraft = tiddler && tiddler.hasField("draft.of"),
|
||||||
template = this.template,
|
template = this.template,
|
||||||
join = this.join,
|
|
||||||
templateTree;
|
templateTree;
|
||||||
if(isDraft && this.editTemplate) {
|
if(isDraft && this.editTemplate) {
|
||||||
template = this.editTemplate;
|
template = this.editTemplate;
|
||||||
@@ -214,12 +185,12 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Return the list item
|
// Return the list item
|
||||||
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree, join: join};
|
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree};
|
||||||
parseTreeNode.isLast = index === this.list.length - 1;
|
|
||||||
if(this.counterName) {
|
if(this.counterName) {
|
||||||
parseTreeNode.counter = (index + 1).toString();
|
parseTreeNode.counter = (index + 1).toString();
|
||||||
parseTreeNode.counterName = this.counterName;
|
parseTreeNode.counterName = this.counterName;
|
||||||
parseTreeNode.isFirst = index === 0;
|
parseTreeNode.isFirst = index === 0;
|
||||||
|
parseTreeNode.isLast = index === this.list.length - 1;
|
||||||
}
|
}
|
||||||
return parseTreeNode;
|
return parseTreeNode;
|
||||||
};
|
};
|
||||||
@@ -235,7 +206,7 @@ ListWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
this.storyview.refreshStart(changedTiddlers,changedAttributes);
|
this.storyview.refreshStart(changedTiddlers,changedAttributes);
|
||||||
}
|
}
|
||||||
// Completely refresh if any of our attributes have changed
|
// Completely refresh if any of our attributes have changed
|
||||||
if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.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();
|
this.refreshSelf();
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -339,29 +310,10 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Cycle through the list, inserting and removing list items as needed
|
// Cycle through the list, inserting and removing list items as needed
|
||||||
var mustRecreateLastItem = false;
|
|
||||||
if(this.join && this.join.length) {
|
|
||||||
if(this.children.length !== this.list.length) {
|
|
||||||
mustRecreateLastItem = true;
|
|
||||||
} else if(prevList[prevList.length-1] !== this.list[this.list.length-1]) {
|
|
||||||
mustRecreateLastItem = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var isLast = false, wasLast = false;
|
|
||||||
for(t=0; t<this.list.length; t++) {
|
for(t=0; t<this.list.length; t++) {
|
||||||
isLast = t === this.list.length-1;
|
|
||||||
var index = this.findListItem(t,this.list[t]);
|
var index = this.findListItem(t,this.list[t]);
|
||||||
wasLast = index === this.children.length-1;
|
|
||||||
if(wasLast && (index !== t || this.children.length !== this.list.length)) {
|
|
||||||
mustRecreateLastItem = !!(this.join && this.join.length);
|
|
||||||
}
|
|
||||||
if(index === undefined) {
|
if(index === undefined) {
|
||||||
// The list item must be inserted
|
// The list item must be inserted
|
||||||
if(isLast && mustRecreateLastItem && t>0) {
|
|
||||||
// First re-create previosly-last item that will no longer be last
|
|
||||||
this.removeListItem(t-1);
|
|
||||||
this.insertListItem(t-1,this.list[t-1]);
|
|
||||||
}
|
|
||||||
this.insertListItem(t,this.list[t]);
|
this.insertListItem(t,this.list[t]);
|
||||||
hasRefreshed = true;
|
hasRefreshed = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -370,15 +322,9 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
this.removeListItem(n);
|
this.removeListItem(n);
|
||||||
hasRefreshed = true;
|
hasRefreshed = true;
|
||||||
}
|
}
|
||||||
// Refresh the item we're reusing, or recreate if necessary
|
// Refresh the item we're reusing
|
||||||
if(mustRecreateLastItem && (isLast || wasLast)) {
|
var refreshed = this.children[t].refresh(changedTiddlers);
|
||||||
this.removeListItem(t);
|
hasRefreshed = hasRefreshed || refreshed;
|
||||||
this.insertListItem(t,this.list[t]);
|
|
||||||
hasRefreshed = true;
|
|
||||||
} else {
|
|
||||||
var refreshed = this.children[t].refresh(changedTiddlers);
|
|
||||||
hasRefreshed = hasRefreshed || refreshed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,17 +414,8 @@ ListItemWidget.prototype.execute = function() {
|
|||||||
this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "yes" : "no");
|
this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "yes" : "no");
|
||||||
this.setVariable(this.parseTreeNode.counterName + "-last",this.parseTreeNode.isLast ? "yes" : "no");
|
this.setVariable(this.parseTreeNode.counterName + "-last",this.parseTreeNode.isLast ? "yes" : "no");
|
||||||
}
|
}
|
||||||
// Add join if needed
|
|
||||||
var children = this.parseTreeNode.children,
|
|
||||||
join = this.parseTreeNode.join;
|
|
||||||
if(join && join.length && !this.parseTreeNode.isLast) {
|
|
||||||
children = children.slice(0);
|
|
||||||
$tw.utils.each(join,function(joinNode) {
|
|
||||||
children.push(joinNode);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// Construct the child widgets
|
// Construct the child widgets
|
||||||
this.makeChildWidgets(children);
|
this.makeChildWidgets();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -513,14 +450,4 @@ ListEmptyWidget.prototype.refresh = function() { return false; }
|
|||||||
|
|
||||||
exports["list-empty"] = ListEmptyWidget;
|
exports["list-empty"] = ListEmptyWidget;
|
||||||
|
|
||||||
var ListJoinWidget = function(parseTreeNode,options) {
|
|
||||||
// Main initialisation inherited from widget.js
|
|
||||||
this.initialise(parseTreeNode,options);
|
|
||||||
};
|
|
||||||
ListJoinWidget.prototype = new Widget();
|
|
||||||
ListJoinWidget.prototype.render = function() {}
|
|
||||||
ListJoinWidget.prototype.refresh = function() { return false; }
|
|
||||||
|
|
||||||
exports["list-join"] = ListJoinWidget;
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
);
|
);
|
||||||
this.inputDomNode = this.document.createElement("input");
|
this.inputDomNode = this.document.createElement("input");
|
||||||
this.inputDomNode.setAttribute("type","radio");
|
this.inputDomNode.setAttribute("type","radio");
|
||||||
this.assignAttributes(this.inputDomNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
if(isChecked) {
|
if(isChecked) {
|
||||||
this.inputDomNode.checked = true;
|
this.inputDomNode.checked = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,10 +50,6 @@ RangeWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.inputDomNode.setAttribute("disabled",true);
|
this.inputDomNode.setAttribute("disabled",true);
|
||||||
}
|
}
|
||||||
this.inputDomNode.value = this.getValue();
|
this.inputDomNode.value = this.getValue();
|
||||||
this.assignAttributes(this.inputDomNode,{
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
// Add a click event handler
|
// Add a click event handler
|
||||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||||
{name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"},
|
{name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"},
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ Scrollable widget
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var DEBOUNCE_INTERVAL = 100; // Delay after last scroll event before updating the bound tiddler
|
|
||||||
|
|
||||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||||
|
|
||||||
var ScrollableWidget = function(parseTreeNode,options) {
|
var ScrollableWidget = function(parseTreeNode,options) {
|
||||||
@@ -173,53 +171,6 @@ ScrollableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
parent.insertBefore(this.outerDomNode,nextSibling);
|
parent.insertBefore(this.outerDomNode,nextSibling);
|
||||||
this.renderChildren(this.innerDomNode,null);
|
this.renderChildren(this.innerDomNode,null);
|
||||||
this.domNodes.push(this.outerDomNode);
|
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() {
|
ScrollableWidget.prototype.execute = function() {
|
||||||
// Get attributes
|
// Get attributes
|
||||||
this.scrollableBind = this.getAttribute("bind");
|
|
||||||
this.fallthrough = this.getAttribute("fallthrough","yes");
|
this.fallthrough = this.getAttribute("fallthrough","yes");
|
||||||
this["class"] = this.getAttribute("class");
|
this["class"] = this.getAttribute("class");
|
||||||
// Make child widgets
|
// Make child widgets
|
||||||
@@ -243,22 +193,7 @@ ScrollableWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// If the bound tiddler has changed, update the eventListener and update scroll position
|
return this.refreshChildren(changedTiddlers);
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.scrollable = ScrollableWidget;
|
exports.scrollable = ScrollableWidget;
|
||||||
|
|||||||
@@ -40,31 +40,7 @@ SelectWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
this.computeAttributes();
|
this.computeAttributes();
|
||||||
this.execute();
|
this.execute();
|
||||||
//Create element
|
this.renderChildren(parent,nextSibling);
|
||||||
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.setSelectValue();
|
this.setSelectValue();
|
||||||
if(this.selectFocus == "yes") {
|
if(this.selectFocus == "yes") {
|
||||||
this.getSelectDomNode().focus();
|
this.getSelectDomNode().focus();
|
||||||
@@ -137,7 +113,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
|||||||
Get the DOM node of the select element
|
Get the DOM node of the select element
|
||||||
*/
|
*/
|
||||||
SelectWidget.prototype.getSelectDomNode = function() {
|
SelectWidget.prototype.getSelectDomNode = function() {
|
||||||
return this.domNodes[0];
|
return this.children[0].domNodes[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return an array of the selected opion values
|
// Return an array of the selected opion values
|
||||||
@@ -173,7 +149,27 @@ SelectWidget.prototype.execute = function() {
|
|||||||
this.selectTooltip = this.getAttribute("tooltip");
|
this.selectTooltip = this.getAttribute("tooltip");
|
||||||
this.selectFocus = this.getAttribute("focus");
|
this.selectFocus = this.getAttribute("focus");
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
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) {
|
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
// If we're using a different tiddler/field/index then completely refresh ourselves
|
// If we're using a different tiddler/field/index then completely refresh ourselves
|
||||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex) {
|
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
|
// If the target tiddler value has changed, just update setting and refresh the children
|
||||||
} else {
|
} else {
|
||||||
if(changedAttributes.class) {
|
if(changedAttributes.class) {
|
||||||
this.selectClass = this.getAttribute("class");
|
this.selectClass = this.getAttribute("class");
|
||||||
this.getSelectDomNode().setAttribute("class",this.selectClass);
|
this.getSelectDomNode().setAttribute("class",this.selectClass);
|
||||||
}
|
}
|
||||||
this.assignAttributes(this.getSelectDomNode(),{
|
|
||||||
changedAttributes: changedAttributes,
|
|
||||||
sourcePrefix: "data-",
|
|
||||||
destPrefix: "data-"
|
|
||||||
});
|
|
||||||
var childrenRefreshed = this.refreshChildren(changedTiddlers);
|
var childrenRefreshed = this.refreshChildren(changedTiddlers);
|
||||||
// If the target tiddler value has changed, just update setting and refresh the children
|
|
||||||
if(changedTiddlers[this.selectTitle] || childrenRefreshed) {
|
if(changedTiddlers[this.selectTitle] || childrenRefreshed) {
|
||||||
this.setSelectValue();
|
this.setSelectValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,160 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/widgets/testcase.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: widget
|
|
||||||
|
|
||||||
Widget to display a test case
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
|
||||||
|
|
||||||
var TestCaseWidget = function(parseTreeNode,options) {
|
|
||||||
this.initialise(parseTreeNode,options);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Inherit from the base widget class
|
|
||||||
*/
|
|
||||||
TestCaseWidget.prototype = new Widget();
|
|
||||||
|
|
||||||
/*
|
|
||||||
Render this widget into the DOM
|
|
||||||
*/
|
|
||||||
TestCaseWidget.prototype.render = function(parent,nextSibling) {
|
|
||||||
var self = this;
|
|
||||||
this.parentDomNode = parent;
|
|
||||||
this.computeAttributes();
|
|
||||||
this.execute();
|
|
||||||
// Create container DOM node
|
|
||||||
var domNode = this.document.createElement("div");
|
|
||||||
this.domNodes.push(domNode);
|
|
||||||
parent.insertBefore(domNode,nextSibling);
|
|
||||||
// Render the children into a hidden DOM node
|
|
||||||
var parser = {
|
|
||||||
tree: [{
|
|
||||||
type: "widget",
|
|
||||||
attributes: {},
|
|
||||||
orderedAttributes: [],
|
|
||||||
children: this.parseTreeNode.children || []
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
this.contentRoot = this.wiki.makeWidget(parser,{
|
|
||||||
document: $tw.fakeDocument,
|
|
||||||
parentWidget: this
|
|
||||||
});
|
|
||||||
this.contentContainer = $tw.fakeDocument.createElement("div");
|
|
||||||
this.contentRoot.render(this.contentContainer,null);
|
|
||||||
// Create a wiki
|
|
||||||
this.testcaseWiki = new $tw.Wiki();
|
|
||||||
// Always load the core plugin
|
|
||||||
var loadTiddler = function(title) {
|
|
||||||
var tiddler = self.wiki.getTiddler(title);
|
|
||||||
if(tiddler) {
|
|
||||||
self.testcaseWiki.addTiddler(tiddler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadTiddler("$:/core");
|
|
||||||
loadTiddler("$:/plugins/tiddlywiki/codemirror");
|
|
||||||
// Load tiddlers from child data widgets
|
|
||||||
var tiddlers = [];
|
|
||||||
this.findChildrenDataWidgets(this.contentRoot.children,"data",function(widget) {
|
|
||||||
Array.prototype.push.apply(tiddlers,widget.readDataTiddlerValues());
|
|
||||||
});
|
|
||||||
var jsonPayload = JSON.stringify(tiddlers);
|
|
||||||
this.testcaseWiki.addTiddlers(tiddlers);
|
|
||||||
// Unpack plugin tiddlers
|
|
||||||
this.testcaseWiki.readPluginInfo();
|
|
||||||
this.testcaseWiki.registerPluginTiddlers("plugin");
|
|
||||||
this.testcaseWiki.unpackPluginTiddlers();
|
|
||||||
this.testcaseWiki.addIndexersToWiki();
|
|
||||||
// Generate a `transclusion` variable that depends on the values of the payload tiddlers so that the template can easily make unique state tiddlers
|
|
||||||
this.setVariable("transclusion",$tw.utils.hashString(jsonPayload));
|
|
||||||
// Generate a `payloadTiddlers` variable that contains the payload in JSON format
|
|
||||||
this.setVariable("payloadTiddlers",jsonPayload);
|
|
||||||
// Render the test rendering if required
|
|
||||||
if(this.testcaseTestOutput && this.testcaseTestExpectedResult) {
|
|
||||||
var testcaseOutputContainer = $tw.fakeDocument.createElement("div");
|
|
||||||
var testcaseOutputWidget = this.testcaseWiki.makeTranscludeWidget(this.testcaseTestOutput,{
|
|
||||||
document: $tw.fakeDocument,
|
|
||||||
parseAsInline: false,
|
|
||||||
parentWidget: this,
|
|
||||||
variables: {
|
|
||||||
currentTiddler: this.testcaseTestOutput
|
|
||||||
}
|
|
||||||
});
|
|
||||||
testcaseOutputWidget.render(testcaseOutputContainer);
|
|
||||||
}
|
|
||||||
// Clear changes queue
|
|
||||||
this.testcaseWiki.clearTiddlerEventQueue();
|
|
||||||
// Run the actions if provided
|
|
||||||
if(this.testcaseWiki.tiddlerExists(this.testcaseTestActions)) {
|
|
||||||
testcaseOutputWidget.invokeActionString(this.testcaseWiki.getTiddlerText(this.testcaseTestActions));
|
|
||||||
testcaseOutputWidget.refresh(this.testcaseWiki.changedTiddlers,testcaseOutputContainer);
|
|
||||||
}
|
|
||||||
// Set up the test result variables
|
|
||||||
var testResult = "",
|
|
||||||
outputHTML = "",
|
|
||||||
expectedHTML = "";
|
|
||||||
if(this.testcaseTestOutput && this.testcaseTestExpectedResult) {
|
|
||||||
outputHTML = testcaseOutputContainer.children[0].innerHTML;
|
|
||||||
expectedHTML = this.testcaseWiki.getTiddlerText(this.testcaseTestExpectedResult);
|
|
||||||
if(outputHTML === expectedHTML) {
|
|
||||||
testResult = "pass";
|
|
||||||
} else {
|
|
||||||
testResult = "fail";
|
|
||||||
}
|
|
||||||
this.setVariable("outputHTML",outputHTML);
|
|
||||||
this.setVariable("expectedHTML",expectedHTML);
|
|
||||||
this.setVariable("testResult",testResult);
|
|
||||||
this.setVariable("currentTiddler",this.testcaseTestOutput);
|
|
||||||
}
|
|
||||||
// Don't display anything if testHideIfPass is "yes" and the tests have passed
|
|
||||||
if(this.testcaseHideIfPass === "yes" && testResult === "pass") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Render the page root template of the subwiki
|
|
||||||
var rootWidget = this.testcaseWiki.makeTranscludeWidget(this.testcaseTemplate,{
|
|
||||||
document: this.document,
|
|
||||||
parseAsInline: false,
|
|
||||||
parentWidget: this
|
|
||||||
});
|
|
||||||
rootWidget.render(domNode);
|
|
||||||
// Trap changes in the wiki and refresh the rendering
|
|
||||||
this.testcaseWiki.addEventListener("change",function(changes) {
|
|
||||||
rootWidget.refresh(changes,domNode);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Compute the internal state of the widget
|
|
||||||
*/
|
|
||||||
TestCaseWidget.prototype.execute = function() {
|
|
||||||
this.testcaseTemplate = this.getAttribute("template","$:/core/ui/testcases/DefaultTemplate");
|
|
||||||
this.testcaseTestOutput = this.getAttribute("testOutput");
|
|
||||||
this.testcaseTestActions = this.getAttribute("testActions");
|
|
||||||
this.testcaseTestExpectedResult = this.getAttribute("testExpectedResult");
|
|
||||||
this.testcaseHideIfPass = this.getAttribute("testHideIfPass");
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
|
||||||
*/
|
|
||||||
TestCaseWidget.prototype.refresh = function(changedTiddlers) {
|
|
||||||
var changedAttributes = this.computeAttributes();
|
|
||||||
if($tw.utils.count(changedAttributes) > 0) {
|
|
||||||
this.refreshSelf();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return this.contentRoot.refresh(changedTiddlers);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["testcase"] = TestCaseWidget;
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -153,7 +153,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
} else if(variable.isFunctionDefinition) {
|
} else if(variable.isFunctionDefinition) {
|
||||||
// Function evaluations
|
// Function evaluations
|
||||||
params = self.resolveVariableParameters(variable.params,actualParams);
|
params = self.resolveVariableParameters(variable.params,actualParams);
|
||||||
var variables = options.variables || Object.create(null);
|
var variables = Object.create(null);
|
||||||
// Apply default parameter values
|
// Apply default parameter values
|
||||||
$tw.utils.each(variable.params,function(param,index) {
|
$tw.utils.each(variable.params,function(param,index) {
|
||||||
if(param["default"]) {
|
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:
|
options include:
|
||||||
sourcePrefix: prefix of attributes that are to be directly assigned (defaults to the empty string meaning all attributes)
|
excludeEventAttributes: ignores attributes whose name begins with "on"
|
||||||
destPrefix: prefix to be applied to attribute names that are to be directly assigned (defaults to the emtpy string which means no prefix is added)
|
|
||||||
changedAttributes: hashmap by attribute name of attributes to process (if missing, process all attributes)
|
|
||||||
excludeEventAttributes: ignores attributes whose name would begin with "on"
|
|
||||||
*/
|
*/
|
||||||
Widget.prototype.assignAttributes = function(domNode,options) {
|
Widget.prototype.assignAttributes = function(domNode,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var self = this,
|
var self = this;
|
||||||
changedAttributes = options.changedAttributes || this.attributes,
|
|
||||||
sourcePrefix = options.sourcePrefix || "",
|
|
||||||
destPrefix = options.destPrefix || "",
|
|
||||||
EVENT_ATTRIBUTE_PREFIX = "on";
|
|
||||||
var assignAttribute = function(name,value) {
|
var assignAttribute = function(name,value) {
|
||||||
// Process any style attributes before considering sourcePrefix and destPrefix
|
|
||||||
if(name.substr(0,6) === "style." && name.length > 6) {
|
|
||||||
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Check if the sourcePrefix is a match
|
|
||||||
if(name.substr(0,sourcePrefix.length) === sourcePrefix) {
|
|
||||||
name = destPrefix + name.substr(sourcePrefix.length);
|
|
||||||
} else {
|
|
||||||
value = undefined;
|
|
||||||
}
|
|
||||||
// Check for excluded attribute names
|
// Check for excluded attribute names
|
||||||
if(options.excludeEventAttributes && name.substr(0,2).toLowerCase() === EVENT_ATTRIBUTE_PREFIX) {
|
if(options.excludeEventAttributes && name.substr(0,2) === "on") {
|
||||||
value = undefined;
|
value = undefined;
|
||||||
}
|
}
|
||||||
if(value !== undefined) {
|
if(value !== undefined) {
|
||||||
@@ -450,24 +432,26 @@ Widget.prototype.assignAttributes = function(domNode,options) {
|
|||||||
namespace = "http://www.w3.org/1999/xlink";
|
namespace = "http://www.w3.org/1999/xlink";
|
||||||
name = name.substr(6);
|
name = name.substr(6);
|
||||||
}
|
}
|
||||||
// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
|
// Handle styles
|
||||||
try {
|
if(name.substr(0,6) === "style." && name.length > 6) {
|
||||||
domNode.setAttributeNS(namespace,name,value);
|
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
|
||||||
} catch(e) {
|
} 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) {
|
if(this.parseTreeNode.orderedAttributes) {
|
||||||
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
|
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
|
||||||
if(attribute.name in changedAttributes) {
|
assignAttribute(attribute.name,self.attributes[attribute.name]);
|
||||||
assignAttribute(attribute.name,self.getAttribute(attribute.name));
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
// Otherwise update each changed attribute irrespective of order
|
|
||||||
} else {
|
} else {
|
||||||
$tw.utils.each(changedAttributes,function(value,name) {
|
$tw.utils.each(Object.keys(self.attributes).sort(),function(name) {
|
||||||
assignAttribute(name,self.getAttribute(name));
|
assignAttribute(name,self.attributes[name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -813,21 +797,6 @@ Widget.prototype.allowActionPropagation = function() {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Find child <$data> widgets recursively. The tag name allows aliased versions of the widget to be found too
|
|
||||||
*/
|
|
||||||
Widget.prototype.findChildrenDataWidgets = function(children,tag,callback) {
|
|
||||||
var self = this;
|
|
||||||
$tw.utils.each(children,function(child) {
|
|
||||||
if(child.dataWidgetTag === tag) {
|
|
||||||
callback(child);
|
|
||||||
}
|
|
||||||
if(child.children) {
|
|
||||||
self.findChildrenDataWidgets(child.children,tag,callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Evaluate a variable with parameters. This is a static convenience method that attempts to evaluate a variable as a function, returning an array of strings
|
Evaluate a variable with parameters. This is a static convenience method that attempts to evaluate a variable as a function, returning an array of strings
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -534,8 +534,8 @@ Return an array of tiddler titles that link to the specified tiddler
|
|||||||
*/
|
*/
|
||||||
exports.getTiddlerBacklinks = function(targetTitle) {
|
exports.getTiddlerBacklinks = function(targetTitle) {
|
||||||
var self = this,
|
var self = this,
|
||||||
backIndexer = this.getIndexer("BackIndexer"),
|
backlinksIndexer = this.getIndexer("BacklinksIndexer"),
|
||||||
backlinks = backIndexer && backIndexer.subIndexers.link.lookup(targetTitle);
|
backlinks = backlinksIndexer && backlinksIndexer.lookup(targetTitle);
|
||||||
|
|
||||||
if(!backlinks) {
|
if(!backlinks) {
|
||||||
backlinks = [];
|
backlinks = [];
|
||||||
@@ -549,68 +549,6 @@ exports.getTiddlerBacklinks = function(targetTitle) {
|
|||||||
return backlinks;
|
return backlinks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return an array of tiddler titles that are directly transcluded within the given parse tree
|
|
||||||
*/
|
|
||||||
exports.extractTranscludes = function(parseTreeRoot) {
|
|
||||||
// Count up the transcludes
|
|
||||||
var transcludes = [],
|
|
||||||
checkParseTree = function(parseTree, parentNode) {
|
|
||||||
for(var t=0; t<parseTree.length; t++) {
|
|
||||||
var parseTreeNode = parseTree[t];
|
|
||||||
if(parseTreeNode.type === "transclude" && parseTreeNode.attributes.$tiddler && parseTreeNode.attributes.$tiddler.type === "string") {
|
|
||||||
var value;
|
|
||||||
// if it is Transclusion with Templates like `{{Index||$:/core/ui/TagTemplate}}`, the `$tiddler` will point to the template. We need to find the actual target tiddler from parent node
|
|
||||||
if(parentNode && parentNode.type === "tiddler" && parentNode.attributes.tiddler && parentNode.attributes.tiddler.type === "string") {
|
|
||||||
value = parentNode.attributes.tiddler.value;
|
|
||||||
} else {
|
|
||||||
value = parseTreeNode.attributes.$tiddler.value;
|
|
||||||
}
|
|
||||||
if(transcludes.indexOf(value) === -1) {
|
|
||||||
transcludes.push(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(parseTreeNode.children) {
|
|
||||||
checkParseTree(parseTreeNode.children, parseTreeNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
checkParseTree(parseTreeRoot);
|
|
||||||
return transcludes;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return an array of tiddler titles that are transcluded from the specified tiddler
|
|
||||||
*/
|
|
||||||
exports.getTiddlerTranscludes = function(title) {
|
|
||||||
var self = this;
|
|
||||||
// We'll cache the transcludes so they only get computed if the tiddler changes
|
|
||||||
return this.getCacheForTiddler(title,"transcludes",function() {
|
|
||||||
// Parse the tiddler
|
|
||||||
var parser = self.parseTiddler(title);
|
|
||||||
if(parser) {
|
|
||||||
return self.extractTranscludes(parser.tree);
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return an array of tiddler titles that transclude to the specified tiddler
|
|
||||||
*/
|
|
||||||
exports.getTiddlerBacktranscludes = function(targetTitle) {
|
|
||||||
var self = this,
|
|
||||||
backIndexer = this.getIndexer("BackIndexer"),
|
|
||||||
backtranscludes = backIndexer && backIndexer.subIndexers.transclude.lookup(targetTitle);
|
|
||||||
|
|
||||||
if(!backtranscludes) {
|
|
||||||
backtranscludes = [];
|
|
||||||
}
|
|
||||||
return backtranscludes;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return a hashmap of tiddler titles that are referenced but not defined. Each value is the number of times the missing tiddler is referenced
|
Return a hashmap of tiddler titles that are referenced but not defined. Each value is the number of times the missing tiddler is referenced
|
||||||
*/
|
*/
|
||||||
@@ -1349,7 +1287,7 @@ exports.search = function(text,options) {
|
|||||||
console.log("Regexp error parsing /(" + text + ")/" + flags + ": ",e);
|
console.log("Regexp error parsing /(" + text + ")/" + flags + ": ",e);
|
||||||
}
|
}
|
||||||
} else if(options.some) {
|
} else if(options.some) {
|
||||||
terms = text.trim().split(/[^\S\xA0]+/);
|
terms = text.trim().split(/ +/);
|
||||||
if(terms.length === 1 && terms[0] === "") {
|
if(terms.length === 1 && terms[0] === "") {
|
||||||
searchTermsRegExps = null;
|
searchTermsRegExps = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -1360,7 +1298,7 @@ exports.search = function(text,options) {
|
|||||||
searchTermsRegExps.push(new RegExp("(" + regExpStr + ")",flags));
|
searchTermsRegExps.push(new RegExp("(" + regExpStr + ")",flags));
|
||||||
}
|
}
|
||||||
} else { // default: words
|
} else { // default: words
|
||||||
terms = text.split(/[^\S\xA0]+/);
|
terms = text.split(/ +/);
|
||||||
if(terms.length === 1 && terms[0] === "") {
|
if(terms.length === 1 && terms[0] === "") {
|
||||||
searchTermsRegExps = null;
|
searchTermsRegExps = null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -95,9 +95,6 @@ table-footer-background: #a8a8a8
|
|||||||
table-header-background: #f0f0f0
|
table-header-background: #f0f0f0
|
||||||
tag-background: #ec6
|
tag-background: #ec6
|
||||||
tag-foreground: #ffffff
|
tag-foreground: #ffffff
|
||||||
testcase-accent-level-1: #84C5E6
|
|
||||||
testcase-accent-level-2: #E3B740
|
|
||||||
testcase-accent-level-3: #5FD564
|
|
||||||
tiddler-background: <<colour background>>
|
tiddler-background: <<colour background>>
|
||||||
tiddler-border: <<colour background>>
|
tiddler-border: <<colour background>>
|
||||||
tiddler-controls-foreground-hover: #888888
|
tiddler-controls-foreground-hover: #888888
|
||||||
|
|||||||
@@ -5,6 +5,5 @@
|
|||||||
"author": "JeremyRuston",
|
"author": "JeremyRuston",
|
||||||
"core-version": ">=5.0.0",
|
"core-version": ">=5.0.0",
|
||||||
"plugin-priority": "0",
|
"plugin-priority": "0",
|
||||||
"list": "readme",
|
"list": "readme"
|
||||||
"stability": "STABILITY_2_STABLE"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: $:/core/save/all-external-js
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<!-- Important: core library is provided by serving URI encoded $:/core/templates/tiddlywiki5.js -->
|
<!-- Important: core library is provided by serving URI encoded $:/core/templates/tiddlywiki5.js -->
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: $:/core/save/offline-external-js
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||||
\end
|
\end
|
||||||
\define defaultCoreURL() tiddlywikicore-$(version)$.js
|
\define defaultCoreURL() tiddlywikicore-$(version)$.js
|
||||||
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
|
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
title: $:/core/templates/html-json-skinny-tiddler
|
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
|
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"/>
|
||||||
@@ -2,6 +2,6 @@ title: $:/core/save/all
|
|||||||
|
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||||
\end
|
\end
|
||||||
{{$:/core/templates/tiddlywiki5.html}}
|
{{$:/core/templates/tiddlywiki5.html}}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
title: $:/core/save/empty
|
title: $:/core/save/empty
|
||||||
|
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||||
\end
|
\end
|
||||||
{{$:/core/templates/tiddlywiki5.html}}
|
{{$:/core/templates/tiddlywiki5.html}}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
title: $:/core/save/lazy-all
|
title: $:/core/save/lazy-all
|
||||||
|
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]]
|
[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]]
|
||||||
\end
|
\end
|
||||||
\define skinnySaveTiddlerFilter()
|
\define skinnySaveTiddlerFilter()
|
||||||
[!is[system]] -[type[application/javascript]]
|
[!is[system]] -[type[application/javascript]]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
title: $:/core/save/lazy-images
|
title: $:/core/save/lazy-images
|
||||||
|
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]]
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]]
|
||||||
\end
|
\end
|
||||||
\define skinnySaveTiddlerFilter()
|
\define skinnySaveTiddlerFilter()
|
||||||
[!is[system]is[image]]
|
[!is[system]is[image]]
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ title: $:/core/templates/store.area.template.html
|
|||||||
<$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]">
|
<$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]">
|
||||||
<!-- New-style JSON store area, with an old-style store area for compatibility with v5.1.x tooling -->
|
<!-- New-style JSON store area, with an old-style store area for compatibility with v5.1.x tooling -->
|
||||||
`<script class="tiddlywiki-tiddler-store" type="application/json">[`
|
`<script class="tiddlywiki-tiddler-store" type="application/json">[`
|
||||||
<$let newline={{{ [charcode[10]] }}} join=`,$(newline)$`>
|
<$vars newline={{{ [charcode[10]] }}}>
|
||||||
<$text text=<<newline>>/>
|
<$text text=<<newline>>/>
|
||||||
<$list filter=<<saveTiddlerFilter>> join=<<join>> template="$:/core/templates/html-json-tiddler"/>
|
<$list filter=<<saveTiddlerFilter>> counter="counter" template="$:/core/templates/html-json-tiddler"/>
|
||||||
<$list filter="[subfilter<skinnySaveTiddlerFilter>]" template="$:/core/templates/html-json-skinny-tiddler"/>
|
<$vars numTiddlers={{{ [subfilter<saveTiddlerFilter>count[]] }}}>
|
||||||
|
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} counter="counter" template="$:/core/templates/html-json-skinny-tiddler"/>
|
||||||
|
</$vars>
|
||||||
<$text text=<<newline>>/>
|
<$text text=<<newline>>/>
|
||||||
</$let>
|
</$vars>
|
||||||
`]</script>`
|
`]</script>`
|
||||||
`<div id="storeArea" style="display:none;">`
|
`<div id="storeArea" style="display:none;">`
|
||||||
`</div>`
|
`</div>`
|
||||||
@@ -20,8 +22,8 @@ title: $:/core/templates/store.area.template.html
|
|||||||
<!-- Old-style DIV/PRE-based store area -->
|
<!-- Old-style DIV/PRE-based store area -->
|
||||||
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
|
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
|
||||||
`<div id="storeArea" style="display:none;">`
|
`<div id="storeArea" style="display:none;">`
|
||||||
<$list filter={{{ [<saveTiddlerFilter>] }}} template="$:/core/templates/html-div-tiddler"/>
|
<$list filter=<<saveTiddlerFilter>> template="$:/core/templates/html-div-tiddler"/>
|
||||||
<$list filter="[subfilter<skinnySaveTiddlerFilter>]" template="$:/core/templates/html-div-skinny-tiddler"/>
|
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} template="$:/core/templates/html-div-skinny-tiddler"/>
|
||||||
`</div>`
|
`</div>`
|
||||||
</$reveal>
|
</$reveal>
|
||||||
</$list>
|
</$list>
|
||||||
|
|||||||
@@ -40,8 +40,10 @@ caption: {{$:/language/Search/Filter/Caption}}
|
|||||||
<$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
|
<$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
|
||||||
</$list></$list>
|
</$list></$list>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<<lingo Filter/Hint>>
|
<<lingo Filter/Hint>>
|
||||||
|
|
||||||
<div class="tc-search tc-advanced-search">
|
<div class="tc-search tc-advanced-search">
|
||||||
<$keyboard key="((input-tab-right))" actions=<<set-next-input-tab>>>
|
<$keyboard key="((input-tab-right))" actions=<<set-next-input-tab>>>
|
||||||
<$keyboard key="((input-tab-left))" actions=<<set-next-input-tab "before">>>
|
<$keyboard key="((input-tab-left))" actions=<<set-next-input-tab "before">>>
|
||||||
@@ -63,10 +65,11 @@ caption: {{$:/language/Search/Filter/Caption}}
|
|||||||
 
|
 
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterButton]!has[draft.of]]"><$transclude/></$list>
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterButton]!has[draft.of]]"><$transclude/></$list>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
|
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
|
||||||
<$set name="resultCount" value="<$count filter={{$:/temp/advancedsearch}}/>">
|
<$set name="resultCount" value="<$count filter={{$:/temp/advancedsearch}}/>">
|
||||||
<div class="tc-search-results">
|
<div class="tc-search-results">
|
||||||
<p><<lingo Filter/Matches>></p>
|
<<lingo Filter/Matches>>
|
||||||
<$list filter={{$:/temp/advancedsearch}}>
|
<$list filter={{$:/temp/advancedsearch}}>
|
||||||
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>
|
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>
|
||||||
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||||
|
|||||||
@@ -54,18 +54,17 @@ caption: {{$:/language/Search/Standard/Caption}}
|
|||||||
variable="listItem">
|
variable="listItem">
|
||||||
<$vars
|
<$vars
|
||||||
userInput={{{ [[$:/temp/advancedsearch]get[text]] }}}
|
userInput={{{ [[$:/temp/advancedsearch]get[text]] }}}
|
||||||
configTiddler={{{ [[$:/state/advancedsearch/standard/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}}
|
configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}}
|
||||||
searchListState="$:/temp/advancedsearch/selected-item">
|
searchListState="$:/temp/advancedsearch/selected-item">
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]">
|
<$list
|
||||||
|
filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]"
|
||||||
|
emptyMessage="<$list filter='[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]'><$transclude/></$list>">
|
||||||
<$macrocall $name="tabs"
|
<$macrocall $name="tabs"
|
||||||
tabsList="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]"
|
tabsList="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]"
|
||||||
default={{$:/config/SearchResults/Default}}
|
default={{$:/config/SearchResults/Default}}
|
||||||
actions="<$action-setfield $tiddler='$:/state/advancedsearch/standard/currentTab' text=<<currentTab>>/>"
|
actions="<$action-setfield $tiddler='$:/state/advancedsearch/standard/currentTab' text=<<currentTab>>/>"
|
||||||
explicitState="$:/state/tab/search-results/advancedsearch" />
|
explicitState="$:/state/tab/search-results/advancedsearch" />
|
||||||
</$list>
|
</$list>
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]] :else[[]]">
|
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]"><$transclude mode="block"/></$list>
|
|
||||||
</$list>
|
|
||||||
</$vars>
|
</$vars>
|
||||||
</$list>
|
</$list>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
|
|||||||
@@ -45,17 +45,7 @@ $:/config/Plugins/Disabled/$(currentTiddler)$
|
|||||||
<$view field="title"/>
|
<$view field="title"/>
|
||||||
</h2>
|
</h2>
|
||||||
<h2>
|
<h2>
|
||||||
<div>
|
<div><em><$view field="version"/></em></div>
|
||||||
<%if [<currentTiddler>get[stability]match[STABILITY_0_DEPRECATED]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-deprecated">DEPRECATED</span>
|
|
||||||
<%elseif [<currentTiddler>get[stability]match[STABILITY_1_EXPERIMENTAL]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-experimental">EXPERIMENTAL</span>
|
|
||||||
<%elseif [<currentTiddler>get[stability]match[STABILITY_2_STABLE]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-stable">STABLE</span>
|
|
||||||
<%elseif [<currentTiddler>get[stability]match[STABILITY_3_LEGACY]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-legacy">LEGACY</span>
|
|
||||||
<%endif%>
|
|
||||||
<em><$view field="version"/></em></div>
|
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -70,20 +70,9 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
|
|||||||
<div class="tc-plugin-info-chunk tc-plugin-info-description">
|
<div class="tc-plugin-info-chunk tc-plugin-info-description">
|
||||||
<h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>:
|
<h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>:
|
||||||
 
|
 
|
||||||
<$view tiddler=<<assetInfo>> field="description"/>
|
<$view tiddler=<<assetInfo>> field="description"/></h1>
|
||||||
</h1>
|
|
||||||
<h2><$view tiddler=<<assetInfo>> field="original-title"/></h2>
|
<h2><$view tiddler=<<assetInfo>> field="original-title"/></h2>
|
||||||
<div>
|
<div><em><$view tiddler=<<assetInfo>> field="version"/></em></div>
|
||||||
<%if [<assetInfo>get[stability]match[STABILITY_0_DEPRECATED]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-deprecated">DEPRECATED</span>
|
|
||||||
<%elseif [<assetInfo>get[stability]match[STABILITY_1_EXPERIMENTAL]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-experimental">EXPERIMENTAL</span>
|
|
||||||
<%elseif [<assetInfo>get[stability]match[STABILITY_2_STABLE]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-stable">STABLE</span>
|
|
||||||
<%elseif [<assetInfo>get[stability]match[STABILITY_3_LEGACY]] %>
|
|
||||||
<span class="tc-plugin-info-stability tc-plugin-info-stability-legacy">LEGACY</span>
|
|
||||||
<%endif%>
|
|
||||||
<em><$view tiddler=<<assetInfo>> field="version"/></em></div>
|
|
||||||
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion"><div><em>{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}</em></div></$list>
|
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion"><div><em>{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}</em></div></$list>
|
||||||
</div>
|
</div>
|
||||||
<div class="tc-plugin-info-chunk tc-plugin-info-buttons">
|
<div class="tc-plugin-info-chunk tc-plugin-info-buttons">
|
||||||
|
|||||||
@@ -2,19 +2,10 @@ title: $:/core/ui/ControlPanel/Saving/DownloadSaver
|
|||||||
tags: $:/tags/ControlPanel/Saving
|
tags: $:/tags/ControlPanel/Saving
|
||||||
caption: {{$:/language/ControlPanel/Saving/DownloadSaver/Caption}}
|
caption: {{$:/language/ControlPanel/Saving/DownloadSaver/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Saving/DownloadSaver/
|
\define lingo-base() $:/language/ControlPanel/Saving/DownloadSaver/
|
||||||
|
|
||||||
<div class="tc-control-panel-saving" data-setting-title=<<currentTab>>>
|
|
||||||
|
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
!!.tc-control-panel-accent <$link to="$:/config/DownloadSaver/AutoSave"><<lingo AutoSave/Hint>></$link>
|
!! <$link to="$:/config/DownloadSaver/AutoSave"><<lingo AutoSave/Hint>></$link>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/DownloadSaver/AutoSave"
|
<$checkbox tiddler="$:/config/DownloadSaver/AutoSave" field="text" checked="yes" unchecked="no" default="no"> <<lingo AutoSave/Description>> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="no"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<span class="tc-tiny-gap-left"><<lingo AutoSave/Description>></span>
|
|
||||||
</$checkbox>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -3,22 +3,14 @@ tags: $:/tags/ControlPanel/Saving
|
|||||||
caption: {{$:/language/ControlPanel/Saving/General/Caption}}
|
caption: {{$:/language/ControlPanel/Saving/General/Caption}}
|
||||||
list-before:
|
list-before:
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/
|
\define lingo-base() $:/language/ControlPanel/Settings/
|
||||||
|
|
||||||
<div class="tc-control-panel-saving" data-setting-title=<<currentTab>>>
|
|
||||||
|
|
||||||
{{$:/language/ControlPanel/Saving/General/Hint}}
|
{{$:/language/ControlPanel/Saving/General/Hint}}
|
||||||
|
|
||||||
!!.tc-control-panel-accent <$link to="$:/config/AutoSave"><<lingo AutoSave/Caption>></$link>
|
!! <$link to="$:/config/AutoSave"><<lingo AutoSave/Caption>></$link>
|
||||||
|
|
||||||
<<lingo AutoSave/Hint>>
|
<<lingo AutoSave/Hint>>
|
||||||
|
|
||||||
<$radio tiddler="$:/config/AutoSave" value="yes">
|
<$radio tiddler="$:/config/AutoSave" value="yes"> <<lingo AutoSave/Enabled/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo AutoSave/Enabled/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/AutoSave" value="no">
|
<$radio tiddler="$:/config/AutoSave" value="no"> <<lingo AutoSave/Disabled/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo AutoSave/Disabled/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -2,16 +2,7 @@ title: $:/core/ui/ControlPanel/Settings/CamelCase
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/CamelCase/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/CamelCase/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/CamelCase/
|
\define lingo-base() $:/language/ControlPanel/Settings/CamelCase/
|
||||||
|
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/WikiParserRules/Inline/wikilink"
|
<$checkbox tiddler="$:/config/WikiParserRules/Inline/wikilink" field="text" checked="enable" unchecked="disable" default="enable"> <$link to="$:/config/WikiParserRules/Inline/wikilink"><<lingo Description>></$link> </$checkbox>
|
||||||
field="text" checked="enable" unchecked="disable" default="enable"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/WikiParserRules/Inline/wikilink" class="tc-tiny-gap-left">
|
|
||||||
<<lingo Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|||||||
@@ -2,18 +2,13 @@ caption: {{$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption}}
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
title: $:/core/ui/ControlPanel/Settings/DefaultMoreSidebarTab
|
title: $:/core/ui/ControlPanel/Settings/DefaultMoreSidebarTab
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/DefaultMoreSidebarTab/
|
\define lingo-base() $:/language/ControlPanel/Settings/DefaultMoreSidebarTab/
|
||||||
|
\whitespace trim
|
||||||
|
|
||||||
<$link to="$:/config/DefaultMoreSidebarTab" class="tc-control-panel-item">
|
<$link to="$:/config/DefaultMoreSidebarTab"><<lingo Hint>></$link>
|
||||||
<<lingo Hint>>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$select tiddler="$:/config/DefaultMoreSidebarTab" class="tc-select">
|
<$select tiddler="$:/config/DefaultMoreSidebarTab">
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]">
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]">
|
||||||
<option value=<<currentTiddler>>><$transclude field="caption">
|
<option value=<<currentTiddler>>><$transclude field="caption"><$text text=<<currentTiddler>>/></$transclude></option>
|
||||||
<$text text=<<currentTiddler>>/>
|
</$list>
|
||||||
</$transclude>
|
|
||||||
</option>
|
|
||||||
</$list>
|
|
||||||
</$select>
|
</$select>
|
||||||
|
|||||||
@@ -5,16 +5,10 @@ title: $:/core/ui/ControlPanel/Settings/DefaultSidebarTab
|
|||||||
\define lingo-base() $:/language/ControlPanel/Settings/DefaultSidebarTab/
|
\define lingo-base() $:/language/ControlPanel/Settings/DefaultSidebarTab/
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
<$link to="$:/config/DefaultSidebarTab" class="tc-control-panel-item">
|
<$link to="$:/config/DefaultSidebarTab"><<lingo Hint>></$link>
|
||||||
<<lingo Hint>>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$select tiddler="$:/config/DefaultSidebarTab" class="tc-select">
|
<$select tiddler="$:/config/DefaultSidebarTab">
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]">
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]">
|
||||||
<option value=<<currentTiddler>>>
|
<option value=<<currentTiddler>>><$transclude field="caption"><$text text=<<currentTiddler>>/></$transclude></option>
|
||||||
<$transclude field="caption">
|
</$list>
|
||||||
<$text text=<<currentTiddler>>/>
|
|
||||||
</$transclude>
|
|
||||||
</option>
|
|
||||||
</$list>
|
|
||||||
</$select>
|
</$select>
|
||||||
|
|||||||
@@ -2,15 +2,8 @@ title: $:/core/ui/ControlPanel/Settings/EditorToolbar
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/EditorToolbar/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/EditorToolbar/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/EditorToolbar/
|
\define lingo-base() $:/language/ControlPanel/Settings/EditorToolbar/
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/TextEditor/EnableToolbar"
|
<$checkbox tiddler="$:/config/TextEditor/EnableToolbar" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/TextEditor/EnableToolbar"><<lingo Description>></$link> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="yes"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/TextEditor/EnableToolbar" class="tc-tiny-gap-left">
|
|
||||||
<<lingo Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|||||||
@@ -2,17 +2,9 @@ title: $:/core/ui/ControlPanel/Settings/InfoPanelMode
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/InfoPanelMode/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/InfoPanelMode/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/InfoPanelMode/
|
\define lingo-base() $:/language/ControlPanel/Settings/InfoPanelMode/
|
||||||
|
<$link to="$:/config/TiddlerInfo/Mode"><<lingo Hint>></$link>
|
||||||
|
|
||||||
<$link to="$:/config/TiddlerInfo/Mode" class="tc-control-panel-item">
|
<$radio tiddler="$:/config/TiddlerInfo/Mode" value="popup"> <<lingo Popup/Description>> </$radio>
|
||||||
<<lingo Hint>>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/TiddlerInfo/Mode" value="popup">
|
<$radio tiddler="$:/config/TiddlerInfo/Mode" value="sticky"> <<lingo Sticky/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo Popup/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/TiddlerInfo/Mode" value="sticky">
|
|
||||||
<span class="tc-tiny-gap-left"><<lingo Sticky/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|||||||
@@ -2,25 +2,21 @@ title: $:/core/ui/ControlPanel/Settings/LinkToBehaviour
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/LinkToBehaviour/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/LinkToBehaviour/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/LinkToBehaviour/
|
\define lingo-base() $:/language/ControlPanel/Settings/LinkToBehaviour/
|
||||||
|
\whitespace trim
|
||||||
|
|
||||||
<$link to="$:/config/Navigation/openLinkFromInsideRiver" class="tc-control-panel-item">
|
<$link to="$:/config/Navigation/openLinkFromInsideRiver"><<lingo "InsideRiver/Hint">></$link>
|
||||||
<<lingo "InsideRiver/Hint">>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$select tiddler="$:/config/Navigation/openLinkFromInsideRiver" class="tc-select">
|
<$select tiddler="$:/config/Navigation/openLinkFromInsideRiver">
|
||||||
<option value="above"><<lingo "OpenAbove">></option>
|
<option value="above"><<lingo "OpenAbove">></option>
|
||||||
<option value="below"><<lingo "OpenBelow">></option>
|
<option value="below"><<lingo "OpenBelow">></option>
|
||||||
<option value="top"><<lingo "OpenAtTop">></option>
|
<option value="top"><<lingo "OpenAtTop">></option>
|
||||||
<option value="bottom"><<lingo "OpenAtBottom">></option>
|
<option value="bottom"><<lingo "OpenAtBottom">></option>
|
||||||
</$select>
|
</$select>
|
||||||
|
|
||||||
<$link to="$:/config/Navigation/openLinkFromOutsideRiver" class="tc-control-panel-item">
|
<$link to="$:/config/Navigation/openLinkFromOutsideRiver"><<lingo "OutsideRiver/Hint">></$link>
|
||||||
<<lingo "OutsideRiver/Hint">>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$select tiddler="$:/config/Navigation/openLinkFromOutsideRiver" class="tc-select">
|
<$select tiddler="$:/config/Navigation/openLinkFromOutsideRiver">
|
||||||
<option value="top"><<lingo "OpenAtTop">></option>
|
<option value="top"><<lingo "OpenAtTop">></option>
|
||||||
<option value="bottom"><<lingo "OpenAtBottom">></option>
|
<option value="bottom"><<lingo "OpenAtBottom">></option>
|
||||||
</$select>
|
</$select>
|
||||||
|
|||||||
@@ -2,12 +2,8 @@ title: $:/core/ui/ControlPanel/Settings/MissingLinks
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/MissingLinks/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/MissingLinks/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/MissingLinks/
|
\define lingo-base() $:/language/ControlPanel/Settings/MissingLinks/
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/MissingLinks" field="text" checked="yes" unchecked="no" default="yes">
|
<$checkbox tiddler="$:/config/MissingLinks" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/MissingLinks"><<lingo Description>></$link> </$checkbox>
|
||||||
<$link to="$:/config/MissingLinks" class="tc-control-panel-item">
|
|
||||||
<span class="tc-tiny-gap-left"><<lingo Description>></span>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|||||||
@@ -2,21 +2,12 @@ title: $:/core/ui/ControlPanel/Settings/NavigationAddressBar
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/NavigationAddressBar/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/NavigationAddressBar/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/NavigationAddressBar/
|
\define lingo-base() $:/language/ControlPanel/Settings/NavigationAddressBar/
|
||||||
|
|
||||||
<$link to="$:/config/Navigation/UpdateAddressBar" class="tc-control-panel-item">
|
<$link to="$:/config/Navigation/UpdateAddressBar"><<lingo Hint>></$link>
|
||||||
<<lingo Hint>>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="permaview">
|
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="permaview"> <<lingo Permaview/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo Permaview/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="permalink">
|
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="permalink"> <<lingo Permalink/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo Permalink/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="no">
|
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="no"> <<lingo No/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo No/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|||||||
@@ -2,17 +2,9 @@ title: $:/core/ui/ControlPanel/Settings/NavigationHistory
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/NavigationHistory/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/NavigationHistory/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/NavigationHistory/
|
\define lingo-base() $:/language/ControlPanel/Settings/NavigationHistory/
|
||||||
|
<$link to="$:/config/Navigation/UpdateHistory"><<lingo Hint>></$link>
|
||||||
|
|
||||||
<$link to="$:/config/Navigation/UpdateHistory" class="tc-control-panel-item">
|
<$radio tiddler="$:/config/Navigation/UpdateHistory" value="yes"> <<lingo Yes/Description>> </$radio>
|
||||||
<<lingo Hint>>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Navigation/UpdateHistory" value="yes">
|
<$radio tiddler="$:/config/Navigation/UpdateHistory" value="no"> <<lingo No/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo Yes/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Navigation/UpdateHistory" value="no">
|
|
||||||
<span class="tc-tiny-gap-left"><<lingo No/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|||||||
@@ -2,24 +2,9 @@ title: $:/core/ui/ControlPanel/Settings/NavigationPermalinkviewMode
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/NavigationPermalinkviewMode/
|
\define lingo-base() $:/language/ControlPanel/Settings/NavigationPermalinkviewMode/
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/Navigation/Permalinkview/CopyToClipboard"
|
<$checkbox tiddler="$:/config/Navigation/Permalinkview/CopyToClipboard" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/Navigation/Permalinkview/CopyToClipboard"><<lingo CopyToClipboard/Description>></$link> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="yes"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/Navigation/Permalinkview/CopyToClipboard" class="tc-tiny-gap-left">
|
|
||||||
<<lingo CopyToClipboard/Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/Navigation/Permalinkview/UpdateAddressBar"
|
<$checkbox tiddler="$:/config/Navigation/Permalinkview/UpdateAddressBar" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/Navigation/Permalinkview/UpdateAddressBar"><<lingo UpdateAddressBar/Description>></$link> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="yes"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/Navigation/Permalinkview/UpdateAddressBar" class="tc-tiny-gap-left">
|
|
||||||
<<lingo UpdateAddressBar/Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|||||||
@@ -2,15 +2,7 @@ title: $:/core/ui/ControlPanel/Settings/PerformanceInstrumentation
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/PerformanceInstrumentation/
|
\define lingo-base() $:/language/ControlPanel/Settings/PerformanceInstrumentation/
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/Performance/Instrumentation"
|
<$checkbox tiddler="$:/config/Performance/Instrumentation" field="text" checked="yes" unchecked="no" default="no"> <$link to="$:/config/Performance/Instrumentation"><<lingo Description>></$link> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="no"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/Performance/Instrumentation" class="tc-tiny-gap-left">
|
|
||||||
<<lingo Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|||||||
@@ -2,17 +2,9 @@ title: $:/core/ui/ControlPanel/Settings/TitleLinks
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/TitleLinks/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/TitleLinks/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/TitleLinks/
|
\define lingo-base() $:/language/ControlPanel/Settings/TitleLinks/
|
||||||
|
<$link to="$:/config/Tiddlers/TitleLinks"><<lingo Hint>></$link>
|
||||||
|
|
||||||
<$link to="$:/config/Tiddlers/TitleLinks" class="tc-control-panel-item">
|
<$radio tiddler="$:/config/Tiddlers/TitleLinks" value="yes"> <<lingo Yes/Description>> </$radio>
|
||||||
<<lingo Hint>>
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Tiddlers/TitleLinks" value="yes">
|
<$radio tiddler="$:/config/Tiddlers/TitleLinks" value="no"> <<lingo No/Description>> </$radio>
|
||||||
<span class="tc-tiny-gap-left"><<lingo Yes/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|
||||||
<$radio tiddler="$:/config/Tiddlers/TitleLinks" value="no">
|
|
||||||
<span class="tc-tiny-gap-left"><<lingo No/Description>></span>
|
|
||||||
</$radio>
|
|
||||||
|
|||||||
@@ -2,15 +2,12 @@ title: $:/core/ui/ControlPanel/Settings/ToolbarButtonStyle
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtonStyle/
|
\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtonStyle/
|
||||||
|
\whitespace trim
|
||||||
|
<$link to="$:/config/Toolbar/ButtonClass"><<lingo "Hint">></$link>
|
||||||
|
|
||||||
<$link to="$:/config/Toolbar/ButtonClass" class="tc-control-panel-item">
|
<$select tiddler="$:/config/Toolbar/ButtonClass">
|
||||||
<<lingo "Hint">>
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ToolbarButtonStyle]]">
|
||||||
</$link>
|
<option value={{!!text}}>{{!!caption}}</option>
|
||||||
|
</$list>
|
||||||
<$select tiddler="$:/config/Toolbar/ButtonClass" class="tc-select">
|
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ToolbarButtonStyle]]">
|
|
||||||
<option value={{!!text}}>{{!!caption}}</option>
|
|
||||||
</$list>
|
|
||||||
</$select>
|
</$select>
|
||||||
|
|||||||
@@ -2,24 +2,9 @@ title: $:/core/ui/ControlPanel/Settings/ToolbarButtons
|
|||||||
tags: $:/tags/ControlPanel/Settings
|
tags: $:/tags/ControlPanel/Settings
|
||||||
caption: {{$:/language/ControlPanel/Settings/ToolbarButtons/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/ToolbarButtons/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtons/
|
\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtons/
|
||||||
<<lingo Hint>>
|
<<lingo Hint>>
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/Toolbar/Icons"
|
<$checkbox tiddler="$:/config/Toolbar/Icons" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/Toolbar/Icons"><<lingo Icons/Description>></$link> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="yes"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/Toolbar/Icons" class="tc-tiny-gap-left">
|
|
||||||
<<lingo Icons/Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|
||||||
<$checkbox tiddler="$:/config/Toolbar/Text"
|
<$checkbox tiddler="$:/config/Toolbar/Text" field="text" checked="yes" unchecked="no" default="no"> <$link to="$:/config/Toolbar/Text"><<lingo Text/Description>></$link> </$checkbox>
|
||||||
field="text" checked="yes" unchecked="no" default="no"
|
|
||||||
class="tc-control-panel-item"
|
|
||||||
>
|
|
||||||
<$link to="$:/config/Toolbar/Text" class="tc-tiny-gap-left">
|
|
||||||
<<lingo Text/Description>>
|
|
||||||
</$link>
|
|
||||||
</$checkbox>
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
title: $:/core/ui/ControlPanel/TestCases
|
|
||||||
tags: $:/tags/ControlPanel/Advanced
|
|
||||||
caption: {{$:/language/ControlPanel/TestCases/Caption}}
|
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
{{$:/language/ControlPanel/TestCases/Hint}}
|
|
||||||
|
|
||||||
<div class="tc-control-panel">
|
|
||||||
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/TestCases]!has[draft.of]]" default="$:/core/ui/ControlPanel/TestCases/All"/>
|
|
||||||
</div>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
title: $:/core/ui/ControlPanel/TestCases/All
|
|
||||||
tags: $:/tags/ControlPanel/TestCases
|
|
||||||
caption: {{$:/language/ControlPanel/TestCases/All/Caption}}
|
|
||||||
|
|
||||||
\define lingo-base() $:/language/ControlPanel/
|
|
||||||
<<lingo TestCases/All/Hint>>
|
|
||||||
|
|
||||||
<$list filter="[all[tiddlers+shadows]tag[$:/tags/wiki-test-spec]type[text/vnd.tiddlywiki-multiple]] [all[tiddlers+shadows]tag[$:/tags/wiki-test-spec-failing]type[text/vnd.tiddlywiki-multiple]]">
|
|
||||||
|
|
||||||
<h2>
|
|
||||||
|
|
||||||
<$link>
|
|
||||||
|
|
||||||
<$text text=<<currentTiddler>>/>
|
|
||||||
|
|
||||||
</$link>
|
|
||||||
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<$transclude
|
|
||||||
$tiddler="$:/core/ui/TestCaseTemplate"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</$list>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
title: $:/core/ui/ControlPanel/TestCases/Failed
|
|
||||||
tags: $:/tags/ControlPanel/TestCases
|
|
||||||
caption: {{$:/language/ControlPanel/TestCases/Failed/Caption}}
|
|
||||||
|
|
||||||
\define lingo-base() $:/language/ControlPanel/
|
|
||||||
<<lingo TestCases/Failed/Hint>>
|
|
||||||
|
|
||||||
<$list filter="[all[tiddlers+shadows]tag[$:/tags/wiki-test-spec]type[text/vnd.tiddlywiki-multiple]] [all[tiddlers+shadows]tag[$:/tags/wiki-test-spec-failing]type[text/vnd.tiddlywiki-multiple]]">
|
|
||||||
|
|
||||||
<$transclude
|
|
||||||
$tiddler="$:/core/ui/TestCaseTemplate"
|
|
||||||
hideIfPass="yes"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</$list>
|
|
||||||
@@ -9,9 +9,9 @@ list-before:
|
|||||||
|
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]">
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]">
|
||||||
|
|
||||||
<div class="tc-control-panel-setting" data-setting-title=<<currentTiddler>> style="border-top:1px solid #eee;">
|
<div style="border-top:1px solid #eee;">
|
||||||
|
|
||||||
!!.tc-control-panel-accent <$link><$transclude field="caption"/></$link>
|
!! <$link><$transclude field="caption"/></$link>
|
||||||
|
|
||||||
<$transclude/>
|
<$transclude/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
title: $:/core/ui/EditTemplate/body/default
|
title: $:/core/ui/EditTemplate/body/default
|
||||||
|
|
||||||
\function edit-preview-state()
|
\function edit-preview-state()
|
||||||
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] +[get[text]] :else[[no]]
|
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] +[get[text]] :else[[no]]
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define config-visibility-title()
|
\define config-visibility-title()
|
||||||
@@ -14,17 +14,15 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let
|
<$let
|
||||||
qualified-preview-state=<<qualify "$:/state/showeditpreview">>
|
|
||||||
editPreviewStateTiddler={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] }}}
|
|
||||||
importTitle=<<qualify $:/ImportImage>>
|
importTitle=<<qualify $:/ImportImage>>
|
||||||
importState=<<qualify $:/state/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>> >
|
<$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>
|
||||||
<div class={{{ [<edit-preview-state>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"/>
|
<$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}}>
|
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
title: $:/core/ui/EditTemplate/controls
|
title: $:/core/ui/EditTemplate/controls
|
||||||
tags: $:/tags/EditTemplate
|
tags: $:/tags/EditTemplate
|
||||||
|
|
||||||
\define config-title() $:/config/EditToolbarButtons/Visibility/$(listItem)$
|
\define config-title()
|
||||||
|
$:/config/EditToolbarButtons/Visibility/$(listItem)$
|
||||||
|
\end
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<div class="tc-tiddler-title tc-tiddler-edit-title">
|
<div class="tc-tiddler-title tc-tiddler-edit-title">
|
||||||
<$view field="title"/>
|
<$view field="title"/>
|
||||||
<span class="tc-tiddler-controls tc-titlebar">
|
<span class="tc-tiddler-controls tc-titlebar"><$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem"><$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]]}}}><$reveal type="nomatch" state=<<config-title>> text="hide"><$transclude tiddler=<<listItem>>/></$reveal></$let></$list></span>
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem">
|
<div style="clear: both;"></div>
|
||||||
<$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]] }}}>
|
|
||||||
<$reveal type="nomatch" state=<<config-title>> text="hide">
|
|
||||||
<$transclude $tiddler=<<listItem>>/>
|
|
||||||
</$reveal>
|
|
||||||
</$let>
|
|
||||||
</$list>
|
|
||||||
</span>
|
|
||||||
<div style="clear: both;"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user