mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-22 19:04:38 +00:00
Compare commits
33 Commits
parser-var
...
single-tid
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d9b00bdb5 | ||
|
|
b88bfda0b4 | ||
|
|
834610cdb9 | ||
|
|
5272b13af1 | ||
|
|
5f25b21c0d | ||
|
|
f256b7791d | ||
|
|
66fc63ed7f | ||
|
|
f703330962 | ||
|
|
0ea4bfe99f | ||
|
|
7f99b8c32e | ||
|
|
95111db7ee | ||
|
|
5e148c1d26 | ||
|
|
1ff40c6b22 | ||
|
|
a0084eee9a | ||
|
|
55740fbfaf | ||
|
|
226a635c5c | ||
|
|
a5dca25078 | ||
|
|
a15a711d4a | ||
|
|
9bc8cbfe98 | ||
|
|
f8b81616fb | ||
|
|
b7611e23b4 | ||
|
|
eacbb928e9 | ||
|
|
04d6677949 | ||
|
|
ee25af758e | ||
|
|
33aa37f7dc | ||
|
|
0d40b691e7 | ||
|
|
81fda40486 | ||
|
|
7a50edb56d | ||
|
|
f76e3f5d41 | ||
|
|
9f2ce65a71 | ||
|
|
9a77ec4591 | ||
|
|
8625d6cd01 | ||
|
|
aba835fb74 |
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve TiddlyWiki 5
|
||||
title: "[BUG]"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for TiddlyWiki 5
|
||||
title: "[IDEA]"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -1,22 +0,0 @@
|
||||
---
|
||||
name: Pull Request
|
||||
about: Propose a change to TiddlyWiki 5
|
||||
title: ""
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your PR related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you are proposing**
|
||||
A clear and concise description of the changes you are proposing. Include images to show visual changes.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
If you link to discussions elsewhere then please copy and paste the important text, and don't expect readers to scan the entire discussion to find the relevant part.
|
||||
74
.github/workflows/ci.yml
vendored
74
.github/workflows/ci.yml
vendored
@@ -1,74 +0,0 @@
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- tiddlywiki-com
|
||||
env:
|
||||
NODE_VERSION: "12"
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/test.sh"
|
||||
build-prerelease:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/master'
|
||||
needs: test
|
||||
env:
|
||||
TW5_BUILD_TIDDLYWIKI: "./tiddlywiki.js"
|
||||
TW5_BUILD_MAIN_EDITION: "./editions/prerelease"
|
||||
TW5_BUILD_OUTPUT: "./output/prerelease"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/ci-pre-build.sh"
|
||||
# There's another near-duplicate "Set dynamic environment variables" step in
|
||||
# the `build-tiddlywiki-com` job.
|
||||
# These _could_ be extracted as a script (or moved into `ci-pre-build.sh`) to do away with the
|
||||
# duplication, but, the visibility that comes from having these in the workflow file seems
|
||||
# valuable. Environment variables are global variables and setting them at the top-level
|
||||
# makes sense.
|
||||
# Time to reconsider this decision might be when this setup turns out to be mistake-prone.
|
||||
- name: "Set dynamic environment variables"
|
||||
run: |
|
||||
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||
echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
|
||||
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
||||
echo ::set-env name=TW5_BUILD_DETAILS::Prerelease built from branch \'$TW5_BUILD_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
||||
- run: "./bin/build-site.sh"
|
||||
- run: "./bin/ci-push.sh"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
||||
build-tiddlywiki-com:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/tiddlywiki-com'
|
||||
needs: test
|
||||
env:
|
||||
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||
TW5_BUILD_OUTPUT: "./output"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/ci-pre-build.sh"
|
||||
# When making a change here, don't forget to see if it also applies to the step
|
||||
# with the same name in the `build-prerelease` job.
|
||||
- name: "Set dynamic environment variables"
|
||||
run: |
|
||||
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||
echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
|
||||
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
||||
echo ::set-env name=TW5_BUILD_DETAILS::Built from branch \'$TW5_BUILD_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
||||
- run: "./bin/build-site.sh"
|
||||
- run: "./bin/ci-push.sh"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
||||
35
.travis.yml
Normal file
35
.travis.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "12.4.0"
|
||||
|
||||
stages:
|
||||
- name: test
|
||||
- name: build-prerelease
|
||||
if: branch = "master"
|
||||
- name: build-tiddlywiki-com
|
||||
if: branch = "tiddlywiki-com"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
script: ./bin/test.sh
|
||||
- stage: build-prerelease
|
||||
script:
|
||||
- ./bin/travis-pre-build.sh
|
||||
- export TW5_BUILD_TIDDLYWIKI='./tiddlywiki.js'
|
||||
- export TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)
|
||||
- export TW5_BUILD_DETAILS="Prerelease built from branch '$TRAVIS_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')"
|
||||
- export TW5_BUILD_MAIN_EDITION='./editions/prerelease'
|
||||
- export TW5_BUILD_OUTPUT='./output/prerelease'
|
||||
- ./bin/build-site.sh || travis_terminate 1
|
||||
- ./bin/travis-push.sh || travis_terminate 1
|
||||
- stage: build-tiddlywiki-com
|
||||
script:
|
||||
- ./bin/travis-pre-build.sh
|
||||
- export TW5_BUILD_TIDDLYWIKI='./node_modules/tiddlywiki/tiddlywiki.js'
|
||||
- export TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)
|
||||
- export TW5_BUILD_DETAILS="Built from branch '$TRAVIS_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')"
|
||||
- export TW5_BUILD_MAIN_EDITION='./editions/tw5.com'
|
||||
- export TW5_BUILD_OUTPUT='./output'
|
||||
- ./bin/build-site.sh || travis_terminate 1
|
||||
- ./bin/travis-push.sh || travis_terminate 1
|
||||
@@ -5,7 +5,7 @@
|
||||
# Default to the current version number for building the plugin library
|
||||
|
||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||
TW5_BUILD_VERSION=v5.1.23
|
||||
TW5_BUILD_VERSION=v5.1.21
|
||||
fi
|
||||
|
||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
cd output || exit 1
|
||||
|
||||
git config --global user.email "actions@github.com" || exit 1
|
||||
git config --global user.email "travis@travis-ci.org" || exit 1
|
||||
|
||||
git config --global user.name "GitHub Actions" || exit 1
|
||||
git config --global user.name "Travis CI" || exit 1
|
||||
|
||||
git add -A . || exit 1
|
||||
|
||||
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" || exit 1
|
||||
git commit --message "Travis build: $TRAVIS_BUILD_NUMBER of $TRAVIS_BRANCH ($(date +'%F %T %Z'))" || exit 1
|
||||
|
||||
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Process translation updates made via the translators edition
|
||||
|
||||
# ./bin/update-translation-from-html-file.sh <language-code> <path-to-html-file>
|
||||
|
||||
# Assign and check parameters
|
||||
|
||||
LANGUAGE_CODE=$1
|
||||
HTML_FILE_PATH=$2
|
||||
|
||||
if [ -z "$LANGUAGE_CODE" ]; then
|
||||
echo "Missing parameter: language code"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$HTML_FILE_PATH" ]; then
|
||||
echo "Missing parameter: path to HTML file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./tiddlywiki.js editions/translators/ --verbose --unpackplugin $:/languages/$LANGUAGE_CODE --load $HTML_FILE_PATH --build output-files || exit 1
|
||||
|
||||
cp -R ./editions/translators/output/language/. ./languages/$LANGUAGE_CODE/ || exit 1
|
||||
|
||||
91
boot/boot.js
91
boot/boot.js
@@ -409,10 +409,10 @@ $tw.utils.resolvePath = function(sourcepath,rootpath) {
|
||||
};
|
||||
|
||||
/*
|
||||
Parse a semantic version string into its constituent parts -- see https://semver.org
|
||||
Parse a semantic version string into its constituent parts
|
||||
*/
|
||||
$tw.utils.parseVersion = function(version) {
|
||||
var match = /^v?((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/.exec(version);
|
||||
var match = /^((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/.exec(version);
|
||||
if(match) {
|
||||
return {
|
||||
version: match[1],
|
||||
@@ -427,37 +427,25 @@ $tw.utils.parseVersion = function(version) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Returns +1 if the version string A is greater than the version string B, 0 if they are the same, and +1 if B is greater than A.
|
||||
Missing or malformed version strings are parsed as 0.0.0
|
||||
*/
|
||||
$tw.utils.compareVersions = function(versionStringA,versionStringB) {
|
||||
var defaultVersion = {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 0
|
||||
},
|
||||
versionA = $tw.utils.parseVersion(versionStringA) || defaultVersion,
|
||||
versionB = $tw.utils.parseVersion(versionStringB) || defaultVersion,
|
||||
diff = [
|
||||
versionA.major - versionB.major,
|
||||
versionA.minor - versionB.minor,
|
||||
versionA.patch - versionB.patch
|
||||
];
|
||||
if((diff[0] > 0) || (diff[0] === 0 && diff[1] > 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] > 0)) {
|
||||
return +1;
|
||||
} else if((diff[0] < 0) || (diff[0] === 0 && diff[1] < 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] < 0)) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Returns true if the version string A is greater than the version string B. Returns true if the versions are the same
|
||||
*/
|
||||
$tw.utils.checkVersions = function(versionStringA,versionStringB) {
|
||||
return $tw.utils.compareVersions(versionStringA,versionStringB) !== -1;
|
||||
var defaultVersion = {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 0
|
||||
},
|
||||
versionA = $tw.utils.parseVersion(versionStringA) || defaultVersion,
|
||||
versionB = $tw.utils.parseVersion(versionStringB) || defaultVersion,
|
||||
diff = [
|
||||
versionA.major - versionB.major,
|
||||
versionA.minor - versionB.minor,
|
||||
versionA.patch - versionB.patch
|
||||
];
|
||||
return (diff[0] > 0) ||
|
||||
(diff[0] === 0 && diff[1] > 0) ||
|
||||
(diff[0] === 0 && diff[1] === 0 && diff[2] >= 0);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -479,31 +467,6 @@ $tw.utils.registerFileType = function(type,encoding,extension,options) {
|
||||
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type};
|
||||
};
|
||||
|
||||
/*
|
||||
Parses a content type of the form "type/subtype; attribute=value", as per https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
|
||||
Returns an array of [type/subtype,attribute,value], with the last two entries being optional
|
||||
*/
|
||||
$tw.utils.parseContentType = function(contentType) {
|
||||
contentType = contentType || "";
|
||||
var parts = contentType.split(";"),
|
||||
results = [(parts[0] || "").trim()];
|
||||
if(parts[1]) {
|
||||
parts = parts[1].split("=");
|
||||
if(parts[0]) {
|
||||
results[1] = (parts[0] || "").trim();
|
||||
results[2] = (parts[1] || "").trim();
|
||||
}
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
/*
|
||||
Returns the contentTypeInfo for a type
|
||||
*/
|
||||
$tw.utils.getContentTypeInfo = function(contentType) {
|
||||
return $tw.config.contentTypeInfo[$tw.utils.parseContentType(contentType)[0]] || null;
|
||||
};
|
||||
|
||||
/*
|
||||
Given an extension, always access the $tw.config.fileExtensionInfo
|
||||
using a lowercase extension only.
|
||||
@@ -1488,7 +1451,6 @@ $tw.Wiki.prototype.processSafeMode = function() {
|
||||
Extracts tiddlers from a typed block of text, specifying default field values
|
||||
*/
|
||||
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
|
||||
type = $tw.utils.parseContentType(type)[0];
|
||||
srcFields = srcFields || Object.create(null);
|
||||
options = options || {};
|
||||
var deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],
|
||||
@@ -2198,7 +2160,8 @@ $tw.loadTiddlersNode = function() {
|
||||
/*
|
||||
Startup TiddlyWiki
|
||||
*/
|
||||
$tw.boot.initStartup = function(options) {
|
||||
$tw.boot.startup = function(options) {
|
||||
options = options || {};
|
||||
// Get the URL hash and check for safe mode
|
||||
$tw.locationHash = "#";
|
||||
if($tw.browser && !$tw.node) {
|
||||
@@ -2293,7 +2256,6 @@ $tw.boot.initStartup = function(options) {
|
||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
||||
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||||
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
|
||||
$tw.utils.registerFileType("video/webm","base64",".webm");
|
||||
@@ -2331,9 +2293,6 @@ $tw.boot.initStartup = function(options) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
$tw.boot.loadStartup = function(options){
|
||||
|
||||
// Load tiddlers
|
||||
if($tw.boot.tasks.readBrowserTiddlers) {
|
||||
$tw.loadTiddlersBrowser();
|
||||
@@ -2346,8 +2305,6 @@ $tw.boot.loadStartup = function(options){
|
||||
}
|
||||
// Give hooks a chance to modify the store
|
||||
$tw.hooks.invokeHook("th-boot-tiddlers-loaded");
|
||||
}
|
||||
$tw.boot.execStartup = function(options){
|
||||
// Unpack plugin tiddlers
|
||||
$tw.wiki.readPluginInfo();
|
||||
$tw.wiki.registerPluginTiddlers("plugin",$tw.safeMode ? ["$:/core"] : undefined);
|
||||
@@ -2376,16 +2333,6 @@ $tw.boot.execStartup = function(options){
|
||||
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
|
||||
// Repeatedly execute the next eligible task
|
||||
$tw.boot.executeNextStartupTask(options.callback);
|
||||
}
|
||||
/*
|
||||
Startup TiddlyWiki
|
||||
*/
|
||||
$tw.boot.startup = function(options) {
|
||||
options = options || {};
|
||||
// Get the URL hash and check for safe mode
|
||||
$tw.boot.initStartup(options);
|
||||
$tw.boot.loadStartup(options);
|
||||
$tw.boot.execStartup(options);
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
4
core/images/storyview-solo.tid
Normal file
4
core/images/storyview-solo.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/storyview-solo
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg width="22pt" height="22pt" class="tc-image-storyview-single tc-image-button" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16A8 8 0 0016 24.009V71.99C16 76.414 19.588 80 24 80h80a8 8 0 008-8.009V24.01c0-4.423-3.588-8.009-8-8.009H24z"/></svg>
|
||||
@@ -70,7 +70,6 @@ Plugins/Caption: Plugins
|
||||
Plugins/Disable/Caption: disable
|
||||
Plugins/Disable/Hint: Disable this plugin when reloading page
|
||||
Plugins/Disabled/Status: (disabled)
|
||||
Plugins/Downgrade/Caption: downgrade
|
||||
Plugins/Empty/Hint: None
|
||||
Plugins/Enable/Caption: enable
|
||||
Plugins/Enable/Hint: Enable this plugin when reloading page
|
||||
@@ -88,11 +87,6 @@ Plugins/Plugins/Hint: Plugins
|
||||
Plugins/Reinstall/Caption: reinstall
|
||||
Plugins/Themes/Caption: Themes
|
||||
Plugins/Themes/Hint: Theme plugins
|
||||
Plugins/Update/Caption: update
|
||||
Plugins/Updates/Caption: Updates
|
||||
Plugins/Updates/Hint: Available updates to installed plugins
|
||||
Plugins/Updates/UpdateAll/Caption: Update <<update-count>> plugins
|
||||
Plugins/SubPluginPrompt: With <<count>> sub-plugins available
|
||||
Saving/Caption: Saving
|
||||
Saving/DownloadSaver/AutoSave/Description: Permit automatic saving for the download saver
|
||||
Saving/DownloadSaver/AutoSave/Hint: Enable Autosave for Download Saver
|
||||
@@ -117,7 +111,6 @@ Saving/GitService/Gitea/Caption: Gitea Saver
|
||||
Saving/GitService/Gitea/Password: Personal access token for API (via Gitea’s web interface: `Settings | Applications | Generate New Token`)
|
||||
Saving/TiddlySpot/Advanced/Heading: Advanced Settings
|
||||
Saving/TiddlySpot/BackupDir: Backup Directory
|
||||
Saving/TiddlySpot/ControlPanel: ~TiddlySpot Control Panel
|
||||
Saving/TiddlySpot/Backups: Backups
|
||||
Saving/TiddlySpot/Caption: ~TiddlySpot Saver
|
||||
Saving/TiddlySpot/Description: These settings are only used when saving to http://tiddlyspot.com or a compatible remote server
|
||||
|
||||
@@ -6,13 +6,13 @@ description: Render tiddlers matching a filter to a specified ContentType
|
||||
Render a set of tiddlers matching a filter to separate files of a specified ContentType (defaults to `text/html`) and extension (defaults to `.html`).
|
||||
|
||||
```
|
||||
--rendertiddlers '<filter>' <template> <pathname> [<type>] [<extension>] ["noclean"]
|
||||
--rendertiddlers <filter> <template> <pathname> [<type>] [<extension>] ["noclean"]
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
--rendertiddlers '[!is[system]]' $:/core/templates/static.tiddler.html ./static text/plain
|
||||
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html ./static text/plain
|
||||
```
|
||||
|
||||
By default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
|
||||
|
||||
@@ -27,7 +27,6 @@ Error/EditConflict: File changed on server
|
||||
Error/Filter: Filter error
|
||||
Error/FilterSyntax: Syntax error in filter expression
|
||||
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
||||
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
||||
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/RecursiveTransclusion: Recursive transclusion error in transclude widget
|
||||
@@ -63,11 +62,6 @@ OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
||||
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
||||
RecentChanges/DateFormat: DDth MMM YYYY
|
||||
Shortcuts/Input/Accept/Hint: Accept the selected item
|
||||
Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant)
|
||||
Shortcuts/Input/Cancel/Hint: Clear the input field
|
||||
Shortcuts/Input/Down/Hint: Select the next item
|
||||
Shortcuts/Input/Up/Hint: Select the previous item
|
||||
SystemTiddler/Tooltip: This is a system tiddler
|
||||
SystemTiddlers/Include/Prompt: Include system tiddlers
|
||||
TagManager/Colour/Heading: Colour
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
title: $:/config/NewJournal/Tags
|
||||
|
||||
Journal
|
||||
tags: Journal
|
||||
|
||||
@@ -4,6 +4,7 @@ All/Caption: All
|
||||
Contents/Caption: Contents
|
||||
Drafts/Caption: Drafts
|
||||
Explorer/Caption: Explorer
|
||||
History/Caption: History
|
||||
Missing/Caption: Missing
|
||||
More/Caption: More
|
||||
Open/Caption: Open
|
||||
|
||||
@@ -71,7 +71,7 @@ Command.prototype.fetchFiles = function(options) {
|
||||
if(options.url) {
|
||||
urls = [options.url]
|
||||
} else if(options.urlFilter) {
|
||||
urls = this.commander.wiki.filterTiddlers(options.urlFilter);
|
||||
urls = $tw.wiki.filterTiddlers(options.urlFilter);
|
||||
} else {
|
||||
return "Missing URL";
|
||||
}
|
||||
@@ -132,7 +132,7 @@ Command.prototype.processBody = function(body,type,options,url) {
|
||||
// Collect the tiddlers in a wiki
|
||||
var incomingWiki = new $tw.Wiki();
|
||||
if(options.raw) {
|
||||
var typeInfo = type ? $tw.utils.getContentTypeInfo(type) : null,
|
||||
var typeInfo = type ? $tw.config.contentTypeInfo[type] : null,
|
||||
encoding = typeInfo ? typeInfo.encoding : "utf8";
|
||||
incomingWiki.addTiddler(new $tw.Tiddler({
|
||||
title: url,
|
||||
|
||||
@@ -33,7 +33,7 @@ Command.prototype.execute = function() {
|
||||
tiddlers = {};
|
||||
// Collect up the library plugins
|
||||
var collectPlugins = function(folder) {
|
||||
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
|
||||
var pluginFolders = fs.readdirSync(folder);
|
||||
for(var p=0; p<pluginFolders.length; p++) {
|
||||
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
|
||||
@@ -44,16 +44,16 @@ Command.prototype.execute = function() {
|
||||
}
|
||||
},
|
||||
collectPublisherPlugins = function(folder) {
|
||||
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
|
||||
var publisherFolders = fs.readdirSync(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);
|
||||
collectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.pluginsPath));
|
||||
collectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.themesPath));
|
||||
collectPlugins(path.resolve($tw.boot.corePath,$tw.config.languagesPath));
|
||||
// Save the upgrade library tiddler
|
||||
var pluginFields = {
|
||||
title: upgradeLibraryTitle,
|
||||
|
||||
@@ -37,7 +37,7 @@ Command.prototype.execute = function() {
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var tiddler = self.commander.wiki.getTiddler(title),
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.utils.getContentTypeInfo(type) || {encoding: "utf8"},
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||
if(self.commander.verbose) {
|
||||
console.log("Saving \"" + title + "\" to \"" + filepath + "\"");
|
||||
|
||||
@@ -5,12 +5,10 @@ module-type: command
|
||||
|
||||
Command to save the subtiddlers of a bundle tiddler as a series of JSON files
|
||||
|
||||
--savelibrarytiddlers <tiddler> <tiddler-filter> <pathname> <skinnylisting>
|
||||
--savelibrarytiddlers <tiddler> <pathname> <skinnylisting>
|
||||
|
||||
The tiddler identifies the bundle tiddler that contains the subtiddlers.
|
||||
|
||||
The tiddler filter specifies the plugins to be included.
|
||||
|
||||
The pathname specifies the pathname to the folder in which the JSON files should be saved. The filename is the URL encoded title of the subtiddler.
|
||||
|
||||
The skinnylisting specifies the title of the tiddler to which a JSON catalogue of the subtiddlers will be saved. The JSON file contains the same data as the bundle tiddler but with the `text` field removed.
|
||||
@@ -71,7 +69,7 @@ Command.prototype.execute = function() {
|
||||
// Collect the skinny list data
|
||||
var pluginTiddlers = JSON.parse(tiddler.text),
|
||||
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
|
||||
doesRequireReload = !!self.commander.wiki.doesPluginInfoRequireReload(pluginTiddlers),
|
||||
doesRequireReload = !!$tw.wiki.doesPluginInfoRequireReload(pluginTiddlers),
|
||||
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},
|
||||
iconType = iconTiddler.type,
|
||||
iconText = iconTiddler.text,
|
||||
|
||||
@@ -35,7 +35,7 @@ Command.prototype.execute = function() {
|
||||
tiddler = this.commander.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.utils.getContentTypeInfo(type) || {encoding: "utf8"};
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"};
|
||||
$tw.utils.createFileDirectories(filename);
|
||||
fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {
|
||||
self.callback(err);
|
||||
|
||||
@@ -44,7 +44,7 @@ Command.prototype.execute = function() {
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var tiddler = self.commander.wiki.getTiddler(title),
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.utils.getContentTypeInfo(type) || {encoding: "utf8"},
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||
filename = path.resolve(pathname,encodeURIComponent(title));
|
||||
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||
});
|
||||
|
||||
@@ -80,8 +80,7 @@ function FramedEngine(options) {
|
||||
$tw.utils.addEventListeners(this.domNode,[
|
||||
{name: "click",handlerObject: this,handlerMethod: "handleClickEvent"},
|
||||
{name: "input",handlerObject: this,handlerMethod: "handleInputEvent"},
|
||||
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"},
|
||||
{name: "focus",handlerObject: this,handlerMethod: "handleFocusEvent"}
|
||||
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"}
|
||||
]);
|
||||
// Insert the element into the DOM
|
||||
this.iframeDoc.body.appendChild(this.domNode);
|
||||
@@ -108,20 +107,13 @@ Set the text of the engine if it doesn't currently have focus
|
||||
FramedEngine.prototype.setText = function(text,type) {
|
||||
if(!this.domNode.isTiddlyWikiFakeDom) {
|
||||
if(this.domNode.ownerDocument.activeElement !== this.domNode) {
|
||||
this.updateDomNodeText(text);
|
||||
this.domNode.value = text;
|
||||
}
|
||||
// Fix the height if needed
|
||||
this.fixHeight();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Update the DomNode with the new text
|
||||
*/
|
||||
FramedEngine.prototype.updateDomNodeText = function(text) {
|
||||
this.domNode.value = text;
|
||||
};
|
||||
|
||||
/*
|
||||
Get the text of the engine
|
||||
*/
|
||||
@@ -161,15 +153,6 @@ FramedEngine.prototype.focus = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a focus event
|
||||
*/
|
||||
FramedEngine.prototype.handleFocusEvent = function(event) {
|
||||
if(this.widget.editCancelPopups) {
|
||||
$tw.popup.cancel(0);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a click
|
||||
*/
|
||||
@@ -184,9 +167,6 @@ Handle a dom "input" event which occurs when the text has changed
|
||||
FramedEngine.prototype.handleInputEvent = function(event) {
|
||||
this.widget.saveChanges(this.getText());
|
||||
this.fixHeight();
|
||||
if(this.widget.editInputActions) {
|
||||
this.widget.invokeActionString(this.widget.editInputActions);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,20 +68,13 @@ Set the text of the engine if it doesn't currently have focus
|
||||
SimpleEngine.prototype.setText = function(text,type) {
|
||||
if(!this.domNode.isTiddlyWikiFakeDom) {
|
||||
if(this.domNode.ownerDocument.activeElement !== this.domNode || text === "") {
|
||||
this.updateDomNodeText(text);
|
||||
this.domNode.value = text;
|
||||
}
|
||||
// Fix the height if needed
|
||||
this.fixHeight();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Update the DomNode with the new text
|
||||
*/
|
||||
SimpleEngine.prototype.updateDomNodeText = function(text) {
|
||||
this.domNode.value = text;
|
||||
};
|
||||
|
||||
/*
|
||||
Get the text of the engine
|
||||
*/
|
||||
@@ -122,9 +115,6 @@ Handle a dom "input" event which occurs when the text has changed
|
||||
SimpleEngine.prototype.handleInputEvent = function(event) {
|
||||
this.widget.saveChanges(this.getText());
|
||||
this.fixHeight();
|
||||
if(this.widget.editInputActions) {
|
||||
this.widget.invokeActionString(this.widget.editInputActions);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -132,9 +122,6 @@ SimpleEngine.prototype.handleInputEvent = function(event) {
|
||||
Handle a dom "focus" event
|
||||
*/
|
||||
SimpleEngine.prototype.handleFocusEvent = function(event) {
|
||||
if(this.widget.editCancelPopups) {
|
||||
$tw.popup.cancel(0);
|
||||
}
|
||||
if(this.widget.editFocusPopup) {
|
||||
$tw.popup.triggerPopup({
|
||||
domNode: this.domNode,
|
||||
|
||||
@@ -177,9 +177,6 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
this.editFocusPopup = this.getAttribute("focusPopup");
|
||||
this.editFocus = this.getAttribute("focus");
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
// Get the default editor element tag and type
|
||||
var tag,type;
|
||||
if(this.editField === "text") {
|
||||
@@ -211,11 +208,9 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Completely rerender if any of our attributes have changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else if (changedTiddlers[this.editRefreshTitle]) {
|
||||
this.engine.updateDomNodeText(this.getEditInfo().value);
|
||||
} else if(changedTiddlers[this.editTitle]) {
|
||||
var editInfo = this.getEditInfo();
|
||||
this.updateEditor(editInfo.value,editInfo.type);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/compare.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
General purpose comparison operator
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.compare = function(source,operator,options) {
|
||||
var suffixes = operator.suffixes || [],
|
||||
type = (suffixes[0] || [])[0],
|
||||
mode = (suffixes[1] || [])[0],
|
||||
typeFn = $tw.utils.makeCompareFunction(type,{defaultType: "number"}),
|
||||
modeFn = modes[mode] || modes.eq,
|
||||
invert = operator.prefix === "!",
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
if(modeFn(typeFn(title,operator.operand)) !== invert) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
var modes = {
|
||||
"eq": function(value) {return value === 0;},
|
||||
"ne": function(value) {return value !== 0;},
|
||||
"gteq": function(value) {return value >= 0;},
|
||||
"gt": function(value) {return value > 0;},
|
||||
"lteq": function(value) {return value <= 0;},
|
||||
"lt": function(value) {return value < 0;}
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -1,36 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/duplicateslugs.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter function for [duplicateslugs[]]
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.duplicateslugs = function(source,operator,options) {
|
||||
var slugs = Object.create(null), // Hashmap by slug of title, replaced with "true" if the duplicate title has already been output
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
var slug = options.wiki.slugify(title);
|
||||
if(slug in slugs) {
|
||||
if(slugs[slug] !== true) {
|
||||
results.push(slugs[slug]);
|
||||
slugs[slug] = true;
|
||||
}
|
||||
results.push(title);
|
||||
} else {
|
||||
slugs[slug] = title;
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -16,28 +16,13 @@ Filter operator for returning the names of the fields on the selected tiddlers
|
||||
Export our filter function
|
||||
*/
|
||||
exports.fields = function(source,operator,options) {
|
||||
var results = [],
|
||||
fieldName,
|
||||
suffixes = (operator.suffixes || [])[0] || [],
|
||||
operand = $tw.utils.parseStringArray(operator.operand);
|
||||
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
if(suffixes.indexOf("include") !== -1) {
|
||||
for(fieldName in tiddler.fields) {
|
||||
(operand.indexOf(fieldName) !== -1) ? $tw.utils.pushTop(results,fieldName) : "";
|
||||
}
|
||||
} else if (suffixes.indexOf("exclude") !== -1) {
|
||||
for(fieldName in tiddler.fields) {
|
||||
(operand.indexOf(fieldName) !== -1) ? "" : $tw.utils.pushTop(results,fieldName);
|
||||
}
|
||||
} // else if
|
||||
else {
|
||||
for(fieldName in tiddler.fields) {
|
||||
$tw.utils.pushTop(results,fieldName);
|
||||
}
|
||||
} // else
|
||||
} // if (tiddler)
|
||||
for(var fieldName in tiddler.fields) {
|
||||
$tw.utils.pushTop(results,fieldName);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/filter.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator returning those input titles that pass a subfilter
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.filter = function(source,operator,options) {
|
||||
var filterFn = options.wiki.compileFilter(operator.operand),
|
||||
results = [],
|
||||
target = operator.prefix !== "!";
|
||||
source(function(tiddler,title) {
|
||||
var list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]));
|
||||
if((list.length > 0) === target) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -1,46 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/format.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
Filter operator for formatting strings
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var formatFilterOperators;
|
||||
|
||||
function getFormatFilterOperators() {
|
||||
if(!formatFilterOperators) {
|
||||
formatFilterOperators = {};
|
||||
$tw.modules.applyMethods("formatfilteroperator",formatFilterOperators);
|
||||
}
|
||||
return formatFilterOperators;
|
||||
}
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.format = function(source,operator,options) {
|
||||
// Dispatch to the correct formatfilteroperator
|
||||
var formatFilterOperators = getFormatFilterOperators();
|
||||
if(operator.suffix) {
|
||||
var formatFilterOperator = formatFilterOperators[operator.suffix];
|
||||
if(formatFilterOperator) {
|
||||
return formatFilterOperator(source,operator.operand,options);
|
||||
} else {
|
||||
return [$tw.language.getString("Error/FormatFilterOperator")];
|
||||
}
|
||||
} else {
|
||||
// Return all unchanged if the suffix is missing
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -1,26 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/format/date.js
|
||||
type: application/javascript
|
||||
module-type: formatfilteroperator
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.date = function(source,operand,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var value = $tw.utils.parseDate(title);
|
||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||
results.push($tw.utils.formatDateString(value,operand || "YYYY MM DD 0hh:0mm"));
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -1,26 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/format/relativedate.js
|
||||
type: application/javascript
|
||||
module-type: formatfilteroperator
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.relativedate = function(source,operand,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var value = $tw.utils.parseDate(title);
|
||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||
results.push($tw.utils.getRelativeDate((new Date()) - (new Date(value))).description);
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
38
core/modules/filters/getstoryviewmode.js
Normal file
38
core/modules/filters/getstoryviewmode.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/getstoryviewmode.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for retrieving modes from a storyview. Only "singletiddlermode" is implemented at present
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter functions
|
||||
*/
|
||||
|
||||
exports.getstoryviewmode = function(source,operator,options) {
|
||||
// Initialise the storyviews if they've not been done already
|
||||
var storyviews = {};
|
||||
$tw.modules.applyMethods("storyview",storyviews);
|
||||
if(operator.operand !== "singletiddlermode") {
|
||||
return [];
|
||||
}
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var storyview = storyviews[title];
|
||||
if(storyview && storyview.singleTiddlerMode) {
|
||||
results.push("yes");
|
||||
} else {
|
||||
results.push("no");
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -3,7 +3,7 @@ title: $:/core/modules/filters/has.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for checking if a tiddler has the specified field or index
|
||||
Filter operator for checking if a tiddler has the specified field
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@@ -33,32 +33,16 @@ exports.has = function(source,operator,options) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(operator.suffix === "index") {
|
||||
} else {
|
||||
if(invert) {
|
||||
source(function(tiddler,title) {
|
||||
if(!tiddler || (tiddler && (!$tw.utils.hop(options.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)))) {
|
||||
if(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand] === "")) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && $tw.utils.hop(options.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(invert) {
|
||||
source(function(tiddler,title) {
|
||||
if(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand].length === 0)) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && (tiddler.fields[operator.operand].length !== 0)) {
|
||||
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && !(tiddler.fields[operator.operand] === "" || tiddler.fields[operator.operand].length === 0)) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -114,9 +114,9 @@ exports.minall = makeNumericReducingOperator(
|
||||
function makeNumericBinaryOperator(fnCalc) {
|
||||
return function(source,operator,options) {
|
||||
var result = [],
|
||||
numOperand = $tw.utils.parseNumber(operator.operand);
|
||||
numOperand = parseNumber(operator.operand);
|
||||
source(function(tiddler,title) {
|
||||
result.push($tw.utils.stringifyNumber(fnCalc($tw.utils.parseNumber(title),numOperand)));
|
||||
result.push(stringifyNumber(fnCalc(parseNumber(title),numOperand)));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
@@ -129,10 +129,18 @@ function makeNumericReducingOperator(fnCalc,initialValue) {
|
||||
source(function(tiddler,title) {
|
||||
result.push(title);
|
||||
});
|
||||
return [$tw.utils.stringifyNumber(result.reduce(function(accumulator,currentValue) {
|
||||
return fnCalc(accumulator,$tw.utils.parseNumber(currentValue));
|
||||
return [stringifyNumber(result.reduce(function(accumulator,currentValue) {
|
||||
return fnCalc(accumulator,parseNumber(currentValue));
|
||||
},initialValue))];
|
||||
};
|
||||
}
|
||||
|
||||
function parseNumber(str) {
|
||||
return parseFloat(str) || 0;
|
||||
}
|
||||
|
||||
function stringifyNumber(num) {
|
||||
return num + "";
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/reduce.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator evaluats a subfilter for each item, making the running total available in the variable `accumulator`, and the current index available in the variable `index`
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.reduce = function(source,operator,options) {
|
||||
// Accumulate the list
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
// Run the filter over each item
|
||||
var filterFn = options.wiki.compileFilter(operator.operand),
|
||||
accumulator = operator.suffix || "";
|
||||
for(var index=0; index<results.length; index++) {
|
||||
var title = results[index],
|
||||
list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),{
|
||||
getVariable: function(name) {
|
||||
switch(name) {
|
||||
case "currentTiddler":
|
||||
return "" + title;
|
||||
case "accumulator":
|
||||
return "" + accumulator;
|
||||
case "index":
|
||||
return "" + index;
|
||||
case "revIndex":
|
||||
return "" + (results.length - 1 - index);
|
||||
case "length":
|
||||
return "" + results.length;
|
||||
default:
|
||||
return options.widget.getVariable(name);
|
||||
}
|
||||
}
|
||||
});
|
||||
if(list.length > 0) {
|
||||
accumulator = "" + list[0];
|
||||
}
|
||||
}
|
||||
return [accumulator];
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -1,23 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/slugify.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for slugifying a tiddler title
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.slugify = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(options.wiki.slugify(title));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -1,57 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/sortsub.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for sorting by a subfilter
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.sortsub = function(source,operator,options) {
|
||||
// Compile the subfilter
|
||||
var filterFn = options.wiki.compileFilter(operator.operand);
|
||||
// Collect the input titles and the corresponding sort keys
|
||||
var inputTitles = [],
|
||||
sortKeys = [];
|
||||
source(function(tiddler,title) {
|
||||
inputTitles.push(title);
|
||||
var r = filterFn.call(options.wiki,function(iterator) {
|
||||
iterator(options.wiki.getTiddler(title),title);
|
||||
},{
|
||||
getVariable: function(name) {
|
||||
if(name === "currentTiddler") {
|
||||
return title;
|
||||
} else {
|
||||
return options.widget.getVariable(name);
|
||||
}
|
||||
}
|
||||
});
|
||||
sortKeys.push(r[0] || "");
|
||||
});
|
||||
// Rather than sorting the titles array, we'll sort the indexes so that we can consult both arrays
|
||||
var indexes = new Array(inputTitles.length);
|
||||
for(var t=0; t<inputTitles.length; t++) {
|
||||
indexes[t] = t;
|
||||
}
|
||||
// Sort the indexes
|
||||
var compareFn = $tw.utils.makeCompareFunction(operator.suffix,{defaultType: "string",invert: operator.prefix === "!"});
|
||||
indexes = indexes.sort(function(a,b) {
|
||||
return compareFn(sortKeys[a],sortKeys[b]);
|
||||
});
|
||||
// Make the results array in order
|
||||
var results = [];
|
||||
$tw.utils.each(indexes,function(index) {
|
||||
results.push(inputTitles[index]);
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -34,31 +34,9 @@ exports.titlecase = makeStringBinaryOperator(
|
||||
function(a) {return [$tw.utils.toTitleCase(a)];}
|
||||
);
|
||||
|
||||
exports.trim = function(source,operator,options) {
|
||||
var result = [],
|
||||
suffix = operator.suffix || "",
|
||||
operand = (operator.operand || ""),
|
||||
fnCalc;
|
||||
if(suffix === "prefix") {
|
||||
fnCalc = function(a,b) {return [$tw.utils.trimPrefix(a,b)];}
|
||||
} else if(suffix === "suffix") {
|
||||
fnCalc = function(a,b) {return [$tw.utils.trimSuffix(a,b)];}
|
||||
} else {
|
||||
if(operand === "") {
|
||||
fnCalc = function(a) {return [$tw.utils.trim(a)];}
|
||||
} else {
|
||||
fnCalc = function(a,b) {return [$tw.utils.trimSuffix($tw.utils.trimPrefix(a,b),b)];}
|
||||
}
|
||||
}
|
||||
source(function(tiddler,title) {
|
||||
Array.prototype.push.apply(result,fnCalc(title,operand));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
// makeStringBinaryOperator(
|
||||
// function(a) {return [$tw.utils.trim(a)];}
|
||||
// );
|
||||
exports.trim = makeStringBinaryOperator(
|
||||
function(a) {return [$tw.utils.trim(a)];}
|
||||
);
|
||||
|
||||
exports.split = makeStringBinaryOperator(
|
||||
function(a,b) {return ("" + a).split(b);}
|
||||
@@ -90,12 +68,9 @@ function makeStringReducingOperator(fnCalc,initialValue) {
|
||||
source(function(tiddler,title) {
|
||||
result.push(title);
|
||||
});
|
||||
if(result.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return [result.reduce(function(accumulator,currentValue) {
|
||||
return fnCalc(accumulator,currentValue,operator.operand || "");
|
||||
},initialValue) || ""];
|
||||
},initialValue)];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ exports.getInfoTiddlerFields = function() {
|
||||
// Basics
|
||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||
infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)});
|
||||
infoTiddlerFields.push({title: "$:/info/startup-timestamp", text: $tw.utils.stringifyDate(new Date())});
|
||||
if($tw.browser) {
|
||||
// Document location
|
||||
var setLocationProperty = function(name,value) {
|
||||
|
||||
@@ -284,16 +284,6 @@ KeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) {
|
||||
return false;
|
||||
};
|
||||
|
||||
KeyboardManager.prototype.getEventModifierKeyDescriptor = function(event) {
|
||||
return event.ctrlKey && !event.shiftKey && !event.altKey ? "ctrl" :
|
||||
event.shiftKey && !event.ctrlKey && !event.altKey? "shift" :
|
||||
event.ctrlKey && event.shiftKey && !event.altKey ? "ctrl-shift" :
|
||||
event.altKey && !event.shiftKey && !event.ctrlKey ? "alt" :
|
||||
event.altKey && event.shiftKey && !event.ctrlKey ? "alt-shift" :
|
||||
event.altKey && event.ctrlKey && !event.shiftKey ? "ctrl-alt" :
|
||||
event.altKey && event.shiftKey && event.ctrlKey ? "ctrl-alt-shift" : "normal";
|
||||
};
|
||||
|
||||
KeyboardManager.prototype.getShortcutTiddlerList = function() {
|
||||
return $tw.wiki.getTiddlersWithTag("$:/tags/KeyboardShortcut");
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ exports.params = [
|
||||
Run the macro
|
||||
*/
|
||||
exports.run = function(filter,spaces) {
|
||||
return this.wiki.getTiddlersAsJson(filter,$tw.utils.parseInt(spaces));
|
||||
return this.wiki.getTiddlersAsJson(filter,spaces);
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/htmlfragmentparser.js
|
||||
type: application/javascript
|
||||
module-type: parser
|
||||
|
||||
Inherits from the base wikitext parser but is forced into inline mode
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var WikiParser = require("$:/core/modules/parsers/wikiparser/wikiparser.js")["text/vnd.tiddlywiki"];
|
||||
|
||||
var PRAGMAS = "\\rules only html entity\n";
|
||||
|
||||
var HtmlFragmentWikiParser = function(type,text,options) {
|
||||
var parser = new WikiParser(type,PRAGMAS + text,$tw.utils.extend({},options,{parseAsInline: true}));
|
||||
this.tree = parser.tree;
|
||||
this.prototype = parser.prototype;
|
||||
};
|
||||
|
||||
exports["text/html+fragment"] = HtmlFragmentWikiParser;
|
||||
|
||||
})();
|
||||
|
||||
@@ -60,7 +60,7 @@ var listTypes = {
|
||||
"#": {listTag: "ol", itemTag: "li"},
|
||||
";": {listTag: "dl", itemTag: "dt"},
|
||||
":": {listTag: "dl", itemTag: "dd"},
|
||||
">": {listTag: "blockquote", itemTag: "div"}
|
||||
">": {listTag: "blockquote", itemTag: "p"}
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -48,10 +48,6 @@ var WikiParser = function(type,text,options) {
|
||||
}
|
||||
// Save the parse text
|
||||
this.type = type || "text/vnd.tiddlywiki";
|
||||
this.variant = null;
|
||||
if(options.paramName === "variant" && options.paramValue) {
|
||||
this.variant = options.paramValue;
|
||||
}
|
||||
this.source = text || "";
|
||||
this.sourceLength = this.source.length;
|
||||
// Flag for ignoring whitespace
|
||||
@@ -63,29 +59,6 @@ var WikiParser = function(type,text,options) {
|
||||
// Instantiate the parser block and inline rules
|
||||
this.blockRules = this.instantiateRules(this.blockRuleClasses,"block",0);
|
||||
this.inlineRules = this.instantiateRules(this.inlineRuleClasses,"inline",0);
|
||||
// Setup the selected variant
|
||||
if(this.variant) {
|
||||
var variantData = this.wiki.getTiddlerDataCached("$:/config/WikiParserVariant/" + this.variant);
|
||||
if(variantData) {
|
||||
// Whitespace setting
|
||||
switch(variantData.whitespace) {
|
||||
case "notrim":
|
||||
this.configTrimWhiteSpace = false;
|
||||
break;
|
||||
case "trim":
|
||||
// Intentional fallthrough
|
||||
default:
|
||||
this.configTrimWhiteSpace = false;
|
||||
break;
|
||||
}
|
||||
// Setup rules
|
||||
if(variantData.rules && variantData.rules.only) {
|
||||
this.amendRules("only",variantData.rules.only);
|
||||
} else if(variantData.rules && variantData.rules.except) {
|
||||
this.amendRules("except",variantData.rules.except);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Parse any pragmas
|
||||
this.tree = [];
|
||||
var topBranch = this.parsePragmas();
|
||||
@@ -413,18 +386,22 @@ Amend the rules used by this instance of the parser
|
||||
WikiParser.prototype.amendRules = function(type,names) {
|
||||
names = names || [];
|
||||
// Define the filter function
|
||||
var target;
|
||||
var keepFilter;
|
||||
if(type === "only") {
|
||||
target = true;
|
||||
keepFilter = function(name) {
|
||||
return names.indexOf(name) !== -1;
|
||||
};
|
||||
} else if(type === "except") {
|
||||
target = false;
|
||||
keepFilter = function(name) {
|
||||
return names.indexOf(name) === -1;
|
||||
};
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// Define a function to process each of our rule arrays
|
||||
var processRuleArray = function(ruleArray) {
|
||||
for(var t=ruleArray.length-1; t>=0; t--) {
|
||||
if((names.indexOf(ruleArray[t].rule.name) === -1) === target) {
|
||||
if(!keepFilter(ruleArray[t].rule.name)) {
|
||||
ruleArray.splice(t,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ GiteaSaver.prototype.save = function(text,method,callback) {
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
"Authorization": "token " + password
|
||||
"Authorization": "Basic " + window.btoa(username + ":" + password)
|
||||
};
|
||||
// Bail if we don't have everything we need
|
||||
if(!username || !password || !repo || !filename) {
|
||||
if(!username || !password || !repo || !path || !filename) {
|
||||
return false;
|
||||
}
|
||||
// Make sure the path start and ends with a slash
|
||||
|
||||
@@ -34,7 +34,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
||||
"Authorization": "Basic " + window.btoa(username + ":" + password)
|
||||
};
|
||||
// Bail if we don't have everything we need
|
||||
if(!username || !password || !repo || !filename) {
|
||||
if(!username || !password || !repo || !path || !filename) {
|
||||
return false;
|
||||
}
|
||||
// Make sure the path start and ends with a slash
|
||||
|
||||
@@ -34,7 +34,7 @@ GitLabSaver.prototype.save = function(text,method,callback) {
|
||||
"Private-Token": password
|
||||
};
|
||||
// Bail if we don't have everything we need
|
||||
if(!username || !password || !repo || !filename) {
|
||||
if(!username || !password || !repo || !path || !filename) {
|
||||
return false;
|
||||
}
|
||||
// Make sure the path start and ends with a slash
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/savers/hyperdrive.js
|
||||
type: application/javascript
|
||||
module-type: saver
|
||||
|
||||
Saves files using the Hyperdrive Protocol (https://hypercore-protocol.org/#hyperdrive) Beaker browser beta-1.0 and later (https://beakerbrowser.com)
|
||||
Compatible with beaker >= V1.0.0
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Set up the saver
|
||||
*/
|
||||
var HyperdriveSaver = function(wiki) {
|
||||
this.wiki = wiki;
|
||||
};
|
||||
|
||||
HyperdriveSaver.prototype.save = function(text,method,callback) {
|
||||
var dat = beaker.hyperdrive.drive("" + window.location),
|
||||
pathname = ("" + window.location.pathname).split("#")[0];
|
||||
dat.stat(pathname).then(function(value) {
|
||||
if(value.isDirectory()) {
|
||||
pathname = pathname + "/index.html";
|
||||
}
|
||||
dat.writeFile(pathname,text,"utf8").then(function(value) {
|
||||
callback(null);
|
||||
},function(reason) {
|
||||
callback("Hyperdrive Saver Write Error: " + reason);
|
||||
});
|
||||
},function(reason) {
|
||||
callback("Hyperdrive Saver Stat Error: " + reason);
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
/*
|
||||
Information about this saver
|
||||
*/
|
||||
HyperdriveSaver.prototype.info = {
|
||||
name: "beaker-1.x",
|
||||
priority: 3000,
|
||||
capabilities: ["save", "autosave"]
|
||||
};
|
||||
|
||||
/*
|
||||
Static method that returns true if this saver is capable of working
|
||||
*/
|
||||
exports.canSave = function(wiki) {
|
||||
return !!window.beaker && !!beaker.hyperdrive && location.protocol==="hyper:";
|
||||
};
|
||||
|
||||
/*
|
||||
Create an instance of this saver
|
||||
*/
|
||||
exports.create = function(wiki) {
|
||||
return new HyperdriveSaver(wiki);
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -31,7 +31,7 @@ BasicAuthenticator.prototype.init = function() {
|
||||
// Read the credentials data
|
||||
this.credentialsFilepath = this.server.get("credentials");
|
||||
if(this.credentialsFilepath) {
|
||||
var resolveCredentialsFilepath = path.resolve(this.server.boot.wikiPath,this.credentialsFilepath);
|
||||
var resolveCredentialsFilepath = path.resolve($tw.boot.wikiPath,this.credentialsFilepath);
|
||||
if(fs.existsSync(resolveCredentialsFilepath) && !fs.statSync(resolveCredentialsFilepath).isDirectory()) {
|
||||
var credentialsText = fs.readFileSync(resolveCredentialsFilepath,"utf8"),
|
||||
credentialsData = $tw.utils.parseCsvStringWithHeader(credentialsText);
|
||||
|
||||
@@ -14,7 +14,7 @@ Authenticator for trusted header authentication
|
||||
|
||||
function HeaderAuthenticator(server) {
|
||||
this.server = server;
|
||||
this.header = server.get("authenticated-user-header") ? server.get("authenticated-user-header").toLowerCase() : undefined;
|
||||
this.header = server.get("authenticated-user-header");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,7 +21,7 @@ exports.handler = function(request,response,state) {
|
||||
fs = require("fs"),
|
||||
util = require("util"),
|
||||
suppliedFilename = decodeURIComponent(state.params[0]),
|
||||
filename = path.resolve(state.boot.wikiPath,"files",suppliedFilename),
|
||||
filename = path.resolve($tw.boot.wikiPath,"files",suppliedFilename),
|
||||
extension = path.extname(filename);
|
||||
fs.readFile(filename,function(err,content) {
|
||||
var status,content,type = "text/plain";
|
||||
|
||||
@@ -3,7 +3,7 @@ title: $:/core/modules/server/routes/get-tiddlers-json.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
GET /recipes/default/tiddlers.json?filter=<filter>
|
||||
GET /recipes/default/tiddlers/tiddlers.json?filter=<filter>
|
||||
|
||||
\*/
|
||||
(function() {
|
||||
@@ -20,9 +20,9 @@ exports.path = /^\/recipes\/default\/tiddlers.json$/;
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var filter = state.queryParameters.filter || DEFAULT_FILTER;
|
||||
if(state.wiki.getTiddlerText("$:/config/Server/AllowAllExternalFilters") !== "yes") {
|
||||
if(state.wiki.getTiddlerText("$:/config/Server/ExternalFilters/" + filter) !== "yes") {
|
||||
console.log("Blocked attempt to GET /recipes/default/tiddlers.json with filter: " + filter);
|
||||
if($tw.wiki.getTiddlerText("$:/config/Server/AllowAllExternalFilters") !== "yes") {
|
||||
if($tw.wiki.getTiddlerText("$:/config/Server/ExternalFilters/" + filter) !== "yes") {
|
||||
console.log("Blocked attempt to GET /recipes/default/tiddlers/tiddlers.json with filter: " + filter);
|
||||
response.writeHead(403);
|
||||
response.end();
|
||||
return;
|
||||
|
||||
@@ -31,7 +31,6 @@ function Server(options) {
|
||||
this.routes = options.routes || [];
|
||||
this.authenticators = options.authenticators || [];
|
||||
this.wiki = options.wiki;
|
||||
this.boot = options.boot || $tw.boot;
|
||||
this.servername = $tw.utils.transliterateToSafeASCII(this.wiki.getTiddlerText("$:/SiteTitle") || "TiddlyWiki5");
|
||||
// Initialise the variables
|
||||
this.variables = $tw.utils.extend({},this.defaultVariables);
|
||||
@@ -70,8 +69,8 @@ function Server(options) {
|
||||
tlsCertFilepath = this.get("tls-cert");
|
||||
if(tlsCertFilepath && tlsKeyFilepath) {
|
||||
this.listenOptions = {
|
||||
key: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsKeyFilepath),"utf8"),
|
||||
cert: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsCertFilepath),"utf8")
|
||||
key: fs.readFileSync(path.resolve($tw.boot.wikiPath,tlsKeyFilepath),"utf8"),
|
||||
cert: fs.readFileSync(path.resolve($tw.boot.wikiPath,tlsCertFilepath),"utf8")
|
||||
};
|
||||
this.protocol = "https";
|
||||
}
|
||||
@@ -113,14 +112,15 @@ Server.prototype.addAuthenticator = function(AuthenticatorClass) {
|
||||
};
|
||||
|
||||
Server.prototype.findMatchingRoute = function(request,state) {
|
||||
var pathprefix = this.get("path-prefix") || "";
|
||||
for(var t=0; t<this.routes.length; t++) {
|
||||
var potentialRoute = this.routes[t],
|
||||
pathRegExp = potentialRoute.path,
|
||||
pathname = state.urlInfo.pathname,
|
||||
match;
|
||||
if(state.pathPrefix) {
|
||||
if(pathname.substr(0,state.pathPrefix.length) === state.pathPrefix) {
|
||||
pathname = pathname.substr(state.pathPrefix.length) || "/";
|
||||
if(pathprefix) {
|
||||
if(pathname.substr(0,pathprefix.length) === pathprefix) {
|
||||
pathname = pathname.substr(pathprefix.length) || "/";
|
||||
match = potentialRoute.path.exec(pathname);
|
||||
} else {
|
||||
match = false;
|
||||
@@ -156,17 +156,14 @@ Server.prototype.isAuthorized = function(authorizationType,username) {
|
||||
return principals.indexOf("(anon)") !== -1 || (username && (principals.indexOf("(authenticated)") !== -1 || principals.indexOf(username) !== -1));
|
||||
}
|
||||
|
||||
Server.prototype.requestHandler = function(request,response,options) {
|
||||
options = options || {};
|
||||
Server.prototype.requestHandler = function(request,response) {
|
||||
// Compose the state object
|
||||
var self = this;
|
||||
var state = {};
|
||||
state.wiki = options.wiki || self.wiki;
|
||||
state.boot = options.boot || self.boot;
|
||||
state.wiki = self.wiki;
|
||||
state.server = self;
|
||||
state.urlInfo = url.parse(request.url);
|
||||
state.queryParameters = querystring.parse(state.urlInfo.query);
|
||||
state.pathPrefix = options.pathPrefix || this.get("path-prefix") || "";
|
||||
// Get the principals authorized to access this resource
|
||||
var authorizationType = this.methodMappings[request.method] || "readers";
|
||||
// Check for the CSRF header if this is a write
|
||||
@@ -251,7 +248,7 @@ Server.prototype.listen = function(port,host,prefix) {
|
||||
port = process.env[port] || 8080;
|
||||
}
|
||||
// Warn if required plugins are missing
|
||||
if(!this.wiki.getTiddler("$:/plugins/tiddlywiki/tiddlyweb") || !this.wiki.getTiddler("$:/plugins/tiddlywiki/filesystem")) {
|
||||
if(!$tw.wiki.getTiddler("$:/plugins/tiddlywiki/tiddlyweb") || !$tw.wiki.getTiddler("$:/plugins/tiddlywiki/filesystem")) {
|
||||
$tw.utils.warning("Warning: Plugins required for client-server operation (\"tiddlywiki/filesystem\" and \"tiddlywiki/tiddlyweb\") are missing from tiddlywiki.info file");
|
||||
}
|
||||
// Create the server
|
||||
|
||||
@@ -36,7 +36,7 @@ function setFavicon() {
|
||||
var tiddler = $tw.wiki.getTiddler(FAVICON_TITLE);
|
||||
if(tiddler) {
|
||||
var faviconLink = document.getElementById("faviconLink");
|
||||
faviconLink.setAttribute("href",$tw.utils.makeDataUri(tiddler.fields.text,tiddler.fields.type,tiddler.fields._canonical_uri));
|
||||
faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,44 +37,48 @@ Story.prototype.getStoryList = function() {
|
||||
Story.prototype.addToStory = function(navigateTo,navigateFromTitle,options) {
|
||||
options = options || {};
|
||||
var storyList = this.getStoryList();
|
||||
// See if the tiddler is already there
|
||||
var slot = storyList.indexOf(navigateTo);
|
||||
// Quit if it already exists in the story river
|
||||
if(slot >= 0) {
|
||||
return;
|
||||
}
|
||||
// First we try to find the position of the story element we navigated from
|
||||
var fromIndex = storyList.indexOf(navigateFromTitle);
|
||||
if(fromIndex >= 0) {
|
||||
// The tiddler is added from inside the river
|
||||
// Determine where to insert the tiddler; Fallback is "below"
|
||||
switch(options.openLinkFromInsideRiver) {
|
||||
case "top":
|
||||
slot = 0;
|
||||
break;
|
||||
case "bottom":
|
||||
slot = storyList.length;
|
||||
break;
|
||||
case "above":
|
||||
slot = fromIndex;
|
||||
break;
|
||||
case "below": // Intentional fall-through
|
||||
default:
|
||||
slot = fromIndex + 1;
|
||||
break;
|
||||
}
|
||||
if(options.singleTiddlerMode) {
|
||||
storyList = [navigateTo];
|
||||
} else {
|
||||
// The tiddler is opened from outside the river. Determine where to insert the tiddler; default is "top"
|
||||
if(options.openLinkFromOutsideRiver === "bottom") {
|
||||
// Insert at bottom
|
||||
slot = storyList.length;
|
||||
} else {
|
||||
// Insert at top
|
||||
slot = 0;
|
||||
// See if the tiddler is already there
|
||||
var slot = storyList.indexOf(navigateTo);
|
||||
// Quit if it already exists in the story river
|
||||
if(slot >= 0) {
|
||||
return;
|
||||
}
|
||||
// First we try to find the position of the story element we navigated from
|
||||
var fromIndex = storyList.indexOf(navigateFromTitle);
|
||||
if(fromIndex >= 0) {
|
||||
// The tiddler is added from inside the river
|
||||
// Determine where to insert the tiddler; Fallback is "below"
|
||||
switch(options.openLinkFromInsideRiver) {
|
||||
case "top":
|
||||
slot = 0;
|
||||
break;
|
||||
case "bottom":
|
||||
slot = storyList.length;
|
||||
break;
|
||||
case "above":
|
||||
slot = fromIndex;
|
||||
break;
|
||||
case "below": // Intentional fall-through
|
||||
default:
|
||||
slot = fromIndex + 1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// The tiddler is opened from outside the river. Determine where to insert the tiddler; default is "top"
|
||||
if(options.openLinkFromOutsideRiver === "bottom") {
|
||||
// Insert at bottom
|
||||
slot = storyList.length;
|
||||
} else {
|
||||
// Insert at top
|
||||
slot = 0;
|
||||
}
|
||||
}
|
||||
// Add the tiddler
|
||||
storyList.splice(slot,0,navigateTo);
|
||||
}
|
||||
// Add the tiddler
|
||||
storyList.splice(slot,0,navigateTo);
|
||||
// Save the story
|
||||
this.saveStoryList(storyList);
|
||||
};
|
||||
@@ -93,11 +97,20 @@ Story.prototype.saveStoryList = function(storyList) {
|
||||
Story.prototype.addToHistory = function(navigateTo,navigateFromClientRect) {
|
||||
var titles = $tw.utils.isArray(navigateTo) ? navigateTo : [navigateTo];
|
||||
// Add a new record to the top of the history stack
|
||||
var historyList = this.wiki.getTiddlerData(this.historyTitle,[]);
|
||||
var historyList = this.wiki.getTiddlerData(this.historyTitle,[]),
|
||||
historyTitles = this.wiki.getTiddlerList(this.historyTitle);
|
||||
$tw.utils.each(titles,function(title) {
|
||||
historyList.push({title: title, fromPageRect: navigateFromClientRect});
|
||||
var p;
|
||||
do {
|
||||
p = historyTitles.indexOf(title);
|
||||
if(p !== -1) {
|
||||
historyTitles.splice(p,1);
|
||||
}
|
||||
} while(p !== -1);
|
||||
historyTitles.unshift(title);
|
||||
});
|
||||
this.wiki.setTiddlerData(this.historyTitle,historyList,{"current-tiddler": titles[titles.length-1]});
|
||||
this.wiki.setTiddlerData(this.historyTitle,historyList,{"current-tiddler": titles[titles.length-1], list: historyTitles});
|
||||
};
|
||||
|
||||
Story.prototype.storyCloseTiddler = function(targetTitle) {
|
||||
|
||||
23
core/modules/storyviews/solo.js
Normal file
23
core/modules/storyviews/solo.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/*\
|
||||
title: $:/core/modules/storyviews/solo.js
|
||||
type: application/javascript
|
||||
module-type: storyview
|
||||
|
||||
Flip between individual tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var SoloListView = function(listWidget) {
|
||||
};
|
||||
|
||||
// Engage single tiddler mode
|
||||
SoloListView.singleTiddlerMode = true;
|
||||
|
||||
exports.solo = SoloListView;
|
||||
|
||||
})();
|
||||
@@ -39,6 +39,9 @@ var ZoominListView = function(listWidget) {
|
||||
});
|
||||
};
|
||||
|
||||
// Engage single tiddler mode
|
||||
ZoominListView.singleTiddlerMode = true;
|
||||
|
||||
ZoominListView.prototype.navigateTo = function(historyInfo) {
|
||||
var duration = $tw.utils.getAnimationDuration(),
|
||||
listElementIndex = this.listWidget.findListItem(0,historyInfo.title);
|
||||
|
||||
@@ -127,7 +127,7 @@ function Syncer(options) {
|
||||
});
|
||||
}
|
||||
// Listen out for lazyLoad events
|
||||
if(!this.disableUI && this.wiki.getTiddlerText(this.titleSyncDisableLazyLoading) !== "yes") {
|
||||
if(!this.disableUI && $tw.wiki.getTiddlerText(this.titleSyncDisableLazyLoading) !== "yes") {
|
||||
this.wiki.addEventListener("lazyLoad",function(title) {
|
||||
self.handleLazyLoadEvent(title);
|
||||
});
|
||||
@@ -180,14 +180,12 @@ Syncer.prototype.readTiddlerInfo = function() {
|
||||
var self = this,
|
||||
tiddlers = this.getSyncedTiddlers();
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var tiddler = self.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
self.tiddlerInfo[title] = {
|
||||
revision: self.getTiddlerRevision(title),
|
||||
adaptorInfo: self.syncadaptor && self.syncadaptor.getTiddlerInfo(tiddler),
|
||||
changeCount: self.wiki.getChangeCount(title)
|
||||
};
|
||||
}
|
||||
var tiddler = self.wiki.tiddlerExists(title) && self.wiki.getTiddler(title);
|
||||
self.tiddlerInfo[title] = {
|
||||
revision: self.getTiddlerRevision(title),
|
||||
adaptorInfo: self.syncadaptor && self.syncadaptor.getTiddlerInfo(tiddler),
|
||||
changeCount: self.wiki.getChangeCount(title)
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -204,7 +202,7 @@ Syncer.prototype.isDirty = function() {
|
||||
if(this.wiki.tiddlerExists(title)) {
|
||||
if(tiddlerInfo) {
|
||||
// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server
|
||||
if(this.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
||||
if($tw.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@@ -526,7 +524,7 @@ Syncer.prototype.chooseNextTask = function() {
|
||||
tiddlerInfo = this.tiddlerInfo[title];
|
||||
if(tiddler) {
|
||||
// If the tiddler is not known on the server, or has been modified locally no more recently than the threshold then it needs to be saved to the server
|
||||
var hasChanged = !tiddlerInfo || this.wiki.getChangeCount(title) > tiddlerInfo.changeCount,
|
||||
var hasChanged = !tiddlerInfo || $tw.wiki.getChangeCount(title) > tiddlerInfo.changeCount,
|
||||
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
||||
if(hasChanged) {
|
||||
if(isReadyToSave) {
|
||||
@@ -583,8 +581,6 @@ SaveTiddlerTask.prototype.run = function(callback) {
|
||||
};
|
||||
// Invoke the callback
|
||||
callback(null);
|
||||
},{
|
||||
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
||||
});
|
||||
} else {
|
||||
this.syncer.logger.log(" Not Dispatching 'save' task:",this.title,"tiddler does not exist");
|
||||
|
||||
@@ -41,7 +41,7 @@ exports.upgrade = function(wiki,titles,tiddlers) {
|
||||
// Check if we're dealing with a plugin
|
||||
if(incomingTiddler && incomingTiddler["plugin-type"]) {
|
||||
// Check whether the plugin contains JS modules
|
||||
var requiresReload = wiki.doesPluginInfoRequireReload(JSON.parse(incomingTiddler.text)) ? (wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
|
||||
var requiresReload = $tw.wiki.doesPluginInfoRequireReload(JSON.parse(incomingTiddler.text)) ? ($tw.wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
|
||||
messages[title] = requiresReload;
|
||||
if(incomingTiddler.version) {
|
||||
// Upgrade the incoming plugin if it is in the upgrade library
|
||||
|
||||
@@ -20,27 +20,15 @@
|
||||
for (i; i < string.length; i++) {
|
||||
charCode = string.charCodeAt(i);
|
||||
|
||||
if (charCode < 128) {
|
||||
if (charCode < 128)
|
||||
output += String.fromCharCode(charCode);
|
||||
} else if ((charCode > 127) && (charCode < 2048)) {
|
||||
output += String.fromCharCode((charCode >> 6) | 192);
|
||||
else if ((charCode > 127) && (charCode < 2048))
|
||||
output += String.fromCharCode((charCode >> 6) | 192),
|
||||
output += String.fromCharCode((charCode & 63) | 128);
|
||||
} else if ((charCode > 55295) && (charCode < 57344) && string.length > i+1) {
|
||||
// Surrogate pair
|
||||
var hiSurrogate = charCode;
|
||||
var loSurrogate = string.charCodeAt(i+1);
|
||||
i++; // Skip the low surrogate on the next loop pass
|
||||
var codePoint = (((hiSurrogate - 55296) << 10) | (loSurrogate - 56320)) + 65536;
|
||||
output += String.fromCharCode((codePoint >> 18) | 240);
|
||||
output += String.fromCharCode(((codePoint >> 12) & 63) | 128);
|
||||
output += String.fromCharCode(((codePoint >> 6) & 63) | 128);
|
||||
output += String.fromCharCode((codePoint & 63) | 128);
|
||||
} else {
|
||||
// Not a surrogate pair, or a dangling surrogate without its partner that we'll just encode as-is
|
||||
output += String.fromCharCode((charCode >> 12) | 224);
|
||||
output += String.fromCharCode(((charCode >> 6) & 63) | 128);
|
||||
else
|
||||
output += String.fromCharCode((charCode >> 12) | 224),
|
||||
output += String.fromCharCode(((charCode >> 6) & 63) | 128),
|
||||
output += String.fromCharCode((charCode & 63) | 128);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
@@ -53,21 +41,15 @@
|
||||
while (i < string.length) {
|
||||
charCode = string.charCodeAt(i);
|
||||
|
||||
if (charCode < 128) {
|
||||
if (charCode < 128)
|
||||
output += String.fromCharCode(charCode),
|
||||
i++;
|
||||
} else if ((charCode > 191) && (charCode < 224)) {
|
||||
output += String.fromCharCode(((charCode & 31) << 6) | (string.charCodeAt(i + 1) & 63));
|
||||
else if ((charCode > 191) && (charCode < 224))
|
||||
output += String.fromCharCode(((charCode & 31) << 6) | (string.charCodeAt(i + 1) & 63)),
|
||||
i += 2;
|
||||
} else if ((charCode > 223) && (charCode < 240)) {
|
||||
output += String.fromCharCode(((charCode & 15) << 12) | ((string.charCodeAt(i + 1) & 63) << 6) | (string.charCodeAt(i + 2) & 63));
|
||||
else
|
||||
output += String.fromCharCode(((charCode & 15) << 12) | ((string.charCodeAt(i + 1) & 63) << 6) | (string.charCodeAt(i + 2) & 63)),
|
||||
i += 3;
|
||||
} else {
|
||||
var codePoint = ((charCode & 7) << 18) | ((string.charCodeAt(i + 1) & 63) << 12) | ((string.charCodeAt(i + 2) & 63) << 6) | (string.charCodeAt(i + 3) & 63);
|
||||
// output += String.fromCodePoint(codePoint); // Can't do this because Internet Explorer doesn't have String.fromCodePoint
|
||||
output += String.fromCharCode(((codePoint - 65536) >> 10) + 55296) + String.fromCharCode(((codePoint - 65536) & 1023) + 56320); // So we do this instead
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
//
|
||||
// copyright: MIT
|
||||
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
|
||||
!function(r,e,o,t){void 0!==o.module&&o.module.exports?o.module.exports=e.apply(o):void 0!==o.define&&"function"===o.define&&o.define.amd?define("utf8",[],e):o.utf8=e.apply(o)}(0,function(){return{encode:function(r){if("string"!=typeof r)return r;r=r.replace(/\r\n/g,"\n");for(var e,o="",t=0;t<r.length;t++)if((e=r.charCodeAt(t))<128)o+=String.fromCharCode(e);else if(e>127&&e<2048)o+=String.fromCharCode(e>>6|192),o+=String.fromCharCode(63&e|128);else if(e>55295&&e<57344&&r.length>t+1){var i=e,n=r.charCodeAt(t+1);t++;var d=65536+(i-55296<<10|n-56320);o+=String.fromCharCode(d>>18|240),o+=String.fromCharCode(d>>12&63|128),o+=String.fromCharCode(d>>6&63|128),o+=String.fromCharCode(63&d|128)}else o+=String.fromCharCode(e>>12|224),o+=String.fromCharCode(e>>6&63|128),o+=String.fromCharCode(63&e|128);return o},decode:function(r){if("string"!=typeof r)return r;for(var e="",o=0,t=0;o<r.length;)if((t=r.charCodeAt(o))<128)e+=String.fromCharCode(t),o++;else if(t>191&&t<224)e+=String.fromCharCode((31&t)<<6|63&r.charCodeAt(o+1)),o+=2;else if(t>223&&t<240)e+=String.fromCharCode((15&t)<<12|(63&r.charCodeAt(o+1))<<6|63&r.charCodeAt(o+2)),o+=3;else{var i=(7&t)<<18|(63&r.charCodeAt(o+1))<<12|(63&r.charCodeAt(o+2))<<6|63&r.charCodeAt(o+3);e+=String.fromCharCode(55296+(i-65536>>10))+String.fromCharCode(56320+(i-65536&1023)),o+=4}return e}}},this),function(r,e,o,t){if(void 0!==o.module&&o.module.exports){if(t&&o.require)for(var i=0;i<t.length;i++)o[t[i]]=o.require(t[i]);o.module.exports=e.apply(o)}else void 0!==o.define&&"function"===o.define&&o.define.amd?define("base64",t||[],e):o.base64=e.apply(o)}(0,function(r){var e=r||this.utf8,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(r){if(void 0===e)throw{error:"MissingMethod",message:"UTF8 Module is missing."};if("string"!=typeof r)return r;r=e.encode(r);for(var t,i,n,d,f,a,h,C="",c=0;c<r.length;)d=(t=r.charCodeAt(c++))>>2,f=(3&t)<<4|(i=r.charCodeAt(c++))>>4,a=(15&i)<<2|(n=r.charCodeAt(c++))>>6,h=63&n,isNaN(i)?a=h=64:isNaN(n)&&(h=64),C+=o.charAt(d)+o.charAt(f)+o.charAt(a)+o.charAt(h);return C},decode:function(r){if(void 0===e)throw{error:"MissingMethod",message:"UTF8 Module is missing."};if("string"!=typeof r)return r;r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,i,n,d,f,a,h="",C=0;C<r.length;)t=o.indexOf(r.charAt(C++))<<2|(d=o.indexOf(r.charAt(C++)))>>4,i=(15&d)<<4|(f=o.indexOf(r.charAt(C++)))>>2,n=(3&f)<<6|(a=o.indexOf(r.charAt(C++))),h+=String.fromCharCode(t),64!=f&&(h+=String.fromCharCode(i)),64!=a&&(h+=String.fromCharCode(n));return e.decode(h)}}},this,["utf8"]);
|
||||
!function(r,e,o,t){void 0!==o.module&&o.module.exports?o.module.exports=e.apply(o):void 0!==o.define&&"function"===o.define&&o.define.amd?define("utf8",[],e):o.utf8=e.apply(o)}(0,function(){return{encode:function(r){if("string"!=typeof r)return r;r=r.replace(/\r\n/g,"\n");for(var e,o="",t=0;t<r.length;t++)(e=r.charCodeAt(t))<128?o+=String.fromCharCode(e):e>127&&e<2048?(o+=String.fromCharCode(e>>6|192),o+=String.fromCharCode(63&e|128)):(o+=String.fromCharCode(e>>12|224),o+=String.fromCharCode(e>>6&63|128),o+=String.fromCharCode(63&e|128));return o},decode:function(r){if("string"!=typeof r)return r;for(var e="",o=0,t=0;o<r.length;)(t=r.charCodeAt(o))<128?(e+=String.fromCharCode(t),o++):t>191&&t<224?(e+=String.fromCharCode((31&t)<<6|63&r.charCodeAt(o+1)),o+=2):(e+=String.fromCharCode((15&t)<<12|(63&r.charCodeAt(o+1))<<6|63&r.charCodeAt(o+2)),o+=3);return e}}},this),function(r,e,o,t){if(void 0!==o.module&&o.module.exports){if(t&&o.require)for(var n=0;n<t.length;n++)o[t[n]]=o.require(t[n]);o.module.exports=e.apply(o)}else void 0!==o.define&&"function"===o.define&&o.define.amd?define("base64",t||[],e):o.base64=e.apply(o)}(0,function(r){var e=r||this.utf8,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(r){if(void 0===e)throw{error:"MissingMethod",message:"UTF8 Module is missing."};if("string"!=typeof r)return r;r=e.encode(r);for(var t,n,i,d,f,a,h,c="",u=0;u<r.length;)d=(t=r.charCodeAt(u++))>>2,f=(3&t)<<4|(n=r.charCodeAt(u++))>>4,a=(15&n)<<2|(i=r.charCodeAt(u++))>>6,h=63&i,isNaN(n)?a=h=64:isNaN(i)&&(h=64),c+=o.charAt(d)+o.charAt(f)+o.charAt(a)+o.charAt(h);return c},decode:function(r){if(void 0===e)throw{error:"MissingMethod",message:"UTF8 Module is missing."};if("string"!=typeof r)return r;r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,n,i,d,f,a,h="",c=0;c<r.length;)t=o.indexOf(r.charAt(c++))<<2|(d=o.indexOf(r.charAt(c++)))>>4,n=(15&d)<<4|(f=o.indexOf(r.charAt(c++)))>>2,i=(3&f)<<6|(a=o.indexOf(r.charAt(c++))),h+=String.fromCharCode(t),64!=f&&(h+=String.fromCharCode(n)),64!=a&&(h+=String.fromCharCode(i));return e.decode(h)}}},this,["utf8"]);
|
||||
@@ -29,23 +29,23 @@ exports.removeChildren = function(node) {
|
||||
};
|
||||
|
||||
exports.hasClass = function(el,className) {
|
||||
return el && el.hasAttribute && el.hasAttribute("class") && el.getAttribute("class").split(" ").indexOf(className) !== -1;
|
||||
return el && el.className && el.className.toString().split(" ").indexOf(className) !== -1;
|
||||
};
|
||||
|
||||
exports.addClass = function(el,className) {
|
||||
var c = (el.getAttribute("class") || "").split(" ");
|
||||
var c = el.className.split(" ");
|
||||
if(c.indexOf(className) === -1) {
|
||||
c.push(className);
|
||||
el.setAttribute("class",c.join(" "));
|
||||
el.className = c.join(" ");
|
||||
}
|
||||
};
|
||||
|
||||
exports.removeClass = function(el,className) {
|
||||
var c = (el.getAttribute("class") || "").split(" "),
|
||||
var c = el.className.split(" "),
|
||||
p = c.indexOf(className);
|
||||
if(p !== -1) {
|
||||
c.splice(p,1);
|
||||
el.setAttribute("class",c.join(" "));
|
||||
el.className = c.join(" ");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,16 +24,6 @@ exports.httpRequest = function(options) {
|
||||
var type = options.type || "GET",
|
||||
url = options.url,
|
||||
headers = options.headers || {accept: "application/json"},
|
||||
hasHeader = function(targetHeader) {
|
||||
targetHeader = targetHeader.toLowerCase();
|
||||
var result = false;
|
||||
$tw.utils.each(headers,function(header,headerTitle,object) {
|
||||
if(headerTitle.toLowerCase() === targetHeader) {
|
||||
result = true;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
returnProp = options.returnProp || "responseText",
|
||||
request = new XMLHttpRequest(),
|
||||
data = "",
|
||||
@@ -73,10 +63,10 @@ exports.httpRequest = function(options) {
|
||||
request.setRequestHeader(headerTitle,header);
|
||||
});
|
||||
}
|
||||
if(data && !hasHeader("Content-Type")) {
|
||||
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
|
||||
if(data && !$tw.utils.hop(headers,"Content-type")) {
|
||||
request.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8");
|
||||
}
|
||||
if(!hasHeader("X-Requested-With")) {
|
||||
if(!$tw.utils.hop(headers,"X-Requested-With")) {
|
||||
request.setRequestHeader("X-Requested-With","TiddlyWiki");
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -21,32 +21,14 @@ var bumpSequenceNumber = function(object) {
|
||||
}
|
||||
};
|
||||
|
||||
var TW_Node = function (){
|
||||
throw TypeError("Illegal constructor");
|
||||
};
|
||||
|
||||
Object.defineProperty(TW_Node.prototype, 'ELEMENT_NODE', {
|
||||
get: function() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(TW_Node.prototype, 'TEXT_NODE', {
|
||||
get: function() {
|
||||
return 3;
|
||||
}
|
||||
});
|
||||
|
||||
var TW_TextNode = function(text) {
|
||||
bumpSequenceNumber(this);
|
||||
this.textContent = text + "";
|
||||
};
|
||||
|
||||
TW_TextNode.prototype = Object.create(TW_Node.prototype);
|
||||
|
||||
Object.defineProperty(TW_TextNode.prototype, "nodeType", {
|
||||
get: function() {
|
||||
return this.TEXT_NODE;
|
||||
return 3;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,8 +49,6 @@ var TW_Element = function(tag,namespace) {
|
||||
this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml";
|
||||
};
|
||||
|
||||
TW_Element.prototype = Object.create(TW_Node.prototype);
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "style", {
|
||||
get: function() {
|
||||
return this._style;
|
||||
@@ -89,7 +69,7 @@ Object.defineProperty(TW_Element.prototype, "style", {
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "nodeType", {
|
||||
get: function() {
|
||||
return this.ELEMENT_NODE;
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -15,33 +15,13 @@ File system utilities
|
||||
var fs = require("fs"),
|
||||
path = require("path");
|
||||
|
||||
/*
|
||||
Return the subdirectories of a path
|
||||
*/
|
||||
exports.getSubdirectories = function(dirPath) {
|
||||
if(!$tw.utils.isDirectory(dirPath)) {
|
||||
return null;
|
||||
}
|
||||
var subdirs = [];
|
||||
$tw.utils.each(fs.readdirSync(dirPath),function(item) {
|
||||
if($tw.utils.isDirectory(path.resolve(dirPath,item))) {
|
||||
subdirs.push(item);
|
||||
}
|
||||
});
|
||||
return subdirs;
|
||||
}
|
||||
|
||||
/*
|
||||
Recursively (and synchronously) copy a directory and all its content
|
||||
*/
|
||||
exports.copyDirectory = function(srcPath,dstPath) {
|
||||
// Remove any trailing path separators
|
||||
srcPath = path.resolve($tw.utils.removeTrailingSeparator(srcPath));
|
||||
dstPath = path.resolve($tw.utils.removeTrailingSeparator(dstPath));
|
||||
// Check that neither director is within the other
|
||||
if(srcPath.substring(0,dstPath.length) === dstPath || dstPath.substring(0,srcPath.length) === srcPath) {
|
||||
return "Cannot copy nested directories";
|
||||
}
|
||||
srcPath = $tw.utils.removeTrailingSeparator(srcPath);
|
||||
dstPath = $tw.utils.removeTrailingSeparator(dstPath);
|
||||
// Create the destination directory
|
||||
var err = $tw.utils.createDirectory(dstPath);
|
||||
if(err) {
|
||||
@@ -240,7 +220,7 @@ exports.generateTiddlerFileInfo = function(tiddler,options) {
|
||||
}
|
||||
}
|
||||
// Take the file extension from the tiddler content type
|
||||
var contentTypeInfo = $tw.utils.getContentTypeInfo(fileInfo.type) || {extension: ""};
|
||||
var contentTypeInfo = $tw.config.contentTypeInfo[fileInfo.type] || {extension: ""};
|
||||
// Generate the filepath
|
||||
fileInfo.filepath = $tw.utils.generateTiddlerFilepath(tiddler.fields.title,{
|
||||
extension: contentTypeInfo.extension,
|
||||
@@ -326,7 +306,7 @@ exports.saveTiddlerToFile = function(tiddler,fileInfo,callback) {
|
||||
$tw.utils.createDirectory(path.dirname(fileInfo.filepath));
|
||||
if(fileInfo.hasMetaFile) {
|
||||
// Save the tiddler as a separate body and meta file
|
||||
var typeInfo = $tw.utils.getContentTypeInfo(tiddler.fields.type || "text/plain") || {encoding: "utf8"};
|
||||
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
||||
fs.writeFile(fileInfo.filepath,tiddler.fields.text,typeInfo.encoding,function(err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
@@ -353,7 +333,7 @@ exports.saveTiddlerToFileSync = function(tiddler,fileInfo) {
|
||||
$tw.utils.createDirectory(path.dirname(fileInfo.filepath));
|
||||
if(fileInfo.hasMetaFile) {
|
||||
// Save the tiddler as a separate body and meta file
|
||||
var typeInfo = $tw.utils.getContentTypeInfo(tiddler.fields.type || "text/plain") || {encoding: "utf8"};
|
||||
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
||||
fs.writeFileSync(fileInfo.filepath,tiddler.fields.text,typeInfo.encoding);
|
||||
fs.writeFileSync(fileInfo.filepath + ".meta",tiddler.getFieldStringBlock({exclude: ["text","bag"]}),"utf8");
|
||||
} else {
|
||||
|
||||
@@ -94,36 +94,6 @@ exports.trim = function(str) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.trimPrefix = function(str,unwanted) {
|
||||
if(typeof str === "string" && typeof unwanted === "string") {
|
||||
if(unwanted === "") {
|
||||
return str.replace(/^\s\s*/, '');
|
||||
} else {
|
||||
// Safely regexp-escape the unwanted text
|
||||
unwanted = unwanted.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
var regex = new RegExp('^(' + unwanted + ')+');
|
||||
return str.replace(regex, '');
|
||||
}
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
exports.trimSuffix = function(str,unwanted) {
|
||||
if(typeof str === "string" && typeof unwanted === "string") {
|
||||
if(unwanted === "") {
|
||||
return str.replace(/\s\s*$/, '');
|
||||
} else {
|
||||
// Safely regexp-escape the unwanted text
|
||||
unwanted = unwanted.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
var regex = new RegExp('(' + unwanted + ')+$');
|
||||
return str.replace(regex, '');
|
||||
}
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Convert a string to sentence case (ie capitalise first letter)
|
||||
*/
|
||||
@@ -760,7 +730,7 @@ Convert text and content type to a data URI
|
||||
*/
|
||||
exports.makeDataUri = function(text,type,_canonical_uri) {
|
||||
type = type || "text/vnd.tiddlywiki";
|
||||
var typeInfo = $tw.utils.getContentTypeInfo(type) || $tw.utils.getContentTypeInfo("text/plain"),
|
||||
var typeInfo = $tw.config.contentTypeInfo[type] || $tw.config.contentTypeInfo["text/plain"],
|
||||
isBase64 = typeInfo.encoding === "base64",
|
||||
parts = [];
|
||||
if(_canonical_uri) {
|
||||
@@ -831,57 +801,4 @@ exports.getSystemInfo = function(str,ending,position) {
|
||||
return results.join("\n");
|
||||
};
|
||||
|
||||
exports.parseNumber = function(str) {
|
||||
return parseFloat(str) || 0;
|
||||
};
|
||||
|
||||
exports.parseInt = function(str) {
|
||||
return parseInt(str,10) || 0;
|
||||
};
|
||||
|
||||
exports.stringifyNumber = function(num) {
|
||||
return num + "";
|
||||
};
|
||||
|
||||
exports.makeCompareFunction = function(type,options) {
|
||||
options = options || {};
|
||||
var gt = options.invert ? -1 : +1,
|
||||
lt = options.invert ? +1 : -1,
|
||||
compare = function(a,b) {
|
||||
if(a > b) {
|
||||
return gt ;
|
||||
} else if(a < b) {
|
||||
return lt;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
types = {
|
||||
"number": function(a,b) {
|
||||
return compare($tw.utils.parseNumber(a),$tw.utils.parseNumber(b));
|
||||
},
|
||||
"integer": function(a,b) {
|
||||
return compare($tw.utils.parseInt(a),$tw.utils.parseInt(b));
|
||||
},
|
||||
"string": function(a,b) {
|
||||
return compare("" + a,"" +b);
|
||||
},
|
||||
"date": function(a,b) {
|
||||
var dateA = $tw.utils.parseDate(a),
|
||||
dateB = $tw.utils.parseDate(b);
|
||||
if(!isFinite(dateA)) {
|
||||
dateA = new Date(0);
|
||||
}
|
||||
if(!isFinite(dateB)) {
|
||||
dateB = new Date(0);
|
||||
}
|
||||
return compare(dateA,dateB);
|
||||
},
|
||||
"version": function(a,b) {
|
||||
return $tw.utils.compareVersions(a,b);
|
||||
}
|
||||
};
|
||||
return (types[type] || types[options.defaultType] || types.number);
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -9,7 +9,7 @@ Action widget to create a new tiddler with a unique name and specified fields.
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw:false, require:false, exports:false */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
@@ -36,15 +36,9 @@ Compute the internal state of the widget
|
||||
*/
|
||||
CreateTiddlerWidget.prototype.execute = function() {
|
||||
this.actionBaseTitle = this.getAttribute("$basetitle");
|
||||
this.hasBase = !!this.actionBaseTitle;
|
||||
this.actionSaveTitle = this.getAttribute("$savetitle");
|
||||
this.actionSaveDraftTitle = this.getAttribute("$savedrafttitle");
|
||||
this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes";
|
||||
//Following params are new since 5.1.22
|
||||
this.actionTemplate = this.getAttribute("$template");
|
||||
this.useTemplate = !!this.actionTemplate;
|
||||
this.actionOverwrite = this.getAttribute("$overwrite","no");
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -63,7 +57,7 @@ CreateTiddlerWidget.prototype.refresh = function(changedTiddlers) {
|
||||
Invoke the action associated with this widget
|
||||
*/
|
||||
CreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||
var title = this.wiki.getTiddlerText("$:/language/DefaultNewTiddlerTitle"), // Get the initial new-tiddler title
|
||||
var title = this.wiki.generateNewTitle(this.actionBaseTitle),
|
||||
fields = {},
|
||||
creationFields,
|
||||
modificationFields;
|
||||
@@ -76,22 +70,7 @@ CreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||
creationFields = this.wiki.getCreationFields();
|
||||
modificationFields = this.wiki.getModificationFields();
|
||||
}
|
||||
if(this.hasBase && this.actionOverwrite === "no") {
|
||||
title = this.wiki.generateNewTitle(this.actionBaseTitle);
|
||||
} else if (this.hasBase && this.actionOverwrite === "yes") {
|
||||
title = this.actionBaseTitle
|
||||
}
|
||||
// NO $basetitle BUT $template parameter is available
|
||||
// the title MUST be unique, otherwise the template would be overwritten
|
||||
if (!this.hasBase && this.useTemplate) {
|
||||
title = this.wiki.generateNewTitle(this.actionTemplate);
|
||||
} else if (!this.hasBase && !this.useTemplate) {
|
||||
// If NO $basetitle AND NO $template use initial title
|
||||
// DON'T overwrite any stuff
|
||||
title = this.wiki.generateNewTitle(title);
|
||||
}
|
||||
var templateTiddler = this.wiki.getTiddler(this.actionTemplate) || {};
|
||||
var tiddler = this.wiki.addTiddler(new $tw.Tiddler(templateTiddler.fields,creationFields,fields,modificationFields,{title: title}));
|
||||
var tiddler = this.wiki.addTiddler(new $tw.Tiddler(creationFields,fields,modificationFields,{title: title}));
|
||||
if(this.actionSaveTitle) {
|
||||
this.wiki.setTextReference(this.actionSaveTitle,title,this.getVariable("currentTiddler"));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ Invoke the action associated with this widget
|
||||
ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||
// Trigger the popup
|
||||
var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/,
|
||||
match = popupLocationRegExp.exec(this.actionCoords || "");
|
||||
match = popupLocationRegExp.exec(this.actionCoords);
|
||||
if(match) {
|
||||
$tw.popup.triggerPopup({
|
||||
domNode: null,
|
||||
@@ -70,8 +70,6 @@ ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||
title: this.actionState,
|
||||
wiki: this.wiki
|
||||
});
|
||||
} else {
|
||||
$tw.popup.cancel(0);
|
||||
}
|
||||
return true; // Action was invoked
|
||||
};
|
||||
|
||||
@@ -46,9 +46,6 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.nwsaveas) {
|
||||
domNode.setAttribute("nwsaveas",this.nwsaveas);
|
||||
}
|
||||
if(this.accept) {
|
||||
domNode.setAttribute("accept",this.accept);
|
||||
}
|
||||
// Nw.js supports "webkitdirectory" and "nwdirectory" to allow a directory to be selected
|
||||
if(this.webkitdirectory) {
|
||||
domNode.setAttribute("webkitdirectory",this.webkitdirectory);
|
||||
@@ -86,7 +83,6 @@ BrowseWidget.prototype.execute = function() {
|
||||
this.param = this.getAttribute("param");
|
||||
this.tooltip = this.getAttribute("tooltip");
|
||||
this.nwsaveas = this.getAttribute("nwsaveas");
|
||||
this.accept = this.getAttribute("accept");
|
||||
this.webkitdirectory = this.getAttribute("webkitdirectory");
|
||||
this.nwdirectory = this.getAttribute("nwdirectory");
|
||||
};
|
||||
|
||||
@@ -91,8 +91,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
||||
handled = true;
|
||||
}
|
||||
if(self.actions) {
|
||||
var modifierKey = $tw.keyboardManager.getEventModifierKeyDescriptor(event);
|
||||
self.invokeActionString(self.actions,self,event,{modifier: modifierKey});
|
||||
self.invokeActionString(self.actions,self,event);
|
||||
}
|
||||
if(handled) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -45,7 +45,7 @@ CountWidget.prototype.execute = function() {
|
||||
if(this.filter) {
|
||||
this.currentCount = this.wiki.filterTiddlers(this.filter,this).length;
|
||||
} else {
|
||||
this.currentCount = "0";
|
||||
this.currentCount = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ DroppableWidget.prototype.render = function(parent,nextSibling) {
|
||||
}
|
||||
// Create element and assign classes
|
||||
var domNode = this.document.createElement(tag),
|
||||
classes = (this.droppableClass || "").split(" ");
|
||||
classes = (this["class"] || "").split(" ");
|
||||
classes.push("tc-droppable");
|
||||
domNode.className = classes.join(" ");
|
||||
// Add event handlers
|
||||
@@ -75,9 +75,7 @@ DroppableWidget.prototype.leaveDrag = function(event) {
|
||||
// Remove highlighting if we're leaving externally. The hacky second condition is to resolve a problem with Firefox whereby there is an erroneous dragenter event if the node being dragged is within the dropzone
|
||||
if(this.currentlyEntered.length === 0 || (this.currentlyEntered.length === 1 && this.currentlyEntered[0] === $tw.dragInProgress)) {
|
||||
this.currentlyEntered = [];
|
||||
if(this.domNodes[0]) {
|
||||
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
|
||||
}
|
||||
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -132,7 +130,8 @@ DroppableWidget.prototype.handleDropEvent = function(event) {
|
||||
|
||||
DroppableWidget.prototype.performActions = function(title,event) {
|
||||
if(this.droppableActions) {
|
||||
var modifierKey = $tw.keyboardManager.getEventModifierKeyDescriptor(event);
|
||||
var modifierKey = event.ctrlKey && ! event.shiftKey ? "ctrl" : event.shiftKey && !event.ctrlKey ? "shift" :
|
||||
event.ctrlKey && event.shiftKey ? "ctrl-shift" : "normal" ;
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title, modifier: modifierKey});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.execute();
|
||||
// Create element
|
||||
var domNode = this.document.createElement("div");
|
||||
domNode.className = this.dropzoneClass || "tc-dropzone";
|
||||
domNode.className = "tc-dropzone";
|
||||
// Add event handlers
|
||||
if(this.dropzoneEnable) {
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
@@ -113,7 +113,7 @@ DropZoneWidget.prototype.handleDragEndEvent = function(event) {
|
||||
DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
var self = this,
|
||||
readFileCallback = function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray), autoOpenOnImport: self.autoOpenOnImport, importTitle: self.importTitle});
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
};
|
||||
this.leaveDrag(event);
|
||||
// Check for being over a TEXTAREA or INPUT
|
||||
@@ -149,7 +149,7 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
var self = this,
|
||||
readFileCallback = function(tiddlerFieldsArray) {
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray), autoOpenOnImport: self.autoOpenOnImport, importTitle: self.importTitle});
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||
};
|
||||
// Let the browser handle it if we're in a textarea or input box
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) == -1 && !event.target.isContentEditable) {
|
||||
@@ -176,7 +176,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
if($tw.log.IMPORT) {
|
||||
console.log("Importing string '" + str + "', type: '" + type + "'");
|
||||
}
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields]), autoOpenOnImport: self.autoOpenOnImport, importTitle: self.importTitle});
|
||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -190,11 +190,8 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
DropZoneWidget.prototype.execute = function() {
|
||||
this.dropzoneClass = this.getAttribute("class");
|
||||
this.dropzoneDeserializer = this.getAttribute("deserializer");
|
||||
this.dropzoneEnable = (this.getAttribute("enable") || "yes") === "yes";
|
||||
this.autoOpenOnImport = this.getAttribute("autoOpenOnImport");
|
||||
this.importTitle = this.getAttribute("importTitle");
|
||||
// Make child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
@@ -204,7 +201,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
DropZoneWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.enable || changedAttributes.autoOpenOnImport || changedAttributes.importTitle || changedAttributes.deserializer || changedAttributes.class) {
|
||||
if(changedAttributes.enable) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,15 +48,20 @@ EditWidget.prototype.execute = function() {
|
||||
this.editPlaceholder = this.getAttribute("placeholder");
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editFocus = this.getAttribute("focus","");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","");
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
// Choose the appropriate edit widget
|
||||
this.editorType = this.getEditorType();
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets([{
|
||||
type: "edit-" + this.editorType,
|
||||
attributes: this.parseTreeNode.attributes,
|
||||
attributes: {
|
||||
tiddler: {type: "string", value: this.editTitle},
|
||||
field: {type: "string", value: this.editField},
|
||||
index: {type: "string", value: this.editIndex},
|
||||
"class": {type: "string", value: this.editClass},
|
||||
"placeholder": {type: "string", value: this.editPlaceholder},
|
||||
"tabindex": {type: "string", value: this.editTabIndex},
|
||||
"focus": {type: "string", value: this.editFocus}
|
||||
},
|
||||
children: this.parseTreeNode.children
|
||||
}]);
|
||||
};
|
||||
@@ -70,10 +75,10 @@ EditWidget.prototype.getEditorType = function() {
|
||||
type = tiddler.fields.type;
|
||||
}
|
||||
}
|
||||
type = $tw.utils.parseContentType(type || "text/vnd.tiddlywiki")[0];
|
||||
type = type || "text/vnd.tiddlywiki";
|
||||
var editorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type);
|
||||
if(!editorType) {
|
||||
var typeInfo = $tw.utils.getContentTypeInfo(type);
|
||||
var typeInfo = $tw.config.contentTypeInfo[type];
|
||||
if(typeInfo && typeInfo.encoding === "base64") {
|
||||
editorType = "binary";
|
||||
} else {
|
||||
@@ -89,7 +94,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -29,47 +29,45 @@ Render this widget into the DOM
|
||||
ElementWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
// Neuter blacklisted elements
|
||||
this.tag = this.parseTreeNode.tag;
|
||||
if($tw.config.htmlUnsafeElements.indexOf(this.tag) !== -1) {
|
||||
this.tag = "safe-" + this.tag;
|
||||
var tag = this.parseTreeNode.tag;
|
||||
if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {
|
||||
tag = "safe-" + tag;
|
||||
}
|
||||
// Adjust headings by the current base level
|
||||
var headingLevel = ["h1","h2","h3","h4","h5","h6"].indexOf(this.tag);
|
||||
var headingLevel = ["h1","h2","h3","h4","h5","h6"].indexOf(tag);
|
||||
if(headingLevel !== -1) {
|
||||
var baseLevel = parseInt(this.getVariable("tv-adjust-heading-level","0"),10) || 0;
|
||||
headingLevel = Math.min(Math.max(headingLevel + 1 + baseLevel,1),6);
|
||||
this.tag = "h" + headingLevel;
|
||||
tag = "h" + headingLevel;
|
||||
}
|
||||
// Create the DOM node
|
||||
var domNode = this.document.createElementNS(this.namespace,tag);
|
||||
this.assignAttributes(domNode,{excludeEventAttributes: true});
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
this.domNodes.push(domNode);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ElementWidget.prototype.execute = function() {
|
||||
// Select the namespace for the tag
|
||||
var tagNamespaces = {
|
||||
svg: "http://www.w3.org/2000/svg",
|
||||
math: "http://www.w3.org/1998/Math/MathML",
|
||||
body: "http://www.w3.org/1999/xhtml"
|
||||
};
|
||||
this.namespace = tagNamespaces[this.tag];
|
||||
this.namespace = tagNamespaces[this.parseTreeNode.tag];
|
||||
if(this.namespace) {
|
||||
this.setVariable("namespace",this.namespace);
|
||||
} else {
|
||||
this.namespace = this.getVariable("namespace",{defaultValue: "http://www.w3.org/1999/xhtml"});
|
||||
}
|
||||
// Invoke the th-rendering-element hook
|
||||
var parseTreeNodes = $tw.hooks.invokeHook("th-rendering-element",null,this);
|
||||
this.isReplaced = !!parseTreeNodes;
|
||||
if(parseTreeNodes) {
|
||||
// Use the parse tree nodes provided by the hook
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
this.renderChildren(this.parentDomNode,null);
|
||||
return;
|
||||
}
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
// Create the DOM node and render children
|
||||
var domNode = this.document.createElementNS(this.namespace,this.tag);
|
||||
this.assignAttributes(domNode,{excludeEventAttributes: true});
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
this.domNodes.push(domNode);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -79,13 +77,8 @@ ElementWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes(),
|
||||
hasChangedAttributes = $tw.utils.count(changedAttributes) > 0;
|
||||
if(hasChangedAttributes) {
|
||||
if(!this.isReplaced) {
|
||||
// Update our attributes
|
||||
this.assignAttributes(this.domNodes[0],{excludeEventAttributes: true});
|
||||
} else {
|
||||
// If we were replaced then completely refresh ourselves
|
||||
return this.refreshSelf();
|
||||
}
|
||||
// Update our attributes
|
||||
this.assignAttributes(this.domNodes[0],{excludeEventAttributes: true});
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers) || hasChangedAttributes;
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ Render this widget into the DOM
|
||||
*/
|
||||
EntityWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
var entityString = this.getAttribute("entity",this.parseTreeNode.entity || ""),
|
||||
textNode = this.document.createTextNode($tw.utils.entityDecode(entityString));
|
||||
|
||||
@@ -42,53 +42,44 @@ FieldsWidget.prototype.execute = function() {
|
||||
// Get parameters from our attributes
|
||||
this.tiddlerTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.template = this.getAttribute("template");
|
||||
this.sort = this.getAttribute("sort","yes") === "yes";
|
||||
this.sortReverse = this.getAttribute("sortReverse","no") === "yes";
|
||||
this.exclude = this.getAttribute("exclude");
|
||||
this.include = this.getAttribute("include",null);
|
||||
this.stripTitlePrefix = this.getAttribute("stripTitlePrefix","no") === "yes";
|
||||
// Get the value to display
|
||||
var tiddler = this.wiki.getTiddler(this.tiddlerTitle);
|
||||
|
||||
// Get the inclusion and exclusion list
|
||||
var excludeArr = (this.exclude) ? this.exclude.split(" ") : ["text"];
|
||||
// Include takes precedence
|
||||
var includeArr = (this.include) ? this.include.split(" ") : null;
|
||||
|
||||
// Get the exclusion list
|
||||
var exclude;
|
||||
if(this.exclude) {
|
||||
exclude = this.exclude.split(" ");
|
||||
} else {
|
||||
exclude = ["text"];
|
||||
}
|
||||
// Compose the template
|
||||
var text = [];
|
||||
if(this.template && tiddler) {
|
||||
var fields = [];
|
||||
if (includeArr) { // Include takes precedence
|
||||
for(var i=0; i<includeArr.length; i++) {
|
||||
if(tiddler.fields[includeArr[i]]) {
|
||||
fields.push(includeArr[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(var fieldName in tiddler.fields) {
|
||||
if(excludeArr.indexOf(fieldName) === -1) {
|
||||
fields.push(fieldName);
|
||||
}
|
||||
for(var fieldName in tiddler.fields) {
|
||||
if(exclude.indexOf(fieldName) === -1) {
|
||||
fields.push(fieldName);
|
||||
}
|
||||
}
|
||||
if (this.sort) fields.sort();
|
||||
if (this.sortReverse) fields.reverse();
|
||||
for(var f=0, fmax=fields.length; f<fmax; f++) {
|
||||
fields.sort();
|
||||
for(var f=0; f<fields.length; f++) {
|
||||
fieldName = fields[f];
|
||||
var row = this.template,
|
||||
value = tiddler.getFieldString(fieldName);
|
||||
if(this.stripTitlePrefix && fieldName === "title") {
|
||||
var reStrip = /^\{[^\}]+\}(.+)/mg,
|
||||
reMatch = reStrip.exec(value);
|
||||
if(reMatch) {
|
||||
value = reMatch[1];
|
||||
if(exclude.indexOf(fieldName) === -1) {
|
||||
var row = this.template,
|
||||
value = tiddler.getFieldString(fieldName);
|
||||
if(this.stripTitlePrefix && fieldName === "title") {
|
||||
var reStrip = /^\{[^\}]+\}(.+)/mg,
|
||||
reMatch = reStrip.exec(value);
|
||||
if(reMatch) {
|
||||
value = reMatch[1];
|
||||
}
|
||||
}
|
||||
row = $tw.utils.replaceString(row,"$name$",fieldName);
|
||||
row = $tw.utils.replaceString(row,"$value$",value);
|
||||
row = $tw.utils.replaceString(row,"$encoded_value$",$tw.utils.htmlEncode(value));
|
||||
text.push(row);
|
||||
}
|
||||
row = $tw.utils.replaceString(row,"$name$",fieldName);
|
||||
row = $tw.utils.replaceString(row,"$value$",value);
|
||||
row = $tw.utils.replaceString(row,"$encoded_value$",$tw.utils.htmlEncode(value));
|
||||
text.push(row);
|
||||
}
|
||||
}
|
||||
this.text = text.join("");
|
||||
@@ -99,13 +90,11 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
FieldsWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if( changedAttributes.tiddler || changedAttributes.template || changedAttributes.exclude ||
|
||||
changedAttributes.include || changedAttributes.sort || changedAttributes.sortReverse ||
|
||||
changedTiddlers[this.tiddlerTitle] || changedAttributes.stripTitlePrefix) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
if(changedAttributes.tiddler || changedAttributes.template || changedAttributes.exclude || changedAttributes.stripTitlePrefix || changedTiddlers[this.tiddlerTitle]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@ Compute the internal state of the widget
|
||||
*/
|
||||
ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
||||
var widgetPointer = this;
|
||||
// Got to flush all the accumulated variables
|
||||
this.variables = new this.variablesConstructor();
|
||||
// Get our parameters
|
||||
this.filter = this.getAttribute("filter");
|
||||
// Compute the filter
|
||||
@@ -72,14 +70,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
||||
widgetPointer.variables[key] = widget.variables[key];
|
||||
});
|
||||
} else {
|
||||
widgetPointer.children = [widgetPointer.makeChildWidget(node)];
|
||||
// No more regenerating children for
|
||||
// this widget. If it needs to refresh,
|
||||
// it'll do so along with the the whole
|
||||
// importvariable tree.
|
||||
if (widgetPointer != this) {
|
||||
widgetPointer.makeChildWidgets = function(){};
|
||||
}
|
||||
widgetPointer.makeChildWidgets([node]);
|
||||
widgetPointer = widgetPointer.children[0];
|
||||
}
|
||||
parseTreeNode = parseTreeNode.children && parseTreeNode.children[0];
|
||||
|
||||
@@ -60,8 +60,7 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
tag = "a";
|
||||
}
|
||||
// Create our element
|
||||
var namespace = this.getVariable("namespace",{defaultValue: "http://www.w3.org/1999/xhtml"}),
|
||||
domNode = this.document.createElementNS(namespace,tag);
|
||||
var domNode = this.document.createElement(tag);
|
||||
// Assign classes
|
||||
var classes = [];
|
||||
if(this.overrideClasses === undefined) {
|
||||
@@ -103,8 +102,7 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
// Override with the value of tv-get-export-link if defined
|
||||
wikiLinkText = this.getVariable("tv-get-export-link",{params: [{name: "to",value: this.to}],defaultValue: wikiLinkText});
|
||||
if(tag === "a") {
|
||||
var namespaceHref = (namespace === "http://www.w3.org/2000/svg") ? "http://www.w3.org/1999/xlink" : undefined;
|
||||
domNode.setAttributeNS(namespaceHref,"href",wikiLinkText);
|
||||
domNode.setAttribute("href",wikiLinkText);
|
||||
}
|
||||
// Set the tabindex
|
||||
if(this.tabIndex) {
|
||||
@@ -158,8 +156,7 @@ LinkWidget.prototype.handleClickEvent = function(event) {
|
||||
metaKey: event.metaKey,
|
||||
ctrlKey: event.ctrlKey,
|
||||
altKey: event.altKey,
|
||||
shiftKey: event.shiftKey,
|
||||
event: event
|
||||
shiftKey: event.shiftKey
|
||||
});
|
||||
if(this.domNodes[0].hasAttribute("href")) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -87,8 +87,7 @@ LinkCatcherWidget.prototype.handleNavigateEvent = function(event) {
|
||||
}
|
||||
if(this.catchActions) {
|
||||
this.executingActions = true;
|
||||
var modifierKey = $tw.keyboardManager.getEventModifierKeyDescriptor(event);
|
||||
this.invokeActionString(this.catchActions,this,event,{navigateTo: event.navigateTo, modifier: modifierKey});
|
||||
this.invokeActionString(this.catchActions,this,event,{navigateTo: event.navigateTo});
|
||||
this.executingActions = false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -73,8 +73,6 @@ MacroCallWidget.prototype.execute = function() {
|
||||
attributes: attributes,
|
||||
children: parseTreeNodes
|
||||
}];
|
||||
} else if(this.renderOutput === "text/raw") {
|
||||
parseTreeNodes = [{type: "text", text: text}];
|
||||
} else {
|
||||
// Otherwise, we'll render the text
|
||||
var plainText = this.wiki.renderText("text/plain",this.parseType,text,{parentWidget: this});
|
||||
|
||||
@@ -60,6 +60,10 @@ NavigatorWidget.prototype.execute = function() {
|
||||
// Get our parameters
|
||||
this.storyTitle = this.getAttribute("story");
|
||||
this.historyTitle = this.getAttribute("history");
|
||||
this.openLinkFromInsideRiver = this.getAttribute("openLinkFromInsideRiver","top");
|
||||
this.openLinkFromOutsideRiver = this.getAttribute("openLinkFromOutsideRiver","top");
|
||||
this.singleTiddlerMode = this.getAttribute("singleTiddlerMode","no") === "yes";
|
||||
this.relinkOnRename = this.getAttribute("relinkOnRename","no").toLowerCase().trim() === "yes";
|
||||
this.setVariable("tv-story-list",this.storyTitle);
|
||||
this.setVariable("tv-history-list",this.historyTitle);
|
||||
// Construct the child widgets
|
||||
@@ -71,7 +75,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
NavigatorWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.story || changedAttributes.history) {
|
||||
if(changedAttributes.story || changedAttributes.history || changedAttributes.openLinkFromInsideRiver || changedAttributes.openLinkFromOutsideRiver || changedAttributes.singleTiddlerMode || changedAttributes.relinkOnRename) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
@@ -122,12 +126,17 @@ NavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle
|
||||
};
|
||||
|
||||
NavigatorWidget.prototype.addToStory = function(title,fromTitle) {
|
||||
if(this.storyTitle) {
|
||||
this.wiki.addToStory(title,fromTitle,this.storyTitle,{
|
||||
openLinkFromInsideRiver: this.getAttribute("openLinkFromInsideRiver","top"),
|
||||
openLinkFromOutsideRiver: this.getAttribute("openLinkFromOutsideRiver","top")
|
||||
});
|
||||
}
|
||||
this.wiki.addToStory(title,fromTitle,this.storyTitle,{
|
||||
openLinkFromInsideRiver: this.openLinkFromInsideRiver,
|
||||
openLinkFromOutsideRiver: this.openLinkFromOutsideRiver,
|
||||
singleTiddlerMode: this.singleTiddlerMode
|
||||
});
|
||||
};
|
||||
|
||||
NavigatorWidget.prototype.removeFromStory = function(title) {
|
||||
var storyList = this.getStoryList();
|
||||
this.removeTitleFromStory(storyList,title);
|
||||
this.saveStoryList(storyList);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -155,11 +164,34 @@ NavigatorWidget.prototype.handleNavigateEvent = function(event) {
|
||||
|
||||
// Close a specified tiddler
|
||||
NavigatorWidget.prototype.handleCloseTiddlerEvent = function(event) {
|
||||
var title = event.param || event.tiddlerTitle,
|
||||
storyList = this.getStoryList();
|
||||
// Look for tiddlers with this title to close
|
||||
this.removeTitleFromStory(storyList,title);
|
||||
this.saveStoryList(storyList);
|
||||
var title = event.param || event.tiddlerTitle;
|
||||
if(this.singleTiddlerMode) {
|
||||
// Get the history stack and find the topmost occurance of the current tiddler
|
||||
var history = this.wiki.getTiddlerDataCached(this.historyTitle,[]),
|
||||
currPos = history.findIndex(function(historyRecord) {
|
||||
return historyRecord.title === title;
|
||||
}),
|
||||
newTitle;
|
||||
// Skip over any duplicates
|
||||
while(currPos > 0 && history[currPos - 1].title === title) {
|
||||
currPos--;
|
||||
}
|
||||
// Get the new title
|
||||
if(currPos > 0) {
|
||||
newTitle = history[currPos - 1].title;
|
||||
}
|
||||
// Navigate to the new title if we've got one
|
||||
if(newTitle) {
|
||||
this.addToStory(newTitle);
|
||||
this.addToHistory(newTitle);
|
||||
} else {
|
||||
// If there's nothing to navigate back to then we really do close the last tiddler
|
||||
this.removeFromStory(title);
|
||||
}
|
||||
} else {
|
||||
// Look for tiddlers with this title to close
|
||||
this.removeFromStory(title);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -273,9 +305,7 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) {
|
||||
var tiddler = this.wiki.getTiddler(targetTitle);
|
||||
// Save the initial value of the draft tiddler
|
||||
draftTitle = this.generateDraftTitle(targetTitle);
|
||||
var draftTiddler = new $tw.Tiddler({
|
||||
text: "",
|
||||
},
|
||||
var draftTiddler = new $tw.Tiddler(
|
||||
tiddler,
|
||||
{
|
||||
title: draftTitle,
|
||||
@@ -322,11 +352,11 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
|
||||
"draft.title": undefined,
|
||||
"draft.of": undefined
|
||||
},this.wiki.getModificationFields());
|
||||
newTiddler = $tw.hooks.invokeHook("th-saving-tiddler",newTiddler,tiddler);
|
||||
newTiddler = $tw.hooks.invokeHook("th-saving-tiddler",newTiddler);
|
||||
this.wiki.addTiddler(newTiddler);
|
||||
// If enabled, relink references to renamed tiddler
|
||||
var shouldRelink = this.getAttribute("relinkOnRename","no").toLowerCase().trim() === "yes";
|
||||
if(isRename && shouldRelink && this.wiki.tiddlerExists(draftOf)) {
|
||||
if(isRename && this.relinkOnRename && this.wiki.tiddlerExists(draftOf)) {
|
||||
console.log("Relinking '" + draftOf + "' to '" + draftTitle + "'");
|
||||
this.wiki.relinkTiddler(draftOf,draftTitle);
|
||||
}
|
||||
// Remove the draft tiddler
|
||||
@@ -495,11 +525,10 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
|
||||
} catch(e) {
|
||||
}
|
||||
// Get the current $:/Import tiddler
|
||||
var importTitle = event.importTitle ? event.importTitle : IMPORT_TITLE,
|
||||
importTiddler = this.wiki.getTiddler(importTitle),
|
||||
importData = this.wiki.getTiddlerData(importTitle,{}),
|
||||
var importTiddler = this.wiki.getTiddler(IMPORT_TITLE),
|
||||
importData = this.wiki.getTiddlerData(IMPORT_TITLE,{}),
|
||||
newFields = new Object({
|
||||
title: importTitle,
|
||||
title: IMPORT_TITLE,
|
||||
type: "application/json",
|
||||
"plugin-type": "import",
|
||||
"status": "pending"
|
||||
@@ -530,16 +559,15 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
|
||||
newFields.text = JSON.stringify(importData,null,$tw.config.preferences.jsonSpaces);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(importTiddler,newFields));
|
||||
// Update the story and history details
|
||||
var autoOpenOnImport = event.autoOpenOnImport ? event.autoOpenOnImport : this.getVariable("tv-auto-open-on-import");
|
||||
if(autoOpenOnImport !== "no") {
|
||||
if(this.getVariable("tv-auto-open-on-import") !== "no") {
|
||||
var storyList = this.getStoryList(),
|
||||
history = [];
|
||||
// Add it to the story
|
||||
if(storyList && storyList.indexOf(importTitle) === -1) {
|
||||
storyList.unshift(importTitle);
|
||||
if(storyList && storyList.indexOf(IMPORT_TITLE) === -1) {
|
||||
storyList.unshift(IMPORT_TITLE);
|
||||
}
|
||||
// And to history
|
||||
history.push(importTitle);
|
||||
history.push(IMPORT_TITLE);
|
||||
// Save the updated story and history
|
||||
this.saveStoryList(storyList);
|
||||
this.addToHistory(history);
|
||||
@@ -612,13 +640,10 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
|
||||
};
|
||||
|
||||
NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
|
||||
var options = {},
|
||||
paramObject = event.paramObject || {},
|
||||
var paramObject = event.paramObject || {},
|
||||
from = paramObject.from || event.tiddlerTitle,
|
||||
to = paramObject.to;
|
||||
options.dontRenameInTags = (paramObject.renameInTags === "false" || paramObject.renameInTags === "no") ? true : false;
|
||||
options.dontRenameInLists = (paramObject.renameInLists === "false" || paramObject.renameInLists === "no") ? true : false;
|
||||
this.wiki.renameTiddler(from,to,options);
|
||||
this.wiki.renameTiddler(from,to);
|
||||
};
|
||||
|
||||
exports.navigator = NavigatorWidget;
|
||||
|
||||
@@ -49,8 +49,7 @@ RangeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.inputDomNode.value = this.getValue();
|
||||
// Add a click event handler
|
||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||
{name: "input", handlerObject: this, handlerMethod: "handleInputEvent"},
|
||||
{name: "change", handlerObject: this, handlerMethod: "handleInputEvent"}
|
||||
{name: "input", handlerObject: this, handlerMethod: "handleInputEvent"}
|
||||
]);
|
||||
// Insert the label into the DOM and render any children
|
||||
parent.insertBefore(this.inputDomNode,nextSibling);
|
||||
@@ -125,4 +124,4 @@ RangeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
|
||||
exports.range = RangeWidget;
|
||||
|
||||
})();
|
||||
})();
|
||||
@@ -66,8 +66,7 @@ ScrollableWidget.prototype.handleScrollEvent = function(event) {
|
||||
Scroll an element into view
|
||||
*/
|
||||
ScrollableWidget.prototype.scrollIntoView = function(element) {
|
||||
var duration = $tw.utils.getAnimationDuration(),
|
||||
srcWindow = element ? element.ownerDocument.defaultView : window;
|
||||
var duration = $tw.utils.getAnimationDuration();
|
||||
this.cancelScroll();
|
||||
this.startTime = Date.now();
|
||||
var scrollPosition = {
|
||||
@@ -123,7 +122,7 @@ ScrollableWidget.prototype.scrollIntoView = function(element) {
|
||||
self.outerDomNode.scrollLeft = scrollPosition.x + (endX - scrollPosition.x) * t;
|
||||
self.outerDomNode.scrollTop = scrollPosition.y + (endY - scrollPosition.y) * t;
|
||||
if(t < 1) {
|
||||
self.idRequestFrame = self.requestAnimationFrame.call(srcWindow,drawFrame);
|
||||
self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);
|
||||
}
|
||||
};
|
||||
drawFrame();
|
||||
|
||||
@@ -421,7 +421,6 @@ Widget.prototype.addEventListener = function(type,handler) {
|
||||
Dispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget
|
||||
*/
|
||||
Widget.prototype.dispatchEvent = function(event) {
|
||||
event.widget = event.widget || this;
|
||||
// Dispatch the event if this widget handles it
|
||||
var listener = this.eventListeners[event.type];
|
||||
if(listener) {
|
||||
|
||||
@@ -214,7 +214,7 @@ exports.isTemporaryTiddler = function(title) {
|
||||
exports.isImageTiddler = function(title) {
|
||||
var tiddler = this.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var contentTypeInfo = $tw.utils.getContentTypeInfo(tiddler.fields.type || "text/vnd.tiddlywiki");
|
||||
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/vnd.tiddlywiki"];
|
||||
return !!contentTypeInfo && contentTypeInfo.flags.indexOf("image") !== -1;
|
||||
} else {
|
||||
return null;
|
||||
@@ -224,7 +224,7 @@ exports.isImageTiddler = function(title) {
|
||||
exports.isBinaryTiddler = function(title) {
|
||||
var tiddler = this.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var contentTypeInfo = $tw.utils.getContentTypeInfo(tiddler.fields.type || "text/vnd.tiddlywiki");
|
||||
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/vnd.tiddlywiki"];
|
||||
return !!contentTypeInfo && contentTypeInfo.encoding === "base64";
|
||||
} else {
|
||||
return null;
|
||||
@@ -580,9 +580,7 @@ Sorts an array of tiddler titles according to an ordered list
|
||||
exports.sortByList = function(array,listTitle) {
|
||||
var self = this,
|
||||
replacedTitles = Object.create(null);
|
||||
// Given a title, this function will place it in the correct location
|
||||
// within titles.
|
||||
function moveItemInList(title) {
|
||||
function replaceItem(title) {
|
||||
if(!$tw.utils.hop(replacedTitles, title)) {
|
||||
replacedTitles[title] = true;
|
||||
var newPos = -1,
|
||||
@@ -595,37 +593,26 @@ exports.sortByList = function(array,listTitle) {
|
||||
} else if(afterTitle === "") {
|
||||
newPos = titles.length;
|
||||
} else if(beforeTitle) {
|
||||
// if this title is placed relative
|
||||
// to another title, make sure that
|
||||
// title is placed before we place
|
||||
// this one.
|
||||
moveItemInList(beforeTitle);
|
||||
replaceItem(beforeTitle);
|
||||
newPos = titles.indexOf(beforeTitle);
|
||||
} else if(afterTitle) {
|
||||
// Same deal
|
||||
moveItemInList(afterTitle);
|
||||
replaceItem(afterTitle);
|
||||
newPos = titles.indexOf(afterTitle);
|
||||
if(newPos >= 0) {
|
||||
++newPos;
|
||||
}
|
||||
}
|
||||
// If a new position is specified, let's move it
|
||||
if (newPos !== -1) {
|
||||
// get its current Pos, and make sure
|
||||
// sure that it's _actually_ in the list
|
||||
// and that it would _actually_ move
|
||||
// (#4275) We don't bother calling
|
||||
// indexOf unless we have a new
|
||||
// position to work with
|
||||
var currPos = titles.indexOf(title);
|
||||
if(currPos >= 0 && newPos !== currPos) {
|
||||
// move it!
|
||||
titles.splice(currPos,1);
|
||||
if(newPos >= currPos) {
|
||||
newPos--;
|
||||
}
|
||||
titles.splice(newPos,0,title);
|
||||
// We get the currPos //after// figuring out the newPos, because recursive replaceItem calls might alter title's currPos
|
||||
var currPos = titles.indexOf(title);
|
||||
if(newPos === -1) {
|
||||
newPos = currPos;
|
||||
}
|
||||
if(currPos >= 0 && newPos !== currPos) {
|
||||
titles.splice(currPos,1);
|
||||
if(newPos >= currPos) {
|
||||
newPos--;
|
||||
}
|
||||
titles.splice(newPos,0,title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,7 +640,7 @@ exports.sortByList = function(array,listTitle) {
|
||||
var sortedTitles = titles.slice(0);
|
||||
for(t=0; t<sortedTitles.length; t++) {
|
||||
title = sortedTitles[t];
|
||||
moveItemInList(title);
|
||||
replaceItem(title);
|
||||
}
|
||||
return titles;
|
||||
}
|
||||
@@ -877,17 +864,14 @@ exports.initParsers = function(moduleType) {
|
||||
|
||||
/*
|
||||
Parse a block of text of a specified MIME type
|
||||
contentType: content type of text to be parsed
|
||||
type: content type of text to be parsed
|
||||
text: text
|
||||
options: see below
|
||||
Options include:
|
||||
parseAsInline: if true, the text of the tiddler will be parsed as an inline run
|
||||
_canonical_uri: optional string of the canonical URI of this content
|
||||
*/
|
||||
exports.parseText = function(contentType,text,options) {
|
||||
// Parse the parameteter from the content type
|
||||
var parsedContentType = $tw.utils.parseContentType(contentType),
|
||||
type = parsedContentType[0];
|
||||
exports.parseText = function(type,text,options) {
|
||||
text = text || "";
|
||||
options = options || {};
|
||||
// Select a parser
|
||||
@@ -905,9 +889,7 @@ exports.parseText = function(contentType,text,options) {
|
||||
return new Parser(type,text,{
|
||||
parseAsInline: options.parseAsInline,
|
||||
wiki: this,
|
||||
_canonical_uri: options._canonical_uri,
|
||||
paramName: parsedContentType[1],
|
||||
paramValue: parsedContentType[2]
|
||||
_canonical_uri: options._canonical_uri
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1057,7 +1039,7 @@ exports.makeTranscludeWidget = function(title,options) {
|
||||
if(options.children) {
|
||||
parseTreeTransclude.children = options.children;
|
||||
}
|
||||
return this.makeWidget(parseTreeDiv,options);
|
||||
return $tw.wiki.makeWidget(parseTreeDiv,options);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1186,7 +1168,7 @@ exports.search = function(text,options) {
|
||||
if(!tiddler) {
|
||||
tiddler = new $tw.Tiddler({title: title, text: "", type: "text/vnd.tiddlywiki"});
|
||||
}
|
||||
var contentTypeInfo = $tw.utils.getContentTypeInfo(tiddler.fields.type) || $tw.utils.getContentTypeInfo("text/vnd.tiddlywiki"),
|
||||
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type] || $tw.config.contentTypeInfo["text/vnd.tiddlywiki"],
|
||||
searchFields;
|
||||
// Get the list of fields we're searching
|
||||
if(options.excludeField) {
|
||||
@@ -1340,7 +1322,7 @@ exports.readFile = function(file,options) {
|
||||
}
|
||||
}
|
||||
// Figure out if we're reading a binary file
|
||||
var contentTypeInfo = $tw.utils.getContentTypeInfo(type),
|
||||
var contentTypeInfo = $tw.config.contentTypeInfo[type],
|
||||
isBinary = contentTypeInfo ? contentTypeInfo.encoding === "base64" : false;
|
||||
// Log some debugging information
|
||||
if($tw.log.IMPORT) {
|
||||
@@ -1508,30 +1490,5 @@ exports.doesPluginInfoRequireReload = function(pluginInfo) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.slugify = function(title,options) {
|
||||
var tiddler = this.getTiddler(title),
|
||||
slug;
|
||||
if(tiddler && tiddler.fields.slug) {
|
||||
slug = tiddler.fields.slug;
|
||||
} else {
|
||||
slug = $tw.utils.transliterate(title.toString().toLowerCase()) // Replace diacritics with basic lowercase ASCII
|
||||
.replace(/\s+/g,"-") // Replace spaces with -
|
||||
.replace(/[^\w\-\.]+/g,"") // Remove all non-word chars except dash and dot
|
||||
.replace(/\-\-+/g,"-") // Replace multiple - with single -
|
||||
.replace(/^-+/,"") // Trim - from start of text
|
||||
.replace(/-+$/,""); // Trim - from end of text
|
||||
}
|
||||
// If the resulting slug is blank (eg because the title is just punctuation characters)
|
||||
if(!slug) {
|
||||
// ...then just use the character codes of the title
|
||||
var result = [];
|
||||
$tw.utils.each(title.split(""),function(char) {
|
||||
result.push(char.charCodeAt(0).toString());
|
||||
});
|
||||
slug = result.join("-");
|
||||
}
|
||||
return slug;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ tag-foreground: #282828
|
||||
tiddler-background: <<colour background>>
|
||||
tiddler-border: <<colour background>>
|
||||
tiddler-controls-foreground-hover: #7c6f64
|
||||
tiddler-controls-foreground-selected: <<colour primary>>
|
||||
tiddler-controls-foreground-selected: #7c6f64
|
||||
tiddler-controls-foreground: #665c54
|
||||
tiddler-editor-background: #282828
|
||||
tiddler-editor-border-image: #282828
|
||||
@@ -120,19 +120,3 @@ toolbar-cancel-button:
|
||||
toolbar-done-button:
|
||||
untagged-background: #504945
|
||||
very-muted-foreground: #bdae93
|
||||
wikilist-background: <<colour page-background>>
|
||||
wikilist-button-background: <<colour button-background>>
|
||||
wikilist-button-foreground: <<colour button-foreground>>
|
||||
wikilist-item: <<colour background>>
|
||||
wikilist-toolbar-background: <<colour background>>
|
||||
wikilist-toolbar-foreground: <<colour foreground>>
|
||||
wikilist-title: <<colour foreground>>
|
||||
wikilist-title-svg: <<colour wikilist-title>>
|
||||
wikilist-url: <<colour muted-foreground>>
|
||||
wikilist-button-open-hover: <<colour primary>>
|
||||
wikilist-button-open: <<colour dropzone-background>>
|
||||
wikilist-button-remove: <<colour dirty-indicator>>
|
||||
wikilist-button-remove-hover: <<colour alert-background>>
|
||||
wikilist-droplink-dragover: <<colour dropzone-background>>
|
||||
wikilist-button-reveal: <<colour sidebar-tiddler-link-foreground-hover>>
|
||||
wikilist-button-reveal-hover: <<colour message-background>>
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
title: $:/palettes/SolarizedDark
|
||||
tags: $:/tags/Palette
|
||||
type: application/x-tiddler-dictionary
|
||||
description: Precision dark colors for machines and people
|
||||
license: MIT, Ethan Schoonover, https://github.com/altercation/solarized/blob/master/LICENSE
|
||||
name: SolarizedDark
|
||||
|
||||
alert-background: #073642
|
||||
alert-border: #93a1a1
|
||||
alert-highlight: #d33682
|
||||
alert-muted-foreground: #d33682
|
||||
background: #073642
|
||||
blockquote-bar: #d33682
|
||||
button-background: #073642
|
||||
button-border: #586e75
|
||||
button-foreground: #93a1a1
|
||||
code-background: #073642
|
||||
code-border: #586e75
|
||||
code-foreground: #93a1a1
|
||||
dirty-indicator: inherit
|
||||
download-background: #859900
|
||||
download-foreground: #073642
|
||||
dragger-background: #073642
|
||||
dragger-foreground: #839496
|
||||
dropdown-background: #073642
|
||||
dropdown-border: #93a1a1
|
||||
dropdown-tab-background: #002b36
|
||||
dropdown-tab-background-selected: #073642
|
||||
dropzone-background: #859900
|
||||
external-link-background: inherit
|
||||
external-link-background-hover: inherit
|
||||
external-link-background-visited: inherit
|
||||
external-link-foreground: #268bd2
|
||||
external-link-foreground-hover:
|
||||
external-link-foreground-visited: #268bd2
|
||||
foreground: #839496
|
||||
message-background: #002b36
|
||||
message-border: #586e75
|
||||
message-foreground: #839496
|
||||
modal-backdrop: #657b83
|
||||
modal-background: #002b36
|
||||
modal-border: #586e75
|
||||
modal-footer-background: #073642
|
||||
modal-footer-border: #586e75
|
||||
modal-header-border: #586e75
|
||||
muted-foreground: #93a1a1
|
||||
notification-background: #002b36
|
||||
notification-border: #586e75
|
||||
page-background: #073642
|
||||
pre-background: inherit
|
||||
pre-border: #657b83
|
||||
primary: #859900
|
||||
select-tag-background: #002b36
|
||||
select-tag-foreground: #839496
|
||||
sidebar-button-foreground: #93a1a1
|
||||
sidebar-controls-foreground: #93a1a1
|
||||
sidebar-controls-foreground-hover: #eee8d5
|
||||
sidebar-foreground: #93a1a1
|
||||
sidebar-foreground-shadow: transparent
|
||||
sidebar-muted-foreground: #839496
|
||||
sidebar-muted-foreground-hover: #93a1a1
|
||||
sidebar-tab-background: #002b36
|
||||
sidebar-tab-background-selected: #073642
|
||||
sidebar-tab-border: #073642
|
||||
sidebar-tab-border-selected: #839496
|
||||
sidebar-tab-divider: #002b36
|
||||
sidebar-tab-foreground: #657b83
|
||||
sidebar-tab-foreground-selected: #93a1a1
|
||||
sidebar-tiddler-link-foreground: #2aa198
|
||||
sidebar-tiddler-link-foreground-hover: #eee8d5
|
||||
site-title-foreground: #d33682
|
||||
static-alert-foreground: #93a1a1
|
||||
tab-background: #073642
|
||||
tab-background-selected: #002b36
|
||||
tab-border: #586e75
|
||||
tab-border-selected: #93a1a1
|
||||
tab-divider: #93a1a1
|
||||
tab-foreground: #839496
|
||||
tab-foreground-selected: #93a1a1
|
||||
table-border: #586e75
|
||||
table-footer-background: #073642
|
||||
table-header-background: #073642
|
||||
tag-background: #b58900
|
||||
tag-foreground: #002b36
|
||||
tiddler-background: #002b36
|
||||
tiddler-border: #586e75
|
||||
tiddler-controls-foreground: inherit
|
||||
tiddler-controls-foreground-hover: #d33682
|
||||
tiddler-controls-foreground-selected: #2aa198
|
||||
tiddler-editor-background: #002b36
|
||||
tiddler-editor-border: #073642
|
||||
tiddler-editor-border-image: #002b36
|
||||
tiddler-editor-fields-even: #002b36
|
||||
tiddler-editor-fields-odd: #073642
|
||||
tiddler-info-background: #073642
|
||||
tiddler-info-border: #657b83
|
||||
tiddler-info-tab-background: #002b36
|
||||
tiddler-link-background: #002b36
|
||||
tiddler-link-foreground: #2aa198
|
||||
tiddler-subtitle-foreground: #839496
|
||||
tiddler-title-foreground: #d33682
|
||||
toolbar-cancel-button: #839496
|
||||
toolbar-close-button: #839496
|
||||
toolbar-delete-button: #dc322f
|
||||
toolbar-done-button: #839496
|
||||
toolbar-edit-button: #839496
|
||||
toolbar-info-button: #839496
|
||||
toolbar-new-button: #839496
|
||||
toolbar-options-button: #839496
|
||||
toolbar-save-button: inherit
|
||||
untagged-background: #586e75
|
||||
very-muted-foreground: #586e75
|
||||
@@ -6,107 +6,115 @@ license: MIT, Ethan Schoonover, https://github.com/altercation/solarized/blob/ma
|
||||
name: SolarizedLight
|
||||
|
||||
alert-background: #eee8d5
|
||||
alert-border: #586e75
|
||||
alert-highlight: #d33682
|
||||
alert-muted-foreground: #d33682
|
||||
background: #eee8d5
|
||||
blockquote-bar: #d33682
|
||||
button-background: #eee8d5
|
||||
button-border: #93a1a1
|
||||
button-foreground: #586e75
|
||||
alert-border: #073642
|
||||
alert-highlight: #cb4b16
|
||||
alert-muted-foreground: #586e75
|
||||
background: #fdf6e3
|
||||
blockquote-bar: <<colour muted-foreground>>
|
||||
button-background: #cb4b16
|
||||
button-foreground: #fdf6e3
|
||||
button-border: transparent
|
||||
code-background: #eee8d5
|
||||
code-border: #93a1a1
|
||||
code-foreground: #586e75
|
||||
dirty-indicator: inherit
|
||||
code-foreground: #d33682
|
||||
diff-delete-background: #BF616A
|
||||
diff-delete-foreground: <<colour foreground>>
|
||||
diff-equal-background:
|
||||
diff-equal-foreground: <<colour foreground>>
|
||||
diff-insert-background: #859900
|
||||
diff-insert-foreground: <<colour foreground>>
|
||||
diff-invisible-background:
|
||||
diff-invisible-foreground: <<colour muted-foreground>>
|
||||
dirty-indicator: #D08770
|
||||
download-background: #859900
|
||||
download-foreground: #eee8d5
|
||||
dragger-background: #eee8d5
|
||||
dragger-foreground: #657b83
|
||||
dropdown-background: #eee8d5
|
||||
dropdown-border: #586e75
|
||||
dropdown-tab-background: #fdf6e3
|
||||
dropdown-tab-background-selected: #eee8d5
|
||||
download-foreground: <<colour background>>
|
||||
dragger-background: <<colour foreground>>
|
||||
dragger-foreground: <<colour background>>
|
||||
dropdown-background: <<colour background>>
|
||||
dropdown-border: <<colour background>>
|
||||
dropdown-tab-background-selected: #fdf6e3
|
||||
dropdown-tab-background: #93a1a1
|
||||
dropzone-background: #859900
|
||||
external-link-background: inherit
|
||||
external-link-background-hover: inherit
|
||||
external-link-background-visited: inherit
|
||||
external-link-foreground: #268bd2
|
||||
external-link-foreground-hover: inherit
|
||||
external-link-foreground-visited: #268bd2
|
||||
foreground: #657b83
|
||||
message-background: #fdf6e3
|
||||
message-border: #93a1a1
|
||||
message-foreground: #657b83
|
||||
modal-backdrop: #839496
|
||||
modal-background: #fdf6e3
|
||||
modal-border: #93a1a1
|
||||
external-link-background: inherit
|
||||
external-link-foreground-hover: #d33682
|
||||
external-link-foreground-visited: #b58900
|
||||
external-link-foreground: #cb4b16
|
||||
foreground: #839496
|
||||
message-background: #586e75
|
||||
message-border: #586e75
|
||||
message-foreground: #eee8d5
|
||||
modal-backdrop: <<colour foreground>>
|
||||
modal-background: <<colour background>>
|
||||
modal-border: #eee8d5
|
||||
modal-footer-background: #eee8d5
|
||||
modal-footer-border: #93a1a1
|
||||
modal-header-border: #93a1a1
|
||||
muted-foreground: #586e75
|
||||
notification-background: #fdf6e3
|
||||
notification-border: #93a1a1
|
||||
modal-footer-border: #eee8d5
|
||||
modal-header-border: #eee8d5
|
||||
muted-foreground: #93a1a1
|
||||
notification-background: #EBCB8B
|
||||
notification-border: #D08770
|
||||
page-background: #eee8d5
|
||||
pre-background: #eee8d5
|
||||
pre-border: #839496
|
||||
primary: #859900
|
||||
select-tag-background: #fdf6e3
|
||||
select-tag-foreground: #657b83
|
||||
sidebar-button-foreground: #586e75
|
||||
pre-border: #93a1a1
|
||||
primary: #2aa198
|
||||
select-tag-background: #eee8d5
|
||||
select-tag-foreground: <<colour foreground>>
|
||||
sidebar-button-foreground: #eee8d5
|
||||
sidebar-controls-foreground-hover: #268bd2
|
||||
sidebar-controls-foreground: #586e75
|
||||
sidebar-controls-foreground-hover: #d33682
|
||||
sidebar-foreground: #586e75
|
||||
sidebar-foreground-shadow: transparent
|
||||
sidebar-muted-foreground: #657b83
|
||||
sidebar-muted-foreground-hover: #586e75
|
||||
sidebar-tab-background: #fdf6e3
|
||||
sidebar-foreground: #839496
|
||||
sidebar-muted-foreground-hover: #657b83
|
||||
sidebar-muted-foreground: #93a1a1
|
||||
sidebar-tab-background-selected: #eee8d5
|
||||
sidebar-tab-border: #eee8d5
|
||||
sidebar-tab-border-selected: #657b83
|
||||
sidebar-tab-divider: #fdf6e3
|
||||
sidebar-tab-foreground: #839496
|
||||
sidebar-tab-foreground-selected: #586e75
|
||||
sidebar-tiddler-link-foreground: #2aa198
|
||||
sidebar-tiddler-link-foreground-hover: #002b36
|
||||
site-title-foreground: #d33682
|
||||
static-alert-foreground: #586e75
|
||||
tab-background: #eee8d5
|
||||
sidebar-tab-background: #839496
|
||||
sidebar-tab-border-selected: <<colour tab-border-selected>>
|
||||
sidebar-tab-border: #657b83
|
||||
sidebar-tab-divider: <<colour page-background>>
|
||||
sidebar-tab-foreground-selected: #839496
|
||||
sidebar-tab-foreground: <<colour tab-foreground>>
|
||||
sidebar-tiddler-link-foreground-hover: #859900
|
||||
sidebar-tiddler-link-foreground: #268bd2
|
||||
site-title-foreground: <<colour tiddler-title-foreground>>
|
||||
static-alert-foreground: #dc322f
|
||||
tab-background-selected: #fdf6e3
|
||||
tab-background: #839496
|
||||
tab-border-selected: #93a1a1
|
||||
tab-border: #93a1a1
|
||||
tab-border-selected: #586e75
|
||||
tab-divider: #586e75
|
||||
tab-foreground: #657b83
|
||||
tab-foreground-selected: #586e75
|
||||
table-border: #93a1a1
|
||||
table-footer-background: #eee8d5
|
||||
table-header-background: #eee8d5
|
||||
tag-background: #b58900
|
||||
tag-foreground: #fdf6e3
|
||||
tiddler-background: #fdf6e3
|
||||
tiddler-border: #93a1a1
|
||||
tiddler-controls-foreground: inherit
|
||||
tiddler-controls-foreground-hover: #d33682
|
||||
tiddler-controls-foreground-selected: #2aa198
|
||||
tiddler-editor-background: #fdf6e3
|
||||
tab-divider: #fdf6e3
|
||||
tab-foreground-selected: #839496
|
||||
tab-foreground: #eee8d5
|
||||
table-border: #657b83
|
||||
table-footer-background: #657b83
|
||||
table-header-background: #93a1a1
|
||||
tag-background: #6c71c4
|
||||
tag-foreground: #eee8d5
|
||||
tiddler-background: <<colour background>>
|
||||
tiddler-border: <<colour background>>
|
||||
tiddler-controls-foreground-hover: #b58900
|
||||
tiddler-controls-foreground-selected: #b58900
|
||||
tiddler-controls-foreground: #073642
|
||||
tiddler-editor-background: #eee8d5
|
||||
tiddler-editor-border-image: #eee8d5
|
||||
tiddler-editor-border: #eee8d5
|
||||
tiddler-editor-border-image: #fdf6e3
|
||||
tiddler-editor-fields-even: #fdf6e3
|
||||
tiddler-editor-fields-odd: #eee8d5
|
||||
tiddler-editor-fields-even: #eee8d5
|
||||
tiddler-editor-fields-odd: #fdf6e3
|
||||
tiddler-info-background: #eee8d5
|
||||
tiddler-info-border: #839496
|
||||
tiddler-info-tab-background: #fdf6e3
|
||||
tiddler-link-background: #fdf6e3
|
||||
tiddler-link-foreground: #2aa198
|
||||
tiddler-subtitle-foreground: #657b83
|
||||
tiddler-title-foreground: #d33682
|
||||
toolbar-cancel-button: #657b83
|
||||
toolbar-close-button: #657b83
|
||||
toolbar-delete-button: #dc322f
|
||||
toolbar-done-button: #657b83
|
||||
toolbar-edit-button: #657b83
|
||||
toolbar-info-button: #657b83
|
||||
toolbar-new-button: #657b83
|
||||
toolbar-options-button: #657b83
|
||||
toolbar-save-button: inherit
|
||||
untagged-background: #586e75
|
||||
tiddler-info-border: #eee8d5
|
||||
tiddler-info-tab-background: #586e75
|
||||
tiddler-link-background: <<colour background>>
|
||||
tiddler-link-foreground: <<colour primary>>
|
||||
tiddler-subtitle-foreground: #586e75
|
||||
tiddler-title-foreground: #073642
|
||||
toolbar-new-button:
|
||||
toolbar-options-button:
|
||||
toolbar-save-button:
|
||||
toolbar-info-button:
|
||||
toolbar-edit-button:
|
||||
toolbar-close-button:
|
||||
toolbar-delete-button:
|
||||
toolbar-cancel-button:
|
||||
toolbar-done-button:
|
||||
untagged-background: #839496
|
||||
very-muted-foreground: #93a1a1
|
||||
|
||||
@@ -57,8 +57,6 @@ page-background: #f4f4f4
|
||||
pre-background: #f5f5f5
|
||||
pre-border: #cccccc
|
||||
primary: #5778d8
|
||||
selection-background:
|
||||
selection-foreground:
|
||||
select-tag-background:
|
||||
select-tag-foreground:
|
||||
sidebar-button-foreground: <<colour foreground>>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"title": "$:/core",
|
||||
"name": "Core",
|
||||
"description": "TiddlyWiki5 core",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0",
|
||||
|
||||
@@ -3,4 +3,7 @@ tags: $:/tags/Exporter
|
||||
description: {{$:/language/Exporters/CsvFile}}
|
||||
extension: .csv
|
||||
|
||||
<$macrocall $name="csvtiddlers" filter=<<exportFilter>> format="quoted-comma-sep" $output="text/raw"/>
|
||||
\define renderContent()
|
||||
<$text text=<<csvtiddlers filter:"""$(exportFilter)$""" format:"quoted-comma-sep">>/>
|
||||
\end
|
||||
<<renderContent>>
|
||||
|
||||
@@ -3,4 +3,7 @@ tags: $:/tags/Exporter
|
||||
description: {{$:/language/Exporters/JsonFile}}
|
||||
extension: .json
|
||||
|
||||
<$macrocall $name="jsontiddlers" filter=<<exportFilter>> $output="text/raw"/>
|
||||
\define renderContent()
|
||||
<$text text=<<jsontiddlers filter:"""$(exportFilter)$""">>/>
|
||||
\end
|
||||
<<renderContent>>
|
||||
|
||||
@@ -2,4 +2,8 @@ title: $:/core/templates/tiddlywiki5.js/tiddlers
|
||||
|
||||
`
|
||||
$tw.preloadTiddlerArray(`<$text text=<<jsontiddlers "[[$:/core]]">>/>`);
|
||||
$tw.preloadTiddlerArray([{
|
||||
title: "$:/config/SaveWikiButton/Template",
|
||||
text: "$:/core/save/all-external-js"
|
||||
}]);
|
||||
`
|
||||
|
||||
@@ -6,17 +6,21 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
\end
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
|
||||
<$vars
|
||||
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}
|
||||
tv-config-toolbar-text={{$:/config/Toolbar/Text}}
|
||||
tv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}
|
||||
tv-show-missing-links={{$:/config/MissingLinks}}
|
||||
storyviewTitle={{$:/view}}
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}>
|
||||
<$set name="tv-config-toolbar-icons" value={{$:/config/Toolbar/Icons}}>
|
||||
|
||||
<$set name="tv-config-toolbar-text" value={{$:/config/Toolbar/Text}}>
|
||||
|
||||
<$set name="tv-config-toolbar-class" value={{$:/config/Toolbar/ButtonClass}}>
|
||||
|
||||
<$set name="tv-show-missing-links" value={{$:/config/MissingLinks}}>
|
||||
|
||||
<$set name="storyviewTitle" value={{$:/view}}>
|
||||
|
||||
<$set name="languageTitle" value={{{ [{$:/language}get[name]] }}}>
|
||||
|
||||
<div class=<<containerClasses>>>
|
||||
|
||||
<$navigator story="$:/StoryList" history="$:/HistoryList">
|
||||
<$navigator story="$:/StoryList" history="$:/HistoryList" singleTiddlerMode={{{ [<storyviewTitle>getstoryviewmode[singletiddlermode]] }}}>
|
||||
|
||||
<$transclude mode="block"/>
|
||||
|
||||
@@ -24,4 +28,14 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
|
||||
</div>
|
||||
|
||||
</$vars>
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
@@ -6,5 +6,5 @@ description: create a new image tiddler
|
||||
image/$(imageType)$
|
||||
\end
|
||||
<$vars imageType={{$:/config/NewImageType}}>
|
||||
<$action-sendmessage $message="tm-new-tiddler" type=<<get-type>> tags={{$:/config/NewTiddler/Tags}}/>
|
||||
<$action-sendmessage $message="tm-new-tiddler" type=<<get-type>> tags={{$:/config/NewTiddler/Tags!!tags}}/>
|
||||
</$vars>
|
||||
|
||||
@@ -2,7 +2,7 @@ title: $:/core/ui/Actions/new-journal
|
||||
tags: $:/tags/Actions
|
||||
description: create a new journal tiddler
|
||||
|
||||
<$vars journalTitleTemplate={{$:/config/NewJournal/Title}} journalTags={{$:/config/NewJournal/Tags}} journalText={{$:/config/NewJournal/Text}}>
|
||||
<$vars journalTitleTemplate={{$:/config/NewJournal/Title}} journalTags={{$:/config/NewJournal/Tags!!tags}} journalText={{$:/config/NewJournal/Text}}>
|
||||
<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
|
||||
<$reveal type="nomatch" state=<<journalTitle>> text="">
|
||||
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalTags>> text={{{ [<journalTitle>get[]] }}}/>
|
||||
|
||||
@@ -2,4 +2,4 @@ title: $:/core/ui/Actions/new-tiddler
|
||||
tags: $:/tags/Actions
|
||||
description: create a new empty tiddler
|
||||
|
||||
<$action-sendmessage $message="tm-new-tiddler" tags={{$:/config/NewTiddler/Tags}}/>
|
||||
<$action-sendmessage $message="tm-new-tiddler" tags={{$:/config/NewTiddler/Tags!!tags}}/>
|
||||
|
||||
@@ -38,7 +38,7 @@ $:/config/Plugins/Disabled/$(currentTiddler)$
|
||||
</div>
|
||||
<div class="tc-plugin-info-chunk tc-plugin-info-description">
|
||||
<h1>
|
||||
''<$text text={{{ [<currentTiddler>get[name]] ~[<currentTiddler>split[/]last[1]] }}}/>'': <$view field="description"><$view field="title"/></$view> $disabledMessage$
|
||||
''<$view field="description"><$view field="title"/></$view>'' $disabledMessage$
|
||||
</h1>
|
||||
<h2>
|
||||
<$view field="title"/>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user