mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-25 12:23:42 +00:00
Compare commits
396 Commits
tm-http-re
...
confetti-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
535581cf81 | ||
|
|
0710054e64 | ||
|
|
c3de9df84f | ||
|
|
2099e687cc | ||
|
|
575d80dfe9 | ||
|
|
bc3d64f4b8 | ||
|
|
aa4aeb187c | ||
|
|
fb85e91f82 | ||
|
|
100eaeff30 | ||
|
|
518c5d3ef6 | ||
|
|
38187d26f4 | ||
|
|
8ac4a448ef | ||
|
|
83dfec471d | ||
|
|
1015a1605d | ||
|
|
f08d3d6030 | ||
|
|
232afb4249 | ||
|
|
22f7af05de | ||
|
|
17665233a2 | ||
|
|
a8f477a3ab | ||
|
|
9d10e2b3a7 | ||
|
|
907aed3eab | ||
|
|
83220be7d9 | ||
|
|
a3cba681e0 | ||
|
|
4f01a53917 | ||
|
|
5cb31b7adb | ||
|
|
6a9dc9dcd5 | ||
|
|
46a22ef585 | ||
|
|
3d712127ad | ||
|
|
a3e5ace458 | ||
|
|
6fa81feeba | ||
|
|
95e270a8a6 | ||
|
|
e2d4388c48 | ||
|
|
f68fa89a29 | ||
|
|
d2d00ffa4d | ||
|
|
c6a72875ba | ||
|
|
aaf7dc355d | ||
|
|
e131dd3761 | ||
|
|
f697f008b1 | ||
|
|
cdfa4b6082 | ||
|
|
8051a3dea2 | ||
|
|
267521ad1b | ||
|
|
e82229210e | ||
|
|
c13c321a61 | ||
|
|
0d2aeb8253 | ||
|
|
9d94459c5d | ||
|
|
5c283f843b | ||
|
|
51862f8128 | ||
|
|
15e53b8cd1 | ||
|
|
4a9b3009dd | ||
|
|
c9be572baf | ||
|
|
4e06c31022 | ||
|
|
a7d469ae99 | ||
|
|
5578fa5f94 | ||
|
|
2b0675cac5 | ||
|
|
155db0f6f8 | ||
|
|
4e67aafeb7 | ||
|
|
e60ddf0b0a | ||
|
|
f7359671aa | ||
|
|
c61c34e9df | ||
|
|
6b47cbed32 | ||
|
|
c282208668 | ||
|
|
622512c380 | ||
|
|
f56f5dcc56 | ||
|
|
fc1e9b6c43 | ||
|
|
fe17f16675 | ||
|
|
b08281a20b | ||
|
|
5dc468f1ea | ||
|
|
c2e61fffe0 | ||
|
|
53d493b876 | ||
|
|
3b84088b27 | ||
|
|
a21f45b93a | ||
|
|
8f661423f7 | ||
|
|
6bd69cc53f | ||
|
|
233b871fdf | ||
|
|
64812f5c06 | ||
|
|
22f9df5850 | ||
|
|
1cb607249e | ||
|
|
ca41a8db04 | ||
|
|
d1c7f79dd2 | ||
|
|
862cb01be7 | ||
|
|
f22e047fa2 | ||
|
|
0716ed4c30 | ||
|
|
62bb8affa4 | ||
|
|
4c2979286b | ||
|
|
ad9cb8a0a8 | ||
|
|
de6b866f22 | ||
|
|
06b1cc4bca | ||
|
|
0cd3c9a8ac | ||
|
|
37c625384a | ||
|
|
a4850ba3d9 | ||
|
|
145a8d6992 | ||
|
|
9012d36859 | ||
|
|
ab72cc7b09 | ||
|
|
bf8b3cff03 | ||
|
|
e4bf7c5f44 | ||
|
|
215bd4e015 | ||
|
|
758089cbb3 | ||
|
|
6567843927 | ||
|
|
1001590326 | ||
|
|
4b56cb4298 | ||
|
|
e593f80278 | ||
|
|
902c7f55ba | ||
|
|
801e8e312c | ||
|
|
23a576b8bd | ||
|
|
6a52081d6b | ||
|
|
246751be1b | ||
|
|
547582c1e7 | ||
|
|
4ebaba8e89 | ||
|
|
8617fa39dc | ||
|
|
f89b52e521 | ||
|
|
e40b83f141 | ||
|
|
efaa8dd1e8 | ||
|
|
326ae61929 | ||
|
|
518c23d06d | ||
|
|
a2f4e71080 | ||
|
|
10fad328dd | ||
|
|
c185e373c5 | ||
|
|
2ffbfd84a5 | ||
|
|
faef02df7a | ||
|
|
c93d56667e | ||
|
|
3855a9f013 | ||
|
|
d7a58a01b9 | ||
|
|
4d548580e6 | ||
|
|
9773dff1e3 | ||
|
|
c6604c0c56 | ||
|
|
b8fdb320dc | ||
|
|
e521ee2133 | ||
|
|
a7bd134c35 | ||
|
|
fd5c073654 | ||
|
|
343839b4d4 | ||
|
|
94e27ccc48 | ||
|
|
d3f5695601 | ||
|
|
efa4f34131 | ||
|
|
fffbedd6b9 | ||
|
|
80c52d071e | ||
|
|
ff1437e439 | ||
|
|
32966c9e91 | ||
|
|
96b0543351 | ||
|
|
b7562f0c7b | ||
|
|
4c9c85aec5 | ||
|
|
cd2b375d80 | ||
|
|
9eac359a5d | ||
|
|
9b6570f420 | ||
|
|
7726982d71 | ||
|
|
774058912d | ||
|
|
106e1c68df | ||
|
|
12f42ad62f | ||
|
|
66a8e2dbf2 | ||
|
|
327ecf8f66 | ||
|
|
35e45f3b90 | ||
|
|
93bc9e4309 | ||
|
|
23b75bbc5d | ||
|
|
906cb8f92b | ||
|
|
6f46775e94 | ||
|
|
aa3f931721 | ||
|
|
0213f1ab8f | ||
|
|
68da654eb3 | ||
|
|
1eceb5f47f | ||
|
|
def508a220 | ||
|
|
3fb71e2553 | ||
|
|
d17525ec8e | ||
|
|
1351109119 | ||
|
|
3254684dd6 | ||
|
|
29575d01bf | ||
|
|
b1eece2a93 | ||
|
|
1c6fba6108 | ||
|
|
5bb8155422 | ||
|
|
bb2973fc29 | ||
|
|
bbaa0890b5 | ||
|
|
c3167d5368 | ||
|
|
b4a862c618 | ||
|
|
184e30afb8 | ||
|
|
44d322868f | ||
|
|
455a51f671 | ||
|
|
1be8f0a933 | ||
|
|
773c1f83f2 | ||
|
|
9ee1ef7e23 | ||
|
|
8effb3f218 | ||
|
|
780e5d33a4 | ||
|
|
526e997aa4 | ||
|
|
5ea2243fd9 | ||
|
|
5a4470e6ed | ||
|
|
d460f9f066 | ||
|
|
e4d8849f22 | ||
|
|
bd99cf3385 | ||
|
|
711d1658e2 | ||
|
|
ef5b3a8840 | ||
|
|
4ef8ce3caa | ||
|
|
6088fd7d95 | ||
|
|
c7cac0f7ea | ||
|
|
7b1701583f | ||
|
|
804e253f93 | ||
|
|
7c619da913 | ||
|
|
b82f012c0c | ||
|
|
f383863654 | ||
|
|
697dc8db4c | ||
|
|
49c96901f3 | ||
|
|
7d8766d2b9 | ||
|
|
6255856205 | ||
|
|
6f307ae01e | ||
|
|
213a850715 | ||
|
|
4e938fad00 | ||
|
|
217af20fcd | ||
|
|
943dcd7567 | ||
|
|
783a5be00e | ||
|
|
4792d241c4 | ||
|
|
06af391773 | ||
|
|
0656580439 | ||
|
|
a4d74be3d8 | ||
|
|
701a038559 | ||
|
|
dd9b4dc787 | ||
|
|
4f026e45a8 | ||
|
|
d2fbbc408a | ||
|
|
c9d8806682 | ||
|
|
d28cf74115 | ||
|
|
d332baabe7 | ||
|
|
6d0b4108a4 | ||
|
|
642f8da6ed | ||
|
|
e16635a5ad | ||
|
|
db79bf2380 | ||
|
|
2b16fa7b5c | ||
|
|
64c9d17181 | ||
|
|
ceee20fd59 | ||
|
|
0889f13fef | ||
|
|
d29ed6a5de | ||
|
|
fa9bfa07a0 | ||
|
|
0c5c673ddc | ||
|
|
dbe233fc87 | ||
|
|
3965e2c027 | ||
|
|
c22cd3f4c6 | ||
|
|
dc282db31b | ||
|
|
70309c67d1 | ||
|
|
ba5bfd1ad0 | ||
|
|
3c66af9fdc | ||
|
|
6877082090 | ||
|
|
9201d2bedc | ||
|
|
229e681550 | ||
|
|
779ac28bd0 | ||
|
|
78ecc20c5e | ||
|
|
8b6bc6664b | ||
|
|
674bd1822c | ||
|
|
6c67dc8235 | ||
|
|
72a4adbd6b | ||
|
|
aaf0bffb39 | ||
|
|
9bbd8a70c2 | ||
|
|
cc57cf2fe9 | ||
|
|
34bc9c72c6 | ||
|
|
aeb502657b | ||
|
|
48705db21f | ||
|
|
587aa28853 | ||
|
|
b926a33b55 | ||
|
|
44ccfe83c9 | ||
|
|
cef0ac680d | ||
|
|
b8a235697f | ||
|
|
ed82536a55 | ||
|
|
d99b1897c3 | ||
|
|
3684cfd178 | ||
|
|
643819f5f5 | ||
|
|
52f7f6382b | ||
|
|
575930b31d | ||
|
|
73f256a411 | ||
|
|
1b5b8905d8 | ||
|
|
825f4eaae1 | ||
|
|
d0da1ef9d9 | ||
|
|
3e213569e2 | ||
|
|
4bdac09872 | ||
|
|
4c9eaeaaf2 | ||
|
|
c1ff85c205 | ||
|
|
afcbac5e86 | ||
|
|
1a92fd5dc0 | ||
|
|
e60232e0cb | ||
|
|
ad6e09f1cb | ||
|
|
3ddb852a16 | ||
|
|
b000f20283 | ||
|
|
160cc0e9a9 | ||
|
|
fd8b8f62da | ||
|
|
61a08cbd7b | ||
|
|
0fd6b986a0 | ||
|
|
0a4cfa1164 | ||
|
|
04e971c3c6 | ||
|
|
963887c8c4 | ||
|
|
aef76fa25f | ||
|
|
4124bbdfb3 | ||
|
|
98ff6b67fd | ||
|
|
1721203a69 | ||
|
|
3d0a015ae5 | ||
|
|
080ca5ed31 | ||
|
|
abcd2f110f | ||
|
|
cf9864ebe3 | ||
|
|
1aef8405bd | ||
|
|
d419161686 | ||
|
|
9b2af13596 | ||
|
|
7182dbf244 | ||
|
|
f61d244410 | ||
|
|
284669544b | ||
|
|
b54a88ce83 | ||
|
|
3bd8c5d50d | ||
|
|
3a90c37816 | ||
|
|
ff7214ff56 | ||
|
|
8e9d8d4fef | ||
|
|
a7bafd8840 | ||
|
|
a6779efb1c | ||
|
|
ec00dc5042 | ||
|
|
08bad90e51 | ||
|
|
9a1d7085b8 | ||
|
|
feb797701f | ||
|
|
34ef27fbc0 | ||
|
|
f517497fe7 | ||
|
|
eff158b1ae | ||
|
|
6954fbee51 | ||
|
|
6c7c21a87b | ||
|
|
29b5b064d6 | ||
|
|
02f6d850d5 | ||
|
|
7597f5af77 | ||
|
|
0c64b58cfb | ||
|
|
39f342a943 | ||
|
|
a6722e9735 | ||
|
|
42d4c5d5ab | ||
|
|
04e771ccbf | ||
|
|
57d85d4f64 | ||
|
|
c101e9efe6 | ||
|
|
d893241ba9 | ||
|
|
3ec6c0eaf1 | ||
|
|
47813ae31f | ||
|
|
9589e3df33 | ||
|
|
ee1200bde1 | ||
|
|
419760a8e5 | ||
|
|
04950452fa | ||
|
|
3f4e301a20 | ||
|
|
2db0322a76 | ||
|
|
d6c77f549f | ||
|
|
7dbcab0192 | ||
|
|
823bcd7999 | ||
|
|
c24d1ef4fb | ||
|
|
b5d835e7dd | ||
|
|
5c5543815b | ||
|
|
28aef51855 | ||
|
|
158384867b | ||
|
|
a02d99a4c1 | ||
|
|
16ef1d84cd | ||
|
|
6bb0da07dc | ||
|
|
ebeb1a8956 | ||
|
|
bc07fd731c | ||
|
|
d46aa4ba4d | ||
|
|
f2d6c5a6eb | ||
|
|
4659b893d8 | ||
|
|
c499fff2a9 | ||
|
|
0d723d8b9d | ||
|
|
3825e2579f | ||
|
|
e5566543c9 | ||
|
|
a5c258ecac | ||
|
|
9b8db5dbb1 | ||
|
|
a05302da10 | ||
|
|
5647ad71b0 | ||
|
|
6fd2139376 | ||
|
|
13a895bd2d | ||
|
|
b90c9ef9a0 | ||
|
|
d8124ee82d | ||
|
|
190613ad29 | ||
|
|
5bef6d50bc | ||
|
|
f4626aa69e | ||
|
|
edaa3727d9 | ||
|
|
b61c01d8b0 | ||
|
|
73b23f48a0 | ||
|
|
f90eb386ae | ||
|
|
12f7b98c4f | ||
|
|
50315310f5 | ||
|
|
120c2f8136 | ||
|
|
f277493acd | ||
|
|
46d0aea0f2 | ||
|
|
5947140b61 | ||
|
|
86d45f1c3d | ||
|
|
106f121133 | ||
|
|
d1f90f075f | ||
|
|
a66b04f532 | ||
|
|
9d2bab0ae3 | ||
|
|
40fd941394 | ||
|
|
8fd4da607d | ||
|
|
62d0c197eb | ||
|
|
1c3dd6b39b | ||
|
|
36041cf38b | ||
|
|
87c2fb390a | ||
|
|
f9cf5764ff | ||
|
|
55a52c9d8d | ||
|
|
0c67269a20 | ||
|
|
74258d66b8 | ||
|
|
5fe542a05b | ||
|
|
0bc6decefb | ||
|
|
8169e43087 | ||
|
|
1d32ef44e5 | ||
|
|
75af83174b | ||
|
|
f4f37460b8 | ||
|
|
5b9f464f26 | ||
|
|
9676706052 | ||
|
|
c977baebca | ||
|
|
8a1ec1d055 |
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
- master
|
- master
|
||||||
- tiddlywiki-com
|
- tiddlywiki-com
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: "12"
|
NODE_VERSION: "18"
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -14,7 +14,13 @@ jobs:
|
|||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: "${{ env.NODE_VERSION }}"
|
node-version: "${{ env.NODE_VERSION }}"
|
||||||
- run: "./bin/test.sh"
|
- run: "./bin/ci-test.sh"
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: playwright-report
|
||||||
|
path: playwright-report/
|
||||||
|
retention-days: 30
|
||||||
build-prerelease:
|
build-prerelease:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
@@ -54,6 +60,7 @@ jobs:
|
|||||||
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||||
TW5_BUILD_OUTPUT: "./output"
|
TW5_BUILD_OUTPUT: "./output"
|
||||||
|
TW5_BUILD_ARCHIVE: "./output"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -5,4 +5,6 @@
|
|||||||
tmp/
|
tmp/
|
||||||
output/
|
output/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
/test-results/
|
||||||
|
/playwright-report/
|
||||||
|
/playwright/.cache/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Default to the current version number for building the plugin library
|
# Default to the current version number for building the plugin library
|
||||||
|
|
||||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||||
TW5_BUILD_VERSION=v5.3.0
|
TW5_BUILD_VERSION=v5.3.3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||||
@@ -84,10 +84,27 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
|
|||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
#
|
#
|
||||||
# Core distribution
|
# Core distributions
|
||||||
#
|
#
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
|
# Conditionally build archive if $TW5_BUILD_ARCHIVE variable is set, otherwise do nothing
|
||||||
|
#
|
||||||
|
# /archive/Empty-TiddlyWiki-<version>.html Empty archived version
|
||||||
|
# /archive/TiddlyWiki-<version>.html Full archived version
|
||||||
|
|
||||||
|
if [ -n "$TW5_BUILD_ARCHIVE" ]; then
|
||||||
|
|
||||||
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
|
--verbose \
|
||||||
|
--version \
|
||||||
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
|
--output $TW5_BUILD_ARCHIVE \
|
||||||
|
--build archive \
|
||||||
|
|| exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# /index.html Main site
|
# /index.html Main site
|
||||||
# /favicon.ico Favicon for main site
|
# /favicon.ico Favicon for main site
|
||||||
# /static.html Static rendering of default tiddlers
|
# /static.html Static rendering of default tiddlers
|
||||||
@@ -95,6 +112,7 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
|
|||||||
# /static/* Static single tiddlers
|
# /static/* Static single tiddlers
|
||||||
# /static/static.css Static stylesheet
|
# /static/static.css Static stylesheet
|
||||||
# /static/favicon.ico Favicon for static pages
|
# /static/favicon.ico Favicon for static pages
|
||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
--verbose \
|
--verbose \
|
||||||
@@ -104,13 +122,15 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--build favicon static index \
|
--build favicon static index \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# /empty.html Empty
|
# /empty.html Empty
|
||||||
# /empty.hta For Internet Explorer
|
# /empty.hta For Internet Explorer
|
||||||
|
# /empty-external-core.html External core empty
|
||||||
|
# /tiddlywikicore-<version>.js Core plugin javascript
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
./editions/empty \
|
||||||
--verbose \
|
--verbose \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build empty \
|
--build empty emptyexternalcore \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
|
|
||||||
@@ -136,6 +156,28 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--build index favicon static \
|
--build index favicon static \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
|
# /tour.html tour edition
|
||||||
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
|
./editions/tour \
|
||||||
|
--verbose \
|
||||||
|
--output $TW5_BUILD_OUTPUT \
|
||||||
|
--rendertiddler $:/core/save/all tour.html text/plain \
|
||||||
|
|| exit 1
|
||||||
|
|
||||||
|
# /dev/index.html Developer docs
|
||||||
|
# /dev/favicon.ico Favicon for dev site
|
||||||
|
# /dev/static.html Static rendering of default tiddlers
|
||||||
|
# /dev/alltiddlers.html Static rendering of all tiddlers
|
||||||
|
# /dev/static/* Static single tiddlers
|
||||||
|
# /dev/static/static.css Static stylesheet
|
||||||
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
|
./editions/dev \
|
||||||
|
--verbose \
|
||||||
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
|
--output $TW5_BUILD_OUTPUT/dev \
|
||||||
|
--build index favicon static \
|
||||||
|
|| exit 1
|
||||||
|
|
||||||
# /share.html Custom edition for sharing via the URL
|
# /share.html Custom edition for sharing via the URL
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/share \
|
./editions/share \
|
||||||
|
|||||||
16
bin/ci-test.sh
Executable file
16
bin/ci-test.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# test TiddlyWiki5 for tiddlywiki.com
|
||||||
|
|
||||||
|
node ./tiddlywiki.js \
|
||||||
|
./editions/test \
|
||||||
|
--verbose \
|
||||||
|
--version \
|
||||||
|
--rendertiddler $:/core/save/all test.html text/plain \
|
||||||
|
--test \
|
||||||
|
|| exit 1
|
||||||
|
|
||||||
|
npm install playwright @playwright/test
|
||||||
|
npx playwright install chromium firefox --with-deps
|
||||||
|
|
||||||
|
npx playwright test
|
||||||
25
boot/boot.js
25
boot/boot.js
@@ -575,9 +575,8 @@ var globalCheck =[
|
|||||||
" configurable: true",
|
" configurable: true",
|
||||||
" });",
|
" });",
|
||||||
" if(Object.keys(__temp__).length){",
|
" if(Object.keys(__temp__).length){",
|
||||||
" console.log(Object.keys(__temp__));",
|
" console.log(\"Warning: Global assignment detected\",Object.keys(__temp__));",
|
||||||
" delete Object.prototype.__temp__;",
|
" delete Object.prototype.__temp__;",
|
||||||
" throw \"Global assignment is not allowed within modules on node.\";",
|
|
||||||
" }",
|
" }",
|
||||||
" delete Object.prototype.__temp__;",
|
" delete Object.prototype.__temp__;",
|
||||||
].join('\n');
|
].join('\n');
|
||||||
@@ -596,11 +595,11 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
|||||||
// Add the code prologue and epilogue
|
// Add the code prologue and epilogue
|
||||||
code = [
|
code = [
|
||||||
"(function(" + contextNames.join(",") + ") {",
|
"(function(" + contextNames.join(",") + ") {",
|
||||||
" (function(){\n" + code + "\n;})();",
|
" (function(){" + code + "\n;})();\n",
|
||||||
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
||||||
" return exports;\n",
|
"\nreturn exports;\n",
|
||||||
"})"
|
"})"
|
||||||
].join("\n");
|
].join("");
|
||||||
|
|
||||||
// Compile the code into a function
|
// Compile the code into a function
|
||||||
var fn;
|
var fn;
|
||||||
@@ -926,7 +925,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// line number should be included in e.stack for runtime errors
|
// line number should be included in e.stack for runtime errors
|
||||||
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
|
$tw.utils.error("Error executing boot module " + name + ": " + String(e) + "\n\n" + e.stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1150,7 +1149,7 @@ $tw.Wiki = function(options) {
|
|||||||
shadowTiddlerTitles = null,
|
shadowTiddlerTitles = null,
|
||||||
getShadowTiddlerTitles = function() {
|
getShadowTiddlerTitles = function() {
|
||||||
if(!shadowTiddlerTitles) {
|
if(!shadowTiddlerTitles) {
|
||||||
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
||||||
}
|
}
|
||||||
return shadowTiddlerTitles;
|
return shadowTiddlerTitles;
|
||||||
},
|
},
|
||||||
@@ -2675,6 +2674,18 @@ $tw.hooks.addHook = function(hookName,definition) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Delete hooks from the hashmap
|
||||||
|
*/
|
||||||
|
$tw.hooks.removeHook = function(hookName,definition) {
|
||||||
|
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
||||||
|
var p = $tw.hooks.names[hookName].indexOf(definition);
|
||||||
|
if(p !== -1) {
|
||||||
|
$tw.hooks.names[hookName].splice(p, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Invoke the hook by key
|
Invoke the hook by key
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type: text/plain
|
|||||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||||
|
|
||||||
Copyright (c) 2004-2007, Jeremy Ruston
|
Copyright (c) 2004-2007, Jeremy Ruston
|
||||||
Copyright (c) 2007-2023, UnaMesa Association
|
Copyright (c) 2007-2024, UnaMesa Association
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
11
core/images/network-activity.tid
Normal file
11
core/images/network-activity.tid
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
title: $:/core/images/network-activity
|
||||||
|
tags: $:/tags/Image
|
||||||
|
|
||||||
|
<svg width="22pt" height="22pt" class="tc-image-network-activity tc-image-button" viewBox="0 0 128 128"><g class={{{ [{$:/state/http-requests}match[0]then[]else[tc-network-activity-background]] }}}>
|
||||||
|
<$list filter="[{$:/state/http-requests}match[0]]" variable="ignore">
|
||||||
|
<path d="M64.043 45.153a4.002 4.002 0 0 1 4.367 2.21l.084.188 30.403 73.4a4 4 0 0 1-7.307 3.25l-.084-.188-3.103-7.49-8.898 8.899a3.985 3.985 0 0 1-2.624 1.166l-.205.005a3.987 3.987 0 0 1-2.828-1.171l-9.849-9.848-9.847 9.848a3.985 3.985 0 0 1-2.624 1.166l-.204.005a3.987 3.987 0 0 1-2.829-1.171l-8.899-8.9-3.102 7.491a4 4 0 1 1-7.391-3.062l30.403-73.4a4.001 4.001 0 0 1 4.495-2.39l.042-.008Zm13.636 56.74-8.023 8.024 7.02 7.019 8.023-8.022-7.02-7.02Zm-27.353.008-7.019 7.019 8.016 8.016 7.019-7.02-8.016-8.015Zm13.68-13.68-8.023 8.023 8.016 8.016 8.023-8.023-8.016-8.016Zm-8.971-8.971-4.687 11.315 8.001-8.001-3.314-3.314Zm17.933.009-3.305 3.305 7.979 7.979-4.674-11.284ZM64 57.607l-5.666 13.68c.096.072.188.15.278.232l.133.126 5.261 5.262 5.262-5.262c.128-.127.261-.244.4-.35L64 57.607Zm0-34.69a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z"/>
|
||||||
|
</$list>
|
||||||
|
<$list filter="[{$:/state/http-requests}!match[0]]" variable="ignore">
|
||||||
|
<path d="M109.395.952a4.002 4.002 0 0 1 3.787 2.708C117.529 11.62 120 20.753 120 30.462c0 15.186-6.044 28.96-15.858 39.047a4 4 0 1 1-6.47-4.626l-.12-.094C106.466 56.074 112 43.914 112 30.462c0-8.492-2.205-16.469-6.074-23.39l.054-.036a4 4 0 0 1 3.415-6.084Zm-90.762 0a4 4 0 0 1 3.072 6.562l.093.06A47.786 47.786 0 0 0 16 30.463c0 13.315 5.42 25.363 14.176 34.058l-.01.007a4 4 0 1 1-6.312 4.863l-.063.05C14.017 59.359 8 45.613 8 30.462c0-9.77 2.502-18.956 6.9-26.952A4.002 4.002 0 0 1 18.634.952Z"/><path d="M64.043 44.698a4.002 4.002 0 0 1 4.367 2.21l.084.188 30.403 73.4a4 4 0 0 1-7.307 3.25l-.084-.188-3.103-7.49-8.898 8.9a3.985 3.985 0 0 1-2.624 1.166l-.205.005a3.987 3.987 0 0 1-2.828-1.172l-9.849-9.848-9.847 9.848a3.985 3.985 0 0 1-2.624 1.167l-.204.005a3.987 3.987 0 0 1-2.829-1.172l-8.899-8.899-3.102 7.49a4 4 0 0 1-7.391-3.061l30.403-73.4a4.001 4.001 0 0 1 4.495-2.39l.042-.009ZM77.68 101.44l-8.023 8.023 7.02 7.019 8.023-8.022-7.02-7.02Zm-27.353.007-7.019 7.019 8.016 8.016 7.019-7.019-8.016-8.016Zm13.68-13.68-8.023 8.023 8.016 8.016 8.023-8.023-8.016-8.016Zm-8.971-8.971L50.348 90.11l8.001-8.001-3.314-3.314Zm17.933.009-3.305 3.305 7.979 7.979-4.674-11.284ZM64 57.152l-5.666 13.68c.096.073.188.15.278.232l.133.127 5.261 5.261 5.262-5.261c.128-.128.261-.244.4-.351L64 57.152ZM38.503 1.058a4 4 0 0 1 2.7 6.952l.17-.175C35.582 13.625 32 21.625 32 30.462c0 8.838 3.582 16.838 9.374 22.629a4 4 0 0 1-5.659 5.658l-.01.01C28.473 51.52 24 41.526 24 30.485 24 19.567 28.374 9.67 35.466 2.453a3.995 3.995 0 0 1 3.037-1.395ZM89.369.952c1.14 0 2.17.478 2.899 1.244l.005-.006C99.518 9.43 104 19.434 104 30.485c0 10.826-4.3 20.648-11.287 27.85a4 4 0 1 1-6.054-5.213l-.032-.032C92.418 47.299 96 39.299 96 30.462c0-8.73-3.496-16.643-9.164-22.416A4 4 0 0 1 89.368.952Zm-39.282 11.14a4 4 0 0 1 2.59 7.048l.01.009A15.95 15.95 0 0 0 48 30.462a15.95 15.95 0 0 0 4.687 11.315l-.01.01a4 4 0 1 1-5.82 5.47l.173.177A23.925 23.925 0 0 1 40 30.462a23.925 23.925 0 0 1 7.03-16.97l.01.01a3.991 3.991 0 0 1 3.047-1.41Zm27.895.07a3.99 3.99 0 0 1 2.984 1.336l.006-.005A23.925 23.925 0 0 1 88 30.463a23.92 23.92 0 0 1-6.707 16.642l-.3.305a4 4 0 1 1-5.679-5.632v-.002A15.95 15.95 0 0 0 80 30.462a15.95 15.95 0 0 0-4.685-11.312 4.012 4.012 0 0 1-1.333-2.987 4 4 0 0 1 4-4ZM64 22.463a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z"/>
|
||||||
|
</$list>
|
||||||
|
</g></svg>
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
title: $:/core/images/new-journal-button
|
title: $:/core/images/new-journal-button
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<$parameters size="22pt" day=<<now "DD">>>
|
<$parameters size="22pt" day=<<now "DD">>><svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg></$parameters>
|
||||||
<svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg>
|
|
||||||
</$parameters>
|
|
||||||
@@ -67,6 +67,8 @@ More/Caption: more
|
|||||||
More/Hint: More actions
|
More/Hint: More actions
|
||||||
NewHere/Caption: new here
|
NewHere/Caption: new here
|
||||||
NewHere/Hint: Create a new tiddler tagged with this one
|
NewHere/Hint: Create a new tiddler tagged with this one
|
||||||
|
NetworkActivity/Caption: network activity
|
||||||
|
NetworkActivity/Hint: Cancel all network activity
|
||||||
NewJournal/Caption: new journal
|
NewJournal/Caption: new journal
|
||||||
NewJournal/Hint: Create a new journal tiddler
|
NewJournal/Hint: Create a new journal tiddler
|
||||||
NewJournalHere/Caption: new journal here
|
NewJournalHere/Caption: new journal here
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ title: $:/language/Exporters/
|
|||||||
StaticRiver: Static HTML
|
StaticRiver: Static HTML
|
||||||
JsonFile: JSON file
|
JsonFile: JSON file
|
||||||
CsvFile: CSV file
|
CsvFile: CSV file
|
||||||
TidFile: ".tid" file
|
TidFile: TID text file
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ _canonical_uri: The full URI of an external image tiddler
|
|||||||
author: Name of the author of a plugin
|
author: Name of the author of a plugin
|
||||||
bag: The name of the bag from which a tiddler came
|
bag: The name of the bag from which a tiddler came
|
||||||
caption: The text to be displayed on a tab or button
|
caption: The text to be displayed on a tab or button
|
||||||
|
class: The CSS class applied to a tiddler when rendering it - see [[Custom styles by user-class]]. Also used for [[Modals]]
|
||||||
code-body: The view template will display the tiddler as code if set to ''yes''
|
code-body: The view template will display the tiddler as code if set to ''yes''
|
||||||
color: The CSS color value associated with a tiddler
|
color: The CSS color value associated with a tiddler
|
||||||
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
|
|||||||
Examples
|
Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
--commands "[enlist{$:/build-commands-as-text}]"
|
--commands "[enlist:raw{$:/build-commands-as-text}]"
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ description: Saves a wiki to a new wiki folder
|
|||||||
<<.from-version "5.1.20">> Saves the current wiki as a wiki folder, including tiddlers, plugins and configuration:
|
<<.from-version "5.1.20">> Saves the current wiki as a wiki folder, including tiddlers, plugins and configuration:
|
||||||
|
|
||||||
```
|
```
|
||||||
--savewikifolder <wikifolderpath> [<filter>]
|
--savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
|
||||||
```
|
```
|
||||||
|
|
||||||
* The target wiki folder must be empty or non-existent
|
* The target wiki folder must be empty or non-existent
|
||||||
@@ -12,8 +12,23 @@ description: Saves a wiki to a new wiki folder
|
|||||||
* Plugins from the official plugin library are replaced with references to those plugins in the `tiddlywiki.info` file
|
* Plugins from the official plugin library are replaced with references to those plugins in the `tiddlywiki.info` file
|
||||||
* Custom plugins are unpacked into their own folder
|
* Custom plugins are unpacked into their own folder
|
||||||
|
|
||||||
|
The following options are supported:
|
||||||
|
|
||||||
|
* ''filter'': a filter expression that defines the tiddlers to include in the output.
|
||||||
|
* ''explodePlugins'': defaults to "yes"
|
||||||
|
** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder
|
||||||
|
** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder
|
||||||
|
|
||||||
|
Note that both ''explodePlugins'' options will produce wiki folders that build the exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
|
||||||
|
|
||||||
A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
|
A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
|
||||||
|
|
||||||
```
|
```
|
||||||
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder
|
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Save the plugin to the tiddlers directory of the target wiki folder:
|
||||||
|
|
||||||
|
```
|
||||||
|
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder explodePlugins=no
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
title: $:/language/Help/server
|
title: $:/language/Help/server
|
||||||
description: Provides an HTTP server interface to TiddlyWiki (deprecated in favour of the new listen command)
|
description: (deprecated: see 'listen' command) Provides an HTTP server interface to TiddlyWiki
|
||||||
|
|
||||||
Legacy command to serve a wiki over HTTP.
|
Legacy command to serve a wiki over HTTP.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
title: $:/language/Docs/Types/image/svg+xml
|
title: $:/language/Docs/Types/image/svg+xml
|
||||||
description: Structured Vector Graphics image
|
description: SVG image
|
||||||
name: image/svg+xml
|
name: image/svg+xml
|
||||||
group: Image
|
group: Image
|
||||||
group-sort: 1
|
group-sort: 1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
title: $:/language/Docs/Types/image/x-icon
|
title: $:/language/Docs/Types/image/x-icon
|
||||||
description: ICO format icon file
|
description: ICO icon
|
||||||
name: image/x-icon
|
name: image/x-icon
|
||||||
group: Image
|
group: Image
|
||||||
group-sort: 1
|
group-sort: 1
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Command.prototype.execute = function() {
|
|||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||||
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
||||||
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ module-type: command
|
|||||||
|
|
||||||
Command to save the current wiki as a wiki folder
|
Command to save the current wiki as a wiki folder
|
||||||
|
|
||||||
--savewikifolder <wikifolderpath> [<filter>]
|
--savewikifolder <wikifolderpath> [ [<name>=<value>] ]*
|
||||||
|
|
||||||
|
The following options are supported:
|
||||||
|
|
||||||
|
* ''filter'': a filter expression defining the tiddlers to be included in the output
|
||||||
|
* ''explodePlugins'': set to "no" to suppress exploding plugins into their constituent shadow tiddlers (defaults to "yes")
|
||||||
|
|
||||||
|
Supports backward compatibility with --savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -35,14 +42,28 @@ Command.prototype.execute = function() {
|
|||||||
if(this.params.length < 1) {
|
if(this.params.length < 1) {
|
||||||
return "Missing wiki folder path";
|
return "Missing wiki folder path";
|
||||||
}
|
}
|
||||||
var wikifoldermaker = new WikiFolderMaker(this.params[0],this.params[1],this.commander);
|
var regFilter = /^[a-zA-Z0-9\.\-_]+=/g, // dynamic parameters
|
||||||
|
namedParames,
|
||||||
|
tiddlerFilter,
|
||||||
|
options = {};
|
||||||
|
if (regFilter.test(this.params[1])) {
|
||||||
|
namedParames = this.commander.extractNamedParameters(this.params.slice(1));
|
||||||
|
tiddlerFilter = namedParames.filter || "[all[tiddlers]]";
|
||||||
|
} else {
|
||||||
|
namedParames = this.commander.extractNamedParameters(this.params.slice(2));
|
||||||
|
tiddlerFilter = this.params[1];
|
||||||
|
}
|
||||||
|
tiddlerFilter = tiddlerFilter || "[all[tiddlers]]";
|
||||||
|
options.explodePlugins = namedParames.explodePlugins || "yes";
|
||||||
|
var wikifoldermaker = new WikiFolderMaker(this.params[0],tiddlerFilter,this.commander,options);
|
||||||
return wikifoldermaker.save();
|
return wikifoldermaker.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander) {
|
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander,options) {
|
||||||
this.wikiFolderPath = wikiFolderPath;
|
this.wikiFolderPath = wikiFolderPath;
|
||||||
this.wikiFilter = wikiFilter || "[all[tiddlers]]";
|
this.wikiFilter = wikiFilter;
|
||||||
this.commander = commander;
|
this.commander = commander;
|
||||||
|
this.explodePlugins = options.explodePlugins;
|
||||||
this.wiki = commander.wiki;
|
this.wiki = commander.wiki;
|
||||||
this.savedPaths = []; // So that we can detect filename clashes
|
this.savedPaths = []; // So that we can detect filename clashes
|
||||||
}
|
}
|
||||||
@@ -93,10 +114,13 @@ WikiFolderMaker.prototype.save = function() {
|
|||||||
self.log("Adding built-in plugin: " + libraryDetails.name);
|
self.log("Adding built-in plugin: " + libraryDetails.name);
|
||||||
newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];
|
newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];
|
||||||
$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);
|
$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);
|
||||||
} else {
|
} else if(self.explodePlugins !== "no") {
|
||||||
// A custom plugin
|
// A custom plugin
|
||||||
self.log("Processing custom plugin: " + title);
|
self.log("Processing custom plugin: " + title);
|
||||||
self.saveCustomPlugin(tiddler);
|
self.saveCustomPlugin(tiddler);
|
||||||
|
} else if(self.explodePlugins === "no") {
|
||||||
|
self.log("Processing custom plugin to tiddlders folder: " + title);
|
||||||
|
self.saveTiddler("tiddlers", tiddler);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ordinary tiddler
|
// Ordinary tiddler
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ function FramedEngine(options) {
|
|||||||
this.domNode.value = this.value;
|
this.domNode.value = this.value;
|
||||||
}
|
}
|
||||||
// Set the attributes
|
// Set the attributes
|
||||||
if(this.widget.editType) {
|
if(this.widget.editType && this.widget.editTag !== "textarea") {
|
||||||
this.domNode.setAttribute("type",this.widget.editType);
|
this.domNode.setAttribute("type",this.widget.editType);
|
||||||
}
|
}
|
||||||
if(this.widget.editPlaceholder) {
|
if(this.widget.editPlaceholder) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function SimpleEngine(options) {
|
|||||||
this.domNode.value = this.value;
|
this.domNode.value = this.value;
|
||||||
}
|
}
|
||||||
// Set the attributes
|
// Set the attributes
|
||||||
if(this.widget.editType) {
|
if(this.widget.editType && this.widget.editTag !== "textarea") {
|
||||||
this.domNode.setAttribute("type",this.widget.editType);
|
this.domNode.setAttribute("type",this.widget.editType);
|
||||||
}
|
}
|
||||||
if(this.widget.editPlaceholder) {
|
if(this.widget.editPlaceholder) {
|
||||||
|
|||||||
32
core/modules/filterrunprefixes/then.js
Normal file
32
core/modules/filterrunprefixes/then.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filterrunprefixes/then.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filterrunprefix
|
||||||
|
|
||||||
|
Replace results of previous runs unless empty
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter prefix function
|
||||||
|
*/
|
||||||
|
exports.then = function(operationSubFunction) {
|
||||||
|
return function(results,source,widget) {
|
||||||
|
if(results.length !== 0) {
|
||||||
|
// Only run if previous run(s) produced results
|
||||||
|
var thisRunResult = operationSubFunction(source,widget);
|
||||||
|
if(thisRunResult.length !== 0) {
|
||||||
|
// Replace results only if this run actually produces a result
|
||||||
|
results.clear();
|
||||||
|
results.pushTop(thisRunResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -28,12 +28,8 @@ function getAllFilterOperators() {
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.all = function(source,operator,options) {
|
exports.all = function(source,operator,options) {
|
||||||
// Get our suboperators
|
|
||||||
var allFilterOperators = getAllFilterOperators();
|
|
||||||
// Cycle through the suboperators accumulating their results
|
|
||||||
var results = new $tw.utils.LinkedList(),
|
|
||||||
subops = operator.operand.split("+");
|
|
||||||
// Check for common optimisations
|
// Check for common optimisations
|
||||||
|
var subops = operator.operand.split("+");
|
||||||
if(subops.length === 1 && subops[0] === "") {
|
if(subops.length === 1 && subops[0] === "") {
|
||||||
return source;
|
return source;
|
||||||
} else if(subops.length === 1 && subops[0] === "tiddlers") {
|
} else if(subops.length === 1 && subops[0] === "tiddlers") {
|
||||||
@@ -46,6 +42,10 @@ exports.all = function(source,operator,options) {
|
|||||||
return options.wiki.eachShadowPlusTiddlers;
|
return options.wiki.eachShadowPlusTiddlers;
|
||||||
}
|
}
|
||||||
// Do it the hard way
|
// Do it the hard way
|
||||||
|
// Get our suboperators
|
||||||
|
var allFilterOperators = getAllFilterOperators();
|
||||||
|
// Cycle through the suboperators accumulating their results
|
||||||
|
var results = new $tw.utils.LinkedList();
|
||||||
for(var t=0; t<subops.length; t++) {
|
for(var t=0; t<subops.length; t++) {
|
||||||
var subop = allFilterOperators[subops[t]];
|
var subop = allFilterOperators[subops[t]];
|
||||||
if(subop) {
|
if(subop) {
|
||||||
|
|||||||
@@ -18,16 +18,20 @@ Export our filter functions
|
|||||||
|
|
||||||
exports.decodebase64 = function(source,operator,options) {
|
exports.decodebase64 = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
|
var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
|
||||||
|
var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.base64Decode(title));
|
results.push($tw.utils.base64Decode(title,binary,urlsafe));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.encodebase64 = function(source,operator,options) {
|
exports.encodebase64 = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
|
var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
|
||||||
|
var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.base64Encode(title));
|
results.push($tw.utils.base64Encode(title,binary,urlsafe));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,6 +68,54 @@ exports["jsontype"] = function(source,operator,options) {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports["jsonset"] = function(source,operator,options) {
|
||||||
|
var suffixes = operator.suffixes || [],
|
||||||
|
type = suffixes[0] && suffixes[0][0],
|
||||||
|
indexes = operator.operands.slice(0,-1),
|
||||||
|
value = operator.operands[operator.operands.length - 1],
|
||||||
|
results = [];
|
||||||
|
if(operator.operands.length === 1 && operator.operands[0] === "") {
|
||||||
|
value = undefined; // Prevents the value from being assigned
|
||||||
|
}
|
||||||
|
switch(type) {
|
||||||
|
case "string":
|
||||||
|
// Use value unchanged
|
||||||
|
break;
|
||||||
|
case "boolean":
|
||||||
|
value = (value === "true" ? true : (value === "false" ? false : undefined));
|
||||||
|
break;
|
||||||
|
case "number":
|
||||||
|
value = $tw.utils.parseNumber(value);
|
||||||
|
break;
|
||||||
|
case "array":
|
||||||
|
indexes = operator.operands;
|
||||||
|
value = [];
|
||||||
|
break;
|
||||||
|
case "object":
|
||||||
|
indexes = operator.operands;
|
||||||
|
value = {};
|
||||||
|
break;
|
||||||
|
case "null":
|
||||||
|
indexes = operator.operands;
|
||||||
|
value = null;
|
||||||
|
break;
|
||||||
|
case "json":
|
||||||
|
value = $tw.utils.parseJSONSafe(value,function() {return undefined;});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Use value unchanged
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
var data = $tw.utils.parseJSONSafe(title,title);
|
||||||
|
if(data) {
|
||||||
|
data = setDataItem(data,indexes,value);
|
||||||
|
results.push(JSON.stringify(data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given a JSON data structure and an array of index strings, return an array of the string representation of the values at the end of the index chain, or "undefined" if any of the index strings are invalid
|
Given a JSON data structure and an array of index strings, return an array of the string representation of the values at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||||
*/
|
*/
|
||||||
@@ -165,6 +213,18 @@ function getDataItemType(data,indexes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getItemAtIndex(item,index) {
|
||||||
|
if($tw.utils.hop(item,index)) {
|
||||||
|
return item[index];
|
||||||
|
} else if($tw.utils.isArray(item)) {
|
||||||
|
index = $tw.utils.parseInt(index);
|
||||||
|
if(index < 0) { index = index + item.length };
|
||||||
|
return item[index]; // Will be undefined if index was out-of-bounds
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given a JSON data structure and an array of index strings, return the value at the end of the index chain, or "undefined" if any of the index strings are invalid
|
Given a JSON data structure and an array of index strings, return the value at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||||
*/
|
*/
|
||||||
@@ -177,7 +237,7 @@ function getDataItem(data,indexes) {
|
|||||||
for(var i=0; i<indexes.length; i++) {
|
for(var i=0; i<indexes.length; i++) {
|
||||||
if(item !== undefined) {
|
if(item !== undefined) {
|
||||||
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
||||||
item = item[indexes[i]];
|
item = getItemAtIndex(item,indexes[i]);
|
||||||
} else {
|
} else {
|
||||||
item = undefined;
|
item = undefined;
|
||||||
}
|
}
|
||||||
@@ -186,5 +246,39 @@ function getDataItem(data,indexes) {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Given a JSON data structure, an array of index strings and a value, return the data structure with the value added at the end of the index chain. If any of the index strings are invalid then the JSON data structure is returned unmodified. If the root item is targetted then a different data object will be returned
|
||||||
|
*/
|
||||||
|
function setDataItem(data,indexes,value) {
|
||||||
|
// Ignore attempts to assign undefined
|
||||||
|
if(value === undefined) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
// Check for the root item
|
||||||
|
if(indexes.length === 0 || (indexes.length === 1 && indexes[0] === "")) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
// Traverse the JSON data structure using the index chain
|
||||||
|
var current = data;
|
||||||
|
for(var i = 0; i < indexes.length - 1; i++) {
|
||||||
|
current = getItemAtIndex(current,indexes[i]);
|
||||||
|
if(current === undefined) {
|
||||||
|
// Return the original JSON data structure if any of the index strings are invalid
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add the value to the end of the index chain
|
||||||
|
var lastIndex = indexes[indexes.length - 1];
|
||||||
|
if($tw.utils.isArray(current)) {
|
||||||
|
lastIndex = $tw.utils.parseInt(lastIndex);
|
||||||
|
if(lastIndex < 0) { lastIndex = lastIndex + current.length };
|
||||||
|
}
|
||||||
|
// Only set indexes on objects and arrays
|
||||||
|
if(typeof current === "object") {
|
||||||
|
current[lastIndex] = value;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ Last entry/entries in list
|
|||||||
exports.last = function(source,operator,options) {
|
exports.last = function(source,operator,options) {
|
||||||
var count = $tw.utils.getInt(operator.operand,1),
|
var count = $tw.utils.getInt(operator.operand,1),
|
||||||
results = [];
|
results = [];
|
||||||
|
if(count === 0) return results;
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
});
|
});
|
||||||
|
|||||||
36
core/modules/filters/substitute.js
Normal file
36
core/modules/filters/substitute.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filters/substitute.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: filteroperator
|
||||||
|
|
||||||
|
Filter operator for substituting variables and embedded filter expressions with their corresponding values
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.substitute = function(source,operator,options) {
|
||||||
|
var results = [],
|
||||||
|
operands = [];
|
||||||
|
$tw.utils.each(operator.operands,function(operand,index){
|
||||||
|
operands.push({
|
||||||
|
name: (index + 1).toString(),
|
||||||
|
value: operand
|
||||||
|
});
|
||||||
|
});
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(title) {
|
||||||
|
results.push(options.wiki.getSubstitutedText(title,options.widget,{substitutions:operands}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
@@ -305,10 +305,11 @@ exports.parseAttribute = function(source,pos) {
|
|||||||
start: pos
|
start: pos
|
||||||
};
|
};
|
||||||
// Define our regexps
|
// Define our regexps
|
||||||
var reAttributeName = /([^\/\s>"'=]+)/g,
|
var reAttributeName = /([^\/\s>"'`=]+)/g,
|
||||||
reUnquotedAttribute = /([^\/\s<>"'=]+)/g,
|
reUnquotedAttribute = /([^\/\s<>"'`=]+)/g,
|
||||||
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
|
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
|
||||||
reIndirectValue = /\{\{([^\}]+)\}\}/g;
|
reIndirectValue = /\{\{([^\}]+)\}\}/g,
|
||||||
|
reSubstitutedValue = /(?:```([\s\S]*?)```|`([^`]|[\S\s]*?)`)/g;
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||||
// Get the attribute name
|
// Get the attribute name
|
||||||
@@ -361,8 +362,15 @@ exports.parseAttribute = function(source,pos) {
|
|||||||
node.type = "macro";
|
node.type = "macro";
|
||||||
node.value = macroInvocation;
|
node.value = macroInvocation;
|
||||||
} else {
|
} else {
|
||||||
node.type = "string";
|
var substitutedValue = $tw.utils.parseTokenRegExp(source,pos,reSubstitutedValue);
|
||||||
node.value = "true";
|
if(substitutedValue) {
|
||||||
|
pos = substitutedValue.end;
|
||||||
|
node.type = "substituted";
|
||||||
|
node.rawValue = substitutedValue.match[1] || substitutedValue.match[2];
|
||||||
|
} else {
|
||||||
|
node.type = "string";
|
||||||
|
node.value = "true";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ The plain text parser processes blocks of source text into a degenerate parse tr
|
|||||||
|
|
||||||
var TextParser = function(type,text,options) {
|
var TextParser = function(type,text,options) {
|
||||||
this.tree = [{
|
this.tree = [{
|
||||||
type: "codeblock",
|
type: "genesis",
|
||||||
attributes: {
|
attributes: {
|
||||||
code: {type: "string", value: text},
|
$type: {name: "$type", type: "string", value: "$codeblock"},
|
||||||
language: {type: "string", value: type}
|
code: {name: "code", type: "string", value: text},
|
||||||
|
language: {name: "language", type: "string", value: type},
|
||||||
|
$remappable: {name: "$remappable", type:"string", value: "no"}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
this.source = text;
|
this.source = text;
|
||||||
@@ -32,4 +34,3 @@ exports["text/css"] = TextParser;
|
|||||||
exports["application/x-tiddler-dictionary"] = TextParser;
|
exports["application/x-tiddler-dictionary"] = TextParser;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
120
core/modules/parsers/wikiparser/rules/conditional.js
Normal file
120
core/modules/parsers/wikiparser/rules/conditional.js
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/parsers/wikiparser/rules/conditional.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: wikirule
|
||||||
|
|
||||||
|
Conditional shortcut syntax
|
||||||
|
|
||||||
|
```
|
||||||
|
This is a <% if [{something}] %>Elephant<% elseif [{else}] %>Pelican<% else %>Crocodile<% endif %>
|
||||||
|
```
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.name = "conditional";
|
||||||
|
exports.types = {inline: true, block: true};
|
||||||
|
|
||||||
|
exports.init = function(parser) {
|
||||||
|
this.parser = parser;
|
||||||
|
// Regexp to match
|
||||||
|
this.matchRegExp = /\<\%\s*if\s+/mg;
|
||||||
|
this.terminateIfRegExp = /\%\>/mg;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.findNextMatch = function(startPos) {
|
||||||
|
// Look for the next <% if shortcut
|
||||||
|
this.matchRegExp.lastIndex = startPos;
|
||||||
|
this.match = this.matchRegExp.exec(this.parser.source);
|
||||||
|
// If not found then return no match
|
||||||
|
if(!this.match) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
// Check for the next %>
|
||||||
|
this.terminateIfRegExp.lastIndex = this.match.index;
|
||||||
|
this.terminateIfMatch = this.terminateIfRegExp.exec(this.parser.source);
|
||||||
|
// If not found then return no match
|
||||||
|
if(!this.terminateIfMatch) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
// Return the position at which the construction was found
|
||||||
|
return this.match.index;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parse the most recent match
|
||||||
|
*/
|
||||||
|
exports.parse = function() {
|
||||||
|
// Get the filter condition
|
||||||
|
var filterCondition = this.parser.source.substring(this.match.index + this.match[0].length,this.terminateIfMatch.index);
|
||||||
|
// Advance the parser position to past the %>
|
||||||
|
this.parser.pos = this.terminateIfMatch.index + this.terminateIfMatch[0].length;
|
||||||
|
// Parse the if clause
|
||||||
|
return this.parseIfClause(filterCondition);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.parseIfClause = function(filterCondition) {
|
||||||
|
// Create the list widget
|
||||||
|
var listWidget = {
|
||||||
|
type: "list",
|
||||||
|
tag: "$list",
|
||||||
|
isBlock: this.is.block,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: "list-template",
|
||||||
|
tag: "$list-template"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "list-empty",
|
||||||
|
tag: "$list-empty"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
$tw.utils.addAttributeToParseTreeNode(listWidget,"filter",filterCondition);
|
||||||
|
$tw.utils.addAttributeToParseTreeNode(listWidget,"variable","condition");
|
||||||
|
$tw.utils.addAttributeToParseTreeNode(listWidget,"limit","1");
|
||||||
|
// Check for an immediately following double linebreak
|
||||||
|
var hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
||||||
|
// Parse the body looking for else or endif
|
||||||
|
var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>|\\<\\%\\s*(else)\\s*\\%\\>|\\<\\%\\s*(elseif)\\s+([\\s\\S]+?)\\%\\>",
|
||||||
|
ex;
|
||||||
|
if(hasLineBreak) {
|
||||||
|
ex = this.parser.parseBlocksTerminatedExtended(reEndString);
|
||||||
|
} else {
|
||||||
|
var reEnd = new RegExp(reEndString,"mg");
|
||||||
|
ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
|
||||||
|
}
|
||||||
|
// Put the body into the list template
|
||||||
|
listWidget.children[0].children = ex.tree;
|
||||||
|
// Check for an else or elseif
|
||||||
|
if(ex.match) {
|
||||||
|
if(ex.match[1] === "endif") {
|
||||||
|
// Nothing to do if we just found an endif
|
||||||
|
} else if(ex.match[2] === "else") {
|
||||||
|
// Check for an immediately following double linebreak
|
||||||
|
hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
||||||
|
// If we found an else then we need to parse the body looking for the endif
|
||||||
|
var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>",
|
||||||
|
ex;
|
||||||
|
if(hasLineBreak) {
|
||||||
|
ex = this.parser.parseBlocksTerminatedExtended(reEndString);
|
||||||
|
} else {
|
||||||
|
var reEnd = new RegExp(reEndString,"mg");
|
||||||
|
ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
|
||||||
|
}
|
||||||
|
// Put the parsed content inside the list empty template
|
||||||
|
listWidget.children[1].children = ex.tree;
|
||||||
|
} else if(ex.match[3] === "elseif") {
|
||||||
|
// Parse the elseif clause by reusing this parser, passing the new filter condition
|
||||||
|
listWidget.children[1].children = this.parseIfClause(ex.match[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Return the parse tree node
|
||||||
|
return [listWidget];
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -35,7 +35,7 @@ Instantiate parse rule
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// Regexp to match
|
||||||
this.matchRegExp = /^\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
this.matchRegExp = /\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -49,11 +49,11 @@ exports.parse = function() {
|
|||||||
if(this.match[3]) {
|
if(this.match[3]) {
|
||||||
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
||||||
}
|
}
|
||||||
// Is this a multiline definition?
|
// Is the remainder of the line blank after the parameter close paren?
|
||||||
var reEnd;
|
var reEnd;
|
||||||
if(this.match[5]) {
|
if(this.match[5]) {
|
||||||
// If so, the end of the body is marked with \end
|
// If so, it is a multiline definition and the end of the body is marked with \end
|
||||||
reEnd = new RegExp("(\\r?\\n\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
reEnd = new RegExp("((:?^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ exports.parse = function() {
|
|||||||
paramMatch = reParam.exec(paramString);
|
paramMatch = reParam.exec(paramString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Is this a multiline definition?
|
// Is the remainder of the \define line blank after the parameter close paren?
|
||||||
var reEnd;
|
var reEnd;
|
||||||
if(this.match[3]) {
|
if(this.match[3]) {
|
||||||
// If so, the end of the body is marked with \end
|
// If so, it is a multiline definition and the end of the body is marked with \end
|
||||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Instantiate parse rule
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// Regexp to match
|
||||||
this.matchRegExp = /^\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
this.matchRegExp = /\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ Parse any pragmas at the beginning of a block of parse text
|
|||||||
WikiParser.prototype.parsePragmas = function() {
|
WikiParser.prototype.parsePragmas = function() {
|
||||||
var currentTreeBranch = this.tree;
|
var currentTreeBranch = this.tree;
|
||||||
while(true) {
|
while(true) {
|
||||||
|
var savedPos = this.pos;
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check for the end of the text
|
// Check for the end of the text
|
||||||
@@ -204,6 +205,7 @@ WikiParser.prototype.parsePragmas = function() {
|
|||||||
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
||||||
// If not, just exit
|
// If not, just exit
|
||||||
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
||||||
|
this.pos = savedPos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Process the pragma rule
|
// Process the pragma rule
|
||||||
@@ -214,6 +216,8 @@ WikiParser.prototype.parsePragmas = function() {
|
|||||||
subTree[0].children = [];
|
subTree[0].children = [];
|
||||||
currentTreeBranch = subTree[0].children;
|
currentTreeBranch = subTree[0].children;
|
||||||
}
|
}
|
||||||
|
// Skip whitespace after the pragma
|
||||||
|
this.skipWhitespace();
|
||||||
}
|
}
|
||||||
return currentTreeBranch;
|
return currentTreeBranch;
|
||||||
};
|
};
|
||||||
@@ -223,7 +227,7 @@ Parse a block from the current position
|
|||||||
terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
|
terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
|
||||||
*/
|
*/
|
||||||
WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
||||||
var terminatorRegExp = terminatorRegExpString ? new RegExp("(" + terminatorRegExpString + "|\\r?\\n\\r?\\n)","mg") : /(\r?\n\r?\n)/mg;
|
var terminatorRegExp = terminatorRegExpString ? new RegExp(terminatorRegExpString + "|\\r?\\n\\r?\\n","mg") : /(\r?\n\r?\n)/mg;
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
if(this.pos >= this.sourceLength) {
|
if(this.pos >= this.sourceLength) {
|
||||||
return [];
|
return [];
|
||||||
@@ -264,11 +268,21 @@ WikiParser.prototype.parseBlocksUnterminated = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parse blocks of text until a terminating regexp is encountered
|
Parse blocks of text until a terminating regexp is encountered. Wrapper for parseBlocksTerminatedExtended that just returns the parse tree
|
||||||
*/
|
*/
|
||||||
WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
||||||
var terminatorRegExp = new RegExp("(" + terminatorRegExpString + ")","mg"),
|
var ex = this.parseBlocksTerminatedExtended(terminatorRegExpString);
|
||||||
tree = [];
|
return ex.tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parse blocks of text until a terminating regexp is encountered
|
||||||
|
*/
|
||||||
|
WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpString) {
|
||||||
|
var terminatorRegExp = new RegExp(terminatorRegExpString,"mg"),
|
||||||
|
result = {
|
||||||
|
tree: []
|
||||||
|
};
|
||||||
// Skip any whitespace
|
// Skip any whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check if we've got the end marker
|
// Check if we've got the end marker
|
||||||
@@ -277,7 +291,7 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
|||||||
// Parse the text into blocks
|
// Parse the text into blocks
|
||||||
while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
|
while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
|
||||||
var blocks = this.parseBlock(terminatorRegExpString);
|
var blocks = this.parseBlock(terminatorRegExpString);
|
||||||
tree.push.apply(tree,blocks);
|
result.tree.push.apply(result.tree,blocks);
|
||||||
// Skip any whitespace
|
// Skip any whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check if we've got the end marker
|
// Check if we've got the end marker
|
||||||
@@ -286,8 +300,9 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
|||||||
}
|
}
|
||||||
if(match && match.index === this.pos) {
|
if(match && match.index === this.pos) {
|
||||||
this.pos = match.index + match[0].length;
|
this.pos = match.index + match[0].length;
|
||||||
|
result.match = match;
|
||||||
}
|
}
|
||||||
return tree;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -330,6 +345,11 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
|
WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
|
||||||
|
var ex = this.parseInlineRunTerminatedExtended(terminatorRegExp,options);
|
||||||
|
return ex.tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegExp,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var tree = [];
|
var tree = [];
|
||||||
// Find the next occurrence of the terminator
|
// Find the next occurrence of the terminator
|
||||||
@@ -349,7 +369,10 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|||||||
if(options.eatTerminator) {
|
if(options.eatTerminator) {
|
||||||
this.pos += terminatorMatch[0].length;
|
this.pos += terminatorMatch[0].length;
|
||||||
}
|
}
|
||||||
return tree;
|
return {
|
||||||
|
match: terminatorMatch,
|
||||||
|
tree: tree
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Process any inline rule, along with the text preceding it
|
// Process any inline rule, along with the text preceding it
|
||||||
@@ -373,7 +396,9 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
|||||||
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
||||||
}
|
}
|
||||||
this.pos = this.sourceLength;
|
this.pos = this.sourceLength;
|
||||||
return tree;
|
return {
|
||||||
|
tree: tree
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
|||||||
headers = {
|
headers = {
|
||||||
"Accept": "application/vnd.github.v3+json",
|
"Accept": "application/vnd.github.v3+json",
|
||||||
"Content-Type": "application/json;charset=UTF-8",
|
"Content-Type": "application/json;charset=UTF-8",
|
||||||
"Authorization": "Basic " + window.btoa(username + ":" + password),
|
"Authorization": "Basic " + $tw.utils.base64Encode(username + ":" + password),
|
||||||
"If-None-Match": ""
|
"If-None-Match": ""
|
||||||
};
|
};
|
||||||
// Bail if we don't have everything we need
|
// Bail if we don't have everything we need
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ Startup logic concerned with managing plugins
|
|||||||
// Export name and synchronous status
|
// Export name and synchronous status
|
||||||
exports.name = "plugins";
|
exports.name = "plugins";
|
||||||
exports.after = ["load-modules"];
|
exports.after = ["load-modules"];
|
||||||
|
exports.before = ["startup"];
|
||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
var TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = "$:/status/RequireReloadDueToPluginChange";
|
var TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = "$:/status/RequireReloadDueToPluginChange";
|
||||||
|
|||||||
@@ -20,6 +20,39 @@ exports.before = ["story"];
|
|||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
|
// Install the HTTP client event handler
|
||||||
|
$tw.httpClient = new $tw.utils.HttpClient();
|
||||||
|
var getPropertiesWithPrefix = function(properties,prefix) {
|
||||||
|
var result = Object.create(null);
|
||||||
|
$tw.utils.each(properties,function(value,name) {
|
||||||
|
if(name.indexOf(prefix) === 0) {
|
||||||
|
result[name.substring(prefix.length)] = properties[name];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
$tw.rootWidget.addEventListener("tm-http-request",function(event) {
|
||||||
|
var params = event.paramObject || {};
|
||||||
|
$tw.httpClient.initiateHttpRequest({
|
||||||
|
wiki: event.widget.wiki,
|
||||||
|
url: params.url,
|
||||||
|
method: params.method,
|
||||||
|
body: params.body,
|
||||||
|
binary: params.binary,
|
||||||
|
oncompletion: params.oncompletion,
|
||||||
|
onprogress: params.onprogress,
|
||||||
|
bindStatus: params["bind-status"],
|
||||||
|
bindProgress: params["bind-progress"],
|
||||||
|
variables: getPropertiesWithPrefix(params,"var-"),
|
||||||
|
headers: getPropertiesWithPrefix(params,"header-"),
|
||||||
|
passwordHeaders: getPropertiesWithPrefix(params,"password-header-"),
|
||||||
|
queryStrings: getPropertiesWithPrefix(params,"query-"),
|
||||||
|
passwordQueryStrings: getPropertiesWithPrefix(params,"password-query-")
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) {
|
||||||
|
$tw.httpClient.cancelAllHttpRequests();
|
||||||
|
});
|
||||||
// Install the modal message mechanism
|
// Install the modal message mechanism
|
||||||
$tw.modal = new $tw.utils.Modal($tw.wiki);
|
$tw.modal = new $tw.utils.Modal($tw.wiki);
|
||||||
$tw.rootWidget.addEventListener("tm-modal",function(event) {
|
$tw.rootWidget.addEventListener("tm-modal",function(event) {
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ exports.startup = function() {
|
|||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||||
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
||||||
|
// 2023-07-21 Edge returns UA below. So we use "isChromeLike"
|
||||||
|
//'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/114.0.0.0 safari/537.36 edg/114.0.1823.82'
|
||||||
|
$tw.browser.isChromeLike = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
||||||
|
$tw.browser.hasTouch = !!window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
||||||
|
$tw.browser.isMobileChrome = $tw.browser.isChromeLike && $tw.browser.hasTouch;
|
||||||
}
|
}
|
||||||
// Platform detection
|
// Platform detection
|
||||||
$tw.platform = {};
|
$tw.platform = {};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ exports.startup = function() {
|
|||||||
variables = $tw.utils.extend({},paramObject,{currentTiddler: title, "tv-window-id": windowID});
|
variables = $tw.utils.extend({},paramObject,{currentTiddler: title, "tv-window-id": windowID});
|
||||||
// Open the window
|
// Open the window
|
||||||
var srcWindow,
|
var srcWindow,
|
||||||
srcDocument;
|
srcDocument;
|
||||||
// In case that popup blockers deny opening a new window
|
// In case that popup blockers deny opening a new window
|
||||||
try {
|
try {
|
||||||
srcWindow = window.open("","external-" + windowID,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
|
srcWindow = window.open("","external-" + windowID,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
|
||||||
@@ -52,6 +52,7 @@ exports.startup = function() {
|
|||||||
$tw.windows[windowID] = srcWindow;
|
$tw.windows[windowID] = srcWindow;
|
||||||
// Check for reopening the same window
|
// Check for reopening the same window
|
||||||
if(srcWindow.haveInitialisedWindow) {
|
if(srcWindow.haveInitialisedWindow) {
|
||||||
|
srcWindow.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Initialise the document
|
// Initialise the document
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
|
|||||||
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
|
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
|
||||||
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
|
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
|
||||||
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
|
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
|
||||||
Syncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer
|
Syncer.prototype.taskTimerInterval = 0.25 * 1000; // Interval for sync timer
|
||||||
Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...
|
Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...
|
||||||
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
|
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
|
||||||
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
|
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
|
||||||
@@ -74,9 +74,11 @@ function Syncer(options) {
|
|||||||
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
|
this.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server
|
||||||
// Timers
|
// Timers
|
||||||
this.taskTimerId = null; // Timer for task dispatch
|
this.taskTimerId = null; // Timer for task dispatch
|
||||||
this.pollTimerId = null; // Timer for polling server
|
|
||||||
// Number of outstanding requests
|
// Number of outstanding requests
|
||||||
this.numTasksInProgress = 0;
|
this.numTasksInProgress = 0;
|
||||||
|
// True when we want to force an immediate sync from the server
|
||||||
|
this.forceSyncFromServer = false;
|
||||||
|
this.timestampLastSyncFromServer = new Date();
|
||||||
// Listen out for changes to tiddlers
|
// Listen out for changes to tiddlers
|
||||||
this.wiki.addEventListener("change",function(changes) {
|
this.wiki.addEventListener("change",function(changes) {
|
||||||
// Filter the changes to just include ones that are being synced
|
// Filter the changes to just include ones that are being synced
|
||||||
@@ -203,33 +205,37 @@ Syncer.prototype.readTiddlerInfo = function() {
|
|||||||
Checks whether the wiki is dirty (ie the window shouldn't be closed)
|
Checks whether the wiki is dirty (ie the window shouldn't be closed)
|
||||||
*/
|
*/
|
||||||
Syncer.prototype.isDirty = function() {
|
Syncer.prototype.isDirty = function() {
|
||||||
this.logger.log("Checking dirty status");
|
var self = this;
|
||||||
// Check tiddlers that are in the store and included in the filter function
|
function checkIsDirty() {
|
||||||
var titles = this.getSyncedTiddlers();
|
// Check tiddlers that are in the store and included in the filter function
|
||||||
for(var index=0; index<titles.length; index++) {
|
var titles = self.getSyncedTiddlers();
|
||||||
var title = titles[index],
|
for(var index=0; index<titles.length; index++) {
|
||||||
tiddlerInfo = this.tiddlerInfo[title];
|
var title = titles[index],
|
||||||
if(this.wiki.tiddlerExists(title)) {
|
tiddlerInfo = self.tiddlerInfo[title];
|
||||||
if(tiddlerInfo) {
|
if(self.wiki.tiddlerExists(title)) {
|
||||||
// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server
|
if(tiddlerInfo) {
|
||||||
if(this.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server
|
||||||
|
if(self.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If the tiddler isn't known on the server then it needs to be saved to the server
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// If the tiddler isn't known on the server then it needs to be saved to the server
|
}
|
||||||
|
// Check tiddlers that are known from the server but not currently in the store
|
||||||
|
titles = Object.keys(self.tiddlerInfo);
|
||||||
|
for(index=0; index<titles.length; index++) {
|
||||||
|
if(!self.wiki.tiddlerExists(titles[index])) {
|
||||||
|
// There must be a pending delete
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// Check tiddlers that are known from the server but not currently in the store
|
var dirtyStatus = checkIsDirty();
|
||||||
titles = Object.keys(this.tiddlerInfo);
|
return dirtyStatus;
|
||||||
for(index=0; index<titles.length; index++) {
|
|
||||||
if(!this.wiki.tiddlerExists(titles[index])) {
|
|
||||||
// There must be a pending delete
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -293,92 +299,16 @@ Syncer.prototype.getStatus = function(callback) {
|
|||||||
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
|
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
|
||||||
*/
|
*/
|
||||||
Syncer.prototype.syncFromServer = function() {
|
Syncer.prototype.syncFromServer = function() {
|
||||||
var self = this,
|
if(this.canSyncFromServer()) {
|
||||||
cancelNextSync = function() {
|
this.forceSyncFromServer = true;
|
||||||
if(self.pollTimerId) {
|
this.processTaskQueue();
|
||||||
clearTimeout(self.pollTimerId);
|
|
||||||
self.pollTimerId = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
triggerNextSync = function() {
|
|
||||||
self.pollTimerId = setTimeout(function() {
|
|
||||||
self.pollTimerId = null;
|
|
||||||
self.syncFromServer.call(self);
|
|
||||||
},self.pollTimerInterval);
|
|
||||||
},
|
|
||||||
syncSystemFromServer = (self.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
|
|
||||||
if(this.syncadaptor && this.syncadaptor.getUpdatedTiddlers) {
|
|
||||||
this.logger.log("Retrieving updated tiddler list");
|
|
||||||
cancelNextSync();
|
|
||||||
this.syncadaptor.getUpdatedTiddlers(self,function(err,updates) {
|
|
||||||
triggerNextSync();
|
|
||||||
if(err) {
|
|
||||||
self.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(updates) {
|
|
||||||
$tw.utils.each(updates.modifications,function(title) {
|
|
||||||
self.titlesToBeLoaded[title] = true;
|
|
||||||
});
|
|
||||||
$tw.utils.each(updates.deletions,function(title) {
|
|
||||||
if(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {
|
|
||||||
delete self.tiddlerInfo[title];
|
|
||||||
self.logger.log("Deleting tiddler missing from server:",title);
|
|
||||||
self.wiki.deleteTiddler(title);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(updates.modifications.length > 0 || updates.deletions.length > 0) {
|
|
||||||
self.processTaskQueue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if(this.syncadaptor && this.syncadaptor.getSkinnyTiddlers) {
|
|
||||||
this.logger.log("Retrieving skinny tiddler list");
|
|
||||||
cancelNextSync();
|
|
||||||
this.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {
|
|
||||||
triggerNextSync();
|
|
||||||
// Check for errors
|
|
||||||
if(err) {
|
|
||||||
self.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Keep track of which tiddlers we already know about have been reported this time
|
|
||||||
var previousTitles = Object.keys(self.tiddlerInfo);
|
|
||||||
// Process each incoming tiddler
|
|
||||||
for(var t=0; t<tiddlers.length; t++) {
|
|
||||||
// Get the incoming tiddler fields, and the existing tiddler
|
|
||||||
var tiddlerFields = tiddlers[t],
|
|
||||||
incomingRevision = tiddlerFields.revision + "",
|
|
||||||
tiddler = self.wiki.tiddlerExists(tiddlerFields.title) && self.wiki.getTiddler(tiddlerFields.title),
|
|
||||||
tiddlerInfo = self.tiddlerInfo[tiddlerFields.title],
|
|
||||||
currRevision = tiddlerInfo ? tiddlerInfo.revision : null,
|
|
||||||
indexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);
|
|
||||||
if(indexInPreviousTitles !== -1) {
|
|
||||||
previousTitles.splice(indexInPreviousTitles,1);
|
|
||||||
}
|
|
||||||
// Ignore the incoming tiddler if it's the same as the revision we've already got
|
|
||||||
if(currRevision !== incomingRevision) {
|
|
||||||
// Only load the skinny version if we don't already have a fat version of the tiddler
|
|
||||||
if(!tiddler || tiddler.fields.text === undefined) {
|
|
||||||
self.storeTiddler(tiddlerFields);
|
|
||||||
}
|
|
||||||
// Do a full load of this tiddler
|
|
||||||
self.titlesToBeLoaded[tiddlerFields.title] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Delete any tiddlers that were previously reported but missing this time
|
|
||||||
$tw.utils.each(previousTitles,function(title) {
|
|
||||||
if(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {
|
|
||||||
delete self.tiddlerInfo[title];
|
|
||||||
self.logger.log("Deleting tiddler missing from server:",title);
|
|
||||||
self.wiki.deleteTiddler(title);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
self.processTaskQueue();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Syncer.prototype.canSyncFromServer = function() {
|
||||||
|
return !!this.syncadaptor.getUpdatedTiddlers || !!this.syncadaptor.getSkinnyTiddlers;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Force load a tiddler from the server
|
Force load a tiddler from the server
|
||||||
*/
|
*/
|
||||||
@@ -510,7 +440,7 @@ Syncer.prototype.processTaskQueue = function() {
|
|||||||
} else {
|
} else {
|
||||||
self.updateDirtyStatus();
|
self.updateDirtyStatus();
|
||||||
// Process the next task
|
// Process the next task
|
||||||
self.processTaskQueue.call(self);
|
self.processTaskQueue.call(self);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -518,31 +448,39 @@ Syncer.prototype.processTaskQueue = function() {
|
|||||||
this.updateDirtyStatus();
|
this.updateDirtyStatus();
|
||||||
// And trigger a timeout if there is a pending task
|
// And trigger a timeout if there is a pending task
|
||||||
if(task === true) {
|
if(task === true) {
|
||||||
this.triggerTimeout();
|
this.triggerTimeout(this.taskTimerInterval);
|
||||||
|
} else if(this.canSyncFromServer()) {
|
||||||
|
this.triggerTimeout(this.pollTimerInterval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.updateDirtyStatus();
|
this.updateDirtyStatus();
|
||||||
|
this.triggerTimeout(this.taskTimerInterval);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Syncer.prototype.triggerTimeout = function(interval) {
|
Syncer.prototype.triggerTimeout = function(interval) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if(!this.taskTimerId) {
|
if(this.taskTimerId) {
|
||||||
this.taskTimerId = setTimeout(function() {
|
clearTimeout(this.taskTimerId);
|
||||||
self.taskTimerId = null;
|
|
||||||
self.processTaskQueue.call(self);
|
|
||||||
},interval || self.taskTimerInterval);
|
|
||||||
}
|
}
|
||||||
|
this.taskTimerId = setTimeout(function() {
|
||||||
|
self.taskTimerId = null;
|
||||||
|
self.processTaskQueue.call(self);
|
||||||
|
},interval || self.taskTimerInterval);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Choose the next sync task. We prioritise saves, then deletes, then loads from the server
|
Choose the next sync task. We prioritise saves to the server, then getting updates from the server, then deletes to the server, then loads from the server
|
||||||
|
|
||||||
Returns either a task object, null if there's no upcoming tasks, or the boolean true if there are pending tasks that aren't yet due
|
Returns either:
|
||||||
|
* a task object
|
||||||
|
* the boolean true if there are pending sync tasks that aren't yet due
|
||||||
|
* null if there's no pending sync tasks (just the next poll)
|
||||||
*/
|
*/
|
||||||
Syncer.prototype.chooseNextTask = function() {
|
Syncer.prototype.chooseNextTask = function() {
|
||||||
var thresholdLastSaved = (new Date()) - this.throttleInterval,
|
var now = new Date(),
|
||||||
|
thresholdLastSaved = now - this.throttleInterval,
|
||||||
havePending = null;
|
havePending = null;
|
||||||
// First we look for tiddlers that have been modified locally and need saving back to the server
|
// First we look for tiddlers that have been modified locally and need saving back to the server
|
||||||
var titles = this.getSyncedTiddlers();
|
var titles = this.getSyncedTiddlers();
|
||||||
@@ -556,14 +494,18 @@ Syncer.prototype.chooseNextTask = function() {
|
|||||||
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
|
||||||
if(hasChanged) {
|
if(hasChanged) {
|
||||||
if(isReadyToSave) {
|
if(isReadyToSave) {
|
||||||
return new SaveTiddlerTask(this,title);
|
return new SaveTiddlerTask(this,title);
|
||||||
} else {
|
} else {
|
||||||
havePending = true;
|
havePending = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Second, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server
|
// Second we check for an outstanding sync from server
|
||||||
|
if(this.forceSyncFromServer || (this.timestampLastSyncFromServer && (now.valueOf() >= (this.timestampLastSyncFromServer.valueOf() + this.pollTimerInterval)))) {
|
||||||
|
return new SyncFromServerTask(this);
|
||||||
|
}
|
||||||
|
// Third, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server
|
||||||
titles = Object.keys(this.tiddlerInfo);
|
titles = Object.keys(this.tiddlerInfo);
|
||||||
for(index=0; index<titles.length; index++) {
|
for(index=0; index<titles.length; index++) {
|
||||||
title = titles[index];
|
title = titles[index];
|
||||||
@@ -573,13 +515,13 @@ Syncer.prototype.chooseNextTask = function() {
|
|||||||
return new DeleteTiddlerTask(this,title);
|
return new DeleteTiddlerTask(this,title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check for tiddlers that need loading
|
// Finally, check for tiddlers that need loading
|
||||||
title = Object.keys(this.titlesToBeLoaded)[0];
|
title = Object.keys(this.titlesToBeLoaded)[0];
|
||||||
if(title) {
|
if(title) {
|
||||||
delete this.titlesToBeLoaded[title];
|
delete this.titlesToBeLoaded[title];
|
||||||
return new LoadTiddlerTask(this,title);
|
return new LoadTiddlerTask(this,title);
|
||||||
}
|
}
|
||||||
// No tasks are ready
|
// No tasks are ready now, but might be in the future
|
||||||
return havePending;
|
return havePending;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -589,6 +531,10 @@ function SaveTiddlerTask(syncer,title) {
|
|||||||
this.type = "save";
|
this.type = "save";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SaveTiddlerTask.prototype.toString = function() {
|
||||||
|
return "SAVE " + this.title;
|
||||||
|
}
|
||||||
|
|
||||||
SaveTiddlerTask.prototype.run = function(callback) {
|
SaveTiddlerTask.prototype.run = function(callback) {
|
||||||
var self = this,
|
var self = this,
|
||||||
changeCount = this.syncer.wiki.getChangeCount(this.title),
|
changeCount = this.syncer.wiki.getChangeCount(this.title),
|
||||||
@@ -613,7 +559,6 @@ SaveTiddlerTask.prototype.run = function(callback) {
|
|||||||
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.syncer.logger.log(" Not Dispatching 'save' task:",this.title,"tiddler does not exist");
|
|
||||||
$tw.utils.nextTick(callback(null));
|
$tw.utils.nextTick(callback(null));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -624,6 +569,10 @@ function DeleteTiddlerTask(syncer,title) {
|
|||||||
this.type = "delete";
|
this.type = "delete";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteTiddlerTask.prototype.toString = function() {
|
||||||
|
return "DELETE " + this.title;
|
||||||
|
}
|
||||||
|
|
||||||
DeleteTiddlerTask.prototype.run = function(callback) {
|
DeleteTiddlerTask.prototype.run = function(callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.syncer.logger.log("Dispatching 'delete' task:",this.title);
|
this.syncer.logger.log("Dispatching 'delete' task:",this.title);
|
||||||
@@ -647,6 +596,10 @@ function LoadTiddlerTask(syncer,title) {
|
|||||||
this.type = "load";
|
this.type = "load";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadTiddlerTask.prototype.toString = function() {
|
||||||
|
return "LOAD " + this.title;
|
||||||
|
}
|
||||||
|
|
||||||
LoadTiddlerTask.prototype.run = function(callback) {
|
LoadTiddlerTask.prototype.run = function(callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.syncer.logger.log("Dispatching 'load' task:",this.title);
|
this.syncer.logger.log("Dispatching 'load' task:",this.title);
|
||||||
@@ -664,6 +617,91 @@ LoadTiddlerTask.prototype.run = function(callback) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function SyncFromServerTask(syncer) {
|
||||||
|
this.syncer = syncer;
|
||||||
|
this.type = "syncfromserver";
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncFromServerTask.prototype.toString = function() {
|
||||||
|
return "SYNCFROMSERVER";
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncFromServerTask.prototype.run = function(callback) {
|
||||||
|
var self = this;
|
||||||
|
var syncSystemFromServer = (self.syncer.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
|
||||||
|
var successCallback = function() {
|
||||||
|
self.syncer.forceSyncFromServer = false;
|
||||||
|
self.syncer.timestampLastSyncFromServer = new Date();
|
||||||
|
callback(null);
|
||||||
|
};
|
||||||
|
if(this.syncer.syncadaptor.getUpdatedTiddlers) {
|
||||||
|
this.syncer.syncadaptor.getUpdatedTiddlers(self.syncer,function(err,updates) {
|
||||||
|
if(err) {
|
||||||
|
self.syncer.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
if(updates) {
|
||||||
|
$tw.utils.each(updates.modifications,function(title) {
|
||||||
|
self.syncer.titlesToBeLoaded[title] = true;
|
||||||
|
});
|
||||||
|
$tw.utils.each(updates.deletions,function(title) {
|
||||||
|
if(syncSystemFromServer || !self.syncer.wiki.isSystemTiddler(title)) {
|
||||||
|
delete self.syncer.tiddlerInfo[title];
|
||||||
|
self.syncer.logger.log("Deleting tiddler missing from server:",title);
|
||||||
|
self.syncer.wiki.deleteTiddler(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return successCallback();
|
||||||
|
});
|
||||||
|
} else if(this.syncer.syncadaptor.getSkinnyTiddlers) {
|
||||||
|
this.syncer.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {
|
||||||
|
// Check for errors
|
||||||
|
if(err) {
|
||||||
|
self.syncer.displayError($tw.language.getString("Error/RetrievingSkinny"),err);
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
// Keep track of which tiddlers we already know about have been reported this time
|
||||||
|
var previousTitles = Object.keys(self.syncer.tiddlerInfo);
|
||||||
|
// Process each incoming tiddler
|
||||||
|
for(var t=0; t<tiddlers.length; t++) {
|
||||||
|
// Get the incoming tiddler fields, and the existing tiddler
|
||||||
|
var tiddlerFields = tiddlers[t],
|
||||||
|
incomingRevision = tiddlerFields.revision + "",
|
||||||
|
tiddler = self.syncer.wiki.tiddlerExists(tiddlerFields.title) && self.syncer.wiki.getTiddler(tiddlerFields.title),
|
||||||
|
tiddlerInfo = self.syncer.tiddlerInfo[tiddlerFields.title],
|
||||||
|
currRevision = tiddlerInfo ? tiddlerInfo.revision : null,
|
||||||
|
indexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);
|
||||||
|
if(indexInPreviousTitles !== -1) {
|
||||||
|
previousTitles.splice(indexInPreviousTitles,1);
|
||||||
|
}
|
||||||
|
// Ignore the incoming tiddler if it's the same as the revision we've already got
|
||||||
|
if(currRevision !== incomingRevision) {
|
||||||
|
// Only load the skinny version if we don't already have a fat version of the tiddler
|
||||||
|
if(!tiddler || tiddler.fields.text === undefined) {
|
||||||
|
self.syncer.storeTiddler(tiddlerFields);
|
||||||
|
}
|
||||||
|
// Do a full load of this tiddler
|
||||||
|
self.syncer.titlesToBeLoaded[tiddlerFields.title] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Delete any tiddlers that were previously reported but missing this time
|
||||||
|
$tw.utils.each(previousTitles,function(title) {
|
||||||
|
if(syncSystemFromServer || !self.syncer.wiki.isSystemTiddler(title)) {
|
||||||
|
delete self.syncer.tiddlerInfo[title];
|
||||||
|
self.syncer.logger.log("Deleting tiddler missing from server:",title);
|
||||||
|
self.syncer.wiki.deleteTiddler(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
self.syncer.forceSyncFromServer = false;
|
||||||
|
self.syncer.timestampLastSyncFromServer = new Date();
|
||||||
|
return successCallback();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return successCallback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.Syncer = Syncer;
|
exports.Syncer = Syncer;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|||||||
variables["dom-" + attribute.name] = attribute.value.toString();
|
variables["dom-" + attribute.name] = attribute.value.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
if(selectedNode.offsetLeft) {
|
if("offsetLeft" in selectedNode) {
|
||||||
// Add variables with a (relative and absolute) popup coordinate string for the selected node
|
// Add variables with a (relative and absolute) popup coordinate string for the selected node
|
||||||
var nodeRect = {
|
var nodeRect = {
|
||||||
left: selectedNode.offsetLeft,
|
left: selectedNode.offsetLeft,
|
||||||
@@ -338,12 +338,12 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(domNode && domNode.offsetWidth) {
|
if(domNode && ("offsetWidth" in domNode)) {
|
||||||
variables["tv-widgetnode-width"] = domNode.offsetWidth.toString();
|
variables["tv-widgetnode-width"] = domNode.offsetWidth.toString();
|
||||||
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
|
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event && event.clientX && event.clientY) {
|
if(event && ("clientX" in event) && ("clientY" in event)) {
|
||||||
if(selectedNode) {
|
if(selectedNode) {
|
||||||
// Add variables for event X and Y position relative to selected node
|
// Add variables for event X and Y position relative to selected node
|
||||||
selectedNodeRect = selectedNode.getBoundingClientRect();
|
selectedNodeRect = selectedNode.getBoundingClientRect();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ exports.makeDraggable = function(options) {
|
|||||||
if(dataTransfer.setDragImage) {
|
if(dataTransfer.setDragImage) {
|
||||||
if(dragImageType === "pill") {
|
if(dragImageType === "pill") {
|
||||||
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
||||||
} else if (dragImageType === "blank") {
|
} else if(dragImageType === "blank") {
|
||||||
dragImage.removeChild(dragImage.firstChild);
|
dragImage.removeChild(dragImage.firstChild);
|
||||||
dataTransfer.setDragImage(dragImage,0,0);
|
dataTransfer.setDragImage(dragImage,0,0);
|
||||||
} else {
|
} else {
|
||||||
@@ -106,7 +106,9 @@ exports.makeDraggable = function(options) {
|
|||||||
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
||||||
dataTransfer.setData("text/plain",titleString);
|
dataTransfer.setData("text/plain",titleString);
|
||||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||||
} else {
|
}
|
||||||
|
// If browser is Chrome-like and has a touch-input device do NOT .setData
|
||||||
|
if(!($tw.browser.isMobileChrome)) {
|
||||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||||
}
|
}
|
||||||
dataTransfer.setData("Text",titleString);
|
dataTransfer.setData("Text",titleString);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: $:/core/modules/utils/dom/http.js
|
|||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: utils
|
module-type: utils
|
||||||
|
|
||||||
Browser HTTP support
|
HTTP support
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -13,12 +13,220 @@ Browser HTTP support
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A quick and dirty HTTP function; to be refactored later. Options are:
|
Manage tm-http-request events. Options include:
|
||||||
|
wiki: Reference to the wiki to be used for state tiddler tracking
|
||||||
|
stateTrackerTitle: Title of tiddler to be used for state tiddler tracking
|
||||||
|
*/
|
||||||
|
function HttpClient(options) {
|
||||||
|
options = options || {};
|
||||||
|
this.nextId = 1;
|
||||||
|
this.wiki = options.wiki || $tw.wiki;
|
||||||
|
this.stateTrackerTitle = options.stateTrackerTitle || "$:/state/http-requests";
|
||||||
|
this.requests = []; // Array of {id: string,request: HttpClientRequest}
|
||||||
|
this.updateRequestTracker();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return the index into this.requests[] corresponding to a given ID. Returns null if not found
|
||||||
|
*/
|
||||||
|
HttpClient.prototype.getRequestIndex = function(targetId) {
|
||||||
|
var targetIndex = null;
|
||||||
|
$tw.utils.each(this.requests,function(requestInfo,index) {
|
||||||
|
if(requestInfo.id === targetId) {
|
||||||
|
targetIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return targetIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Update the state tiddler that is tracking the outstanding requests
|
||||||
|
*/
|
||||||
|
HttpClient.prototype.updateRequestTracker = function() {
|
||||||
|
this.wiki.addTiddler({title: this.stateTrackerTitle, text: "" + this.requests.length});
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpClient.prototype.initiateHttpRequest = function(options) {
|
||||||
|
var self = this,
|
||||||
|
id = this.nextId,
|
||||||
|
request = new HttpClientRequest(options);
|
||||||
|
this.nextId += 1;
|
||||||
|
this.requests.push({id: id, request: request});
|
||||||
|
this.updateRequestTracker();
|
||||||
|
request.send(function(err) {
|
||||||
|
var targetIndex = self.getRequestIndex(id);
|
||||||
|
if(targetIndex !== null) {
|
||||||
|
self.requests.splice(targetIndex,1);
|
||||||
|
self.updateRequestTracker();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return id;
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpClient.prototype.cancelAllHttpRequests = function() {
|
||||||
|
var self = this;
|
||||||
|
if(this.requests.length > 0) {
|
||||||
|
for(var t=this.requests.length - 1; t--; t>=0) {
|
||||||
|
var requestInfo = this.requests[t];
|
||||||
|
requestInfo.request.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.requests = [];
|
||||||
|
this.updateRequestTracker();
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpClient.prototype.cancelHttpRequest = function(targetId) {
|
||||||
|
var targetIndex = this.getRequestIndex(targetId);
|
||||||
|
if(targetIndex !== null) {
|
||||||
|
this.requests[targetIndex].request.cancel();
|
||||||
|
this.requests.splice(targetIndex,1);
|
||||||
|
this.updateRequestTracker();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Initiate an HTTP request. Options:
|
||||||
|
wiki: wiki to be used for executing action strings
|
||||||
|
url: URL for request
|
||||||
|
method: method eg GET, POST
|
||||||
|
body: text of request body
|
||||||
|
binary: set to "yes" to force binary processing of response payload
|
||||||
|
oncompletion: action string to be invoked on completion
|
||||||
|
onprogress: action string to be invoked on progress updates
|
||||||
|
bindStatus: optional title of tiddler to which status ("pending", "complete", "error") should be written
|
||||||
|
bindProgress: optional title of tiddler to which the progress of the request (0 to 100) should be bound
|
||||||
|
variables: hashmap of variable name to string value passed to action strings
|
||||||
|
headers: hashmap of header name to header value to be sent with the request
|
||||||
|
passwordHeaders: hashmap of header name to password store name to be sent with the request
|
||||||
|
queryStrings: hashmap of query string parameter name to parameter value to be sent with the request
|
||||||
|
passwordQueryStrings: hashmap of query string parameter name to password store name to be sent with the request
|
||||||
|
*/
|
||||||
|
function HttpClientRequest(options) {
|
||||||
|
var self = this;
|
||||||
|
console.log("Initiating an HTTP request",options)
|
||||||
|
this.wiki = options.wiki;
|
||||||
|
this.completionActions = options.oncompletion;
|
||||||
|
this.progressActions = options.onprogress;
|
||||||
|
this.bindStatus = options["bindStatus"];
|
||||||
|
this.bindProgress = options["bindProgress"];
|
||||||
|
this.method = options.method || "GET";
|
||||||
|
this.body = options.body || "";
|
||||||
|
this.binary = options.binary || "";
|
||||||
|
this.variables = options.variables;
|
||||||
|
var url = options.url;
|
||||||
|
$tw.utils.each(options.queryStrings,function(value,name) {
|
||||||
|
url = $tw.utils.setQueryStringParameter(url,name,value);
|
||||||
|
});
|
||||||
|
$tw.utils.each(options.passwordQueryStrings,function(value,name) {
|
||||||
|
url = $tw.utils.setQueryStringParameter(url,name,$tw.utils.getPassword(value) || "");
|
||||||
|
});
|
||||||
|
this.url = url;
|
||||||
|
this.requestHeaders = {};
|
||||||
|
$tw.utils.each(options.headers,function(value,name) {
|
||||||
|
self.requestHeaders[name] = value;
|
||||||
|
});
|
||||||
|
$tw.utils.each(options.passwordHeaders,function(value,name) {
|
||||||
|
self.requestHeaders[name] = $tw.utils.getPassword(value) || "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpClientRequest.prototype.send = function(callback) {
|
||||||
|
var self = this,
|
||||||
|
setBinding = function(title,text) {
|
||||||
|
if(title) {
|
||||||
|
self.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(this.url) {
|
||||||
|
setBinding(this.bindStatus,"pending");
|
||||||
|
setBinding(this.bindProgress,"0");
|
||||||
|
// Set the request tracker tiddler
|
||||||
|
var requestTrackerTitle = this.wiki.generateNewTitle("$:/temp/HttpRequest");
|
||||||
|
this.wiki.addTiddler({
|
||||||
|
title: requestTrackerTitle,
|
||||||
|
tags: "$:/tags/HttpRequest",
|
||||||
|
text: JSON.stringify({
|
||||||
|
url: this.url,
|
||||||
|
type: this.method,
|
||||||
|
status: "inprogress",
|
||||||
|
headers: this.requestHeaders,
|
||||||
|
data: this.body
|
||||||
|
})
|
||||||
|
});
|
||||||
|
this.xhr = $tw.utils.httpRequest({
|
||||||
|
url: this.url,
|
||||||
|
type: this.method,
|
||||||
|
headers: this.requestHeaders,
|
||||||
|
data: this.body,
|
||||||
|
returnProp: this.binary === "" ? "responseText" : "response",
|
||||||
|
responseType: this.binary === "" ? "text" : "arraybuffer",
|
||||||
|
callback: function(err,data,xhr) {
|
||||||
|
var hasSucceeded = xhr.status >= 200 && xhr.status < 300,
|
||||||
|
completionCode = hasSucceeded ? "complete" : "error",
|
||||||
|
headers = {};
|
||||||
|
$tw.utils.each(xhr.getAllResponseHeaders().split("\r\n"),function(line) {
|
||||||
|
var pos = line.indexOf(":");
|
||||||
|
if(pos !== -1) {
|
||||||
|
headers[line.substr(0,pos)] = line.substr(pos + 1).trim();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setBinding(self.bindStatus,completionCode);
|
||||||
|
setBinding(self.bindProgress,"100");
|
||||||
|
var resultVariables = {
|
||||||
|
status: xhr.status.toString(),
|
||||||
|
statusText: xhr.statusText,
|
||||||
|
error: (err || "").toString(),
|
||||||
|
data: (data || "").toString(),
|
||||||
|
headers: JSON.stringify(headers)
|
||||||
|
};
|
||||||
|
/* Convert data from binary to base64 */
|
||||||
|
if (xhr.responseType === "arraybuffer") {
|
||||||
|
var binary = "",
|
||||||
|
bytes = new Uint8Array(data),
|
||||||
|
len = bytes.byteLength;
|
||||||
|
for (var i=0; i<len; i++) {
|
||||||
|
binary += String.fromCharCode(bytes[i]);
|
||||||
|
}
|
||||||
|
resultVariables.data = $tw.utils.base64Encode(binary,true);
|
||||||
|
}
|
||||||
|
self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getTiddler(requestTrackerTitle),{
|
||||||
|
status: completionCode,
|
||||||
|
}));
|
||||||
|
self.wiki.invokeActionString(self.completionActions,undefined,$tw.utils.extend({},self.variables,resultVariables),{parentWidget: $tw.rootWidget});
|
||||||
|
callback(hasSucceeded ? null : xhr.statusText);
|
||||||
|
// console.log("Back!",err,data,xhr);
|
||||||
|
},
|
||||||
|
progress: function(lengthComputable,loaded,total) {
|
||||||
|
if(lengthComputable) {
|
||||||
|
setBinding(self.bindProgress,"" + Math.floor((loaded/total) * 100))
|
||||||
|
}
|
||||||
|
self.wiki.invokeActionString(self.progressActions,undefined,{
|
||||||
|
lengthComputable: lengthComputable ? "yes" : "no",
|
||||||
|
loaded: loaded,
|
||||||
|
total: total
|
||||||
|
},{parentWidget: $tw.rootWidget});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpClientRequest.prototype.cancel = function() {
|
||||||
|
if(this.xhr) {
|
||||||
|
this.xhr.abort();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.HttpClient = HttpClient;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Make an HTTP request. Options are:
|
||||||
url: URL to retrieve
|
url: URL to retrieve
|
||||||
headers: hashmap of headers to send
|
headers: hashmap of headers to send
|
||||||
type: GET, PUT, POST etc
|
type: GET, PUT, POST etc
|
||||||
callback: function invoked with (err,data,xhr)
|
callback: function invoked with (err,data,xhr)
|
||||||
|
progress: optional function invoked with (lengthComputable,loaded,total)
|
||||||
returnProp: string name of the property to return as first argument of callback
|
returnProp: string name of the property to return as first argument of callback
|
||||||
|
responseType: "text" or "arraybuffer"
|
||||||
*/
|
*/
|
||||||
exports.httpRequest = function(options) {
|
exports.httpRequest = function(options) {
|
||||||
var type = options.type || "GET",
|
var type = options.type || "GET",
|
||||||
@@ -71,6 +279,7 @@ exports.httpRequest = function(options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
request.responseType = options.responseType || "text";
|
||||||
// Set up the state change handler
|
// Set up the state change handler
|
||||||
request.onreadystatechange = function() {
|
request.onreadystatechange = function() {
|
||||||
if(this.readyState === 4) {
|
if(this.readyState === 4) {
|
||||||
@@ -83,8 +292,16 @@ exports.httpRequest = function(options) {
|
|||||||
options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this);
|
options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// Handle progress
|
||||||
|
if(options.progress) {
|
||||||
|
request.onprogress = function(event) {
|
||||||
|
console.log("Progress event",event)
|
||||||
|
options.progress(event.lengthComputable,event.loaded,event.total);
|
||||||
|
};
|
||||||
|
}
|
||||||
// Make the request
|
// Make the request
|
||||||
request.open(type,url,true);
|
request.open(type,url,true);
|
||||||
|
// Headers
|
||||||
if(headers) {
|
if(headers) {
|
||||||
$tw.utils.each(headers,function(header,headerTitle,object) {
|
$tw.utils.each(headers,function(header,headerTitle,object) {
|
||||||
request.setRequestHeader(headerTitle,header);
|
request.setRequestHeader(headerTitle,header);
|
||||||
@@ -96,6 +313,7 @@ exports.httpRequest = function(options) {
|
|||||||
if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers)) {
|
if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers)) {
|
||||||
request.setRequestHeader("X-Requested-With","TiddlyWiki");
|
request.setRequestHeader("X-Requested-With","TiddlyWiki");
|
||||||
}
|
}
|
||||||
|
// Send data
|
||||||
try {
|
try {
|
||||||
request.send(data);
|
request.send(data);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@@ -104,4 +322,19 @@ exports.httpRequest = function(options) {
|
|||||||
return request;
|
return request;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.setQueryStringParameter = function(url,paramName,paramValue) {
|
||||||
|
var URL = $tw.browser ? window.URL : require("url").URL,
|
||||||
|
newUrl;
|
||||||
|
try {
|
||||||
|
newUrl = new URL(url);
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
if(newUrl && paramName) {
|
||||||
|
newUrl.searchParams.set(paramName,paramValue || "");
|
||||||
|
return newUrl.toString();
|
||||||
|
} else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -104,7 +104,11 @@ TW_Element.prototype.setAttribute = function(name,value) {
|
|||||||
if(this.isRaw) {
|
if(this.isRaw) {
|
||||||
throw "Cannot setAttribute on a raw TW_Element";
|
throw "Cannot setAttribute on a raw TW_Element";
|
||||||
}
|
}
|
||||||
this.attributes[name] = value + "";
|
if(name === "style") {
|
||||||
|
this.style = value;
|
||||||
|
} else {
|
||||||
|
this.attributes[name] = value + "";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TW_Element.prototype.setAttributeNS = function(namespace,name,value) {
|
TW_Element.prototype.setAttributeNS = function(namespace,name,value) {
|
||||||
|
|||||||
@@ -819,18 +819,41 @@ exports.hashString = function(str) {
|
|||||||
},0);
|
},0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Base64 utility functions that work in either browser or Node.js
|
||||||
|
*/
|
||||||
|
if(typeof window !== 'undefined') {
|
||||||
|
exports.btoa = function(binstr) { return window.btoa(binstr); }
|
||||||
|
exports.atob = function(b64) { return window.atob(b64); }
|
||||||
|
} else {
|
||||||
|
exports.btoa = function(binstr) {
|
||||||
|
return Buffer.from(binstr, 'binary').toString('base64');
|
||||||
|
}
|
||||||
|
exports.atob = function(b64) {
|
||||||
|
return Buffer.from(b64, 'base64').toString('binary');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Decode a base64 string
|
Decode a base64 string
|
||||||
*/
|
*/
|
||||||
exports.base64Decode = function(string64) {
|
exports.base64Decode = function(string64,binary,urlsafe) {
|
||||||
return base64utf8.base64.decode.call(base64utf8,string64);
|
var encoded = urlsafe ? string64.replace(/_/g,'/').replace(/-/g,'+') : string64;
|
||||||
|
if(binary) return exports.atob(encoded)
|
||||||
|
else return base64utf8.base64.decode.call(base64utf8,encoded);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Encode a string to base64
|
Encode a string to base64
|
||||||
*/
|
*/
|
||||||
exports.base64Encode = function(string64) {
|
exports.base64Encode = function(string64,binary,urlsafe) {
|
||||||
return base64utf8.base64.encode.call(base64utf8,string64);
|
var encoded;
|
||||||
|
if(binary) encoded = exports.btoa(string64);
|
||||||
|
else encoded = base64utf8.base64.encode.call(base64utf8,string64);
|
||||||
|
if(urlsafe) {
|
||||||
|
encoded = encoded.replace(/\+/g,'-').replace(/\//g,'_');
|
||||||
|
}
|
||||||
|
return encoded;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},false);
|
},false);
|
||||||
|
// Assign data- attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Insert element
|
// Insert element
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
@@ -95,6 +100,11 @@ BrowseWidget.prototype.execute = function() {
|
|||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
*/
|
*/
|
||||||
BrowseWidget.prototype.refresh = function(changedTiddlers) {
|
BrowseWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
|
var changedAttributes = this.computeAttributes();
|
||||||
|
if($tw.utils.count(changedAttributes) > 0) {
|
||||||
|
this.refreshSelf();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
$tw.utils.pushTop(classes,"tc-popup-handle");
|
$tw.utils.pushTop(classes,"tc-popup-handle");
|
||||||
}
|
}
|
||||||
domNode.className = classes.join(" ");
|
domNode.className = classes.join(" ");
|
||||||
|
// Assign data- attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Assign other attributes
|
// Assign other attributes
|
||||||
if(this.style) {
|
if(this.style) {
|
||||||
domNode.setAttribute("style",this.style);
|
domNode.setAttribute("style",this.style);
|
||||||
@@ -250,7 +255,7 @@ ButtonWidget.prototype.updateDomNodeClasses = function() {
|
|||||||
//Add new classes from updated class attribute.
|
//Add new classes from updated class attribute.
|
||||||
$tw.utils.pushTop(domNodeClasses,newClasses);
|
$tw.utils.pushTop(domNodeClasses,newClasses);
|
||||||
this.domNode.className = domNodeClasses.join(" ");
|
this.domNode.className = domNodeClasses.join(" ");
|
||||||
}
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
@@ -260,8 +265,15 @@ ButtonWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
if(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) {
|
if(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else if(changedAttributes["class"]) {
|
} else {
|
||||||
this.updateDomNodeClasses();
|
if(changedAttributes["class"]) {
|
||||||
|
this.updateDomNodeClasses();
|
||||||
|
}
|
||||||
|
this.assignAttributes(this.domNodes[0],{
|
||||||
|
changedAttributes: changedAttributes,
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ CheckboxWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.labelDomNode.appendChild(this.inputDomNode);
|
this.labelDomNode.appendChild(this.inputDomNode);
|
||||||
this.spanDomNode = this.document.createElement("span");
|
this.spanDomNode = this.document.createElement("span");
|
||||||
this.labelDomNode.appendChild(this.spanDomNode);
|
this.labelDomNode.appendChild(this.spanDomNode);
|
||||||
|
// Assign data- attributes
|
||||||
|
this.assignAttributes(this.inputDomNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Add a click event handler
|
// Add a click event handler
|
||||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||||
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
||||||
@@ -116,7 +121,7 @@ CheckboxWidget.prototype.getValue = function() {
|
|||||||
} else {
|
} else {
|
||||||
list = $tw.utils.parseStringArray(this.checkboxDefault || "") || [];
|
list = $tw.utils.parseStringArray(this.checkboxDefault || "") || [];
|
||||||
}
|
}
|
||||||
} else if (this.checkboxListIndex) {
|
} else if(this.checkboxListIndex) {
|
||||||
list = $tw.utils.parseStringArray(this.wiki.extractTiddlerDataItem(tiddler,this.checkboxListIndex,this.checkboxDefault || "")) || [];
|
list = $tw.utils.parseStringArray(this.wiki.extractTiddlerDataItem(tiddler,this.checkboxListIndex,this.checkboxDefault || "")) || [];
|
||||||
} else {
|
} else {
|
||||||
list = this.wiki.filterTiddlers(this.checkboxFilter,this) || [];
|
list = this.wiki.filterTiddlers(this.checkboxFilter,this) || [];
|
||||||
@@ -215,6 +220,8 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
|||||||
if($tw.utils.isArray(fieldContents)) {
|
if($tw.utils.isArray(fieldContents)) {
|
||||||
// Make a copy so we can modify it without changing original that's refrenced elsewhere
|
// Make a copy so we can modify it without changing original that's refrenced elsewhere
|
||||||
listContents = fieldContents.slice(0);
|
listContents = fieldContents.slice(0);
|
||||||
|
} else if(fieldContents === undefined) {
|
||||||
|
listContents = [];
|
||||||
} else if(typeof fieldContents === "string") {
|
} else if(typeof fieldContents === "string") {
|
||||||
listContents = $tw.utils.parseStringArray(fieldContents);
|
listContents = $tw.utils.parseStringArray(fieldContents);
|
||||||
// No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere
|
// No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere
|
||||||
@@ -323,6 +330,11 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
$tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked");
|
$tw.utils.removeClass(this.labelDomNode,"tc-checkbox-checked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.assignAttributes(this.inputDomNode,{
|
||||||
|
changedAttributes: changedAttributes,
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -330,3 +342,4 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
exports.checkbox = CheckboxWidget;
|
exports.checkbox = CheckboxWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -52,6 +52,11 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
classes.push("tc-draggable");
|
classes.push("tc-draggable");
|
||||||
}
|
}
|
||||||
domNode.setAttribute("class",classes.join(" "));
|
domNode.setAttribute("class",classes.join(" "));
|
||||||
|
// Assign data- attributes and style. attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Insert the node into the DOM and render any children
|
// Insert the node into the DOM and render any children
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
@@ -108,13 +113,19 @@ DraggableWidget.prototype.updateDomNodeClasses = function() {
|
|||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
*/
|
*/
|
||||||
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes(),
|
var changedAttributes = this.computeAttributes();
|
||||||
changedAttributesCount = $tw.utils.count(changedAttributes);
|
if(changedAttributes.tag || changedAttributes.selector || changedAttributes.dragimagetype || changedAttributes.enable || changedAttributes.startactions || changedAttributes.endactions) {
|
||||||
if(changedAttributesCount === 1 && changedAttributes["class"]) {
|
|
||||||
this.updateDomNodeClasses();
|
|
||||||
} else if(changedAttributesCount > 0) {
|
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
if(changedAttributes["class"]) {
|
||||||
|
this.assignDomNodeClasses();
|
||||||
|
}
|
||||||
|
this.assignAttributes(this.domNodes[0],{
|
||||||
|
changedAttributes: changedAttributes,
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ DroppableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
domNode = this.document.createElement(tag);
|
domNode = this.document.createElement(tag);
|
||||||
this.domNode = domNode;
|
this.domNode = domNode;
|
||||||
this.assignDomNodeClasses();
|
this.assignDomNodeClasses();
|
||||||
|
// Assign data- attributes and style. attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Add event handlers
|
// Add event handlers
|
||||||
if(this.droppableEnable) {
|
if(this.droppableEnable) {
|
||||||
$tw.utils.addEventListeners(domNode,[
|
$tw.utils.addEventListeners(domNode,[
|
||||||
@@ -166,8 +171,15 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
|
if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else if(changedAttributes["class"]) {
|
} else {
|
||||||
this.assignDomNodeClasses();
|
if(changedAttributes["class"]) {
|
||||||
|
this.assignDomNodeClasses();
|
||||||
|
}
|
||||||
|
this.assignAttributes(this.domNodes[0],{
|
||||||
|
changedAttributes: changedAttributes,
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (this.getEditorType() !== this.editorType)) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -58,24 +58,25 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
if(this.wiki.isImageTiddler(this.imageSource)) {
|
if(this.wiki.isImageTiddler(this.imageSource)) {
|
||||||
var type = tiddler.fields.type,
|
var type = tiddler.fields.type,
|
||||||
text = tiddler.fields.text,
|
text = tiddler.fields.text,
|
||||||
_canonical_uri = tiddler.fields._canonical_uri;
|
_canonical_uri = tiddler.fields._canonical_uri,
|
||||||
|
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||||
|
deserializerType = typeInfo.deserializerType || type;
|
||||||
// If the tiddler has body text then it doesn't need to be lazily loaded
|
// If the tiddler has body text then it doesn't need to be lazily loaded
|
||||||
if(text) {
|
if(text) {
|
||||||
// Render the appropriate element for the image type
|
// Render the appropriate element for the image type by looking up the encoding in the content type info
|
||||||
switch(type) {
|
var encoding = typeInfo.encoding || "utf8";
|
||||||
case "application/pdf":
|
if (encoding === "base64") {
|
||||||
|
// .pdf .png .jpg etc.
|
||||||
|
src = "data:" + deserializerType + ";base64," + text;
|
||||||
|
if (deserializerType === "application/pdf") {
|
||||||
tag = "embed";
|
tag = "embed";
|
||||||
src = "data:application/pdf;base64," + text;
|
}
|
||||||
break;
|
} else {
|
||||||
case "image/svg+xml":
|
// .svg .tid .xml etc.
|
||||||
src = "data:image/svg+xml," + encodeURIComponent(text);
|
src = "data:" + deserializerType + "," + encodeURIComponent(text);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
src = "data:" + type + ";base64," + text;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else if(_canonical_uri) {
|
} else if(_canonical_uri) {
|
||||||
switch(type) {
|
switch(deserializerType) {
|
||||||
case "application/pdf":
|
case "application/pdf":
|
||||||
tag = "embed";
|
tag = "embed";
|
||||||
src = _canonical_uri;
|
src = _canonical_uri;
|
||||||
@@ -99,6 +100,9 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
if(this.imageClass) {
|
if(this.imageClass) {
|
||||||
domNode.setAttribute("class",this.imageClass);
|
domNode.setAttribute("class",this.imageClass);
|
||||||
}
|
}
|
||||||
|
if(this.imageUsemap) {
|
||||||
|
domNode.setAttribute("usemap",this.imageUsemap);
|
||||||
|
}
|
||||||
if(this.imageWidth) {
|
if(this.imageWidth) {
|
||||||
domNode.setAttribute("width",this.imageWidth);
|
domNode.setAttribute("width",this.imageWidth);
|
||||||
}
|
}
|
||||||
@@ -138,6 +142,7 @@ ImageWidget.prototype.execute = function() {
|
|||||||
this.imageWidth = this.getAttribute("width");
|
this.imageWidth = this.getAttribute("width");
|
||||||
this.imageHeight = this.getAttribute("height");
|
this.imageHeight = this.getAttribute("height");
|
||||||
this.imageClass = this.getAttribute("class");
|
this.imageClass = this.getAttribute("class");
|
||||||
|
this.imageUsemap = this.getAttribute("usemap");
|
||||||
this.imageTooltip = this.getAttribute("tooltip");
|
this.imageTooltip = this.getAttribute("tooltip");
|
||||||
this.imageAlt = this.getAttribute("alt");
|
this.imageAlt = this.getAttribute("alt");
|
||||||
this.lazyLoading = this.getAttribute("loading");
|
this.lazyLoading = this.getAttribute("loading");
|
||||||
@@ -148,7 +153,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
*/
|
*/
|
||||||
ImageWidget.prototype.refresh = function(changedTiddlers) {
|
ImageWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(changedAttributes.source || changedAttributes.width || changedAttributes.height || changedAttributes["class"] || changedAttributes.tooltip || changedTiddlers[this.imageSource]) {
|
if(changedAttributes.source || changedAttributes.width || changedAttributes.height || changedAttributes["class"] || changedAttributes.usemap || changedAttributes.tooltip || changedTiddlers[this.imageSource]) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
|||||||
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
||||||
// Accumulate the <$set> widgets from each tiddler
|
// Accumulate the <$set> widgets from each tiddler
|
||||||
$tw.utils.each(this.tiddlerList,function(title) {
|
$tw.utils.each(this.tiddlerList,function(title) {
|
||||||
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true});
|
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:true});
|
||||||
if(parser) {
|
if(parser) {
|
||||||
var parseTreeNode = parser.tree[0];
|
var parseTreeNode = parser.tree[0];
|
||||||
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ LinkWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
} else {
|
} else {
|
||||||
// Just insert the link text
|
// Just insert the link text
|
||||||
var domNode = this.document.createElement("span");
|
var domNode = this.document.createElement("span");
|
||||||
|
// Assign data- attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
this.domNodes.push(domNode);
|
this.domNodes.push(domNode);
|
||||||
@@ -138,6 +143,11 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
|||||||
widget: this
|
widget: this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Assign data- attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Insert the link into the DOM and render any children
|
// Insert the link into the DOM and render any children
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
@@ -207,8 +217,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
*/
|
*/
|
||||||
LinkWidget.prototype.refresh = function(changedTiddlers) {
|
LinkWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip ||
|
if($tw.utils.count(changedAttributes) > 0 || changedTiddlers[this.to]) {
|
||||||
changedAttributes["class"] || changedAttributes.tabindex || changedAttributes.draggable || changedAttributes.tag) {
|
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -218,3 +227,4 @@ LinkWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
exports.link = LinkWidget;
|
exports.link = LinkWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -28,6 +28,18 @@ Inherit from the base widget class
|
|||||||
*/
|
*/
|
||||||
ListWidget.prototype = new Widget();
|
ListWidget.prototype = new Widget();
|
||||||
|
|
||||||
|
ListWidget.prototype.initialise = function(parseTreeNode,options) {
|
||||||
|
// Bail if parseTreeNode is undefined, meaning that the ListWidget constructor was called without any arguments so that it can be subclassed
|
||||||
|
if(parseTreeNode === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// First call parent constructor to set everything else up
|
||||||
|
Widget.prototype.initialise.call(this,parseTreeNode,options);
|
||||||
|
// Now look for <$list-template> and <$list-empty> widgets as immediate child widgets
|
||||||
|
// This is safe to do during initialization because parse trees never change after creation
|
||||||
|
this.findExplicitTemplates();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Render this widget into the DOM
|
Render this widget into the DOM
|
||||||
*/
|
*/
|
||||||
@@ -38,8 +50,8 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
$tw.modules.applyMethods("storyview",this.storyViews);
|
$tw.modules.applyMethods("storyview",this.storyViews);
|
||||||
}
|
}
|
||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
this.execute();
|
this.execute(changedAttributes);
|
||||||
this.renderChildren(parent,nextSibling);
|
this.renderChildren(parent,nextSibling);
|
||||||
// Construct the storyview
|
// Construct the storyview
|
||||||
var StoryView = this.storyViews[this.storyViewName];
|
var StoryView = this.storyViews[this.storyViewName];
|
||||||
@@ -59,7 +71,8 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
/*
|
/*
|
||||||
Compute the internal state of the widget
|
Compute the internal state of the widget
|
||||||
*/
|
*/
|
||||||
ListWidget.prototype.execute = function() {
|
ListWidget.prototype.execute = function(changedAttributes) {
|
||||||
|
var self = this;
|
||||||
// Get our attributes
|
// Get our attributes
|
||||||
this.template = this.getAttribute("template");
|
this.template = this.getAttribute("template");
|
||||||
this.editTemplate = this.getAttribute("editTemplate");
|
this.editTemplate = this.getAttribute("editTemplate");
|
||||||
@@ -67,6 +80,10 @@ ListWidget.prototype.execute = function() {
|
|||||||
this.counterName = this.getAttribute("counter");
|
this.counterName = this.getAttribute("counter");
|
||||||
this.storyViewName = this.getAttribute("storyview");
|
this.storyViewName = this.getAttribute("storyview");
|
||||||
this.historyTitle = this.getAttribute("history");
|
this.historyTitle = this.getAttribute("history");
|
||||||
|
// Create join template only if needed
|
||||||
|
if(this.join === undefined || (changedAttributes && changedAttributes.join)) {
|
||||||
|
this.join = this.makeJoinTemplate();
|
||||||
|
}
|
||||||
// Compose the list elements
|
// Compose the list elements
|
||||||
this.list = this.getTiddlerList();
|
this.list = this.getTiddlerList();
|
||||||
var members = [],
|
var members = [],
|
||||||
@@ -85,18 +102,57 @@ ListWidget.prototype.execute = function() {
|
|||||||
this.history = [];
|
this.history = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ListWidget.prototype.findExplicitTemplates = function() {
|
||||||
|
var self = this;
|
||||||
|
this.explicitListTemplate = null;
|
||||||
|
this.explicitEmptyTemplate = null;
|
||||||
|
this.explicitJoinTemplate = null;
|
||||||
|
this.hasTemplateInBody = false;
|
||||||
|
var searchChildren = function(childNodes) {
|
||||||
|
var foundInlineTemplate = false;
|
||||||
|
$tw.utils.each(childNodes,function(node) {
|
||||||
|
if(node.type === "list-template") {
|
||||||
|
self.explicitListTemplate = node.children;
|
||||||
|
} else if(node.type === "list-empty") {
|
||||||
|
self.explicitEmptyTemplate = node.children;
|
||||||
|
} else if(node.type === "list-join") {
|
||||||
|
self.explicitJoinTemplate = node.children;
|
||||||
|
} else if(node.type === "element" && node.tag === "p") {
|
||||||
|
searchChildren(node.children);
|
||||||
|
foundInlineTemplate = true;
|
||||||
|
} else {
|
||||||
|
foundInlineTemplate = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return foundInlineTemplate;
|
||||||
|
};
|
||||||
|
this.hasTemplateInBody = searchChildren(this.parseTreeNode.children);
|
||||||
|
}
|
||||||
|
|
||||||
ListWidget.prototype.getTiddlerList = function() {
|
ListWidget.prototype.getTiddlerList = function() {
|
||||||
|
var limit = $tw.utils.getInt(this.getAttribute("limit",""),undefined);
|
||||||
var defaultFilter = "[!is[system]sort[title]]";
|
var defaultFilter = "[!is[system]sort[title]]";
|
||||||
return this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
|
var results = this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
|
||||||
|
if(limit !== undefined) {
|
||||||
|
if(limit >= 0) {
|
||||||
|
results = results.slice(0,limit);
|
||||||
|
} else {
|
||||||
|
results = results.slice(limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
ListWidget.prototype.getEmptyMessage = function() {
|
ListWidget.prototype.getEmptyMessage = function() {
|
||||||
var parser,
|
var parser,
|
||||||
emptyMessage = this.getAttribute("emptyMessage","");
|
emptyMessage = this.getAttribute("emptyMessage");
|
||||||
// this.wiki.parseText() calls
|
// If emptyMessage attribute is not present or empty then look for an explicit empty template
|
||||||
// new Parser(..), which should only be done, if needed, because it's heavy!
|
if(!emptyMessage) {
|
||||||
if (emptyMessage === "") {
|
if(this.explicitEmptyTemplate) {
|
||||||
return [];
|
return this.explicitEmptyTemplate;
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parser = this.wiki.parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true});
|
parser = this.wiki.parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true});
|
||||||
if(parser) {
|
if(parser) {
|
||||||
@@ -106,6 +162,24 @@ ListWidget.prototype.getEmptyMessage = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Compose the template for a join between list items
|
||||||
|
*/
|
||||||
|
ListWidget.prototype.makeJoinTemplate = function() {
|
||||||
|
var parser,
|
||||||
|
join = this.getAttribute("join","");
|
||||||
|
if(join) {
|
||||||
|
parser = this.wiki.parseText("text/vnd.tiddlywiki",join,{parseAsInline:true})
|
||||||
|
if(parser) {
|
||||||
|
return parser.tree;
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.explicitJoinTemplate; // May be null, and that's fine
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compose the template for a list item
|
Compose the template for a list item
|
||||||
*/
|
*/
|
||||||
@@ -114,6 +188,7 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
|||||||
var tiddler = this.wiki.getTiddler(title),
|
var tiddler = this.wiki.getTiddler(title),
|
||||||
isDraft = tiddler && tiddler.hasField("draft.of"),
|
isDraft = tiddler && tiddler.hasField("draft.of"),
|
||||||
template = this.template,
|
template = this.template,
|
||||||
|
join = this.join,
|
||||||
templateTree;
|
templateTree;
|
||||||
if(isDraft && this.editTemplate) {
|
if(isDraft && this.editTemplate) {
|
||||||
template = this.editTemplate;
|
template = this.editTemplate;
|
||||||
@@ -122,22 +197,29 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
|||||||
if(template) {
|
if(template) {
|
||||||
templateTree = [{type: "transclude", attributes: {tiddler: {type: "string", value: template}}}];
|
templateTree = [{type: "transclude", attributes: {tiddler: {type: "string", value: template}}}];
|
||||||
} else {
|
} else {
|
||||||
|
// Check for child nodes of the list widget
|
||||||
if(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {
|
if(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {
|
||||||
templateTree = this.parseTreeNode.children;
|
// Check for a <$list-item> widget
|
||||||
} else {
|
if(this.explicitListTemplate) {
|
||||||
|
templateTree = this.explicitListTemplate;
|
||||||
|
} else if(this.hasTemplateInBody) {
|
||||||
|
templateTree = this.parseTreeNode.children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!templateTree || templateTree.length === 0) {
|
||||||
// Default template is a link to the title
|
// Default template is a link to the title
|
||||||
templateTree = [{type: "element", tag: this.parseTreeNode.isBlock ? "div" : "span", children: [{type: "link", attributes: {to: {type: "string", value: title}}, children: [
|
templateTree = [{type: "element", tag: this.parseTreeNode.isBlock ? "div" : "span", children: [{type: "link", attributes: {to: {type: "string", value: title}}, children: [
|
||||||
{type: "text", text: title}
|
{type: "text", text: title}
|
||||||
]}]}];
|
]}]}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Return the list item
|
// Return the list item
|
||||||
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree};
|
var parseTreeNode = {type: "listitem", itemTitle: title, variableName: this.variableName, children: templateTree, join: join};
|
||||||
|
parseTreeNode.isLast = index === this.list.length - 1;
|
||||||
if(this.counterName) {
|
if(this.counterName) {
|
||||||
parseTreeNode.counter = (index + 1).toString();
|
parseTreeNode.counter = (index + 1).toString();
|
||||||
parseTreeNode.counterName = this.counterName;
|
parseTreeNode.counterName = this.counterName;
|
||||||
parseTreeNode.isFirst = index === 0;
|
parseTreeNode.isFirst = index === 0;
|
||||||
parseTreeNode.isLast = index === this.list.length - 1;
|
|
||||||
}
|
}
|
||||||
return parseTreeNode;
|
return parseTreeNode;
|
||||||
};
|
};
|
||||||
@@ -153,7 +235,7 @@ ListWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
this.storyview.refreshStart(changedTiddlers,changedAttributes);
|
this.storyview.refreshStart(changedTiddlers,changedAttributes);
|
||||||
}
|
}
|
||||||
// Completely refresh if any of our attributes have changed
|
// Completely refresh if any of our attributes have changed
|
||||||
if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {
|
if(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.join || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -225,6 +307,8 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
// If we are providing an counter variable then we must refresh the items, otherwise we can rearrange them
|
// If we are providing an counter variable then we must refresh the items, otherwise we can rearrange them
|
||||||
var hasRefreshed = false,t;
|
var hasRefreshed = false,t;
|
||||||
if(this.counterName) {
|
if(this.counterName) {
|
||||||
|
var mustRefreshOldLast = false;
|
||||||
|
var oldLength = this.children.length;
|
||||||
// Cycle through the list and remove and re-insert the first item that has changed, and all the remaining items
|
// Cycle through the list and remove and re-insert the first item that has changed, and all the remaining items
|
||||||
for(t=0; t<this.list.length; t++) {
|
for(t=0; t<this.list.length; t++) {
|
||||||
if(hasRefreshed || !this.children[t] || this.children[t].parseTreeNode.itemTitle !== this.list[t]) {
|
if(hasRefreshed || !this.children[t] || this.children[t].parseTreeNode.itemTitle !== this.list[t]) {
|
||||||
@@ -232,6 +316,9 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
this.removeListItem(t);
|
this.removeListItem(t);
|
||||||
}
|
}
|
||||||
this.insertListItem(t,this.list[t]);
|
this.insertListItem(t,this.list[t]);
|
||||||
|
if(!hasRefreshed && t === oldLength) {
|
||||||
|
mustRefreshOldLast = true;
|
||||||
|
}
|
||||||
hasRefreshed = true;
|
hasRefreshed = true;
|
||||||
} else {
|
} else {
|
||||||
// Refresh the item we're reusing
|
// Refresh the item we're reusing
|
||||||
@@ -239,6 +326,12 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
hasRefreshed = hasRefreshed || refreshed;
|
hasRefreshed = hasRefreshed || refreshed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If items were inserted then we must recreate the item that used to be at the last position as it is no longer last
|
||||||
|
if(mustRefreshOldLast && oldLength > 0) {
|
||||||
|
var oldLastIdx = oldLength-1;
|
||||||
|
this.removeListItem(oldLastIdx);
|
||||||
|
this.insertListItem(oldLastIdx,this.list[oldLastIdx]);
|
||||||
|
}
|
||||||
// If there are items to remove and we have not refreshed then recreate the item that will now be at the last position
|
// If there are items to remove and we have not refreshed then recreate the item that will now be at the last position
|
||||||
if(!hasRefreshed && this.children.length > this.list.length) {
|
if(!hasRefreshed && this.children.length > this.list.length) {
|
||||||
this.removeListItem(this.list.length-1);
|
this.removeListItem(this.list.length-1);
|
||||||
@@ -246,10 +339,29 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Cycle through the list, inserting and removing list items as needed
|
// Cycle through the list, inserting and removing list items as needed
|
||||||
|
var mustRecreateLastItem = false;
|
||||||
|
if(this.join && this.join.length) {
|
||||||
|
if(this.children.length !== this.list.length) {
|
||||||
|
mustRecreateLastItem = true;
|
||||||
|
} else if(prevList[prevList.length-1] !== this.list[this.list.length-1]) {
|
||||||
|
mustRecreateLastItem = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var isLast = false, wasLast = false;
|
||||||
for(t=0; t<this.list.length; t++) {
|
for(t=0; t<this.list.length; t++) {
|
||||||
|
isLast = t === this.list.length-1;
|
||||||
var index = this.findListItem(t,this.list[t]);
|
var index = this.findListItem(t,this.list[t]);
|
||||||
|
wasLast = index === this.children.length-1;
|
||||||
|
if(wasLast && (index !== t || this.children.length !== this.list.length)) {
|
||||||
|
mustRecreateLastItem = !!(this.join && this.join.length);
|
||||||
|
}
|
||||||
if(index === undefined) {
|
if(index === undefined) {
|
||||||
// The list item must be inserted
|
// The list item must be inserted
|
||||||
|
if(isLast && mustRecreateLastItem && t>0) {
|
||||||
|
// First re-create previosly-last item that will no longer be last
|
||||||
|
this.removeListItem(t-1);
|
||||||
|
this.insertListItem(t-1,this.list[t-1]);
|
||||||
|
}
|
||||||
this.insertListItem(t,this.list[t]);
|
this.insertListItem(t,this.list[t]);
|
||||||
hasRefreshed = true;
|
hasRefreshed = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -258,9 +370,15 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
this.removeListItem(n);
|
this.removeListItem(n);
|
||||||
hasRefreshed = true;
|
hasRefreshed = true;
|
||||||
}
|
}
|
||||||
// Refresh the item we're reusing
|
// Refresh the item we're reusing, or recreate if necessary
|
||||||
var refreshed = this.children[t].refresh(changedTiddlers);
|
if(mustRecreateLastItem && (isLast || wasLast)) {
|
||||||
hasRefreshed = hasRefreshed || refreshed;
|
this.removeListItem(t);
|
||||||
|
this.insertListItem(t,this.list[t]);
|
||||||
|
hasRefreshed = true;
|
||||||
|
} else {
|
||||||
|
var refreshed = this.children[t].refresh(changedTiddlers);
|
||||||
|
hasRefreshed = hasRefreshed || refreshed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,8 +468,17 @@ ListItemWidget.prototype.execute = function() {
|
|||||||
this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "yes" : "no");
|
this.setVariable(this.parseTreeNode.counterName + "-first",this.parseTreeNode.isFirst ? "yes" : "no");
|
||||||
this.setVariable(this.parseTreeNode.counterName + "-last",this.parseTreeNode.isLast ? "yes" : "no");
|
this.setVariable(this.parseTreeNode.counterName + "-last",this.parseTreeNode.isLast ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
// Add join if needed
|
||||||
|
var children = this.parseTreeNode.children,
|
||||||
|
join = this.parseTreeNode.join;
|
||||||
|
if(join && join.length && !this.parseTreeNode.isLast) {
|
||||||
|
children = children.slice(0);
|
||||||
|
$tw.utils.each(join,function(joinNode) {
|
||||||
|
children.push(joinNode);
|
||||||
|
})
|
||||||
|
}
|
||||||
// Construct the child widgets
|
// Construct the child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets(children);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -363,4 +490,37 @@ ListItemWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
|
|
||||||
exports.listitem = ListItemWidget;
|
exports.listitem = ListItemWidget;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Make <$list-template> and <$list-empty> widgets that do nothing
|
||||||
|
*/
|
||||||
|
var ListTemplateWidget = function(parseTreeNode,options) {
|
||||||
|
// Main initialisation inherited from widget.js
|
||||||
|
this.initialise(parseTreeNode,options);
|
||||||
|
};
|
||||||
|
ListTemplateWidget.prototype = new Widget();
|
||||||
|
ListTemplateWidget.prototype.render = function() {}
|
||||||
|
ListTemplateWidget.prototype.refresh = function() { return false; }
|
||||||
|
|
||||||
|
exports["list-template"] = ListTemplateWidget;
|
||||||
|
|
||||||
|
var ListEmptyWidget = function(parseTreeNode,options) {
|
||||||
|
// Main initialisation inherited from widget.js
|
||||||
|
this.initialise(parseTreeNode,options);
|
||||||
|
};
|
||||||
|
ListEmptyWidget.prototype = new Widget();
|
||||||
|
ListEmptyWidget.prototype.render = function() {}
|
||||||
|
ListEmptyWidget.prototype.refresh = function() { return false; }
|
||||||
|
|
||||||
|
exports["list-empty"] = ListEmptyWidget;
|
||||||
|
|
||||||
|
var ListJoinWidget = function(parseTreeNode,options) {
|
||||||
|
// Main initialisation inherited from widget.js
|
||||||
|
this.initialise(parseTreeNode,options);
|
||||||
|
};
|
||||||
|
ListJoinWidget.prototype = new Widget();
|
||||||
|
ListJoinWidget.prototype.render = function() {}
|
||||||
|
ListJoinWidget.prototype.refresh = function() { return false; }
|
||||||
|
|
||||||
|
exports["list-join"] = ListJoinWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
);
|
);
|
||||||
this.inputDomNode = this.document.createElement("input");
|
this.inputDomNode = this.document.createElement("input");
|
||||||
this.inputDomNode.setAttribute("type","radio");
|
this.inputDomNode.setAttribute("type","radio");
|
||||||
|
this.assignAttributes(this.inputDomNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
if(isChecked) {
|
if(isChecked) {
|
||||||
this.inputDomNode.checked = true;
|
this.inputDomNode.checked = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ RangeWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.inputDomNode.setAttribute("disabled",true);
|
this.inputDomNode.setAttribute("disabled",true);
|
||||||
}
|
}
|
||||||
this.inputDomNode.value = this.getValue();
|
this.inputDomNode.value = this.getValue();
|
||||||
|
this.assignAttributes(this.inputDomNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
// Add a click event handler
|
// Add a click event handler
|
||||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||||
{name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"},
|
{name:"mousedown", handlerObject:this, handlerMethod:"handleMouseDownEvent"},
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ Scrollable widget
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var DEBOUNCE_INTERVAL = 100; // Delay after last scroll event before updating the bound tiddler
|
||||||
|
|
||||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||||
|
|
||||||
var ScrollableWidget = function(parseTreeNode,options) {
|
var ScrollableWidget = function(parseTreeNode,options) {
|
||||||
@@ -171,6 +173,53 @@ ScrollableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
parent.insertBefore(this.outerDomNode,nextSibling);
|
parent.insertBefore(this.outerDomNode,nextSibling);
|
||||||
this.renderChildren(this.innerDomNode,null);
|
this.renderChildren(this.innerDomNode,null);
|
||||||
this.domNodes.push(this.outerDomNode);
|
this.domNodes.push(this.outerDomNode);
|
||||||
|
// If the scroll position is bound to a tiddler
|
||||||
|
if(this.scrollableBind) {
|
||||||
|
// After a delay for rendering, scroll to the bound position
|
||||||
|
this.updateScrollPositionFromBoundTiddler();
|
||||||
|
// Set up event listener
|
||||||
|
this.currentListener = this.listenerFunction.bind(this);
|
||||||
|
this.outerDomNode.addEventListener("scroll", this.currentListener);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ScrollableWidget.prototype.listenerFunction = function(event) {
|
||||||
|
self = this;
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
this.timeout = setTimeout(function() {
|
||||||
|
var existingTiddler = self.wiki.getTiddler(self.scrollableBind),
|
||||||
|
newTiddlerFields = {
|
||||||
|
title: self.scrollableBind,
|
||||||
|
"scroll-left": self.outerDomNode.scrollLeft.toString(),
|
||||||
|
"scroll-top": self.outerDomNode.scrollTop.toString()
|
||||||
|
};
|
||||||
|
if(!existingTiddler || (existingTiddler.fields["title"] !== newTiddlerFields["title"]) || (existingTiddler.fields["scroll-left"] !== newTiddlerFields["scroll-left"] || existingTiddler.fields["scroll-top"] !== newTiddlerFields["scroll-top"])) {
|
||||||
|
self.wiki.addTiddler(new $tw.Tiddler(existingTiddler,newTiddlerFields));
|
||||||
|
}
|
||||||
|
}, DEBOUNCE_INTERVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollableWidget.prototype.updateScrollPositionFromBoundTiddler = function() {
|
||||||
|
// Bail if we're running on the fakedom
|
||||||
|
if(!this.outerDomNode.scrollTo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var tiddler = this.wiki.getTiddler(this.scrollableBind);
|
||||||
|
if(tiddler) {
|
||||||
|
var scrollLeftTo = this.outerDomNode.scrollLeft;
|
||||||
|
if(parseFloat(tiddler.fields["scroll-left"]).toString() === tiddler.fields["scroll-left"]) {
|
||||||
|
scrollLeftTo = parseFloat(tiddler.fields["scroll-left"]);
|
||||||
|
}
|
||||||
|
var scrollTopTo = this.outerDomNode.scrollTop;
|
||||||
|
if(parseFloat(tiddler.fields["scroll-top"]).toString() === tiddler.fields["scroll-top"]) {
|
||||||
|
scrollTopTo = parseFloat(tiddler.fields["scroll-top"]);
|
||||||
|
}
|
||||||
|
this.outerDomNode.scrollTo({
|
||||||
|
top: scrollTopTo,
|
||||||
|
left: scrollLeftTo,
|
||||||
|
behavior: "instant"
|
||||||
|
})
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -178,6 +227,7 @@ Compute the internal state of the widget
|
|||||||
*/
|
*/
|
||||||
ScrollableWidget.prototype.execute = function() {
|
ScrollableWidget.prototype.execute = function() {
|
||||||
// Get attributes
|
// Get attributes
|
||||||
|
this.scrollableBind = this.getAttribute("bind");
|
||||||
this.fallthrough = this.getAttribute("fallthrough","yes");
|
this.fallthrough = this.getAttribute("fallthrough","yes");
|
||||||
this["class"] = this.getAttribute("class");
|
this["class"] = this.getAttribute("class");
|
||||||
// Make child widgets
|
// Make child widgets
|
||||||
@@ -193,7 +243,22 @@ ScrollableWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
// If the bound tiddler has changed, update the eventListener and update scroll position
|
||||||
|
if(changedAttributes["bind"]) {
|
||||||
|
if(this.currentListener) {
|
||||||
|
this.outerDomNode.removeEventListener("scroll", this.currentListener, false);
|
||||||
|
}
|
||||||
|
this.scrollableBind = this.getAttribute("bind");
|
||||||
|
this.currentListener = this.listenerFunction.bind(this);
|
||||||
|
this.outerDomNode.addEventListener("scroll", this.currentListener);
|
||||||
|
}
|
||||||
|
// Refresh children
|
||||||
|
var result = this.refreshChildren(changedTiddlers);
|
||||||
|
// If the bound tiddler has changed, update scroll position
|
||||||
|
if(changedAttributes["bind"] || changedTiddlers[this.getAttribute("bind")]) {
|
||||||
|
this.updateScrollPositionFromBoundTiddler();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.scrollable = ScrollableWidget;
|
exports.scrollable = ScrollableWidget;
|
||||||
|
|||||||
@@ -40,7 +40,31 @@ SelectWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
this.computeAttributes();
|
this.computeAttributes();
|
||||||
this.execute();
|
this.execute();
|
||||||
this.renderChildren(parent,nextSibling);
|
//Create element
|
||||||
|
var domNode = this.document.createElement("select");
|
||||||
|
if(this.selectClass) {
|
||||||
|
domNode.className = this.selectClass;
|
||||||
|
}
|
||||||
|
// Assign data- attributes
|
||||||
|
this.assignAttributes(domNode,{
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
|
if(this.selectMultiple) {
|
||||||
|
domNode.setAttribute("multiple","multiple");
|
||||||
|
}
|
||||||
|
if(this.selectSize) {
|
||||||
|
domNode.setAttribute("size",this.selectSize);
|
||||||
|
}
|
||||||
|
if(this.selectTabindex) {
|
||||||
|
domNode.setAttribute("tabindex",this.selectTabindex);
|
||||||
|
}
|
||||||
|
if(this.selectTooltip) {
|
||||||
|
domNode.setAttribute("title",this.selectTooltip);
|
||||||
|
}
|
||||||
|
this.parentDomNode.insertBefore(domNode,nextSibling);
|
||||||
|
this.renderChildren(domNode,null);
|
||||||
|
this.domNodes.push(domNode);
|
||||||
this.setSelectValue();
|
this.setSelectValue();
|
||||||
if(this.selectFocus == "yes") {
|
if(this.selectFocus == "yes") {
|
||||||
this.getSelectDomNode().focus();
|
this.getSelectDomNode().focus();
|
||||||
@@ -113,7 +137,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
|||||||
Get the DOM node of the select element
|
Get the DOM node of the select element
|
||||||
*/
|
*/
|
||||||
SelectWidget.prototype.getSelectDomNode = function() {
|
SelectWidget.prototype.getSelectDomNode = function() {
|
||||||
return this.children[0].domNodes[0];
|
return this.domNodes[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return an array of the selected opion values
|
// Return an array of the selected opion values
|
||||||
@@ -145,27 +169,11 @@ SelectWidget.prototype.execute = function() {
|
|||||||
this.selectDefault = this.getAttribute("default");
|
this.selectDefault = this.getAttribute("default");
|
||||||
this.selectMultiple = this.getAttribute("multiple", false);
|
this.selectMultiple = this.getAttribute("multiple", false);
|
||||||
this.selectSize = this.getAttribute("size");
|
this.selectSize = this.getAttribute("size");
|
||||||
|
this.selectTabindex = this.getAttribute("tabindex");
|
||||||
this.selectTooltip = this.getAttribute("tooltip");
|
this.selectTooltip = this.getAttribute("tooltip");
|
||||||
this.selectFocus = this.getAttribute("focus");
|
this.selectFocus = this.getAttribute("focus");
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
var selectNode = {
|
this.makeChildWidgets();
|
||||||
type: "element",
|
|
||||||
tag: "select",
|
|
||||||
children: this.parseTreeNode.children
|
|
||||||
};
|
|
||||||
if(this.selectClass) {
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"class",this.selectClass);
|
|
||||||
}
|
|
||||||
if(this.selectMultiple) {
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"multiple","multiple");
|
|
||||||
}
|
|
||||||
if(this.selectSize) {
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize);
|
|
||||||
}
|
|
||||||
if(this.selectTooltip) {
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip);
|
|
||||||
}
|
|
||||||
this.makeChildWidgets([selectNode]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -174,17 +182,21 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
// If we're using a different tiddler/field/index then completely refresh ourselves
|
// If we're using a different tiddler/field/index then completely refresh ourselves
|
||||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip) {
|
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
// If the target tiddler value has changed, just update setting and refresh the children
|
|
||||||
} else {
|
} else {
|
||||||
if(changedAttributes.class) {
|
if(changedAttributes.class) {
|
||||||
this.selectClass = this.getAttribute("class");
|
this.selectClass = this.getAttribute("class");
|
||||||
this.getSelectDomNode().setAttribute("class",this.selectClass);
|
this.getSelectDomNode().setAttribute("class",this.selectClass);
|
||||||
}
|
}
|
||||||
|
this.assignAttributes(this.getSelectDomNode(),{
|
||||||
|
changedAttributes: changedAttributes,
|
||||||
|
sourcePrefix: "data-",
|
||||||
|
destPrefix: "data-"
|
||||||
|
});
|
||||||
var childrenRefreshed = this.refreshChildren(changedTiddlers);
|
var childrenRefreshed = this.refreshChildren(changedTiddlers);
|
||||||
|
// If the target tiddler value has changed, just update setting and refresh the children
|
||||||
if(changedTiddlers[this.selectTitle] || childrenRefreshed) {
|
if(changedTiddlers[this.selectTitle] || childrenRefreshed) {
|
||||||
this.setSelectValue();
|
this.setSelectValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,27 +41,43 @@ TranscludeWidget.prototype.execute = function() {
|
|||||||
this.collectAttributes();
|
this.collectAttributes();
|
||||||
this.collectStringParameters();
|
this.collectStringParameters();
|
||||||
this.collectSlotFillParameters();
|
this.collectSlotFillParameters();
|
||||||
// Get the parse tree nodes that we are transcluding
|
// Determine whether we're being used in inline or block mode
|
||||||
var target = this.getTransclusionTarget(),
|
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||||
parseTreeNodes = target.parseTreeNodes;
|
if(this.transcludeMode === "inline") {
|
||||||
this.sourceText = target.text;
|
parseAsInline = true;
|
||||||
this.parserType = target.type;
|
} else if(this.transcludeMode === "block") {
|
||||||
this.parseAsInline = target.parseAsInline;
|
parseAsInline = false;
|
||||||
|
}
|
||||||
|
// Set 'thisTiddler'
|
||||||
|
this.setVariable("thisTiddler",this.transcludeTitle);
|
||||||
|
var parseTreeNodes, target;
|
||||||
// Process the transclusion according to the output type
|
// Process the transclusion according to the output type
|
||||||
switch(this.transcludeOutput || "text/html") {
|
switch(this.transcludeOutput || "text/html") {
|
||||||
case "text/html":
|
case "text/html":
|
||||||
// No further processing required
|
// Return the parse tree nodes of the target
|
||||||
|
target = this.parseTransclusionTarget(parseAsInline);
|
||||||
|
this.parseAsInline = target.parseAsInline;
|
||||||
|
parseTreeNodes = target.parseTreeNodes;
|
||||||
break;
|
break;
|
||||||
case "text/raw":
|
case "text/raw":
|
||||||
// Just return the raw text
|
// Just return the raw text
|
||||||
parseTreeNodes = [{type: "text", text: this.sourceText}];
|
target = this.getTransclusionTarget();
|
||||||
|
parseTreeNodes = [{type: "text", text: target.text}];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// text/plain
|
// "text/plain" is the plain text result of wikifying the text
|
||||||
var plainText = this.wiki.renderText("text/plain",this.parserType,this.sourceText,{parentWidget: this});
|
target = this.parseTransclusionTarget(parseAsInline);
|
||||||
parseTreeNodes = [{type: "text", text: plainText}];
|
var widgetNode = this.wiki.makeWidget(target.parser,{
|
||||||
|
parentWidget: this,
|
||||||
|
document: $tw.fakeDocument
|
||||||
|
});
|
||||||
|
var container = $tw.fakeDocument.createElement("div");
|
||||||
|
widgetNode.render(container,null);
|
||||||
|
parseTreeNodes = [{type: "text", text: container.textContent}];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this.sourceText = target.text;
|
||||||
|
this.parserType = target.type;
|
||||||
// Set the legacy transclusion context variables only if we're not transcluding a variable
|
// Set the legacy transclusion context variables only if we're not transcluding a variable
|
||||||
if(!this.transcludeVariable) {
|
if(!this.transcludeVariable) {
|
||||||
var recursionMarker = this.makeRecursionMarker();
|
var recursionMarker = this.makeRecursionMarker();
|
||||||
@@ -93,6 +109,7 @@ TranscludeWidget.prototype.collectAttributes = function() {
|
|||||||
this.recursionMarker = this.getAttribute("recursionMarker","yes");
|
this.recursionMarker = this.getAttribute("recursionMarker","yes");
|
||||||
} else {
|
} else {
|
||||||
this.transcludeVariable = this.getAttribute("$variable");
|
this.transcludeVariable = this.getAttribute("$variable");
|
||||||
|
this.transcludeVariableIsFunction = false;
|
||||||
this.transcludeType = this.getAttribute("$type");
|
this.transcludeType = this.getAttribute("$type");
|
||||||
this.transcludeOutput = this.getAttribute("$output","text/html");
|
this.transcludeOutput = this.getAttribute("$output","text/html");
|
||||||
this.transcludeTitle = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
this.transcludeTitle = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
||||||
@@ -158,17 +175,46 @@ TranscludeWidget.prototype.collectSlotFillParameters = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get transcluded parse tree nodes as an object {parser:,text:,type:}
|
Get transcluded details as an object {text:,type:}
|
||||||
*/
|
*/
|
||||||
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
// Determine whether we're being used in inline or block mode
|
var text;
|
||||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
// Return the text and type of the target
|
||||||
if(this.transcludeMode === "inline") {
|
if(this.hasAttribute("$variable")) {
|
||||||
parseAsInline = true;
|
if(this.transcludeVariable) {
|
||||||
} else if(this.transcludeMode === "block") {
|
// Transcluding a variable
|
||||||
parseAsInline = false;
|
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
||||||
|
this.transcludeVariableIsFunction = variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition;
|
||||||
|
text = variableInfo.text;
|
||||||
|
this.transcludeFunctionResult = text;
|
||||||
|
return {
|
||||||
|
text: variableInfo.text,
|
||||||
|
type: this.transcludeType
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Transcluding a text reference
|
||||||
|
var parserInfo = this.wiki.getTextReferenceParserInfo(
|
||||||
|
this.transcludeTitle,
|
||||||
|
this.transcludeField,
|
||||||
|
this.transcludeIndex,
|
||||||
|
{
|
||||||
|
subTiddler: this.transcludeSubTiddler,
|
||||||
|
defaultType: this.transcludeType
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
text: parserInfo.text,
|
||||||
|
type: parserInfo.type
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get transcluded parse tree nodes as an object {text:,type:,parseTreeNodes:,parseAsInline:}
|
||||||
|
*/
|
||||||
|
TranscludeWidget.prototype.parseTransclusionTarget = function(parseAsInline) {
|
||||||
|
var self = this;
|
||||||
var parser;
|
var parser;
|
||||||
// Get the parse tree
|
// Get the parse tree
|
||||||
if(this.hasAttribute("$variable")) {
|
if(this.hasAttribute("$variable")) {
|
||||||
@@ -176,22 +222,24 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
// Transcluding a variable
|
// Transcluding a variable
|
||||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
|
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
|
||||||
srcVariable = variableInfo && variableInfo.srcVariable;
|
srcVariable = variableInfo && variableInfo.srcVariable;
|
||||||
|
if(srcVariable && srcVariable.isFunctionDefinition) {
|
||||||
|
this.transcludeVariableIsFunction = true;
|
||||||
|
this.transcludeFunctionResult = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
||||||
|
}
|
||||||
if(variableInfo.text) {
|
if(variableInfo.text) {
|
||||||
if(srcVariable.isFunctionDefinition) {
|
if(srcVariable && srcVariable.isFunctionDefinition) {
|
||||||
// Function to return parameters by name or position
|
|
||||||
var result = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
|
||||||
parser = {
|
parser = {
|
||||||
tree: [{
|
tree: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: result
|
text: this.transcludeFunctionResult
|
||||||
}],
|
}],
|
||||||
source: result,
|
source: this.transcludeFunctionResult,
|
||||||
type: "text/vnd.tiddlywiki"
|
type: "text/vnd.tiddlywiki"
|
||||||
};
|
};
|
||||||
if(parseAsInline) {
|
if(parseAsInline) {
|
||||||
parser.tree[0] = {
|
parser.tree[0] = {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: result
|
text: this.transcludeFunctionResult
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
parser.tree[0] = {
|
parser.tree[0] = {
|
||||||
@@ -199,7 +247,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
tag: "p",
|
tag: "p",
|
||||||
children: [{
|
children: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: result
|
text: this.transcludeFunctionResult
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,7 +256,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
if(variableInfo.isCacheable && srcVariable[cacheKey]) {
|
if(variableInfo.isCacheable && srcVariable[cacheKey]) {
|
||||||
parser = srcVariable[cacheKey];
|
parser = srcVariable[cacheKey];
|
||||||
} else {
|
} else {
|
||||||
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable.configTrimWhiteSpace});
|
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable && srcVariable.configTrimWhiteSpace});
|
||||||
if(variableInfo.isCacheable) {
|
if(variableInfo.isCacheable) {
|
||||||
srcVariable[cacheKey] = parser;
|
srcVariable[cacheKey] = parser;
|
||||||
}
|
}
|
||||||
@@ -216,7 +264,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
}
|
}
|
||||||
if(parser) {
|
if(parser) {
|
||||||
// Add parameters widget for procedures and custom widgets
|
// Add parameters widget for procedures and custom widgets
|
||||||
if(srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition) {
|
if(srcVariable && (srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition)) {
|
||||||
parser = {
|
parser = {
|
||||||
tree: [
|
tree: [
|
||||||
{
|
{
|
||||||
@@ -235,7 +283,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
}
|
}
|
||||||
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
|
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
|
||||||
});
|
});
|
||||||
} else {
|
} else if(srcVariable && !srcVariable.isFunctionDefinition) {
|
||||||
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
||||||
parser = {
|
parser = {
|
||||||
tree: [
|
tree: [
|
||||||
@@ -266,27 +314,14 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
defaultType: this.transcludeType
|
defaultType: this.transcludeType
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Set 'thisTiddler'
|
|
||||||
this.setVariable("thisTiddler",this.transcludeTitle);
|
|
||||||
// Return the parse tree
|
// Return the parse tree
|
||||||
if(parser) {
|
return {
|
||||||
return {
|
parser: parser,
|
||||||
parser: parser,
|
parseTreeNodes: parser ? parser.tree : (this.slotFillParseTrees["ts-missing"] || []),
|
||||||
parseTreeNodes: parser.tree,
|
parseAsInline: parseAsInline,
|
||||||
parseAsInline: parseAsInline,
|
text: parser && parser.source,
|
||||||
text: parser.source,
|
type: parser && parser.type
|
||||||
type: parser.type
|
};
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// If there's no parse tree then return the missing slot value
|
|
||||||
return {
|
|
||||||
parser: null,
|
|
||||||
parseTreeNodes: (this.slotFillParseTrees["ts-missing"] || []),
|
|
||||||
parseAsInline: parseAsInline,
|
|
||||||
text: null,
|
|
||||||
type: null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -401,12 +436,19 @@ TranscludeWidget.prototype.parserNeedsRefresh = function() {
|
|||||||
return (this.sourceText === undefined || parserInfo.sourceText !== this.sourceText || parserInfo.parserType !== this.parserType)
|
return (this.sourceText === undefined || parserInfo.sourceText !== this.sourceText || parserInfo.parserType !== this.parserType)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TranscludeWidget.prototype.functionNeedsRefresh = function() {
|
||||||
|
var oldResult = this.transcludeFunctionResult;
|
||||||
|
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
||||||
|
var newResult = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
||||||
|
return oldResult !== newResult;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||||
*/
|
*/
|
||||||
TranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
TranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(($tw.utils.count(changedAttributes) > 0) || (!this.transcludeVariable && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) {
|
if(($tw.utils.count(changedAttributes) > 0) || (this.transcludeVariableIsFunction && this.functionNeedsRefresh()) || (!this.transcludeVariable && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
} else if(variable.isFunctionDefinition) {
|
} else if(variable.isFunctionDefinition) {
|
||||||
// Function evaluations
|
// Function evaluations
|
||||||
params = self.resolveVariableParameters(variable.params,actualParams);
|
params = self.resolveVariableParameters(variable.params,actualParams);
|
||||||
var variables = Object.create(null);
|
var variables = options.variables || Object.create(null);
|
||||||
// Apply default parameter values
|
// Apply default parameter values
|
||||||
$tw.utils.each(variable.params,function(param,index) {
|
$tw.utils.each(variable.params,function(param,index) {
|
||||||
if(param["default"]) {
|
if(param["default"]) {
|
||||||
@@ -182,8 +182,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: text,
|
text: text,
|
||||||
resultList: [text],
|
resultList: [text]
|
||||||
srcVariable: {}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -380,6 +379,8 @@ Widget.prototype.computeAttribute = function(attribute) {
|
|||||||
} else if(attribute.type === "macro") {
|
} else if(attribute.type === "macro") {
|
||||||
var variableInfo = this.getVariableInfo(attribute.value.name,{params: attribute.value.params});
|
var variableInfo = this.getVariableInfo(attribute.value.name,{params: attribute.value.params});
|
||||||
value = variableInfo.text;
|
value = variableInfo.text;
|
||||||
|
} else if(attribute.type === "substituted") {
|
||||||
|
value = this.wiki.getSubstitutedText(attribute.rawValue,this) || "";
|
||||||
} else { // String attribute
|
} else { // String attribute
|
||||||
value = attribute.value;
|
value = attribute.value;
|
||||||
}
|
}
|
||||||
@@ -412,16 +413,34 @@ Widget.prototype.getAttribute = function(name,defaultText) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Assign the computed attributes of the widget to a domNode
|
Assign the common attributes of the widget to a domNode
|
||||||
options include:
|
options include:
|
||||||
excludeEventAttributes: ignores attributes whose name begins with "on"
|
sourcePrefix: prefix of attributes that are to be directly assigned (defaults to the empty string meaning all attributes)
|
||||||
|
destPrefix: prefix to be applied to attribute names that are to be directly assigned (defaults to the emtpy string which means no prefix is added)
|
||||||
|
changedAttributes: hashmap by attribute name of attributes to process (if missing, process all attributes)
|
||||||
|
excludeEventAttributes: ignores attributes whose name would begin with "on"
|
||||||
*/
|
*/
|
||||||
Widget.prototype.assignAttributes = function(domNode,options) {
|
Widget.prototype.assignAttributes = function(domNode,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var self = this;
|
var self = this,
|
||||||
|
changedAttributes = options.changedAttributes || this.attributes,
|
||||||
|
sourcePrefix = options.sourcePrefix || "",
|
||||||
|
destPrefix = options.destPrefix || "",
|
||||||
|
EVENT_ATTRIBUTE_PREFIX = "on";
|
||||||
var assignAttribute = function(name,value) {
|
var assignAttribute = function(name,value) {
|
||||||
|
// Process any style attributes before considering sourcePrefix and destPrefix
|
||||||
|
if(name.substr(0,6) === "style." && name.length > 6) {
|
||||||
|
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Check if the sourcePrefix is a match
|
||||||
|
if(name.substr(0,sourcePrefix.length) === sourcePrefix) {
|
||||||
|
name = destPrefix + name.substr(sourcePrefix.length);
|
||||||
|
} else {
|
||||||
|
value = undefined;
|
||||||
|
}
|
||||||
// Check for excluded attribute names
|
// Check for excluded attribute names
|
||||||
if(options.excludeEventAttributes && name.substr(0,2) === "on") {
|
if(options.excludeEventAttributes && name.substr(0,2).toLowerCase() === EVENT_ATTRIBUTE_PREFIX) {
|
||||||
value = undefined;
|
value = undefined;
|
||||||
}
|
}
|
||||||
if(value !== undefined) {
|
if(value !== undefined) {
|
||||||
@@ -431,26 +450,24 @@ Widget.prototype.assignAttributes = function(domNode,options) {
|
|||||||
namespace = "http://www.w3.org/1999/xlink";
|
namespace = "http://www.w3.org/1999/xlink";
|
||||||
name = name.substr(6);
|
name = name.substr(6);
|
||||||
}
|
}
|
||||||
// Handle styles
|
// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
|
||||||
if(name.substr(0,6) === "style." && name.length > 6) {
|
try {
|
||||||
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
|
domNode.setAttributeNS(namespace,name,value);
|
||||||
} else {
|
} catch(e) {
|
||||||
// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)
|
|
||||||
try {
|
|
||||||
domNode.setAttributeNS(namespace,name,value);
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
// Not all parse tree nodes have the orderedAttributes property
|
// If the parse tree node has the orderedAttributes property then use that order
|
||||||
if(this.parseTreeNode.orderedAttributes) {
|
if(this.parseTreeNode.orderedAttributes) {
|
||||||
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
|
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
|
||||||
assignAttribute(attribute.name,self.attributes[attribute.name]);
|
if(attribute.name in changedAttributes) {
|
||||||
});
|
assignAttribute(attribute.name,self.getAttribute(attribute.name));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Otherwise update each changed attribute irrespective of order
|
||||||
} else {
|
} else {
|
||||||
$tw.utils.each(Object.keys(self.attributes).sort(),function(name) {
|
$tw.utils.each(changedAttributes,function(value,name) {
|
||||||
assignAttribute(name,self.attributes[name]);
|
assignAttribute(name,self.getAttribute(name));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1063,6 +1063,34 @@ exports.getTextReferenceParserInfo = function(title,field,index,options) {
|
|||||||
return parserInfo;
|
return parserInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parse a block of text of a specified MIME type
|
||||||
|
text: text on which to perform substitutions
|
||||||
|
widget
|
||||||
|
options: see below
|
||||||
|
Options include:
|
||||||
|
substitutions: an optional array of substitutions
|
||||||
|
*/
|
||||||
|
exports.getSubstitutedText = function(text,widget,options) {
|
||||||
|
options = options || {};
|
||||||
|
text = text || "";
|
||||||
|
var self = this,
|
||||||
|
substitutions = options.substitutions || [],
|
||||||
|
output;
|
||||||
|
// Evaluate embedded filters and substitute with first result
|
||||||
|
output = text.replace(/\$\{([\S\s]+?)\}\$/g, function(match,filter) {
|
||||||
|
return self.filterTiddlers(filter,widget)[0] || "";
|
||||||
|
});
|
||||||
|
// Process any substitutions provided in options
|
||||||
|
$tw.utils.each(substitutions,function(substitute) {
|
||||||
|
output = $tw.utils.replaceString(output,new RegExp("\\$" + $tw.utils.escapeRegExp(substitute.name) + "\\$","mg"),substitute.value);
|
||||||
|
});
|
||||||
|
// Substitute any variable references with their values
|
||||||
|
return output.replace(/\$\(([^\)\$]+)\)\$/g, function(match,varname) {
|
||||||
|
return widget.getVariable(varname,{defaultValue: ""})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Make a widget tree for a parse tree
|
Make a widget tree for a parse tree
|
||||||
parser: parser object
|
parser: parser object
|
||||||
@@ -1259,7 +1287,7 @@ exports.search = function(text,options) {
|
|||||||
console.log("Regexp error parsing /(" + text + ")/" + flags + ": ",e);
|
console.log("Regexp error parsing /(" + text + ")/" + flags + ": ",e);
|
||||||
}
|
}
|
||||||
} else if(options.some) {
|
} else if(options.some) {
|
||||||
terms = text.trim().split(/ +/);
|
terms = text.trim().split(/[^\S\xA0]+/);
|
||||||
if(terms.length === 1 && terms[0] === "") {
|
if(terms.length === 1 && terms[0] === "") {
|
||||||
searchTermsRegExps = null;
|
searchTermsRegExps = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -1270,7 +1298,7 @@ exports.search = function(text,options) {
|
|||||||
searchTermsRegExps.push(new RegExp("(" + regExpStr + ")",flags));
|
searchTermsRegExps.push(new RegExp("(" + regExpStr + ")",flags));
|
||||||
}
|
}
|
||||||
} else { // default: words
|
} else { // default: words
|
||||||
terms = text.split(/ +/);
|
terms = text.split(/[^\S\xA0]+/);
|
||||||
if(terms.length === 1 && terms[0] === "") {
|
if(terms.length === 1 && terms[0] === "") {
|
||||||
searchTermsRegExps = null;
|
searchTermsRegExps = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -1415,6 +1443,14 @@ exports.checkTiddlerText = function(title,targetText,options) {
|
|||||||
return text === targetText;
|
return text === targetText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Execute an action string without an associated context widget
|
||||||
|
*/
|
||||||
|
exports.invokeActionString = function(actions,event,variables,options) {
|
||||||
|
var widget = this.makeWidget(null,{parentWidget: options.parentWidget});
|
||||||
|
widget.invokeActionString(actions,null,event,variables);
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ modal-footer-background: #f5f5f5
|
|||||||
modal-footer-border: #dddddd
|
modal-footer-border: #dddddd
|
||||||
modal-header-border: #eeeeee
|
modal-header-border: #eeeeee
|
||||||
muted-foreground: #bbb
|
muted-foreground: #bbb
|
||||||
|
network-activity-foreground: #448844
|
||||||
notification-background: #ffffdd
|
notification-background: #ffffdd
|
||||||
notification-border: #999999
|
notification-border: #999999
|
||||||
page-background: #f4f4f4
|
page-background: #f4f4f4
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ tags: $:/tags/Exporter
|
|||||||
description: {{$:/language/Exporters/StaticRiver}}
|
description: {{$:/language/Exporters/StaticRiver}}
|
||||||
extension: .html
|
extension: .html
|
||||||
|
|
||||||
|
\define tv-config-static() yes
|
||||||
\define tv-wikilink-template() #$uri_encoded$
|
\define tv-wikilink-template() #$uri_encoded$
|
||||||
\define tv-config-toolbar-icons() no
|
\define tv-config-toolbar-icons() no
|
||||||
\define tv-config-toolbar-text() no
|
\define tv-config-toolbar-text() no
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
title: $:/core/templates/html-json-skinny-tiddler
|
title: $:/core/templates/html-json-skinny-tiddler
|
||||||
|
|
||||||
<$list filter="[<numTiddlers>compare:number:gteq[1]] ~[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list>
|
<$text text=<<join>>/><$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes"/>
|
||||||
<$jsontiddler tiddler=<<currentTiddler>> exclude="text" escapeUnsafeScriptChars="yes"/>
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
title: $:/core/templates/html-json-tiddler
|
title: $:/core/templates/html-json-tiddler
|
||||||
|
|
||||||
<$list filter="[<counter>!match[1]]">`,`<$text text=<<newline>>/></$list><$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes"/>
|
<$jsontiddler tiddler=<<currentTiddler>> escapeUnsafeScriptChars="yes"/>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
title: $:/core/templates/server/static.tiddler.html
|
title: $:/core/templates/server/static.tiddler.html
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
\define tv-config-static() yes
|
||||||
\define tv-wikilink-template() $uri_encoded$
|
\define tv-wikilink-template() $uri_encoded$
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||||
<html>
|
<html>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
title: $:/core/templates/static.template.html
|
title: $:/core/templates/static.template.html
|
||||||
type: text/vnd.tiddlywiki-html
|
type: text/vnd.tiddlywiki-html
|
||||||
|
|
||||||
|
\define tv-config-static() yes
|
||||||
\define tv-wikilink-template() static/$uri_doubleencoded$.html
|
\define tv-wikilink-template() static/$uri_doubleencoded$.html
|
||||||
\define tv-config-toolbar-icons() no
|
\define tv-config-toolbar-icons() no
|
||||||
\define tv-config-toolbar-text() no
|
\define tv-config-toolbar-text() no
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
title: $:/core/templates/static.tiddler.html
|
title: $:/core/templates/static.tiddler.html
|
||||||
|
|
||||||
\define tv-wikilink-template() $uri_doubleencoded$.html
|
\define tv-wikilink-template() $uri_doubleencoded$.html
|
||||||
|
\define tv-config-static() yes
|
||||||
\define tv-config-toolbar-icons() no
|
\define tv-config-toolbar-icons() no
|
||||||
\define tv-config-toolbar-text() no
|
\define tv-config-toolbar-text() no
|
||||||
\define tv-config-toolbar-class() tc-btn-invisible
|
\define tv-config-toolbar-class() tc-btn-invisible
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ title: $:/core/templates/store.area.template.html
|
|||||||
<$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]">
|
<$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]">
|
||||||
<!-- New-style JSON store area, with an old-style store area for compatibility with v5.1.x tooling -->
|
<!-- New-style JSON store area, with an old-style store area for compatibility with v5.1.x tooling -->
|
||||||
`<script class="tiddlywiki-tiddler-store" type="application/json">[`
|
`<script class="tiddlywiki-tiddler-store" type="application/json">[`
|
||||||
<$vars newline={{{ [charcode[10]] }}}>
|
<$let newline={{{ [charcode[10]] }}} join=`,$(newline)$`>
|
||||||
<$text text=<<newline>>/>
|
<$text text=<<newline>>/>
|
||||||
<$list filter=<<saveTiddlerFilter>> counter="counter" template="$:/core/templates/html-json-tiddler"/>
|
<$list filter=<<saveTiddlerFilter>> join=<<join>> template="$:/core/templates/html-json-tiddler"/>
|
||||||
<$vars numTiddlers={{{ [subfilter<saveTiddlerFilter>count[]] }}}>
|
<$list filter="[subfilter<skinnySaveTiddlerFilter>]" template="$:/core/templates/html-json-skinny-tiddler"/>
|
||||||
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} counter="counter" template="$:/core/templates/html-json-skinny-tiddler"/>
|
|
||||||
</$vars>
|
|
||||||
<$text text=<<newline>>/>
|
<$text text=<<newline>>/>
|
||||||
</$vars>
|
</$let>
|
||||||
`]</script>`
|
`]</script>`
|
||||||
`<div id="storeArea" style="display:none;">`
|
`<div id="storeArea" style="display:none;">`
|
||||||
`</div>`
|
`</div>`
|
||||||
@@ -22,8 +20,8 @@ title: $:/core/templates/store.area.template.html
|
|||||||
<!-- Old-style DIV/PRE-based store area -->
|
<!-- Old-style DIV/PRE-based store area -->
|
||||||
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
|
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
|
||||||
`<div id="storeArea" style="display:none;">`
|
`<div id="storeArea" style="display:none;">`
|
||||||
<$list filter=<<saveTiddlerFilter>> template="$:/core/templates/html-div-tiddler"/>
|
<$list filter={{{ [<saveTiddlerFilter>] }}} template="$:/core/templates/html-div-tiddler"/>
|
||||||
<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} template="$:/core/templates/html-div-skinny-tiddler"/>
|
<$list filter="[subfilter<skinnySaveTiddlerFilter>]" template="$:/core/templates/html-div-skinny-tiddler"/>
|
||||||
`</div>`
|
`</div>`
|
||||||
</$reveal>
|
</$reveal>
|
||||||
</$list>
|
</$list>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
code-body: yes
|
||||||
title: $:/core/ui/AlertTemplate
|
title: $:/core/ui/AlertTemplate
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ caption: {{$:/language/ControlPanel/Basics/Caption}}
|
|||||||
|<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
|<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||||
|<$link to="$:/status/UserName"><<lingo Username/Prompt>></$link> |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> |
|
|<$link to="$:/status/UserName"><<lingo Username/Prompt>></$link> |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> |
|
||||||
|<$link to="$:/config/AnimationDuration"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> |
|
|<$link to="$:/config/AnimationDuration"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> |
|
||||||
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit class="tc-edit-texteditor" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit class="tc-edit-texteditor" tiddler="$:/DefaultTiddlers" autoHeight="yes"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||||
|<$link to="$:/language/DefaultNewTiddlerTitle"><<lingo NewTiddler/Title/Prompt>></$link> |<$edit-text tiddler="$:/language/DefaultNewTiddlerTitle" default="" tag="input"/> |
|
|<$link to="$:/language/DefaultNewTiddlerTitle"><<lingo NewTiddler/Title/Prompt>></$link> |<$edit-text tiddler="$:/language/DefaultNewTiddlerTitle" default="" tag="input"/> |
|
||||||
|<$link to="$:/config/NewJournal/Title"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> |
|
|<$link to="$:/config/NewJournal/Title"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> |
|
||||||
|<$link to="$:/config/NewJournal/Text"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler="$:/config/NewJournal/Text" class="tc-edit-texteditor" default=""/> |
|
|<$link to="$:/config/NewJournal/Text"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler="$:/config/NewJournal/Text" class="tc-edit-texteditor" default="" autoHeight="yes"/> |
|
||||||
|<$link to="$:/config/NewTiddler/Tags"><<lingo NewTiddler/Tags/Prompt>></$link> |<$vars currentTiddler="$:/config/NewTiddler/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}}<$list filter="[<currentTiddler>tags[]] +[limit[1]]" variable="ignore"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field="text" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=""/></$button></$list></$vars> |
|
|<$link to="$:/config/NewTiddler/Tags"><<lingo NewTiddler/Tags/Prompt>></$link> |<$vars currentTiddler="$:/config/NewTiddler/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}}<$list filter="[<currentTiddler>tags[]] +[limit[1]]" variable="ignore"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field="text" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=""/></$button></$list></$vars> |
|
||||||
|<$link to="$:/config/NewJournal/Tags"><<lingo NewJournal/Tags/Prompt>></$link> |<$vars currentTiddler="$:/config/NewJournal/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}}<$list filter="[<currentTiddler>tags[]] +[limit[1]]" variable="ignore"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field="text" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=""/></$button></$list></$vars> |
|
|<$link to="$:/config/NewJournal/Tags"><<lingo NewJournal/Tags/Prompt>></$link> |<$vars currentTiddler="$:/config/NewJournal/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}}<$list filter="[<currentTiddler>tags[]] +[limit[1]]" variable="ignore"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field="text" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=""/></$button></$list></$vars> |
|
||||||
|<$link to="$:/config/AutoFocus"><<lingo AutoFocus/Prompt>></$link> |{{$:/snippets/minifocusswitcher}} |
|
|<$link to="$:/config/AutoFocus"><<lingo AutoFocus/Prompt>></$link> |{{$:/snippets/minifocusswitcher}} |
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
code-body: yes
|
||||||
title: $:/core/ui/EditTemplate
|
title: $:/core/ui/EditTemplate
|
||||||
|
|
||||||
\define delete-edittemplate-state-tiddlers()
|
\define delete-edittemplate-state-tiddlers()
|
||||||
|
|||||||
@@ -10,15 +10,17 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let
|
<$let
|
||||||
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
editPreviewStateTiddler={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
||||||
importTitle=<<qualify $:/ImportImage>>
|
importTitle=<<qualify $:/ImportImage>>
|
||||||
importState=<<qualify $:/state/ImportImage>> >
|
importState=<<qualify $:/state/ImportImage>> >
|
||||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||||
<$reveal stateTitle=<<edit-preview-state>> type="match" text="yes" tag="div">
|
<div>
|
||||||
<div class="tc-tiddler-preview">
|
<div class={{{ [<editPreviewStateTiddler>get[text]match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}>
|
||||||
|
|
||||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||||
|
|
||||||
|
<$list filter="[<editPreviewStateTiddler>get[text]match[yes]]" variable="ignore">
|
||||||
|
|
||||||
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
||||||
|
|
||||||
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
||||||
@@ -29,13 +31,12 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</$list>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</$reveal>
|
|
||||||
|
|
||||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div">
|
</div>
|
||||||
|
|
||||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
|
||||||
|
|
||||||
</$reveal>
|
|
||||||
</$dropzone>
|
</$dropzone>
|
||||||
|
|
||||||
</$let>
|
</$let>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>
|
<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>
|
||||||
<$reveal type="nomatch" text="" default=<<name>>>
|
<$reveal type="nomatch" text="" default=<<name>>>
|
||||||
<$button tooltip=<<lingo Fields/Add/Button/Hint>>>
|
<$button tooltip={{$:/language/EditTemplate/Fields/Add/Button/Hint}}>
|
||||||
<$action-sendmessage $message="tm-add-field"
|
<$action-sendmessage $message="tm-add-field"
|
||||||
$name=<<name>>
|
$name=<<name>>
|
||||||
$value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
$value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||||
@@ -89,7 +89,7 @@ $value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
|||||||
</td>
|
</td>
|
||||||
<td class="tc-edit-field-remove">
|
<td class="tc-edit-field-remove">
|
||||||
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
|
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
|
||||||
<$action-deletefield $field=<<currentField>>/><$set name="currentTiddlerCSSescaped" value={{{ [<currentTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<current-tiddler-new-field-selector>>/></$set>
|
<$action-deletefield $field=<<currentField>>/>
|
||||||
{{$:/core/images/delete-button}}
|
{{$:/core/images/delete-button}}
|
||||||
</$button>
|
</$button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ first-search-filter: [all[shadows+tiddlers]prefix[$:/language/Docs/Types/]sort[d
|
|||||||
<em class="tc-edit tc-small-gap-right"><<lingo Type/Prompt>></em>
|
<em class="tc-edit tc-small-gap-right"><<lingo Type/Prompt>></em>
|
||||||
<div class="tc-type-selector-dropdown-wrapper">
|
<div class="tc-type-selector-dropdown-wrapper">
|
||||||
<div class="tc-type-selector"><$fieldmangler>
|
<div class="tc-type-selector"><$fieldmangler>
|
||||||
<$macrocall $name="keyboard-driven-input" tiddler=<<currentTiddler>> storeTitle=<<typeInputTiddler>> refreshTitle=<<refreshTitle>> selectionStateTitle=<<typeSelectionTiddler>> field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/popup/type-dropdown">> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}} cancelPopups="yes" configTiddlerFilter="[[$:/core/ui/EditTemplate/type]]" inputCancelActions=<<input-cancel-actions>>/><$button popup=<<qualify "$:/state/popup/type-dropdown">> class="tc-btn-invisible tc-btn-dropdown tc-small-gap" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}<$action-deletetiddler $filter="[<storeTitle>] [<refreshTitle>] [<selectionStateTitle>]"/></$button>
|
<$macrocall $name="keyboard-driven-input" tiddler=<<currentTiddler>> storeTitle=<<typeInputTiddler>> refreshTitle=<<refreshTitle>> selectionStateTitle=<<typeSelectionTiddler>> field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/popup/type-dropdown">> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}} cancelPopups="yes" configTiddlerFilter="[[$:/core/ui/EditTemplate/type]]" inputCancelActions=<<input-cancel-actions>>/><$button popup=<<qualify "$:/state/popup/type-dropdown">> class="tc-btn-invisible tc-btn-dropdown tc-small-gap" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}<$action-deletetiddler $filter="[<typeInputTiddler>] [<storeTitle>] [<refreshTitle>] [<selectionStateTitle>]"/></$button>
|
||||||
</$fieldmangler></div>
|
</$fieldmangler></div>
|
||||||
|
|
||||||
<div class="tc-block-dropdown-wrapper">
|
<div class="tc-block-dropdown-wrapper">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
|||||||
|
|
||||||
\define external-link()
|
\define external-link()
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
<$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
||||||
{{$:/core/images/chevron-right}}
|
{{$:/core/images/chevron-right}}
|
||||||
</$button>
|
</$button>
|
||||||
\end
|
\end
|
||||||
@@ -45,7 +45,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
|||||||
<$reveal tag="span" state=<<storeTitle>> type="nomatch" text="">
|
<$reveal tag="span" state=<<storeTitle>> type="nomatch" text="">
|
||||||
<<external-link>>
|
<<external-link>>
|
||||||
 
|
 
|
||||||
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;">
|
<$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;">
|
||||||
<<cancel-search-actions>><$set name="cssEscapedTitle" value={{{ [<storyTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<get-focus-selector>>/></$set>
|
<<cancel-search-actions>><$set name="cssEscapedTitle" value={{{ [<storyTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<get-focus-selector>>/></$set>
|
||||||
{{$:/core/images/close-button}}
|
{{$:/core/images/close-button}}
|
||||||
</$button>
|
</$button>
|
||||||
|
|||||||
@@ -9,11 +9,8 @@ button-classes: tc-text-editor-toolbar-item-start-group
|
|||||||
shortcuts: ((preview))
|
shortcuts: ((preview))
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$reveal state=<<edit-preview-state>> type="match" text="yes" tag="span">
|
<span>
|
||||||
{{$:/core/images/preview-open}}
|
<$transclude $tiddler={{{ [<editPreviewStateTiddler>get[text]match[yes]then[$:/core/images/preview-open]else[$:/core/images/preview-closed]] }}} />
|
||||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="no"/>
|
</span>
|
||||||
</$reveal>
|
<$action-setfield $tiddler=<<editPreviewStateTiddler>> $value={{{ [<editPreviewStateTiddler>get[text]toggle[yes],[no]] }}} />
|
||||||
<$reveal state=<<edit-preview-state>> type="nomatch" text="yes" tag="span">
|
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||||
{{$:/core/images/preview-closed}}
|
|
||||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="yes"/>
|
|
||||||
</$reveal>
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
title: $:/core/ui/ImportPreviews/Text
|
title: $:/core/ui/ImportPreviews/Text
|
||||||
tags: $:/tags/ImportPreview
|
tags: $:/tags/ImportPreview
|
||||||
caption: {{$:/language/Import/Listing/Preview/Text}}
|
caption: {{$:/language/Import/Listing/Preview/Text}}
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
<$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode="block"/>
|
<$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode="block"/>
|
||||||
|
|||||||
@@ -3,15 +3,14 @@ tags: $:/tags/MoreSideBar
|
|||||||
caption: {{$:/language/SideBar/Tags/Caption}}
|
caption: {{$:/language/SideBar/Tags/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
<$let tv-config-toolbar-icons="yes" tv-config-toolbar-text="yes" tv-config-toolbar-class="">
|
<$let tv-config-toolbar-icons="yes" tv-config-toolbar-text="yes" tv-config-toolbar-class="">
|
||||||
<div class="tc-tiny-v-gap-bottom">
|
<div class="tc-tiny-v-gap-bottom">
|
||||||
{{$:/core/ui/Buttons/tag-manager}}
|
{{$:/core/ui/Buttons/tag-manager}}
|
||||||
</div>
|
</div>
|
||||||
</$let>
|
</$let>
|
||||||
<$list filter={{$:/core/Filters/AllTags!!filter}}>
|
<$list filter={{$:/core/Filters/AllTags!!filter}}>
|
||||||
<div class="tc-tiny-v-gap-bottom">
|
<div class="tc-tiny-v-gap-bottom">
|
||||||
<$transclude tiddler="$:/core/ui/TagTemplate"/>
|
<$transclude tiddler="$:/core/ui/TagTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</$list>
|
</$list>
|
||||||
<hr class="tc-untagged-separator">
|
<hr class="tc-untagged-separator">
|
||||||
|
|||||||
16
core/ui/PageControls/network-activity.tid
Normal file
16
core/ui/PageControls/network-activity.tid
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
title: $:/core/ui/Buttons/network-activity
|
||||||
|
tags: $:/tags/PageControls
|
||||||
|
caption: {{$:/core/images/network-activity}} {{$:/language/Buttons/NetworkActivity/Caption}}
|
||||||
|
description: {{$:/language/Buttons/NetworkActivity/Hint}}
|
||||||
|
|
||||||
|
\whitespace trim
|
||||||
|
<$button message="tm-http-cancel-all-requests" tooltip={{$:/language/Buttons/NetworkActivity/Hint}} aria-label={{$:/language/Buttons/NetworkActivity/Caption}} class=<<tv-config-toolbar-class>>>
|
||||||
|
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
|
||||||
|
{{$:/core/images/network-activity}}
|
||||||
|
</$list>
|
||||||
|
<$list filter="[<tv-config-toolbar-text>match[yes]]">
|
||||||
|
<span class="tc-btn-text">
|
||||||
|
<$text text={{$:/language/Buttons/NetworkActivity/Caption}}/>
|
||||||
|
</span>
|
||||||
|
</$list>
|
||||||
|
</$button>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
title: $:/core/ui/PageStylesheet
|
title: $:/core/ui/PageStylesheet
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ title: $:/core/ui/PageTemplate
|
|||||||
name: {{$:/language/PageTemplate/Name}}
|
name: {{$:/language/PageTemplate/Name}}
|
||||||
description: {{$:/language/PageTemplate/Description}}
|
description: {{$:/language/PageTemplate/Description}}
|
||||||
icon: $:/core/images/layout-button
|
icon: $:/core/images/layout-button
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||||
@@ -19,7 +20,7 @@ icon: $:/core/images/layout-button
|
|||||||
|
|
||||||
<$navigator story="$:/StoryList" history="$:/HistoryList" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>
|
<$navigator story="$:/StoryList" history="$:/HistoryList" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>
|
||||||
|
|
||||||
<$dropzone enable=<<tv-enable-drag-and-drop>>>
|
<$dropzone enable=<<tv-enable-drag-and-drop>> class="tc-dropzone tc-page-container-inner">
|
||||||
|
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageTemplate]!has[draft.of]]" variable="listItem">
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageTemplate]!has[draft.of]]" variable="listItem">
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
title: $:/core/ui/RootTemplate
|
title: $:/core/ui/RootTemplate
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/>
|
<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
title: $:/core/ui/StoryTiddlerTemplate
|
title: $:/core/ui/StoryTiddlerTemplate
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/StoryTiddlerTemplateFilter]!is[draft]get[text]] :and[has[title]else[$:/core/ui/ViewTemplate]] }}} />
|
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/StoryTiddlerTemplateFilter]!is[draft]get[text]] :and[has[title]else[$:/core/ui/ViewTemplate]] }}} />
|
||||||
|
|||||||
@@ -2,22 +2,29 @@ title: $:/core/ui/TagPickerTagTemplate
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$button class=<<button-classes>> tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
|
<$button class=<<button-classes>> tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
|
||||||
<$list filter="[<saveTiddler>minlength[1]]">
|
<$list filter="[<saveTiddler>minlength[1]]">
|
||||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>]"/>
|
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>]"/>
|
||||||
</$list>
|
</$list>
|
||||||
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
||||||
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>> preventScroll="true"/>
|
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>> preventScroll="true"/>
|
||||||
</$set>
|
</$set>
|
||||||
<<delete-tag-state-tiddlers>>
|
<<delete-tag-state-tiddlers>>
|
||||||
<$list filter="[<refreshTitle>minlength[1]]">
|
<$list filter="[<refreshTitle>minlength[1]]">
|
||||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||||
</$list>
|
</$list>
|
||||||
<<actions>>
|
<<actions>>
|
||||||
<$set name="backgroundColor" value={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}>
|
<$set name="backgroundColor"
|
||||||
<$wikify name="foregroundColor" text="""<$macrocall $name="contrastcolour" target=<<backgroundColor>> fallbackTarget=<<fallbackTarget>> colourA=<<colourA>> colourB=<<colourB>>/>""">
|
value={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||||
<span class="tc-tag-label tc-btn-invisible" style=<<tag-pill-styles>> data-tag-title=<<currentTiddler>> >
|
>
|
||||||
{{||$:/core/ui/TiddlerIcon}}<$view field="title" format="text"/>
|
<$wikify name="foregroundColor"
|
||||||
</span>
|
text="""<$macrocall $name="contrastcolour" target=<<backgroundColor>> fallbackTarget=<<fallbackTarget>> colourA=<<colourA>> colourB=<<colourB>>/>"""
|
||||||
</$wikify>
|
>
|
||||||
</$set>
|
<span class="tc-tag-label tc-btn-invisible"
|
||||||
|
style=<<tag-pill-styles>>
|
||||||
|
data-tag-title=<<currentTiddler>>
|
||||||
|
>
|
||||||
|
{{||$:/core/ui/TiddlerIcon}}<$view field="title" format="text"/>
|
||||||
|
</span>
|
||||||
|
</$wikify>
|
||||||
|
</$set>
|
||||||
</$button>
|
</$button>
|
||||||
|
|||||||
@@ -3,16 +3,23 @@ title: $:/core/ui/TagTemplate
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-tag-list-item" data-tag-title=<<currentTiddler>>>
|
<span class="tc-tag-list-item" data-tag-title=<<currentTiddler>>>
|
||||||
<$set name="transclusion" value=<<currentTiddler>>>
|
<$set name="transclusion" value=<<currentTiddler>>>
|
||||||
<$macrocall $name="tag-pill-body" tag=<<currentTiddler>> icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} element-tag="""$button""" element-attributes="""popup=<<qualify "$:/state/popup/tag">> dragFilter='[all[current]tagging[]]' tag='span'"""/>
|
<$macrocall $name="tag-pill-body"
|
||||||
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
|
tag=<<currentTiddler>>
|
||||||
<$set name="tv-show-missing-links" value="yes">
|
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
||||||
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||||
</$set>
|
palette={{$:/palette}}
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem">
|
element-tag="$button"
|
||||||
<$transclude tiddler=<<listItem>>/>
|
element-attributes="""popup=<<qualify "$:/state/popup/tag">> dragFilter="[all[current]tagging[]]" tag='span'"""
|
||||||
</$list>
|
/>
|
||||||
<hr>
|
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
|
||||||
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>>/>
|
<$set name="tv-show-missing-links" value="yes">
|
||||||
</$reveal>
|
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||||
|
</$set>
|
||||||
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem">
|
||||||
|
<$transclude tiddler=<<listItem>>/>
|
||||||
|
</$list>
|
||||||
|
<hr>
|
||||||
|
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>>/>
|
||||||
|
</$reveal>
|
||||||
</$set>
|
</$set>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
title: $:/core/ui/ViewTemplate
|
title: $:/core/ui/ViewTemplate
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\define folded-state()
|
\define folded-state()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
title: $:/core/ui/ViewTemplate/body/default
|
title: $:/core/ui/ViewTemplate/body/default
|
||||||
|
code-body: yes
|
||||||
|
|
||||||
<$transclude>
|
<$transclude>
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,8 @@ tags: $:/tags/ViewTemplate
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||||
<div class="tc-subtitle">
|
<div class="tc-subtitle">
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler" counter="indexSubtitleTiddler">
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler">
|
||||||
<$list filter="[<indexSubtitleTiddler-first>match[no]]" variable="ignore">
|
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/><$list-join> </$list-join>
|
||||||
|
|
||||||
</$list>
|
|
||||||
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/>
|
|
||||||
</$list>
|
</$list>
|
||||||
</div>
|
</div>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
title: $:/config/OfficialPluginLibrary
|
title: $:/config/OfficialPluginLibrary
|
||||||
tags: $:/tags/PluginLibrary
|
tags: $:/tags/PluginLibrary
|
||||||
url: https://tiddlywiki.com/library/v5.2.8/index.html
|
url: https://tiddlywiki.com/library/v5.3.3/index.html
|
||||||
caption: {{$:/language/OfficialPluginLibrary}}
|
caption: {{$:/language/OfficialPluginLibrary}}
|
||||||
|
|
||||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ core/ui/Buttons/language: hide
|
|||||||
core/ui/Buttons/tag-manager: hide
|
core/ui/Buttons/tag-manager: hide
|
||||||
core/ui/Buttons/manager: hide
|
core/ui/Buttons/manager: hide
|
||||||
core/ui/Buttons/more-page-actions: hide
|
core/ui/Buttons/more-page-actions: hide
|
||||||
|
core/ui/Buttons/network-activity: hide
|
||||||
core/ui/Buttons/new-journal: hide
|
core/ui/Buttons/new-journal: hide
|
||||||
core/ui/Buttons/new-image: hide
|
core/ui/Buttons/new-image: hide
|
||||||
core/ui/Buttons/palette: hide
|
core/ui/Buttons/palette: hide
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ title: $:/config/ViewTemplateBodyFilters/
|
|||||||
tags: $:/tags/ViewTemplateBodyFilter
|
tags: $:/tags/ViewTemplateBodyFilter
|
||||||
|
|
||||||
stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]]
|
stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]]
|
||||||
system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/core/ui/]split[/]count[]compare:number:eq[4]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]]
|
core-ui-tags: [tag[$:/tags/PageTemplate]] [tag[$:/tags/EditTemplate]] [tag[$:/tags/ViewTemplate]] [tag[$:/tags/KeyboardShortcut]] [tag[$:/tags/ImportPreview]] [tag[$:/tags/EditPreview]][tag[$:/tags/EditorToolbar]] [tag[$:/tags/Actions]] :then[[$:/core/ui/ViewTemplate/body/code]]
|
||||||
|
system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]]
|
||||||
code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]]
|
code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]]
|
||||||
import: [field:plugin-type[import]then[$:/core/ui/ViewTemplate/body/import]]
|
import: [field:plugin-type[import]then[$:/core/ui/ViewTemplate/body/import]]
|
||||||
plugin: [has[plugin-type]then[$:/core/ui/ViewTemplate/body/plugin]]
|
plugin: [has[plugin-type]then[$:/core/ui/ViewTemplate/body/plugin]]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ tags: $:/tags/Macro
|
|||||||
|
|
||||||
$(colour-picker-update-recent)$
|
$(colour-picker-update-recent)$
|
||||||
|
|
||||||
$actions$
|
<$transclude $variable="__actions__"/>
|
||||||
|
|
||||||
<span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/>
|
<span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/>
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ $actions$
|
|||||||
\define colour-picker-recent-inner(actions)
|
\define colour-picker-recent-inner(actions)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$set name="colour-picker-value" value="$(recentColour)$">
|
<$set name="colour-picker-value" value="$(recentColour)$">
|
||||||
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/>
|
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
|
||||||
</$set>
|
</$set>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ $actions$
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
{{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour">
|
{{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour">
|
||||||
 
|
 
|
||||||
<$macrocall $name="colour-picker-recent-inner" actions="""$actions$"""/>
|
<$macrocall $name="colour-picker-recent-inner" actions=<<__actions__>>/>
|
||||||
</$list>
|
</$list>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
@@ -39,13 +39,13 @@ $actions$
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
<div class="tc-colour-chooser">
|
<div class="tc-colour-chooser">
|
||||||
|
|
||||||
<$macrocall $name="colour-picker-recent" actions="""$actions$"""/>
|
<$macrocall $name="colour-picker-recent" actions=<<__actions__>>/>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value">
|
<$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value">
|
||||||
 
|
 
|
||||||
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/>
|
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
|
||||||
</$list>
|
</$list>
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -54,7 +54,7 @@ $actions$
|
|||||||
 
|
 
|
||||||
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
|
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
|
||||||
<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}>
|
<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}>
|
||||||
<$macrocall $name="colour-picker-inner" actions="""$actions$"""/>
|
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
|
||||||
</$set>
|
</$set>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ title: $:/core/macros/image-picker
|
|||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
\define image-picker-thumbnail(actions)
|
\define image-picker-thumbnail(actions)
|
||||||
<$button tag="a" tooltip="""$(imageTitle)$""">$actions$<$transclude tiddler=<<imageTitle>>/></$button>
|
<$button tag="a" tooltip="""$(imageTitle)$"""><$transclude $variable="__actions__"/><$transclude tiddler=<<imageTitle>>/></$button>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define image-picker-list(filter,actions)
|
\define image-picker-list(filter,actions)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$list filter="""$filter$""" variable="imageTitle">
|
<$list filter="""$filter$""" variable="imageTitle">
|
||||||
<$macrocall $name="image-picker-thumbnail" actions="""$actions$"""/>
|
<$macrocall $name="image-picker-thumbnail" actions=<<__actions__>>/>
|
||||||
 
|
 
|
||||||
</$list>
|
</$list>
|
||||||
\end
|
\end
|
||||||
@@ -25,15 +25,15 @@ type: text/vnd.tiddlywiki
|
|||||||
{{$:/language/SystemTiddlers/Include/Prompt}}
|
{{$:/language/SystemTiddlers/Include/Prompt}}
|
||||||
</$checkbox>
|
</$checkbox>
|
||||||
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">
|
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">
|
||||||
<$macrocall $name="image-picker-list" filter="""$filter$ +[!is[system]]""" actions="""$actions$"""/>
|
<$macrocall $name="image-picker-list" filter="""$filter$ +[!is[system]]""" actions=<<__actions__>>/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
<$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div">
|
<$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div">
|
||||||
<$macrocall $name="image-picker-list" filter="""$filter$""" actions="""$actions$"""/>
|
<$macrocall $name="image-picker-list" filter="""$filter$""" actions=<<__actions__>>/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
</$vars>
|
</$vars>
|
||||||
</div>
|
</div>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define image-picker-include-tagged-images(actions)
|
\define image-picker-include-tagged-images(actions)
|
||||||
<$macrocall $name="image-picker" filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]" actions="""$actions$"""/>
|
<$macrocall $name="image-picker" filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]" actions=<<__actions__>>/>
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ tags: $:/tags/Macro
|
|||||||
\define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption")
|
\define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$genesis $type=<<__type__>> class=<<__class__>>>
|
<$genesis $type=<<__type__>> class=<<__class__>>>
|
||||||
<$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>>
|
<$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>>
|
||||||
<$genesis $type=<<__subtype__>>>
|
<$genesis $type=<<__subtype__>>>
|
||||||
<$link to={{!!title}}>
|
<$link to={{!!title}}>
|
||||||
<$let tv-wikilinks="no">
|
<$let tv-wikilinks="no">
|
||||||
<$transclude field=<<__field__>>>
|
<$transclude field=<<__field__>>>
|
||||||
<$view field="title"/>
|
<$view field="title"/>
|
||||||
</$transclude>
|
</$transclude>
|
||||||
</$let>
|
</$let>
|
||||||
</$link>
|
</$link>
|
||||||
</$genesis>
|
</$genesis>
|
||||||
</$list>
|
</$list>
|
||||||
</$genesis>
|
</$genesis>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
@@ -25,34 +25,42 @@ tags: $:/tags/Macro
|
|||||||
\define list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate)
|
\define list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-links-draggable-list">
|
<span class="tc-links-draggable-list">
|
||||||
<$vars targetTiddler="""$tiddler$""" targetField="""$field$""">
|
<$vars targetTiddler="""$tiddler$""" targetField="""$field$""">
|
||||||
<$genesis $type=<<__type__>> class="$class$">
|
<$genesis $type=<<__type__>> class="$class$">
|
||||||
<$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>>
|
<$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>>
|
||||||
<$droppable actions=<<list-links-draggable-drop-actions>> tag="""$subtype$""" enable=<<tv-enable-drag-and-drop>>>
|
<$droppable
|
||||||
<div class="tc-droppable-placeholder"/>
|
actions=<<list-links-draggable-drop-actions>>
|
||||||
<div>
|
tag="""$subtype$"""
|
||||||
<$transclude tiddler="""$itemTemplate$""">
|
enable=<<tv-enable-drag-and-drop>>
|
||||||
<$link to={{!!title}}>
|
>
|
||||||
<$let tv-wikilinks="no">
|
<div class="tc-droppable-placeholder"/>
|
||||||
<$transclude field="caption">
|
<div>
|
||||||
<$view field="title"/>
|
<$transclude tiddler="""$itemTemplate$""">
|
||||||
</$transclude>
|
<$link to={{!!title}}>
|
||||||
</$let>
|
<$let tv-wikilinks="no">
|
||||||
</$link>
|
<$transclude field="caption">
|
||||||
</$transclude>
|
<$view field="title"/>
|
||||||
</div>
|
</$transclude>
|
||||||
</$droppable>
|
</$let>
|
||||||
</$list>
|
</$link>
|
||||||
<$tiddler tiddler="">
|
</$transclude>
|
||||||
<$droppable actions=<<list-links-draggable-drop-actions>> tag="div" enable=<<tv-enable-drag-and-drop>>>
|
</div>
|
||||||
<div class="tc-droppable-placeholder">
|
</$droppable>
|
||||||
{{$:/core/images/blank}}
|
</$list>
|
||||||
</div>
|
<$tiddler tiddler="">
|
||||||
<div style="height:0.5em;"/>
|
<$droppable
|
||||||
</$droppable>
|
actions=<<list-links-draggable-drop-actions>>
|
||||||
</$tiddler>
|
tag="div"
|
||||||
</$genesis>
|
enable=<<tv-enable-drag-and-drop>>
|
||||||
</$vars>
|
>
|
||||||
|
<div class="tc-droppable-placeholder">
|
||||||
|
{{$:/core/images/blank}}
|
||||||
|
</div>
|
||||||
|
<div style="height:0.5em;"/>
|
||||||
|
</$droppable>
|
||||||
|
</$tiddler>
|
||||||
|
</$genesis>
|
||||||
|
</$vars>
|
||||||
</span>
|
</span>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
@@ -60,50 +68,59 @@ tags: $:/tags/Macro
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
<!-- Save the current ordering of the tiddlers with this tag -->
|
<!-- Save the current ordering of the tiddlers with this tag -->
|
||||||
<$set name="order" filter="[<__tag__>tagging[]]">
|
<$set name="order" filter="[<__tag__>tagging[]]">
|
||||||
<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->
|
<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->
|
||||||
<$list filter="[<__tag__>tagging[]]">
|
<$list filter="[<__tag__>tagging[]]">
|
||||||
<$action-deletefield $field="list-before"/>
|
<$action-deletefield $field="list-before"/>
|
||||||
<$action-deletefield $field="list-after"/>
|
<$action-deletefield $field="list-after"/>
|
||||||
</$list>
|
</$list>
|
||||||
<!-- Save the new order to the Tag Tiddler -->
|
<!-- Save the new order to the Tag Tiddler -->
|
||||||
<$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
<$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||||
<!-- Make sure the newly added item has the right tag -->
|
<!-- Make sure the newly added item has the right tag -->
|
||||||
<!-- Removing this line makes dragging tags within the dropdown work as intended -->
|
<!-- Removing this line makes dragging tags within the dropdown work as intended -->
|
||||||
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
|
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
|
||||||
<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->
|
<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->
|
||||||
<$list filter="[<actionTiddler>!contains:tags<__tag__>]">
|
<$list filter="[<actionTiddler>!contains:tags<__tag__>]">
|
||||||
<$fieldmangler tiddler=<<actionTiddler>>>
|
<$fieldmangler tiddler=<<actionTiddler>>>
|
||||||
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
|
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
|
||||||
</$fieldmangler>
|
</$fieldmangler>
|
||||||
</$list>
|
</$list>
|
||||||
</$set>
|
</$set>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
|
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-tagged-draggable-list">
|
<span class="tc-tagged-draggable-list">
|
||||||
<$set name="tag" value=<<__tag__>>>
|
<$set name="tag" value=<<__tag__>>>
|
||||||
<$list filter="[<__tag__>tagging[]$subFilter$]" emptyMessage=<<__emptyMessage__>> storyview=<<__storyview__>>>
|
<$list
|
||||||
<$genesis $type=<<__elementTag__>> class="tc-menu-list-item">
|
filter="[<__tag__>tagging[]$subFilter$]"
|
||||||
<$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<<tv-enable-drag-and-drop>>>
|
emptyMessage=<<__emptyMessage__>>
|
||||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
storyview=<<__storyview__>>
|
||||||
<$genesis $type=<<__elementTag__>>>
|
>
|
||||||
<$transclude tiddler="""$itemTemplate$""">
|
<$genesis $type=<<__elementTag__>> class="tc-menu-list-item">
|
||||||
<$link to={{!!title}}>
|
<$droppable
|
||||||
<$view field="title"/>
|
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
|
||||||
</$link>
|
enable=<<tv-enable-drag-and-drop>>
|
||||||
</$transclude>
|
>
|
||||||
</$genesis>
|
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||||
</$droppable>
|
<$genesis $type=<<__elementTag__>>>
|
||||||
</$genesis>
|
<$transclude tiddler="""$itemTemplate$""">
|
||||||
</$list>
|
<$link to={{!!title}}>
|
||||||
<$tiddler tiddler="">
|
<$view field="title"/>
|
||||||
<$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<<tv-enable-drag-and-drop>>>
|
</$link>
|
||||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
</$transclude>
|
||||||
<$genesis $type=<<__elementTag__>> style="height:0.5em;">
|
</$genesis>
|
||||||
</$genesis>
|
</$droppable>
|
||||||
</$droppable>
|
</$genesis>
|
||||||
</$tiddler>
|
</$list>
|
||||||
</$set>
|
<$tiddler tiddler="">
|
||||||
|
<$droppable
|
||||||
|
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
|
||||||
|
enable=<<tv-enable-drag-and-drop>>
|
||||||
|
>
|
||||||
|
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||||
|
<$genesis $type=<<__elementTag__>> style="height:0.5em;"/>
|
||||||
|
</$droppable>
|
||||||
|
</$tiddler>
|
||||||
|
</$set>
|
||||||
</span>
|
</span>
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -4,7 +4,15 @@ code-body: yes
|
|||||||
|
|
||||||
\define tabs-button()
|
\define tabs-button()
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$button set=<<tabsState>> setTo=<<currentTab>> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}} role="switch">
|
<$button
|
||||||
|
set=<<tabsState>>
|
||||||
|
setTo=<<currentTab>>
|
||||||
|
default=<<__default__>>
|
||||||
|
selectedClass="tc-tab-selected"
|
||||||
|
tooltip={{!!tooltip}}
|
||||||
|
role="switch"
|
||||||
|
data-tab-title=<<currentTab>>
|
||||||
|
>
|
||||||
<$tiddler tiddler=<<save-currentTiddler>>>
|
<$tiddler tiddler=<<save-currentTiddler>>>
|
||||||
<$set name="tv-wikilinks" value="no">
|
<$set name="tv-wikilinks" value="no">
|
||||||
<$transclude tiddler=<<__buttonTemplate__>> mode="inline">
|
<$transclude tiddler=<<__buttonTemplate__>> mode="inline">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ second-search-filter: [tags[]is[system]search:title<userInput>sort[]]
|
|||||||
emptyMessage="<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter='-[<tag>]'/>"
|
emptyMessage="<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter='-[<tag>]'/>"
|
||||||
>
|
>
|
||||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
|
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
|
||||||
$actions$
|
<$transclude $variable="__actions__"/>
|
||||||
</$list>
|
</$list>
|
||||||
</$set>
|
</$set>
|
||||||
<<delete-tag-state-tiddlers>>
|
<<delete-tag-state-tiddlers>>
|
||||||
@@ -102,7 +102,7 @@ second-search-filter: [tags[]is[system]search:title<userInput>sort[]]
|
|||||||
<$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}>
|
<$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}>
|
||||||
<$button set=<<newTagNameTiddler>> setTo="" class="">
|
<$button set=<<newTagNameTiddler>> setTo="" class="">
|
||||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
|
<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="[<tag>trim[]]"/>
|
||||||
$actions$
|
<$transclude $variable="__actions__"/>
|
||||||
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
||||||
<<delete-tag-state-tiddlers>><$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>>/>
|
<<delete-tag-state-tiddlers>><$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>>/>
|
||||||
</$set>
|
</$set>
|
||||||
|
|||||||
@@ -9,26 +9,51 @@ color:$(foregroundColor)$;
|
|||||||
|
|
||||||
<!-- This has no whitespace trim to avoid modifying $actions$. Closing tags omitted for brevity. -->
|
<!-- This has no whitespace trim to avoid modifying $actions$. Closing tags omitted for brevity. -->
|
||||||
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
|
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
|
||||||
<$vars
|
\whitespace trim
|
||||||
|
<$let
|
||||||
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
|
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
|
||||||
backgroundColor="""$colour$"""
|
backgroundColor=<<__colour__>>
|
||||||
><$element-tag$
|
>
|
||||||
|
<$element-tag$
|
||||||
$element-attributes$
|
$element-attributes$
|
||||||
class="tc-tag-label tc-btn-invisible"
|
class="tc-tag-label tc-btn-invisible"
|
||||||
style=<<tag-pill-styles>>
|
style=<<tag-pill-styles>>
|
||||||
>$actions$<$transclude tiddler="""$icon$"""/><$view tiddler=<<__tag__>> field="title" format="text" /></$element-tag$>
|
>
|
||||||
|
<<__actions__>>
|
||||||
|
<$transclude tiddler=<<__icon__>>/>
|
||||||
|
<$view tiddler=<<__tag__>> field="title" format="text" />
|
||||||
|
</$element-tag$>
|
||||||
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
|
\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
|
||||||
<$macrocall $name="tag-pill-inner" tag=<<__tag__>> icon="""$icon$""" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} element-tag="""$element-tag$""" element-attributes="""$element-attributes$""" actions="""$actions$"""/>
|
\whitespace trim
|
||||||
|
<$macrocall $name="tag-pill-inner"
|
||||||
|
tag=<<__tag__>>
|
||||||
|
icon=<<__icon__>>
|
||||||
|
colour=<<__colour__>>
|
||||||
|
fallbackTarget={{$palette$##tag-background}}
|
||||||
|
colourA={{$palette$##foreground}}
|
||||||
|
colourB={{$palette$##background}}
|
||||||
|
element-tag=<<__element-tag__>>
|
||||||
|
element-attributes=<<__element-attributes__>>
|
||||||
|
actions=<<__actions__>>
|
||||||
|
/>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
|
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
|
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
|
||||||
<$let currentTiddler=<<__tag__>>>
|
<$let currentTiddler=<<__tag__>>>
|
||||||
<$macrocall $name="tag-pill-body" tag=<<__tag__>> icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} element-tag="""$element-tag$""" element-attributes="""$element-attributes$""" actions="""$actions$"""/>
|
<$macrocall $name="tag-pill-body"
|
||||||
</$let>
|
tag=<<__tag__>>
|
||||||
|
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
||||||
|
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||||
|
palette={{$:/palette}}
|
||||||
|
element-tag=<<__element-tag__>>
|
||||||
|
element-attributes=<<__element-attributes__>>
|
||||||
|
actions=<<__actions__>>/>
|
||||||
|
</$let>
|
||||||
</span>
|
</span>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ tags: $:/tags/Macro
|
|||||||
|
|
||||||
\define toc-caption()
|
\define toc-caption()
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-toc-caption">
|
<span class="tc-toc-caption tc-tiny-gap-left">
|
||||||
<$set name="tv-wikilinks" value="no">
|
<$set name="tv-wikilinks" value="no">
|
||||||
<$transclude field="caption">
|
<$transclude field="caption">
|
||||||
<$view field="title"/>
|
<$view field="title"/>
|
||||||
@@ -19,9 +19,9 @@ tags: $:/tags/Macro
|
|||||||
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<ol class="tc-toc">
|
<ol class="tc-toc">
|
||||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||||
<$let item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
<$let item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||||
<$set name="excluded" filter="""[enlist<__exclude__>] [<__tag__>]""">
|
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||||
<li class=<<toc-item-class>>>
|
<li class=<<toc-item-class>>>
|
||||||
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><<toc-caption>></$link>">
|
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><<toc-caption>></$link>">
|
||||||
@@ -36,8 +36,8 @@ tags: $:/tags/Macro
|
|||||||
</ol>
|
</ol>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc(tag,sort:"",itemClassFilter:"")
|
\define toc(tag,sort:"",itemClassFilter:"", exclude)
|
||||||
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> />
|
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>>/>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||||
@@ -75,7 +75,7 @@ tags: $:/tags/Macro
|
|||||||
<li class=<<toc-item-class>>>
|
<li class=<<toc-item-class>>>
|
||||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||||
<$transclude tiddler=<<toc-closed-icon>> />
|
<$transclude tiddler=<<toc-closed-icon>> />
|
||||||
<<toc-caption>>
|
<<toc-caption>>
|
||||||
</$button>
|
</$button>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
@@ -100,9 +100,9 @@ tags: $:/tags/Macro
|
|||||||
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||||
<$set name="excluded" filter="""[enlist<__exclude__>] [<__tag__>]""">
|
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||||
<ol class="tc-toc toc-expandable">
|
<ol class="tc-toc toc-expandable">
|
||||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||||
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
||||||
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
||||||
</$list>
|
</$list>
|
||||||
@@ -118,7 +118,7 @@ tags: $:/tags/Macro
|
|||||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item" >
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item" >
|
||||||
<li class=<<toc-item-class>>>
|
<li class=<<toc-item-class>>>
|
||||||
<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>
|
<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>
|
||||||
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
|
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
|
||||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||||
<$transclude tiddler=<<toc-closed-icon>> />
|
<$transclude tiddler=<<toc-closed-icon>> />
|
||||||
@@ -145,7 +145,7 @@ tags: $:/tags/Macro
|
|||||||
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
||||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||||
<li class=<<toc-item-class>>>
|
<li class=<<toc-item-class>>>
|
||||||
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>">
|
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
|
||||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||||
<$transclude tiddler=<<toc-closed-icon>> />
|
<$transclude tiddler=<<toc-closed-icon>> />
|
||||||
@@ -174,9 +174,9 @@ tags: $:/tags/Macro
|
|||||||
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||||
<$set name="excluded" filter="[enlist<__exclude__>] [<__tag__>]">
|
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||||
<ol class="tc-toc toc-selective-expandable">
|
<ol class="tc-toc toc-selective-expandable">
|
||||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||||
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
||||||
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
||||||
</$list>
|
</$list>
|
||||||
@@ -186,13 +186,13 @@ tags: $:/tags/Macro
|
|||||||
</$let>
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
||||||
<div class="tc-tabbed-table-of-contents">
|
<div class="tc-tabbed-table-of-contents">
|
||||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||||
<div class="tc-table-of-contents">
|
<div class="tc-table-of-contents">
|
||||||
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]"/>
|
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]" exclude=<<__exclude__>>/>
|
||||||
</div>
|
</div>
|
||||||
</$linkcatcher>
|
</$linkcatcher>
|
||||||
<div class="tc-tabbed-table-of-contents-content">
|
<div class="tc-tabbed-table-of-contents-content">
|
||||||
@@ -210,9 +210,9 @@ tags: $:/tags/Macro
|
|||||||
</$tiddler>
|
</$tiddler>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||||
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>>/>
|
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>> exclude=<<__exclude__>> />
|
||||||
</$linkcatcher>
|
</$linkcatcher>
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
title: $:/tags/PageControls
|
title: $:/tags/PageControls
|
||||||
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/layout]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]]
|
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/layout]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/network-activity]] [[$:/core/ui/Buttons/more-page-actions]]
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user