mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-02-15 06:29:48 +00:00
Compare commits
286 Commits
v5.1.15
...
print-wind
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60ab25bf6e | ||
|
|
33e636cbe7 | ||
|
|
760c80c655 | ||
|
|
1436196758 | ||
|
|
c252d7c945 | ||
|
|
4fd980debe | ||
|
|
38b24906c1 | ||
|
|
9e8a0653b0 | ||
|
|
398b715bb8 | ||
|
|
d54f599269 | ||
|
|
f355f07ff9 | ||
|
|
6e2b4ebf3e | ||
|
|
c5511854ab | ||
|
|
577a87a502 | ||
|
|
731759e20b | ||
|
|
85648590e5 | ||
|
|
944010c3bf | ||
|
|
78e734797b | ||
|
|
98bafd0b69 | ||
|
|
4e12c93b90 | ||
|
|
280cc39434 | ||
|
|
7468ad7acf | ||
|
|
737e9ae4cb | ||
|
|
e11282cc08 | ||
|
|
2beae0db2e | ||
|
|
523060e823 | ||
|
|
b95aa6ec6a | ||
|
|
e6466b2c32 | ||
|
|
0ab9ec1ad3 | ||
|
|
715cb1d1bc | ||
|
|
230c13129a | ||
|
|
a2606781b7 | ||
|
|
4c89bbabbe | ||
|
|
3816819705 | ||
|
|
f9be417204 | ||
|
|
d4b4c3c936 | ||
|
|
c64fc164fc | ||
|
|
2c7f467514 | ||
|
|
46e8e4343a | ||
|
|
38baa70bc6 | ||
|
|
36d321746b | ||
|
|
ab5e5795e8 | ||
|
|
8464101430 | ||
|
|
c569df4bd4 | ||
|
|
215c8bb9ea | ||
|
|
55453d463a | ||
|
|
b2173d11ea | ||
|
|
c95a32abdf | ||
|
|
ac26c8829d | ||
|
|
8feb07e429 | ||
|
|
3aaa7357f6 | ||
|
|
895447c40c | ||
|
|
5626148202 | ||
|
|
aab408109f | ||
|
|
34ce15638c | ||
|
|
d84a03c2d7 | ||
|
|
9499af9a70 | ||
|
|
d77a3795b7 | ||
|
|
75709d745f | ||
|
|
3e707f6a51 | ||
|
|
c397004cfb | ||
|
|
466566502c | ||
|
|
7f2ad15464 | ||
|
|
df50d675f2 | ||
|
|
19085a1277 | ||
|
|
200e854814 | ||
|
|
6bbf36f903 | ||
|
|
c974858cf5 | ||
|
|
f26bcb273b | ||
|
|
61f9adb710 | ||
|
|
7e58866499 | ||
|
|
7f1541464a | ||
|
|
141629c63b | ||
|
|
07887c1226 | ||
|
|
8bf7dd7172 | ||
|
|
df809bcb87 | ||
|
|
848d9cc4cb | ||
|
|
462d0a9402 | ||
|
|
5ea6c9a273 | ||
|
|
2163302190 | ||
|
|
3af0487f29 | ||
|
|
99d8da9fc4 | ||
|
|
06a10d7180 | ||
|
|
d4fc913012 | ||
|
|
afe14b47b5 | ||
|
|
b783d0f5af | ||
|
|
f092d08358 | ||
|
|
ea763d0eab | ||
|
|
f4496d8fd3 | ||
|
|
df1f7e9798 | ||
|
|
ce7cb020fb | ||
|
|
1d6edfbfcb | ||
|
|
4139690447 | ||
|
|
6cf508ef27 | ||
|
|
3c92512a2d | ||
|
|
a07fe6f016 | ||
|
|
3d64d7d126 | ||
|
|
02529a51d0 | ||
|
|
67bab83902 | ||
|
|
bafe447e1c | ||
|
|
0c3e549235 | ||
|
|
038f19ca9d | ||
|
|
df0b8b5a1e | ||
|
|
df9b8c5505 | ||
|
|
9e03264ebe | ||
|
|
53f2cc9814 | ||
|
|
0080728d36 | ||
|
|
47cdf55133 | ||
|
|
52319ee88a | ||
|
|
43b4ded2cc | ||
|
|
2e8eb15536 | ||
|
|
e4660a8cc1 | ||
|
|
6401b5c886 | ||
|
|
501ad2798f | ||
|
|
a8bd22f363 | ||
|
|
e19a9e6ff6 | ||
|
|
274bea1258 | ||
|
|
1280984e78 | ||
|
|
633208958c | ||
|
|
f4fd5e76f8 | ||
|
|
be375c40f2 | ||
|
|
b7746b0c55 | ||
|
|
019cb6a542 | ||
|
|
44a7ca7e43 | ||
|
|
1c6942402e | ||
|
|
28e713caac | ||
|
|
1b31004941 | ||
|
|
8e9330e484 | ||
|
|
033feda02d | ||
|
|
f1b38c42f9 | ||
|
|
1dc7647640 | ||
|
|
a62e7d218c | ||
|
|
6963a54c66 | ||
|
|
ac154e1452 | ||
|
|
45bf58b920 | ||
|
|
c4f6ba3a3f | ||
|
|
54f2c4c34f | ||
|
|
e92e109162 | ||
|
|
92c1a82492 | ||
|
|
bbccb60c0b | ||
|
|
aa7b18427f | ||
|
|
0d354fe57f | ||
|
|
b43ff430b7 | ||
|
|
f78190ef61 | ||
|
|
47264c8cd5 | ||
|
|
11b21d3583 | ||
|
|
de984366b9 | ||
|
|
eae573b9dd | ||
|
|
c9b8319801 | ||
|
|
de6e0d1c1e | ||
|
|
c0569849d2 | ||
|
|
22a15bed67 | ||
|
|
cb28065d8e | ||
|
|
bc87c3e3ae | ||
|
|
a5f3968304 | ||
|
|
2e9f0b29d0 | ||
|
|
0a1152b83a | ||
|
|
dbfe28094c | ||
|
|
7cb54f32c6 | ||
|
|
de6c9aff9d | ||
|
|
33cdf1550a | ||
|
|
1a52fdd626 | ||
|
|
6acf36e898 | ||
|
|
3361d749bf | ||
|
|
540cd1a286 | ||
|
|
634eb222ca | ||
|
|
25d667868d | ||
|
|
5fe80ec122 | ||
|
|
80e9c39b75 | ||
|
|
25fc4aa3ae | ||
|
|
ee0ccd4cc4 | ||
|
|
8030ea0fd6 | ||
|
|
22cd017c2f | ||
|
|
74c1fe16c8 | ||
|
|
51ad1deaf2 | ||
|
|
308c644fc1 | ||
|
|
521c1f6068 | ||
|
|
7f5a2f96ef | ||
|
|
8a5c357f23 | ||
|
|
8abe626957 | ||
|
|
64ca68e8e9 | ||
|
|
29e4965d2b | ||
|
|
fb3b7aa1cd | ||
|
|
2b0204422d | ||
|
|
cc39a86430 | ||
|
|
da0ffce2d6 | ||
|
|
b252abd4d1 | ||
|
|
24c6eece1b | ||
|
|
b1cd450889 | ||
|
|
0b9a3923bf | ||
|
|
5341d2887f | ||
|
|
4435afc726 | ||
|
|
042e9185a9 | ||
|
|
cda43f2ef8 | ||
|
|
220f73fde6 | ||
|
|
5963adf92e | ||
|
|
477cb0c47e | ||
|
|
86266c506f | ||
|
|
5754216479 | ||
|
|
38cf4c7ccf | ||
|
|
1c8170463c | ||
|
|
7534a97518 | ||
|
|
ab2ac78620 | ||
|
|
55d7f43f0c | ||
|
|
3e81921eea | ||
|
|
028888edff | ||
|
|
c194cec520 | ||
|
|
327fed30c8 | ||
|
|
42660b05a7 | ||
|
|
ff6aa0570f | ||
|
|
6350f55e25 | ||
|
|
eaf0869c94 | ||
|
|
df7f4fedb2 | ||
|
|
460a07ca03 | ||
|
|
4e1f9bf5ed | ||
|
|
a88e28cb5a | ||
|
|
ad116be7f6 | ||
|
|
949c178f45 | ||
|
|
a4623a8ebb | ||
|
|
293c2fce07 | ||
|
|
92870c0b2d | ||
|
|
4e433966f4 | ||
|
|
43108926de | ||
|
|
302b6a93de | ||
|
|
48a98bad02 | ||
|
|
89e8f689bb | ||
|
|
b4c7c59d5d | ||
|
|
a3dae612fe | ||
|
|
6fa1602c2c | ||
|
|
3b34f60b90 | ||
|
|
25f76a5996 | ||
|
|
5fee52beac | ||
|
|
413894e3e7 | ||
|
|
50950d8143 | ||
|
|
a7a3748bca | ||
|
|
de4eb5ca89 | ||
|
|
3f5e8aed3d | ||
|
|
17bd6b76a8 | ||
|
|
edeab188a9 | ||
|
|
4bc592c9e8 | ||
|
|
6a96cd1284 | ||
|
|
47d065b239 | ||
|
|
642a6505a1 | ||
|
|
57e1fc6cd8 | ||
|
|
358d416526 | ||
|
|
e4b10d42f9 | ||
|
|
7e71fcfab8 | ||
|
|
254e1ca7f7 | ||
|
|
e27497d43d | ||
|
|
cbfbd0c2bc | ||
|
|
ca43a28d0e | ||
|
|
34306983b2 | ||
|
|
1b6a06a4d7 | ||
|
|
6c7f8e5381 | ||
|
|
c83231871d | ||
|
|
d2ff164c07 | ||
|
|
e344c38349 | ||
|
|
f128650c6e | ||
|
|
d96b4f4d90 | ||
|
|
f478fa97fc | ||
|
|
49b3ed4770 | ||
|
|
cd32b627b3 | ||
|
|
6928c411d6 | ||
|
|
2b21b74c50 | ||
|
|
7ba9cbc052 | ||
|
|
451150ebd6 | ||
|
|
56940e49c2 | ||
|
|
920d225f37 | ||
|
|
a2c764d407 | ||
|
|
feace8d26b | ||
|
|
38fbc4f35a | ||
|
|
661bff4f5b | ||
|
|
4d2d202935 | ||
|
|
9b2d916946 | ||
|
|
be4c108ed9 | ||
|
|
abec14af9b | ||
|
|
b02ee28968 | ||
|
|
c507d4e2dd | ||
|
|
525e07f259 | ||
|
|
bd2ff7a4c9 | ||
|
|
e64c42e661 | ||
|
|
06fa483b7d | ||
|
|
ca2225b940 | ||
|
|
c65ca8060c | ||
|
|
5acfc012cb | ||
|
|
0b3e637880 |
@@ -9,37 +9,50 @@ Basic styles used before we boot up the parsing engine
|
||||
Error message and password prompt
|
||||
*/
|
||||
|
||||
.tc-password-wrapper, .tc-error-form {
|
||||
.tc-error-form {
|
||||
font-family: sans-serif;
|
||||
color: #fff;
|
||||
z-index: 20000;
|
||||
position: fixed;
|
||||
background-color: rgb(255, 75, 75);
|
||||
border: 8px solid rgb(255, 0, 0);
|
||||
border-radius: 8px;
|
||||
width: 50%;
|
||||
margin-left: 25%;
|
||||
margin-top: 4em;
|
||||
padding: 0 2em 1em 2em;
|
||||
}
|
||||
|
||||
.tc-error-form h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tc-error-prompt {
|
||||
text-align: center;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.tc-error-message {
|
||||
overflow: auto;
|
||||
max-height: 40em;
|
||||
padding-right: 1em;
|
||||
margin: 1em 0;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.tc-password-wrapper {
|
||||
font-family: sans-serif;
|
||||
z-index: 20000;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
top: 4em;
|
||||
left: 50%;
|
||||
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
|
||||
left: 50%;
|
||||
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
|
||||
padding: 16px 16px 16px 16px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.tc-error-form {
|
||||
color: #fff;
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
|
||||
background-color: rgb(255, 75, 75);
|
||||
border: 8px solid rgb(255, 0, 0);
|
||||
width: 480px;
|
||||
margin-left: -244px; /* - width/2 - paddingHorz/2 - border */
|
||||
}
|
||||
|
||||
.tc-error-form div {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.tc-error-prompt {
|
||||
color: #000;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.tc-password-wrapper {
|
||||
color: #000;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
|
||||
80
boot/boot.js
80
boot/boot.js
@@ -135,8 +135,8 @@ $tw.utils.error = function(err) {
|
||||
var dm = $tw.utils.domMaker,
|
||||
heading = dm("h1",{text: errHeading}),
|
||||
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
||||
message = dm("div",{text: err}),
|
||||
button = dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )}),
|
||||
message = dm("div",{text: err, "class":"tc-error-message"}),
|
||||
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
||||
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"});
|
||||
document.body.insertBefore(form,document.body.firstChild);
|
||||
form.addEventListener("submit",function(event) {
|
||||
@@ -902,9 +902,23 @@ $tw.Wiki = function(options) {
|
||||
options = options || {};
|
||||
var self = this,
|
||||
tiddlers = Object.create(null), // Hashmap of tiddlers
|
||||
tiddlerTitles = null, // Array of tiddler titles
|
||||
getTiddlerTitles = function() {
|
||||
if(!tiddlerTitles) {
|
||||
tiddlerTitles = Object.keys(tiddlers);
|
||||
}
|
||||
return tiddlerTitles;
|
||||
},
|
||||
pluginTiddlers = [], // Array of tiddlers containing registered plugins, ordered by priority
|
||||
pluginInfo = Object.create(null), // Hashmap of parsed plugin content
|
||||
shadowTiddlers = options.shadowTiddlers || Object.create(null); // Hashmap by title of {source:, tiddler:}
|
||||
shadowTiddlers = options.shadowTiddlers || Object.create(null), // Hashmap by title of {source:, tiddler:}
|
||||
shadowTiddlerTitles = null,
|
||||
getShadowTiddlerTitles = function() {
|
||||
if(!shadowTiddlerTitles) {
|
||||
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||||
}
|
||||
return shadowTiddlerTitles;
|
||||
};
|
||||
|
||||
// Add a tiddler to the store
|
||||
this.addTiddler = function(tiddler) {
|
||||
@@ -918,6 +932,9 @@ $tw.Wiki = function(options) {
|
||||
// Uncomment the following line for detailed logs of all tiddler writes
|
||||
// console.log("Adding",title,tiddler)
|
||||
tiddlers[title] = tiddler;
|
||||
if(tiddlerTitles && tiddlerTitles.indexOf(title) === -1) {
|
||||
tiddlerTitles.push(title);
|
||||
}
|
||||
this.clearCache(title);
|
||||
this.clearGlobalCache();
|
||||
this.enqueueTiddlerEvent(title);
|
||||
@@ -931,6 +948,12 @@ $tw.Wiki = function(options) {
|
||||
// console.log("Deleting",title)
|
||||
if($tw.utils.hop(tiddlers,title)) {
|
||||
delete tiddlers[title];
|
||||
if(tiddlerTitles) {
|
||||
var index = tiddlerTitles.indexOf(title);
|
||||
if(index !== -1) {
|
||||
tiddlerTitles.splice(index,1);
|
||||
}
|
||||
}
|
||||
this.clearCache(title);
|
||||
this.clearGlobalCache();
|
||||
this.enqueueTiddlerEvent(title,true);
|
||||
@@ -943,7 +966,7 @@ $tw.Wiki = function(options) {
|
||||
var t = tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
return t;
|
||||
} else if(title !== undefined && Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||
} else if(title !== undefined && shadowTiddlers[title]) {
|
||||
return shadowTiddlers[title].tiddler;
|
||||
}
|
||||
return undefined;
|
||||
@@ -952,12 +975,12 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Get an array of all tiddler titles
|
||||
this.allTitles = function() {
|
||||
return Object.keys(tiddlers);
|
||||
return getTiddlerTitles().slice(0);
|
||||
};
|
||||
|
||||
// Iterate through all tiddler titles
|
||||
this.each = function(callback) {
|
||||
var titles = Object.keys(tiddlers),
|
||||
var titles = getTiddlerTitles(),
|
||||
index,titlesLength,title;
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
@@ -967,12 +990,12 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Get an array of all shadow tiddler titles
|
||||
this.allShadowTitles = function() {
|
||||
return Object.keys(shadowTiddlers);
|
||||
return getShadowTiddlerTitles().slice(0);
|
||||
};
|
||||
|
||||
// Iterate through all shadow tiddler titles
|
||||
this.eachShadow = function(callback) {
|
||||
var titles = Object.keys(shadowTiddlers),
|
||||
var titles = getShadowTiddlerTitles(),
|
||||
index,titlesLength,title;
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
@@ -983,16 +1006,16 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Iterate through all tiddlers and then the shadows
|
||||
this.eachTiddlerPlusShadows = function(callback) {
|
||||
var titles = Object.keys(tiddlers),
|
||||
index,titlesLength,title;
|
||||
var index,titlesLength,title,
|
||||
titles = getTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
callback(tiddlers[title],title);
|
||||
}
|
||||
titles = Object.keys(shadowTiddlers);
|
||||
titles = getShadowTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
if(!Object.prototype.hasOwnProperty.call(tiddlers,title)) {
|
||||
if(!tiddlers[title]) {
|
||||
var shadowInfo = shadowTiddlers[title];
|
||||
callback(shadowInfo.tiddler,title);
|
||||
}
|
||||
@@ -1001,21 +1024,21 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Iterate through all the shadows and then the tiddlers
|
||||
this.eachShadowPlusTiddlers = function(callback) {
|
||||
var titles = Object.keys(shadowTiddlers),
|
||||
index,titlesLength,title;
|
||||
var index,titlesLength,title,
|
||||
titles = getShadowTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
if(Object.prototype.hasOwnProperty.call(tiddlers,title)) {
|
||||
if(tiddlers[title]) {
|
||||
callback(tiddlers[title],title);
|
||||
} else {
|
||||
var shadowInfo = shadowTiddlers[title];
|
||||
callback(shadowInfo.tiddler,title);
|
||||
}
|
||||
}
|
||||
titles = Object.keys(tiddlers);
|
||||
titles = getTiddlerTitles();
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
if(!Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||
if(!shadowTiddlers[title]) {
|
||||
callback(tiddlers[title],title);
|
||||
}
|
||||
}
|
||||
@@ -1130,6 +1153,7 @@ $tw.Wiki = function(options) {
|
||||
});
|
||||
}
|
||||
});
|
||||
shadowTiddlerTitles = null;
|
||||
this.clearCache(null);
|
||||
this.clearGlobalCache();
|
||||
};
|
||||
@@ -1257,8 +1281,7 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
|
||||
/*
|
||||
Register the built in tiddler deserializer modules
|
||||
*/
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
|
||||
"application/javascript": function(text,fields) {
|
||||
var deserializeHeaderComment = function(text,fields) {
|
||||
var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"),
|
||||
match = headerCommentRegExp.exec(text);
|
||||
fields.text = text;
|
||||
@@ -1266,7 +1289,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
|
||||
fields = $tw.utils.parseFields(match[1].split(/\r?\n\r?\n/mg)[0],fields);
|
||||
}
|
||||
return [fields];
|
||||
}
|
||||
};
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
|
||||
"application/javascript": deserializeHeaderComment
|
||||
});
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/css","tiddlerdeserializer",{
|
||||
"text/css": deserializeHeaderComment
|
||||
});
|
||||
$tw.modules.define("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{
|
||||
"application/x-tiddler": function(text,fields) {
|
||||
@@ -1806,9 +1834,13 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
||||
// Save the original tiddler file locations if requested
|
||||
var config = wikiInfo.config || {};
|
||||
if(config["retain-original-tiddler-path"]) {
|
||||
var output = {};
|
||||
var output = {}, relativePath;
|
||||
for(var title in $tw.boot.files) {
|
||||
output[title] = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
|
||||
relativePath = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
|
||||
output[title] =
|
||||
path.sep === path.posix.sep ?
|
||||
relativePath :
|
||||
relativePath.split(path.sep).join(path.posix.sep);
|
||||
}
|
||||
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
||||
}
|
||||
@@ -1914,7 +1946,7 @@ $tw.boot.startup = function(options) {
|
||||
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
|
||||
$tw.boot.files = Object.create(null);
|
||||
// System paths and filenames
|
||||
$tw.boot.bootPath = path.dirname(module.filename);
|
||||
$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);
|
||||
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
|
||||
// If there's no arguments then default to `--help`
|
||||
if($tw.boot.argv.length === 0) {
|
||||
@@ -1956,6 +1988,7 @@ $tw.boot.startup = function(options) {
|
||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||||
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
||||
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
||||
@@ -1966,6 +1999,7 @@ $tw.boot.startup = function(options) {
|
||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
||||
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
||||
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
||||
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||||
// Create the wiki store for the app
|
||||
|
||||
@@ -4,7 +4,7 @@ type: text/plain
|
||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||
|
||||
Copyright (c) 2004-2007, Jeremy Ruston
|
||||
Copyright (c) 2007-2017, UnaMesa Association
|
||||
Copyright (c) 2007-2018, UnaMesa Association
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
4
core/images/linkify.tid
Normal file
4
core/images/linkify.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/linkify
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-linkify-button tc-image-button" viewBox="0 0 128 128" width="22pt" height="22pt"><path d="M17.031 31.919H9.048V96.85h7.983v6.92H0V25h17.031v6.919zm24.66 0h-7.983V96.85h7.983v6.92H24.66V25h17.03v6.919zM67.77 56.422l11.975-3.903 2.306 7.096-12.063 3.903 7.628 10.379-6.12 4.435-7.63-10.467-7.45 10.2-5.943-4.523L58.1 63.518 45.95 59.35l2.306-7.096 12.064 4.17V43.825h7.45v12.596zM86.31 96.85h7.982V31.92H86.31V25h17.031v78.77H86.31v-6.92zm24.659 0h7.983V31.92h-7.983V25H128v78.77h-17.031v-6.92z" fill-rule="evenodd"/></svg>
|
||||
4
core/images/rotate-left.tid
Normal file
4
core/images/rotate-left.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/rotate-left
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-rotate-left tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128"><g fill-rule="evenodd"><rect width="32" height="80" rx="8"/><rect x="48" y="96" width="80" height="32" rx="8"/><path d="M61.32 36.65c19.743 2.45 35.023 19.287 35.023 39.693a4 4 0 0 1-8 0c0-15.663-11.254-28.698-26.117-31.46l3.916 3.916a4 4 0 1 1-5.657 5.657L49.172 43.142a4 4 0 0 1 0-5.657l11.313-11.313a4 4 0 1 1 5.657 5.656l-4.821 4.822z"/></g></svg>
|
||||
4
core/images/transcludify.tid
Normal file
4
core/images/transcludify.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/transcludify
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-transcludify-button tc-image-button" viewBox="0 0 128 128" width="22pt" height="22pt"><path d="M0 59.482c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 0 0 2.75-.932 6.762 6.762 0 0 0 2.306-1.907c.651-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 0 0-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 0 0-2.75-1.02C1.36 67.377.591 67.288 0 67.288v-7.806zm24.66 0c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 0 0 2.75-.932 6.762 6.762 0 0 0 2.306-1.907c.65-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 0 0-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 0 0-2.75-1.02c-.946-.177-1.715-.266-2.306-.266v-7.806zm43.965-3.538L80.6 52.041l2.306 7.097-12.063 3.903 7.628 10.378-6.12 4.435-7.63-10.467-7.45 10.201-5.943-4.524 7.628-10.023-12.152-4.17 2.306-7.096 12.064 4.17V43.347h7.451v12.596zm34.425 11.344c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 0 0-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 0 0 .71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 0 0-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 0 0 2.262 2.084 8.868 8.868 0 0 0 2.75 1.02c.946.177 1.745.266 2.395.266v7.806zm24.66 0c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 0 0-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 0 0 .71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 0 0-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 0 0 2.262 2.084 8.868 8.868 0 0 0 2.75 1.02c.946.177 1.745.266 2.395.266v7.806z" fill-rule="evenodd"/></svg>
|
||||
@@ -14,6 +14,8 @@ CloseOthers/Caption: close others
|
||||
CloseOthers/Hint: Close other tiddlers
|
||||
ControlPanel/Caption: control panel
|
||||
ControlPanel/Hint: Open control panel
|
||||
CopyToClipboard/Caption: copy to clipboard
|
||||
CopyToClipboard/Hint: Copy this text to the clipboard
|
||||
Delete/Caption: delete
|
||||
Delete/Hint: Delete this tiddler
|
||||
Edit/Caption: edit
|
||||
@@ -80,6 +82,8 @@ Permaview/Caption: permaview
|
||||
Permaview/Hint: Set browser address bar to a direct link to all the tiddlers in this story
|
||||
Print/Caption: print page
|
||||
Print/Hint: Print the current page
|
||||
PrintWindow/Caption: print in new window
|
||||
PrintWindow/Hint: Print tiddler in new window
|
||||
Refresh/Caption: refresh
|
||||
Refresh/Hint: Perform a full refresh of the wiki
|
||||
Save/Caption: ok
|
||||
@@ -139,6 +143,8 @@ LineWidth/Caption: line width
|
||||
LineWidth/Hint: Set line width for painting
|
||||
Link/Caption: link
|
||||
Link/Hint: Create wikitext link
|
||||
Linkify/Caption: wikilink
|
||||
Linkify/Hint: Wrap selection in square brackets
|
||||
ListBullet/Caption: bulleted list
|
||||
ListBullet/Hint: Apply bulleted list formatting to lines containing selection
|
||||
ListNumber/Caption: numbered list
|
||||
@@ -159,6 +165,8 @@ PreviewType/Caption: preview type
|
||||
PreviewType/Hint: Choose preview type
|
||||
Quote/Caption: quote
|
||||
Quote/Hint: Apply quoted text formatting to lines containing selection
|
||||
RotateLeft/Caption: rotate left
|
||||
RotateLeft/Hint: Rotate image left by 90 degrees
|
||||
Size/Caption: image size
|
||||
Size/Caption/Height: Height:
|
||||
Size/Caption/Resize: Resize image
|
||||
@@ -175,5 +183,7 @@ Subscript/Caption: subscript
|
||||
Subscript/Hint: Apply subscript formatting to selection
|
||||
Superscript/Caption: superscript
|
||||
Superscript/Hint: Apply superscript formatting to selection
|
||||
Transcludify/Caption: transclusion
|
||||
Transcludify/Hint: Wrap selection in curly brackets
|
||||
Underline/Caption: underline
|
||||
Underline/Hint: Apply underline formatting to selection
|
||||
|
||||
@@ -13,6 +13,7 @@ Basics/Language/Prompt: Hello! Current language:
|
||||
Basics/NewJournal/Title/Prompt: Title of new journal tiddlers
|
||||
Basics/NewJournal/Text/Prompt: Text for new journal tiddlers
|
||||
Basics/NewJournal/Tags/Prompt: Tags for new journal tiddlers
|
||||
Basics/NewTiddler/Title/Prompt: Title of new tiddlers
|
||||
Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers:
|
||||
Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers:
|
||||
Basics/Subtitle/Prompt: Subtitle:
|
||||
@@ -139,6 +140,8 @@ Settings/ToolbarButtons/Icons/Description: Include icon
|
||||
Settings/ToolbarButtons/Text/Description: Include text
|
||||
Settings/DefaultSidebarTab/Caption: Default Sidebar Tab
|
||||
Settings/DefaultSidebarTab/Hint: Specify which sidebar tab is displayed by default
|
||||
Settings/DefaultMoreSidebarTab/Caption: Default More Sidebar Tab
|
||||
Settings/DefaultMoreSidebarTab/Hint: Specify which More sidebar tab is displayed by default
|
||||
Settings/LinkToBehaviour/Caption: Tiddler Opening Behaviour
|
||||
Settings/LinkToBehaviour/InsideRiver/Hint: Navigation from //within// the story river
|
||||
Settings/LinkToBehaviour/OutsideRiver/Hint: Navigation from //outside// the story river
|
||||
@@ -155,6 +158,10 @@ Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist
|
||||
Settings/MissingLinks/Description: Enable links to missing tiddlers
|
||||
StoryView/Caption: Story View
|
||||
StoryView/Prompt: Current view:
|
||||
Stylesheets/Caption: Stylesheets
|
||||
Stylesheets/Expand/Caption: Expand All
|
||||
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
|
||||
Stylesheets/Restore/Caption: Restore
|
||||
Theme/Caption: Theme
|
||||
Theme/Prompt: Current theme:
|
||||
TiddlerFields/Caption: Tiddler Fields
|
||||
|
||||
@@ -5,6 +5,8 @@ Body/Placeholder: Type the text for this tiddler
|
||||
Body/Preview/Type/Output: output
|
||||
Field/Remove/Caption: remove field
|
||||
Field/Remove/Hint: Remove field
|
||||
Field/Dropdown/Caption: field list
|
||||
Field/Dropdown/Hint: Show field list
|
||||
Fields/Add/Button: add
|
||||
Fields/Add/Name/Placeholder: field name
|
||||
Fields/Add/Prompt: Add a new field:
|
||||
|
||||
@@ -18,7 +18,7 @@ icon: The title of the tiddler containing the icon associated with a tiddler
|
||||
library: If set to "yes" indicates that a tiddler should be saved as a JavaScript library
|
||||
list: An ordered list of tiddler titles associated with a tiddler
|
||||
list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty
|
||||
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles
|
||||
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty
|
||||
modified: The date and time at which a tiddler was last modified
|
||||
modifier: The tiddler title associated with the person who last modified a tiddler
|
||||
name: The human readable name associated with a plugin tiddler
|
||||
|
||||
@@ -3,7 +3,7 @@ title: GettingStarted
|
||||
\define lingo-base() $:/language/ControlPanel/Basics/
|
||||
Welcome to ~TiddlyWiki and the ~TiddlyWiki community
|
||||
|
||||
Before you start storing important information in ~TiddlyWiki it is important to make sure that you can reliably save changes. See https://tiddlywiki.com/#GettingStarted for details
|
||||
Before you start storing important information in ~TiddlyWiki it is vital to make sure that you can reliably save changes. See https://tiddlywiki.com/#GettingStarted for details
|
||||
|
||||
!! Set up this ~TiddlyWiki
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ At the root, it serves a rendering of a specified tiddler. Away from the root, i
|
||||
|
||||
The parameters are:
|
||||
|
||||
* ''port'' - port number to serve from (defaults to "8080")
|
||||
* ''port'' - port number on which to listen; non-numeric values are interpreted as a system environment variable from which the port number is extracted (defaults to "8080")
|
||||
* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
||||
* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
||||
* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html")
|
||||
@@ -34,4 +34,9 @@ The username and password can be specified as empty strings if you need to set t
|
||||
--server 8080 $:/core/save/all text/plain text/html "" "" 192.168.0.245
|
||||
```
|
||||
|
||||
To run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port.
|
||||
To run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port. It can be useful to use an environment variable to pass the port number to the Node.js process. This example references an environment variable called "MY_PORT_NUMBER":
|
||||
|
||||
|
||||
```
|
||||
--server MY_PORT_NUMBER $:/core/save/all text/plain text/html MyUserName passw0rd
|
||||
```
|
||||
|
||||
@@ -7,6 +7,12 @@ Listing/Import/Caption: Import
|
||||
Listing/Select/Caption: Select
|
||||
Listing/Status/Caption: Status
|
||||
Listing/Title/Caption: Title
|
||||
Listing/Preview: Preview:
|
||||
Listing/Preview/Text: Text
|
||||
Listing/Preview/TextRaw: Text (Raw)
|
||||
Listing/Preview/Fields: Fields
|
||||
Listing/Preview/Diff: Diff
|
||||
Listing/Preview/DiffFields: Diff (Fields)
|
||||
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
||||
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
|
||||
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
|
||||
|
||||
@@ -12,6 +12,7 @@ ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<tit
|
||||
ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"?
|
||||
Count: count
|
||||
DefaultNewTiddlerTitle: New Tiddler
|
||||
Diffs/CountMessage: <<diff-count>> differences
|
||||
DropMessage: Drop here (or use the 'Escape' key to cancel)
|
||||
Encryption/Cancel: Cancel
|
||||
Encryption/ConfirmClearPassword: Do you wish to clear the password? This will remove the encryption applied when saving this wiki
|
||||
|
||||
@@ -2,3 +2,5 @@ title: $:/language/Notifications/
|
||||
|
||||
Save/Done: Saved wiki
|
||||
Save/Starting: Starting to save wiki
|
||||
CopiedToClipboard/Succeeded: Copied!
|
||||
CopiedToClipboard/Failed: Failed to copy to clipboard!
|
||||
|
||||
@@ -7,7 +7,7 @@ Options/SidebarLayout: Sidebar layout
|
||||
Options/SidebarLayout/Fixed-Fluid: Fixed story, fluid sidebar
|
||||
Options/SidebarLayout/Fluid-Fixed: Fluid story, fixed sidebar
|
||||
Options/StickyTitles: Sticky titles
|
||||
Options/StickyTitles/Hint: Causes tiddler titles to "stick" to the top of the browser window. Caution: Does not work at all with Chrome, and causes some layout issues in Firefox
|
||||
Options/StickyTitles/Hint: Causes tiddler titles to "stick" to the top of the browser window
|
||||
Options/CodeWrapping: Wrap long lines in code blocks
|
||||
Settings: Settings
|
||||
Settings/FontFamily: Font family
|
||||
|
||||
@@ -143,7 +143,7 @@ SimpleServer.prototype.requestHandler = function(request,response) {
|
||||
};
|
||||
|
||||
SimpleServer.prototype.listen = function(port,host) {
|
||||
http.createServer(this.requestHandler.bind(this)).listen(port,host);
|
||||
return http.createServer(this.requestHandler.bind(this)).listen(port,host);
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
@@ -291,6 +291,9 @@ Command.prototype.execute = function() {
|
||||
password = this.params[5],
|
||||
host = this.params[6] || "127.0.0.1",
|
||||
pathprefix = this.params[7];
|
||||
if(parseInt(port,10).toString() !== port) {
|
||||
port = process.env[port] || 8080;
|
||||
}
|
||||
this.server.set({
|
||||
rootTiddler: rootTiddler,
|
||||
renderType: renderType,
|
||||
@@ -299,13 +302,14 @@ Command.prototype.execute = function() {
|
||||
password: password,
|
||||
pathprefix: pathprefix
|
||||
});
|
||||
this.server.listen(port,host);
|
||||
var nodeServer = this.server.listen(port,host);
|
||||
$tw.utils.log("Serving on " + host + ":" + port,"brown/orange");
|
||||
$tw.utils.log("(press ctrl-C to exit)","red");
|
||||
// Warn if required plugins are missing
|
||||
if(!$tw.wiki.getTiddler("$:/plugins/tiddlywiki/tiddlyweb") || !$tw.wiki.getTiddler("$:/plugins/tiddlywiki/filesystem")) {
|
||||
$tw.utils.warning("Warning: Plugins required for client-server operation (\"tiddlywiki/filesystem\" and \"tiddlywiki/tiddlyweb\") are missing from tiddlywiki.info file");
|
||||
}
|
||||
$tw.hooks.invokeHook('th-server-command-post-start', this.server, nodeServer);
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ function FramedEngine(options) {
|
||||
this.copyStyles();
|
||||
// Add event listeners
|
||||
$tw.utils.addEventListeners(this.domNode,[
|
||||
{name: "click",handlerObject: this,handlerMethod: "handleClickEvent"},
|
||||
{name: "input",handlerObject: this,handlerMethod: "handleInputEvent"},
|
||||
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"}
|
||||
]);
|
||||
@@ -147,6 +148,14 @@ FramedEngine.prototype.focus = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a click
|
||||
*/
|
||||
FramedEngine.prototype.handleClickEvent = function(event) {
|
||||
this.fixHeight();
|
||||
return true;
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a dom "input" event which occurs when the text has changed
|
||||
*/
|
||||
|
||||
@@ -198,7 +198,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
this.makeChildWidgets();
|
||||
// Determine whether to show the toolbar
|
||||
this.editShowToolbar = this.wiki.getTiddlerText(ENABLE_TOOLBAR_TITLE,"yes");
|
||||
this.editShowToolbar = (this.editShowToolbar === "yes") && !!(this.children && this.children.length > 0);
|
||||
this.editShowToolbar = (this.editShowToolbar === "yes") && !!(this.children && this.children.length > 0) && (!this.document.isTiddlyWikiFakeDom);
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
24
core/modules/editor/operations/bitmap/rotate-left.js
Normal file
24
core/modules/editor/operations/bitmap/rotate-left.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/*\
|
||||
title: $:/core/modules/editor/operations/bitmap/rotate-left.js
|
||||
type: application/javascript
|
||||
module-type: bitmapeditoroperation
|
||||
|
||||
Bitmap editor operation to rotate the image left by 90 degrees
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports["rotate-left"] = function(event) {
|
||||
// Rotate the canvas left by 90 degrees
|
||||
this.rotateCanvasLeft();
|
||||
// Update the input controls
|
||||
this.refreshToolbar();
|
||||
// Save the image into the tiddler
|
||||
this.saveChanges();
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -18,18 +18,34 @@ Export our filter function
|
||||
*/
|
||||
exports.each = function(source,operator,options) {
|
||||
var results =[] ,
|
||||
value,values = {},
|
||||
field = operator.operand || "title";
|
||||
if(operator.suffix !== "list-item") {
|
||||
value,values = {},
|
||||
field = operator.operand || "title";
|
||||
if(operator.suffix === "value" && field === "title") {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
value = (field === "title") ? title : tiddler.getFieldString(field);
|
||||
if(!$tw.utils.hop(values,value)) {
|
||||
values[value] = true;
|
||||
results.push(title);
|
||||
}
|
||||
if(!$tw.utils.hop(values,title)) {
|
||||
values[title] = true;
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else if(operator.suffix !== "list-item") {
|
||||
if(field === "title") {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && !$tw.utils.hop(values,title)) {
|
||||
values[title] = true;
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
value = tiddler.getFieldString(field);
|
||||
if(!$tw.utils.hop(values,value)) {
|
||||
values[value] = true;
|
||||
results.push(title);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
|
||||
@@ -45,4 +45,4 @@ exports.is = function(source,operator,options) {
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
})();
|
||||
@@ -24,7 +24,7 @@ exports.order = function(source,operator,options) {
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
});
|
||||
}
|
||||
return results;
|
||||
};
|
||||
@@ -44,7 +44,7 @@ exports.reverse = function(source,operator,options) {
|
||||
First entry/entries in list
|
||||
*/
|
||||
exports.first = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -56,7 +56,7 @@ exports.first = function(source,operator,options) {
|
||||
Last entry/entries in list
|
||||
*/
|
||||
exports.last = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -68,7 +68,7 @@ exports.last = function(source,operator,options) {
|
||||
All but the first entry/entries of the list
|
||||
*/
|
||||
exports.rest = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -82,7 +82,7 @@ exports.bf = exports.rest;
|
||||
All but the last entry/entries of the list
|
||||
*/
|
||||
exports.butlast = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
@@ -95,7 +95,7 @@ exports.bl = exports.butlast;
|
||||
The nth member of the list
|
||||
*/
|
||||
exports.nth = function(source,operator,options) {
|
||||
var count = parseInt(operator.operand) || 1,
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
|
||||
@@ -27,6 +27,12 @@ exports.nsort = function(source,operator,options) {
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.sortan = function(source, operator, options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results, operator.operand || "title", operator.prefix === "!",false,false,true);
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.sortcs = function(source,operator,options) {
|
||||
var results = prepare_results(source);
|
||||
options.wiki.sortTiddlers(results,operator.operand || "title",operator.prefix === "!",true,false);
|
||||
|
||||
31
core/modules/filters/subtiddlerfields.js
Normal file
31
core/modules/filters/subtiddlerfields.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/subtiddlerfields.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for returning the names of the fields on the selected subtiddlers of the plugin named in the operand
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.subtiddlerfields = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var subtiddler = options.wiki.getSubTiddler(operator.operand,title);
|
||||
if(subtiddler) {
|
||||
for(var fieldName in subtiddler.fields) {
|
||||
$tw.utils.pushTop(results,fieldName);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -25,17 +25,18 @@ exports.tag = function(source,operator,options) {
|
||||
});
|
||||
} else {
|
||||
// Old semantics:
|
||||
var tiddlers = options.wiki.getTiddlersWithTag(operator.operand);
|
||||
if(operator.prefix === "!") {
|
||||
// Returns a copy of the input if operator.operand is missing
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && !tiddler.hasTag(operator.operand)) {
|
||||
if(tiddlers.indexOf(title) === -1) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Returns empty results if operator.operand is missing
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && tiddler.hasTag(operator.operand)) {
|
||||
if(tiddlers.indexOf(title) !== -1) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.putbefore = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return (index === -1) ?
|
||||
results.slice(0, -1) :
|
||||
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index, -count));
|
||||
@@ -41,7 +41,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.putafter = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return (index === -1) ?
|
||||
results.slice(0, -1) :
|
||||
results.slice(0, index + 1).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
||||
@@ -53,7 +53,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.replace = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return (index === -1) ?
|
||||
results.slice(0, -count) :
|
||||
results.slice(0, index).concat(results.slice(-count)).concat(results.slice(index + 1, -count));
|
||||
@@ -64,7 +64,7 @@ Extended filter operators to manipulate the current list.
|
||||
*/
|
||||
exports.putfirst = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return results.slice(-count).concat(results.slice(0, -count));
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ Extended filter operators to manipulate the current list.
|
||||
*/
|
||||
exports.putlast = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
count = parseInt(operator.suffix) || 1;
|
||||
count = $tw.utils.getInt(operator.suffix,1);
|
||||
return results.slice(count).concat(results.slice(0, count));
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.move = function (source, operator) {
|
||||
var results = prepare_results(source),
|
||||
index = results.indexOf(operator.operand),
|
||||
count = parseInt(operator.suffix) || 1,
|
||||
count = $tw.utils.getInt(operator.suffix,1),
|
||||
marker = results.splice(index, 1),
|
||||
offset = (index + count) > 0 ? index + count : 0;
|
||||
return results.slice(0, offset).concat(marker).concat(results.slice(offset));
|
||||
@@ -129,7 +129,7 @@ Extended filter operators to manipulate the current list.
|
||||
exports.prepend = function (source, operator) {
|
||||
var prepend = $tw.utils.parseStringArray(operator.operand, "true"),
|
||||
results = prepare_results(source),
|
||||
count = parseInt(operator.suffix) || prepend.length;
|
||||
count = $tw.utils.getInt(operator.suffix,prepend.length);
|
||||
return (prepend.length === 0) ? results :
|
||||
(operator.prefix) ? prepend.slice(-count).concat(results) :
|
||||
prepend.slice(0, count).concat(results);
|
||||
|
||||
@@ -18,8 +18,8 @@ exports.getInfoTiddlerFields = function() {
|
||||
// Basics
|
||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||
infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)});
|
||||
// Document location
|
||||
if($tw.browser) {
|
||||
// Document location
|
||||
var setLocationProperty = function(name,value) {
|
||||
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
||||
},
|
||||
@@ -32,6 +32,9 @@ exports.getInfoTiddlerFields = function() {
|
||||
setLocationProperty("pathname", location.pathname);
|
||||
setLocationProperty("search", location.search);
|
||||
setLocationProperty("origin", location.origin);
|
||||
// Screen size
|
||||
infoTiddlerFields.push({title: "$:/info/browser/screen/width", text: window.screen.width.toString()});
|
||||
infoTiddlerFields.push({title: "$:/info/browser/screen/height", text: window.screen.height.toString()});
|
||||
}
|
||||
return infoTiddlerFields;
|
||||
};
|
||||
|
||||
@@ -17,8 +17,7 @@ var ImageParser = function(type,text,options) {
|
||||
type: "element",
|
||||
tag: "img",
|
||||
attributes: {}
|
||||
},
|
||||
src;
|
||||
};
|
||||
if(options._canonical_uri) {
|
||||
element.attributes.src = {type: "string", value: options._canonical_uri};
|
||||
} else if(text) {
|
||||
|
||||
@@ -97,6 +97,9 @@ exports.parseTag = function(source,pos,options) {
|
||||
return null;
|
||||
}
|
||||
node.tag = token.match[1];
|
||||
if(node.tag.slice(1).indexOf("$") !== -1) {
|
||||
return null;
|
||||
}
|
||||
if(node.tag.charAt(0) === "$") {
|
||||
node.type = node.tag.substr(1);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ BeakerSaver.prototype.info = {
|
||||
Static method that returns true if this saver is capable of working
|
||||
*/
|
||||
exports.canSave = function(wiki) {
|
||||
return !!window.DatArchive;
|
||||
return !!window.DatArchive && location.protocol==="dat:";
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,6 +15,25 @@ to the current URL, such as a WebDAV server.
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Retrieve ETag if available
|
||||
*/
|
||||
var RetrieveETag = function(self) {
|
||||
var headers = { "Accept": "*/*;charset=UTF-8" };
|
||||
$tw.utils.httpRequest({
|
||||
url: self.uri(),
|
||||
type: "HEAD",
|
||||
headers: headers,
|
||||
callback: function(err, data, xhr) {
|
||||
if(err) return;
|
||||
var etag = xhr.getResponseHeader("ETag");
|
||||
if(!etag) return;
|
||||
self.etag = etag.replace(/^W\//,"");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Select the appropriate saver module and set it up
|
||||
*/
|
||||
@@ -34,16 +53,7 @@ var PutSaver = function(wiki) {
|
||||
}
|
||||
}
|
||||
});
|
||||
// Retrieve ETag if available
|
||||
$tw.utils.httpRequest({
|
||||
url: uri,
|
||||
type: "HEAD",
|
||||
callback: function(err, data, xhr) {
|
||||
if(!err) {
|
||||
self.etag = xhr.getResponseHeader("ETag");
|
||||
}
|
||||
}
|
||||
});
|
||||
RetrieveETag(this);
|
||||
};
|
||||
|
||||
PutSaver.prototype.uri = function() {
|
||||
@@ -69,15 +79,20 @@ PutSaver.prototype.save = function(text, method, callback) {
|
||||
data: text,
|
||||
callback: function(err, data, xhr) {
|
||||
if(err) {
|
||||
callback(err);
|
||||
} if(xhr.status === 200 || xhr.status === 201) {
|
||||
self.etag = xhr.getResponseHeader("ETag");
|
||||
callback(null); // success
|
||||
} else if(xhr.status === 412) { // edit conflict
|
||||
var message = $tw.language.getString("Error/EditConflict");
|
||||
callback(message);
|
||||
// response is textual: "XMLHttpRequest error code: 412"
|
||||
const status = Number(err.substring(err.indexOf(':') + 2, err.length))
|
||||
if(status === 412) { // edit conflict
|
||||
var message = $tw.language.getString("Error/EditConflict");
|
||||
callback(message);
|
||||
} else {
|
||||
callback(err); // fail
|
||||
}
|
||||
} else {
|
||||
callback(xhr.responseText); // fail
|
||||
self.etag = xhr.getResponseHeader("ETag");
|
||||
if (self.etag == null) {
|
||||
RetrieveETag(self);
|
||||
}
|
||||
callback(null); // success
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -57,6 +57,7 @@ exports.startup = function() {
|
||||
$tw.utils.addClass($tw.pageContainer,"tc-page-container-wrapper");
|
||||
document.body.insertBefore($tw.pageContainer,document.body.firstChild);
|
||||
$tw.pageWidgetNode.render($tw.pageContainer,null);
|
||||
$tw.hooks.invokeHook("th-page-refreshed");
|
||||
})();
|
||||
// Prepare refresh mechanism
|
||||
var deferredChanges = Object.create(null),
|
||||
@@ -65,6 +66,7 @@ exports.startup = function() {
|
||||
// Process the refresh
|
||||
$tw.pageWidgetNode.refresh(deferredChanges);
|
||||
deferredChanges = Object.create(null);
|
||||
$tw.hooks.invokeHook("th-page-refreshed");
|
||||
}
|
||||
// Add the change event handler
|
||||
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
||||
|
||||
@@ -30,6 +30,10 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tm-notify",function(event) {
|
||||
$tw.notifier.display(event.param,{variables: event.paramObject});
|
||||
});
|
||||
// Install the copy-to-clipboard mechanism
|
||||
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
|
||||
$tw.utils.copyToClipboard(event.param);
|
||||
});
|
||||
// Install the scroller
|
||||
$tw.pageScroller = new $tw.utils.PageScroller();
|
||||
$tw.rootWidget.addEventListener("tm-scroll",function(event) {
|
||||
|
||||
@@ -87,18 +87,29 @@ exports.startup = function() {
|
||||
});
|
||||
// Kick off the keyboard manager
|
||||
$tw.keyboardManager = new $tw.KeyboardManager();
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: $tw.browser ? document : $tw.fakeDocument
|
||||
});
|
||||
// Execute any startup actions
|
||||
var executeStartupTiddlers = function(tag) {
|
||||
$tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) {
|
||||
$tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget);
|
||||
});
|
||||
};
|
||||
executeStartupTiddlers("$:/tags/StartupAction");
|
||||
if($tw.browser) {
|
||||
executeStartupTiddlers("$:/tags/StartupAction/Browser");
|
||||
}
|
||||
if($tw.node) {
|
||||
executeStartupTiddlers("$:/tags/StartupAction/Node");
|
||||
}
|
||||
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
|
||||
$tw.wiki.clearTiddlerEventQueue();
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
if($tw.browser) {
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: document
|
||||
});
|
||||
}
|
||||
// Find a working syncadaptor
|
||||
$tw.syncadaptor = undefined;
|
||||
$tw.modules.forEachModuleOfType("syncadaptor",function(title,module) {
|
||||
|
||||
@@ -29,6 +29,7 @@ exports.startup = function() {
|
||||
title = event.param || event.tiddlerTitle,
|
||||
paramObject = event.paramObject || {},
|
||||
template = paramObject.template || "$:/core/templates/single.tiddler.window",
|
||||
print = paramObject.print === "yes",
|
||||
width = paramObject.width || "700",
|
||||
height = paramObject.height || "600",
|
||||
variables = $tw.utils.extend({},paramObject,{currentTiddler: title});
|
||||
@@ -62,6 +63,10 @@ exports.startup = function() {
|
||||
var parser = $tw.wiki.parseTiddler(template),
|
||||
widgetNode = $tw.wiki.makeWidget(parser,{document: srcDocument, parentWidget: $tw.rootWidget, variables: variables});
|
||||
widgetNode.render(srcDocument.body,srcDocument.body.firstChild);
|
||||
// Print the window if required
|
||||
if(print) {
|
||||
srcWindow.print();
|
||||
}
|
||||
// Function to handle refreshes
|
||||
refreshHandler = function(changes) {
|
||||
if(styleWidgetNode.refresh(changes,styleContainer,null)) {
|
||||
|
||||
@@ -178,8 +178,6 @@ Syncer.prototype.getStatus = function(callback) {
|
||||
self.wiki.addTiddler({title: self.titleIsLoggedIn,text: isLoggedIn ? "yes" : "no"});
|
||||
if(isLoggedIn) {
|
||||
self.wiki.addTiddler({title: self.titleUserName,text: username || ""});
|
||||
} else {
|
||||
self.wiki.deleteTiddler(self.titleUserName);
|
||||
}
|
||||
// Invoke the callback
|
||||
if(callback) {
|
||||
@@ -271,13 +269,16 @@ Syncer.prototype.handleLazyLoadEvent = function(title) {
|
||||
// Don't lazy load the same tiddler twice
|
||||
var info = this.tiddlerInfo[title];
|
||||
if(!info || !info.hasBeenLazyLoaded) {
|
||||
this.createTiddlerInfo(title);
|
||||
this.tiddlerInfo[title].hasBeenLazyLoaded = true;
|
||||
// Queue up a sync task to load this tiddler
|
||||
this.enqueueSyncTask({
|
||||
type: "load",
|
||||
title: title
|
||||
});
|
||||
// Don't lazy load if the tiddler isn't included in the sync filter
|
||||
if(this.filterFn.call(this.wiki).indexOf(title) !== -1) {
|
||||
this.createTiddlerInfo(title);
|
||||
this.tiddlerInfo[title].hasBeenLazyLoaded = true;
|
||||
// Queue up a sync task to load this tiddler
|
||||
this.enqueueSyncTask({
|
||||
type: "load",
|
||||
title: title
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
202
core/modules/utils/diff-match-patch/LICENSE
Executable file
202
core/modules/utils/diff-match-patch/LICENSE
Executable file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
41
core/modules/utils/diff-match-patch/README.md
Executable file
41
core/modules/utils/diff-match-patch/README.md
Executable file
@@ -0,0 +1,41 @@
|
||||
The Diff Match and Patch libraries offer robust algorithms to perform the
|
||||
operations required for synchronizing plain text.
|
||||
|
||||
1. Diff:
|
||||
* Compare two blocks of plain text and efficiently return a list of differences.
|
||||
* [Diff Demo](https://neil.fraser.name/software/diff_match_patch/demos/diff.html)
|
||||
2. Match:
|
||||
* Given a search string, find its best fuzzy match in a block of plain text. Weighted for both accuracy and location.
|
||||
* [Match Demo](https://neil.fraser.name/software/diff_match_patch/demos/match.html)
|
||||
3. Patch:
|
||||
* Apply a list of patches onto plain text. Use best-effort to apply patch even when the underlying text doesn't match.
|
||||
* [Patch Demo](https://neil.fraser.name/software/diff_match_patch/demos/patch.html)
|
||||
|
||||
Originally built in 2006 to power Google Docs, this library is now available in C++, C#, Dart, Java, JavaScript, Lua, Objective C, and Python.
|
||||
|
||||
### Reference
|
||||
|
||||
* [API](https://github.com/google/diff-match-patch/wiki/API) - Common API across all languages.
|
||||
* [Line or Word Diffs](https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs) - Less detailed diffs.
|
||||
* [Plain Text vs. Structured Content](https://github.com/google/diff-match-patch/wiki/Plain-Text-vs.-Structured-Content) - How to deal with data like XML.
|
||||
* [Unidiff](https://github.com/google/diff-match-patch/wiki/Unidiff) - The patch serialization format.
|
||||
* [Support](https://groups.google.com/forum/#!forum/diff-match-patch) - Newsgroup for developers.
|
||||
|
||||
### Languages
|
||||
Although each language port of Diff Match Patch uses the same API, there are some language-specific notes.
|
||||
|
||||
* [C++](https://github.com/google/diff-match-patch/wiki/Language:-Cpp)
|
||||
* [C#](https://github.com/google/diff-match-patch/wiki/Language:-C%23)
|
||||
* [Dart](https://github.com/google/diff-match-patch/wiki/Language:-Dart)
|
||||
* [Java](https://github.com/google/diff-match-patch/wiki/Language:-Java)
|
||||
* [JavaScript](https://github.com/google/diff-match-patch/wiki/Language:-JavaScript)
|
||||
* [Lua](https://github.com/google/diff-match-patch/wiki/Language:-Lua)
|
||||
* [Objective-C](https://github.com/google/diff-match-patch/wiki/Language:-Objective-C)
|
||||
* [Python](https://github.com/google/diff-match-patch/wiki/Language:-Python)
|
||||
|
||||
A standardized speed test tracks the [relative performance of diffs](https://docs.google.com/spreadsheets/d/1zpZccuBpjMZTvL1nGDMKJc7rWL_m_drF4XKOJvB27Kc/edit#gid=0) in each language.
|
||||
|
||||
### Algorithms
|
||||
This library implements [Myer's diff algorithm](https://neil.fraser.name/writing/diff/myers.pdf) which is generally considered to be the best general-purpose diff. A layer of [pre-diff speedups and post-diff cleanups](https://neil.fraser.name/writing/diff/) surround the diff algorithm, improving both performance and output quality.
|
||||
|
||||
This library also implements a [Bitap matching algorithm](https://neil.fraser.name/writing/patch/bitap.ps) at the heart of a [flexible matching and patching strategy](https://neil.fraser.name/writing/patch/).
|
||||
53
core/modules/utils/diff-match-patch/diff_match_patch.js
Executable file
53
core/modules/utils/diff-match-patch/diff_match_patch.js
Executable file
@@ -0,0 +1,53 @@
|
||||
function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=.5;this.Patch_Margin=4;this.Match_MaxBits=32}var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;
|
||||
diff_match_patch.prototype.diff_main=function(a,b,c,d){"undefined"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error("Null input. (diff_main)");if(a==b)return a?[[DIFF_EQUAL,a]]:[];"undefined"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b);c=a.substring(0,f);a=a.substring(f);b=b.substring(f);f=this.diff_commonSuffix(a,b);var g=a.substring(a.length-f);a=a.substring(0,a.length-f);b=b.substring(0,b.length-f);a=this.diff_compute_(a,
|
||||
b,e,d);c&&a.unshift([DIFF_EQUAL,c]);g&&a.push([DIFF_EQUAL,g]);this.diff_cleanupMerge(a);return a};
|
||||
diff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[DIFF_INSERT,b]];if(!b)return[[DIFF_DELETE,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);return-1!=g?(c=[[DIFF_INSERT,e.substring(0,g)],[DIFF_EQUAL,f],[DIFF_INSERT,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=DIFF_DELETE),c):1==f.length?[[DIFF_DELETE,a],[DIFF_INSERT,b]]:(e=this.diff_halfMatch_(a,b))?(b=e[1],f=e[3],a=e[4],e=this.diff_main(e[0],e[2],c,d),c=this.diff_main(b,f,c,d),e.concat([[DIFF_EQUAL,
|
||||
a]],c)):c&&100<a.length&&100<b.length?this.diff_lineMode_(a,b,d):this.diff_bisect_(a,b,d)};
|
||||
diff_match_patch.prototype.diff_lineMode_=function(a,b,c){var d=this.diff_linesToChars_(a,b);a=d.chars1;b=d.chars2;d=d.lineArray;a=this.diff_main(a,b,!1,c);this.diff_charsToLines_(a,d);this.diff_cleanupSemantic(a);a.push([DIFF_EQUAL,""]);for(var e=d=b=0,f="",g="";b<a.length;){switch(a[b][0]){case DIFF_INSERT:e++;g+=a[b][1];break;case DIFF_DELETE:d++;f+=a[b][1];break;case DIFF_EQUAL:if(1<=d&&1<=e){a.splice(b-d-e,d+e);b=b-d-e;d=this.diff_main(f,g,!1,c);for(e=d.length-1;0<=e;e--)a.splice(b,0,d[e]);b+=
|
||||
d.length}d=e=0;g=f=""}b++}a.pop();return a};
|
||||
diff_match_patch.prototype.diff_bisect_=function(a,b,c){for(var d=a.length,e=b.length,f=Math.ceil((d+e)/2),g=2*f,h=Array(g),l=Array(g),k=0;k<g;k++)h[k]=-1,l[k]=-1;h[f+1]=0;l[f+1]=0;k=d-e;for(var m=0!=k%2,p=0,x=0,w=0,q=0,t=0;t<f&&!((new Date).getTime()>c);t++){for(var v=-t+p;v<=t-x;v+=2){var n=f+v;var r=v==-t||v!=t&&h[n-1]<h[n+1]?h[n+1]:h[n-1]+1;for(var y=r-v;r<d&&y<e&&a.charAt(r)==b.charAt(y);)r++,y++;h[n]=r;if(r>d)x+=2;else if(y>e)p+=2;else if(m&&(n=f+k-v,0<=n&&n<g&&-1!=l[n])){var u=d-l[n];if(r>=
|
||||
u)return this.diff_bisectSplit_(a,b,r,y,c)}}for(v=-t+w;v<=t-q;v+=2){n=f+v;u=v==-t||v!=t&&l[n-1]<l[n+1]?l[n+1]:l[n-1]+1;for(r=u-v;u<d&&r<e&&a.charAt(d-u-1)==b.charAt(e-r-1);)u++,r++;l[n]=u;if(u>d)q+=2;else if(r>e)w+=2;else if(!m&&(n=f+k-v,0<=n&&n<g&&-1!=h[n]&&(r=h[n],y=f+r-n,u=d-u,r>=u)))return this.diff_bisectSplit_(a,b,r,y,c)}}return[[DIFF_DELETE,a],[DIFF_INSERT,b]]};
|
||||
diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)};
|
||||
diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,f=-1,g=d.length;f<a.length-1;){f=a.indexOf("\n",c);-1==f&&(f=a.length-1);var h=a.substring(c,f+1);c=f+1;(e.hasOwnProperty?e.hasOwnProperty(h):void 0!==e[h])?b+=String.fromCharCode(e[h]):(b+=String.fromCharCode(g),e[h]=g,d[g++]=h)}return b}var d=[],e={};d[0]="";var f=c(a),g=c(b);return{chars1:f,chars2:g,lineArray:d}};
|
||||
diff_match_patch.prototype.diff_charsToLines_=function(a,b){for(var c=0;c<a.length;c++){for(var d=a[c][1],e=[],f=0;f<d.length;f++)e[f]=b[d.charCodeAt(f)];a[c][1]=e.join("")}};diff_match_patch.prototype.diff_commonPrefix=function(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(f,e)==b.substring(f,e)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
|
||||
diff_match_patch.prototype.diff_commonSuffix=function(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
|
||||
diff_match_patch.prototype.diff_commonOverlap_=function(a,b){var c=a.length,d=b.length;if(0==c||0==d)return 0;c>d?a=a.substring(c-d):c<d&&(b=b.substring(0,c));c=Math.min(c,d);if(a==b)return c;d=0;for(var e=1;;){var f=a.substring(c-e);f=b.indexOf(f);if(-1==f)return d;e+=f;if(0==f||a.substring(c-e)==b.substring(0,e))d=e,e++}};
|
||||
diff_match_patch.prototype.diff_halfMatch_=function(a,b){function c(a,b,c){for(var d=a.substring(c,c+Math.floor(a.length/4)),e=-1,g="",h,k,l,m;-1!=(e=b.indexOf(d,e+1));){var p=f.diff_commonPrefix(a.substring(c),b.substring(e)),u=f.diff_commonSuffix(a.substring(0,c),b.substring(0,e));g.length<u+p&&(g=b.substring(e-u,e)+b.substring(e,e+p),h=a.substring(0,c-u),k=a.substring(c+p),l=b.substring(0,e-u),m=b.substring(e+p))}return 2*g.length>=a.length?[h,k,l,m,g]:null}if(0>=this.Diff_Timeout)return null;
|
||||
var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.length<d.length)return null;var f=this,g=c(d,e,Math.ceil(d.length/4));d=c(d,e,Math.ceil(d.length/2));if(g||d)g=d?g?g[4].length>d[4].length?g:d:d:g;else return null;if(a.length>b.length){d=g[0];e=g[1];var h=g[2];var l=g[3]}else h=g[0],l=g[1],d=g[2],e=g[3];return[d,e,h,l,g[4]]};
|
||||
diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,l=0,k=0;f<a.length;)a[f][0]==DIFF_EQUAL?(c[d++]=f,g=l,h=k,k=l=0,e=a[f][1]):(a[f][0]==DIFF_INSERT?l+=a[f][1].length:k+=a[f][1].length,e&&e.length<=Math.max(g,h)&&e.length<=Math.max(l,k)&&(a.splice(c[d-1],0,[DIFF_DELETE,e]),a[c[d-1]+1][0]=DIFF_INSERT,d--,d--,f=0<d?c[d-1]:-1,k=l=h=g=0,e=null,b=!0)),f++;b&&this.diff_cleanupMerge(a);this.diff_cleanupSemanticLossless(a);for(f=1;f<a.length;){if(a[f-1][0]==
|
||||
DIFF_DELETE&&a[f][0]==DIFF_INSERT){b=a[f-1][1];c=a[f][1];d=this.diff_commonOverlap_(b,c);e=this.diff_commonOverlap_(c,b);if(d>=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[DIFF_EQUAL,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[DIFF_EQUAL,b.substring(0,e)]),a[f-1][0]=DIFF_INSERT,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=DIFF_DELETE,a[f+1][1]=b.substring(e),f++;f++}f++}};
|
||||
diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_);c=g&&c.match(diff_match_patch.linebreakRegex_);d=h&&d.match(diff_match_patch.linebreakRegex_);var k=c&&a.match(diff_match_patch.blanklineEndRegex_),l=d&&b.match(diff_match_patch.blanklineStartRegex_);
|
||||
return k||l?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c<a.length-1;){if(a[c-1][0]==DIFF_EQUAL&&a[c+1][0]==DIFF_EQUAL){var d=a[c-1][1],e=a[c][1],f=a[c+1][1],g=this.diff_commonSuffix(d,e);if(g){var h=e.substring(e.length-g);d=d.substring(0,d.length-g);e=h+e.substring(0,e.length-g);f=h+f}g=d;h=e;for(var l=f,k=b(d,e)+b(e,f);e.charAt(0)===f.charAt(0);){d+=e.charAt(0);e=e.substring(1)+f.charAt(0);f=f.substring(1);var m=b(d,e)+b(e,f);m>=k&&(k=m,g=d,h=e,l=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-
|
||||
1,1),c--),a[c][1]=h,l?a[c+1][1]=l:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/;
|
||||
diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,l=!1,k=!1;f<a.length;)a[f][0]==DIFF_EQUAL?(a[f][1].length<this.Diff_EditCost&&(l||k)?(c[d++]=f,g=l,h=k,e=a[f][1]):(d=0,e=null),l=k=!1):(a[f][0]==DIFF_DELETE?k=!0:l=!0,e&&(g&&h&&l&&k||e.length<this.Diff_EditCost/2&&3==g+h+l+k)&&(a.splice(c[d-1],0,[DIFF_DELETE,e]),a[c[d-1]+1][0]=DIFF_INSERT,d--,e=null,g&&h?(l=k=!0,d=0):(d--,f=0<d?c[d-1]:-1,l=k=!1),b=!0)),f++;b&&this.diff_cleanupMerge(a)};
|
||||
diff_match_patch.prototype.diff_cleanupMerge=function(a){a.push([DIFF_EQUAL,""]);for(var b=0,c=0,d=0,e="",f="",g;b<a.length;)switch(a[b][0]){case DIFF_INSERT:d++;f+=a[b][1];b++;break;case DIFF_DELETE:c++;e+=a[b][1];b++;break;case DIFF_EQUAL:1<c+d?(0!==c&&0!==d&&(g=this.diff_commonPrefix(f,e),0!==g&&(0<b-c-d&&a[b-c-d-1][0]==DIFF_EQUAL?a[b-c-d-1][1]+=f.substring(0,g):(a.splice(0,0,[DIFF_EQUAL,f.substring(0,g)]),b++),f=f.substring(g),e=e.substring(g)),g=this.diff_commonSuffix(f,e),0!==g&&(a[b][1]=f.substring(f.length-
|
||||
g)+a[b][1],f=f.substring(0,f.length-g),e=e.substring(0,e.length-g))),0===c?a.splice(b-d,c+d,[DIFF_INSERT,f]):0===d?a.splice(b-c,c+d,[DIFF_DELETE,e]):a.splice(b-c-d,c+d,[DIFF_DELETE,e],[DIFF_INSERT,f]),b=b-c-d+(c?1:0)+(d?1:0)+1):0!==b&&a[b-1][0]==DIFF_EQUAL?(a[b-1][1]+=a[b][1],a.splice(b,1)):b++,c=d=0,f=e=""}""===a[a.length-1][1]&&a.pop();c=!1;for(b=1;b<a.length-1;)a[b-1][0]==DIFF_EQUAL&&a[b+1][0]==DIFF_EQUAL&&(a[b][1].substring(a[b][1].length-a[b-1][1].length)==a[b-1][1]?(a[b][1]=a[b-1][1]+a[b][1].substring(0,
|
||||
a[b][1].length-a[b-1][1].length),a[b+1][1]=a[b-1][1]+a[b+1][1],a.splice(b-1,1),c=!0):a[b][1].substring(0,a[b+1][1].length)==a[b+1][1]&&(a[b-1][1]+=a[b+1][1],a[b][1]=a[b][1].substring(a[b+1][1].length)+a[b+1][1],a.splice(b+1,1),c=!0)),b++;c&&this.diff_cleanupMerge(a)};
|
||||
diff_match_patch.prototype.diff_xIndex=function(a,b){var c=0,d=0,e=0,f=0,g;for(g=0;g<a.length;g++){a[g][0]!==DIFF_INSERT&&(c+=a[g][1].length);a[g][0]!==DIFF_DELETE&&(d+=a[g][1].length);if(c>b)break;e=c;f=d}return a.length!=g&&a[g][0]===DIFF_DELETE?f:f+(b-e)};
|
||||
diff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=/</g,e=/>/g,f=/\n/g,g=0;g<a.length;g++){var h=a[g][0],l=a[g][1].replace(c,"&").replace(d,"<").replace(e,">").replace(f,"¶<br>");switch(h){case DIFF_INSERT:b[g]='<ins style="background:#e6ffe6;">'+l+"</ins>";break;case DIFF_DELETE:b[g]='<del style="background:#ffe6e6;">'+l+"</del>";break;case DIFF_EQUAL:b[g]="<span>"+l+"</span>"}}return b.join("")};
|
||||
diff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_INSERT&&(b[c]=a[c][1]);return b.join("")};diff_match_patch.prototype.diff_text2=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_DELETE&&(b[c]=a[c][1]);return b.join("")};
|
||||
diff_match_patch.prototype.diff_levenshtein=function(a){for(var b=0,c=0,d=0,e=0;e<a.length;e++){var f=a[e][1];switch(a[e][0]){case DIFF_INSERT:c+=f.length;break;case DIFF_DELETE:d+=f.length;break;case DIFF_EQUAL:b+=Math.max(c,d),d=c=0}}return b+=Math.max(c,d)};
|
||||
diff_match_patch.prototype.diff_toDelta=function(a){for(var b=[],c=0;c<a.length;c++)switch(a[c][0]){case DIFF_INSERT:b[c]="+"+encodeURI(a[c][1]);break;case DIFF_DELETE:b[c]="-"+a[c][1].length;break;case DIFF_EQUAL:b[c]="="+a[c][1].length}return b.join("\t").replace(/%20/g," ")};
|
||||
diff_match_patch.prototype.diff_fromDelta=function(a,b){for(var c=[],d=0,e=0,f=b.split(/\t/g),g=0;g<f.length;g++){var h=f[g].substring(1);switch(f[g].charAt(0)){case "+":try{c[d++]=[DIFF_INSERT,decodeURI(h)]}catch(k){throw Error("Illegal escape in diff_fromDelta: "+h);}break;case "-":case "=":var l=parseInt(h,10);if(isNaN(l)||0>l)throw Error("Invalid number in diff_fromDelta: "+h);h=a.substring(e,e+=l);"="==f[g].charAt(0)?c[d++]=[DIFF_EQUAL,h]:c[d++]=[DIFF_DELETE,h];break;default:if(f[g])throw Error("Invalid diff operation in diff_fromDelta: "+
|
||||
f[g]);}}if(e!=a.length)throw Error("Delta length ("+e+") does not equal source text length ("+a.length+").");return c};diff_match_patch.prototype.match_main=function(a,b,c){if(null==a||null==b||null==c)throw Error("Null input. (match_main)");c=Math.max(0,Math.min(c,a.length));return a==b?0:a.length?a.substring(c,c+b.length)==b?c:this.match_bitap_(a,b,c):-1};
|
||||
diff_match_patch.prototype.match_bitap_=function(a,b,c){function d(a,d){var e=a/b.length,g=Math.abs(c-d);return f.Match_Distance?e+g/f.Match_Distance:g?1:e}if(b.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));var l=1<<b.length-1;h=-1;for(var k,m,p=b.length+a.length,x,w=0;w<b.length;w++){k=0;for(m=p;k<m;)d(w,
|
||||
c+m)<=g?k=m:p=m,m=Math.floor((p-k)/2+k);p=m;k=Math.max(1,c-m+1);var q=Math.min(c+m,a.length)+b.length;m=Array(q+2);for(m[q+1]=(1<<w)-1;q>=k;q--){var t=e[a.charAt(q-1)];m[q]=0===w?(m[q+1]<<1|1)&t:(m[q+1]<<1|1)&t|(x[q+1]|x[q])<<1|1|x[q+1];if(m[q]&l&&(t=d(w,q-1),t<=g))if(g=t,h=q-1,h>c)k=Math.max(1,2*c-h);else break}if(d(w+1,c)>g)break;x=m}return h};
|
||||
diff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=0;for(c=0;c<a.length;c++)b[a.charAt(c)]|=1<<a.length-c-1;return b};
|
||||
diff_match_patch.prototype.patch_addContext_=function(a,b){if(0!=b.length){for(var c=b.substring(a.start2,a.start2+a.length1),d=0;b.indexOf(c)!=b.lastIndexOf(c)&&c.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)d+=this.Patch_Margin,c=b.substring(a.start2-d,a.start2+a.length1+d);d+=this.Patch_Margin;(c=b.substring(a.start2-d,a.start2))&&a.diffs.unshift([DIFF_EQUAL,c]);(d=b.substring(a.start2+a.length1,a.start2+a.length1+d))&&a.diffs.push([DIFF_EQUAL,d]);a.start1-=c.length;a.start2-=
|
||||
c.length;a.length1+=c.length+d.length;a.length2+=c.length+d.length}};
|
||||
diff_match_patch.prototype.patch_make=function(a,b,c){if("string"==typeof a&&"string"==typeof b&&"undefined"==typeof c){var d=a;b=this.diff_main(d,b,!0);2<b.length&&(this.diff_cleanupSemantic(b),this.diff_cleanupEfficiency(b))}else if(a&&"object"==typeof a&&"undefined"==typeof b&&"undefined"==typeof c)b=a,d=this.diff_text1(b);else if("string"==typeof a&&b&&"object"==typeof b&&"undefined"==typeof c)d=a;else if("string"==typeof a&&"string"==typeof b&&c&&"object"==typeof c)d=a,b=c;else throw Error("Unknown call format to patch_make.");
|
||||
if(0===b.length)return[];c=[];a=new diff_match_patch.patch_obj;for(var e=0,f=0,g=0,h=d,l=0;l<b.length;l++){var k=b[l][0],m=b[l][1];e||k===DIFF_EQUAL||(a.start1=f,a.start2=g);switch(k){case DIFF_INSERT:a.diffs[e++]=b[l];a.length2+=m.length;d=d.substring(0,g)+m+d.substring(g);break;case DIFF_DELETE:a.length1+=m.length;a.diffs[e++]=b[l];d=d.substring(0,g)+d.substring(g+m.length);break;case DIFF_EQUAL:m.length<=2*this.Patch_Margin&&e&&b.length!=l+1?(a.diffs[e++]=b[l],a.length1+=m.length,a.length2+=m.length):
|
||||
m.length>=2*this.Patch_Margin&&e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}k!==DIFF_INSERT&&(f+=m.length);k!==DIFF_DELETE&&(g+=m.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c};
|
||||
diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=new diff_match_patch.patch_obj;e.diffs=[];for(var f=0;f<d.diffs.length;f++)e.diffs[f]=d.diffs[f].slice();e.start1=d.start1;e.start2=d.start2;e.length1=d.length1;e.length2=d.length2;b[c]=e}return b};
|
||||
diff_match_patch.prototype.patch_apply=function(a,b){if(0==a.length)return[b,[]];a=this.patch_deepCopy(a);var c=this.patch_addPadding(a);b=c+b+c;this.patch_splitMax(a);for(var d=0,e=[],f=0;f<a.length;f++){var g=a[f].start2+d,h=this.diff_text1(a[f].diffs),l=-1;if(h.length>this.Match_MaxBits){var k=this.match_main(b,h.substring(0,this.Match_MaxBits),g);-1!=k&&(l=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==l||k>=l)&&(k=-1)}else k=this.match_main(b,h,
|
||||
g);if(-1==k)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=k-g,g=-1==l?b.substring(k,k+h.length):b.substring(k,l+this.Match_MaxBits),h==g)b=b.substring(0,k)+this.diff_text2(a[f].diffs)+b.substring(k+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);h=0;var m;for(l=0;l<a[f].diffs.length;l++){var p=a[f].diffs[l];p[0]!==DIFF_EQUAL&&(m=this.diff_xIndex(g,h));p[0]===
|
||||
DIFF_INSERT?b=b.substring(0,k+m)+p[1]+b.substring(k+m):p[0]===DIFF_DELETE&&(b=b.substring(0,k+m)+b.substring(k+this.diff_xIndex(g,h+p[1].length)));p[0]!==DIFF_DELETE&&(h+=p[1].length)}}}b=b.substring(c.length,b.length-c.length);return[b,e]};
|
||||
diff_match_patch.prototype.patch_addPadding=function(a){for(var b=this.Patch_Margin,c="",d=1;d<=b;d++)c+=String.fromCharCode(d);for(d=0;d<a.length;d++)a[d].start1+=b,a[d].start2+=b;d=a[0];var e=d.diffs;if(0==e.length||e[0][0]!=DIFF_EQUAL)e.unshift([DIFF_EQUAL,c]),d.start1-=b,d.start2-=b,d.length1+=b,d.length2+=b;else if(b>e[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||e[e.length-
|
||||
1][0]!=DIFF_EQUAL?(e.push([DIFF_EQUAL,c]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c};
|
||||
diff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c<a.length;c++)if(!(a[c].length1<=b)){var d=a[c];a.splice(c--,1);for(var e=d.start1,f=d.start2,g="";0!==d.diffs.length;){var h=new diff_match_patch.patch_obj,l=!0;h.start1=e-g.length;h.start2=f-g.length;""!==g&&(h.length1=h.length2=g.length,h.diffs.push([DIFF_EQUAL,g]));for(;0!==d.diffs.length&&h.length1<b-this.Patch_Margin;){g=d.diffs[0][0];var k=d.diffs[0][1];g===DIFF_INSERT?(h.length2+=k.length,f+=k.length,h.diffs.push(d.diffs.shift()),
|
||||
l=!1):g===DIFF_DELETE&&1==h.diffs.length&&h.diffs[0][0]==DIFF_EQUAL&&k.length>2*b?(h.length1+=k.length,e+=k.length,l=!1,h.diffs.push([g,k]),d.diffs.shift()):(k=k.substring(0,b-h.length1-this.Patch_Margin),h.length1+=k.length,e+=k.length,g===DIFF_EQUAL?(h.length2+=k.length,f+=k.length):l=!1,h.diffs.push([g,k]),k==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(k.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);k=this.diff_text1(d.diffs).substring(0,
|
||||
this.Patch_Margin);""!==k&&(h.length1+=k.length,h.length2+=k.length,0!==h.diffs.length&&h.diffs[h.diffs.length-1][0]===DIFF_EQUAL?h.diffs[h.diffs.length-1][1]+=k:h.diffs.push([DIFF_EQUAL,k]));l||a.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=a[c];return b.join("")};
|
||||
diff_match_patch.prototype.patch_fromText=function(a){var b=[];if(!a)return b;a=a.split("\n");for(var c=0,d=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;c<a.length;){var e=a[c].match(d);if(!e)throw Error("Invalid patch string: "+a[c]);var f=new diff_match_patch.patch_obj;b.push(f);f.start1=parseInt(e[1],10);""===e[2]?(f.start1--,f.length1=1):"0"==e[2]?f.length1=0:(f.start1--,f.length1=parseInt(e[2],10));f.start2=parseInt(e[3],10);""===e[4]?(f.start2--,f.length2=1):"0"==e[4]?f.length2=0:(f.start2--,f.length2=
|
||||
parseInt(e[4],10));for(c++;c<a.length;){e=a[c].charAt(0);try{var g=decodeURI(a[c].substring(1))}catch(h){throw Error("Illegal escape in patch_fromText: "+g);}if("-"==e)f.diffs.push([DIFF_DELETE,g]);else if("+"==e)f.diffs.push([DIFF_INSERT,g]);else if(" "==e)f.diffs.push([DIFF_EQUAL,g]);else if("@"==e)break;else if(""!==e)throw Error('Invalid patch mode "'+e+'" in: '+g);c++}}return b};diff_match_patch.patch_obj=function(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0};
|
||||
diff_match_patch.patch_obj.prototype.toString=function(){for(var a=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],b,c=0;c<this.diffs.length;c++){switch(this.diffs[c][0]){case DIFF_INSERT:b="+";break;case DIFF_DELETE:b="-";break;case DIFF_EQUAL:b=" "}a[c+1]=b+encodeURI(this.diffs[c][1])+"\n"}return a.join("").replace(/%20/g," ")};
|
||||
this.diff_match_patch=diff_match_patch;this.DIFF_DELETE=DIFF_DELETE;this.DIFF_INSERT=DIFF_INSERT;this.DIFF_EQUAL=DIFF_EQUAL;
|
||||
2192
core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
Executable file
2192
core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
Executable file
File diff suppressed because it is too large
Load Diff
14
core/modules/utils/diff-match-patch/tiddlywiki.files
Normal file
14
core/modules/utils/diff-match-patch/tiddlywiki.files
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"file": "diff_match_patch.js",
|
||||
"fields": {
|
||||
"type": "application/javascript",
|
||||
"title": "$:/core/modules/utils/diff-match-patch/diff_match_patch.js",
|
||||
"module-type": "library"
|
||||
},
|
||||
"prefix": "(function(){",
|
||||
"suffix": "}).call(exports);"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -99,7 +99,7 @@ exports.resizeTextAreaToFit = function(domNode,minHeight) {
|
||||
scrollTop = container.scrollTop;
|
||||
// Measure the specified minimum height
|
||||
domNode.style.height = minHeight;
|
||||
var measuredHeight = domNode.offsetHeight;
|
||||
var measuredHeight = domNode.offsetHeight || parseInt(minHeight,10);
|
||||
// Set its height to auto so that it snaps to the correct height
|
||||
domNode.style.height = "auto";
|
||||
// Calculate the revised height
|
||||
@@ -231,4 +231,36 @@ exports.copyStyles = function(srcDomNode,dstDomNode) {
|
||||
$tw.utils.setStyles(dstDomNode,$tw.utils.getComputedStyles(srcDomNode));
|
||||
};
|
||||
|
||||
/*
|
||||
Copy plain text to the clipboard on browsers that support it
|
||||
*/
|
||||
exports.copyToClipboard = function(text,options) {
|
||||
options = options || {};
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.style.position = "fixed";
|
||||
textArea.style.top = 0;
|
||||
textArea.style.left = 0;
|
||||
textArea.style.fontSize = "12pt";
|
||||
textArea.style.width = "2em";
|
||||
textArea.style.height = "2em";
|
||||
textArea.style.padding = 0;
|
||||
textArea.style.border = "none";
|
||||
textArea.style.outline = "none";
|
||||
textArea.style.boxShadow = "none";
|
||||
textArea.style.background = "transparent";
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
textArea.setSelectionRange(0,text.length);
|
||||
var succeeded = false;
|
||||
try {
|
||||
succeeded = document.execCommand("copy");
|
||||
} catch (err) {
|
||||
}
|
||||
if(!options.doNotNotify) {
|
||||
$tw.notifier.display(succeeded ? "$:/language/Notifications/CopiedToClipboard/Succeeded" : "$:/language/Notifications/CopiedToClipboard/Failed");
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -32,10 +32,14 @@ exports.makeDraggable = function(options) {
|
||||
// Add event handlers
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
{name: "dragstart", handlerFunction: function(event) {
|
||||
if(event.dataTransfer === undefined) {
|
||||
return false;
|
||||
}
|
||||
// Collect the tiddlers being dragged
|
||||
var dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),
|
||||
dragFilter = options.dragFilterFn && options.dragFilterFn(),
|
||||
titles = dragTiddler ? [dragTiddler] : [];
|
||||
titles = dragTiddler ? [dragTiddler] : [],
|
||||
startActions = options.startActions;
|
||||
if(dragFilter) {
|
||||
titles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));
|
||||
}
|
||||
@@ -46,6 +50,10 @@ exports.makeDraggable = function(options) {
|
||||
$tw.dragInProgress = domNode;
|
||||
// Set the dragging class on the element being dragged
|
||||
$tw.utils.addClass(event.target,"tc-dragging");
|
||||
// Invoke drag-start actions if given
|
||||
if(startActions !== undefined) {
|
||||
options.widget.invokeActionString(startActions,options.widget,event,{actionTiddler: titleString});
|
||||
}
|
||||
// Create the drag image elements
|
||||
dragImage = options.widget.document.createElement("div");
|
||||
dragImage.className = "tc-tiddler-dragger";
|
||||
@@ -97,7 +105,20 @@ exports.makeDraggable = function(options) {
|
||||
}},
|
||||
{name: "dragend", handlerFunction: function(event) {
|
||||
if(event.target === domNode) {
|
||||
// Collect the tiddlers being dragged
|
||||
var dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),
|
||||
dragFilter = options.dragFilterFn && options.dragFilterFn(),
|
||||
titles = dragTiddler ? [dragTiddler] : [],
|
||||
endActions = options.endActions;
|
||||
if(dragFilter) {
|
||||
titles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));
|
||||
}
|
||||
var titleString = $tw.utils.stringifyList(titles);
|
||||
$tw.dragInProgress = null;
|
||||
// Invoke drag-end actions if given
|
||||
if(endActions !== undefined) {
|
||||
options.widget.invokeActionString(endActions,options.widget,event,{actionTiddler: titleString});
|
||||
}
|
||||
// Remove the dragging class on the element being dragged
|
||||
$tw.utils.removeClass(event.target,"tc-dragging");
|
||||
// Delete the drag image element
|
||||
|
||||
@@ -54,51 +54,35 @@ PageScroller.prototype.handleEvent = function(event) {
|
||||
Handle a scroll event hitting the page document
|
||||
*/
|
||||
PageScroller.prototype.scrollIntoView = function(element) {
|
||||
var duration = $tw.utils.getAnimationDuration();
|
||||
var self = this,
|
||||
duration = $tw.utils.getAnimationDuration();
|
||||
// Now get ready to scroll the body
|
||||
this.cancelScroll();
|
||||
this.startTime = Date.now();
|
||||
var scrollPosition = $tw.utils.getScrollPosition();
|
||||
// Get the client bounds of the element and adjust by the scroll position
|
||||
var clientBounds = element.getBoundingClientRect(),
|
||||
bounds = {
|
||||
left: clientBounds.left + scrollPosition.x,
|
||||
top: clientBounds.top + scrollPosition.y,
|
||||
width: clientBounds.width,
|
||||
height: clientBounds.height
|
||||
};
|
||||
// We'll consider the horizontal and vertical scroll directions separately via this function
|
||||
// targetPos/targetSize - position and size of the target element
|
||||
// currentPos/currentSize - position and size of the current scroll viewport
|
||||
// returns: new position of the scroll viewport
|
||||
var getEndPos = function(targetPos,targetSize,currentPos,currentSize) {
|
||||
var newPos = currentPos;
|
||||
// If the target is above/left of the current view, then scroll to it's top/left
|
||||
if(targetPos <= currentPos) {
|
||||
newPos = targetPos;
|
||||
// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window
|
||||
} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {
|
||||
newPos = targetPos + targetSize - currentSize;
|
||||
// If the target is big, then just scroll to the top
|
||||
} else if(currentPos < targetPos) {
|
||||
newPos = targetPos;
|
||||
// Otherwise, stay where we are
|
||||
} else {
|
||||
newPos = currentPos;
|
||||
}
|
||||
var getBounds = function() {
|
||||
var clientBounds = element.getBoundingClientRect(),
|
||||
scrollPosition = $tw.utils.getScrollPosition();
|
||||
return {
|
||||
left: clientBounds.left + scrollPosition.x,
|
||||
top: clientBounds.top + scrollPosition.y,
|
||||
width: clientBounds.width,
|
||||
height: clientBounds.height
|
||||
};
|
||||
},
|
||||
// We'll consider the horizontal and vertical scroll directions separately via this function
|
||||
// targetPos/targetSize - position and size of the target element
|
||||
// currentPos/currentSize - position and size of the current scroll viewport
|
||||
// returns: new position of the scroll viewport
|
||||
getEndPos = function(targetPos,targetSize,currentPos,currentSize) {
|
||||
var newPos = targetPos;
|
||||
// If we are scrolling within 50 pixels of the top/left then snap to zero
|
||||
if(newPos < 50) {
|
||||
newPos = 0;
|
||||
}
|
||||
return newPos;
|
||||
},
|
||||
endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth),
|
||||
endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);
|
||||
// Only scroll if the position has changed
|
||||
if(endX !== scrollPosition.x || endY !== scrollPosition.y) {
|
||||
var self = this,
|
||||
drawFrame;
|
||||
drawFrame = function () {
|
||||
drawFrame = function drawFrame() {
|
||||
var t;
|
||||
if(duration <= 0) {
|
||||
t = 1;
|
||||
@@ -110,13 +94,16 @@ PageScroller.prototype.scrollIntoView = function(element) {
|
||||
t = 1;
|
||||
}
|
||||
t = $tw.utils.slowInSlowOut(t);
|
||||
var scrollPosition = $tw.utils.getScrollPosition(),
|
||||
bounds = getBounds(),
|
||||
endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth),
|
||||
endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight);
|
||||
window.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t);
|
||||
if(t < 1) {
|
||||
self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);
|
||||
}
|
||||
};
|
||||
drawFrame();
|
||||
}
|
||||
drawFrame();
|
||||
};
|
||||
|
||||
exports.PageScroller = PageScroller;
|
||||
|
||||
@@ -51,6 +51,15 @@ exports.warning = function(text) {
|
||||
exports.log(text,"brown/orange");
|
||||
};
|
||||
|
||||
/*
|
||||
Return the integer represented by the str (string).
|
||||
Return the dflt (default) parameter if str is not a base-10 number.
|
||||
*/
|
||||
exports.getInt = function(str,deflt) {
|
||||
var i = parseInt(str,10);
|
||||
return isNaN(i) ? deflt : i;
|
||||
}
|
||||
|
||||
/*
|
||||
Repeatedly replaces a substring within a string. Like String.prototype.replace, but without any of the default special handling of $ sequences in the replace string
|
||||
*/
|
||||
@@ -363,15 +372,15 @@ exports.formatDateString = function(date,template) {
|
||||
}]
|
||||
];
|
||||
// If the user wants everything in UTC, shift the datestamp
|
||||
// Optimize for format string that essentially means
|
||||
// Optimize for format string that essentially means
|
||||
// 'return raw UTC (tiddlywiki style) date string.'
|
||||
if(t.indexOf("[UTC]") == 0 ) {
|
||||
if(t == "[UTC]YYYY0MM0DD0hh0mm0ssXXX")
|
||||
if(t == "[UTC]YYYY0MM0DD0hh0mm0ssXXX")
|
||||
return $tw.utils.stringifyDate(new Date());
|
||||
var offset = date.getTimezoneOffset() ; // in minutes
|
||||
date = new Date(date.getTime()+offset*60*1000) ;
|
||||
t = t.substr(5) ;
|
||||
}
|
||||
}
|
||||
while(t.length){
|
||||
var matchString = "";
|
||||
$tw.utils.each(matches, function(m) {
|
||||
@@ -491,7 +500,7 @@ exports.entityDecode = function(s) {
|
||||
e = s.substr(1,s.length-2); // Strip the & and the ;
|
||||
if(e.charAt(0) === "#") {
|
||||
if(e.charAt(1) === "x" || e.charAt(1) === "X") {
|
||||
return converter(parseInt(e.substr(2),16));
|
||||
return converter(parseInt(e.substr(2),16));
|
||||
} else {
|
||||
return converter(parseInt(e.substr(1),10));
|
||||
}
|
||||
@@ -724,7 +733,7 @@ High resolution microsecond timer for profiling
|
||||
exports.timer = function(base) {
|
||||
var m;
|
||||
if($tw.node) {
|
||||
var r = process.hrtime();
|
||||
var r = process.hrtime();
|
||||
m = r[0] * 1e3 + (r[1] / 1e6);
|
||||
} else if(window.performance) {
|
||||
m = performance.now();
|
||||
|
||||
@@ -67,7 +67,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
||||
// Add a click event handler
|
||||
domNode.addEventListener("click",function (event) {
|
||||
var handled = false;
|
||||
if(self.invokeActions(this,event)) {
|
||||
if(self.invokeActions(self,event)) {
|
||||
handled = true;
|
||||
}
|
||||
if(self.to) {
|
||||
|
||||
@@ -156,6 +156,9 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||
if(this.checkboxActions) {
|
||||
this.invokeActionString(this.checkboxActions,this,event);
|
||||
}
|
||||
if(this.checkboxUncheckActions && !checked) {
|
||||
this.invokeActionString(this.checkboxUncheckActions,this,event);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -164,6 +167,7 @@ Compute the internal state of the widget
|
||||
CheckboxWidget.prototype.execute = function() {
|
||||
// Get the parameters from the attributes
|
||||
this.checkboxActions = this.getAttribute("actions");
|
||||
this.checkboxUncheckActions = this.getAttribute("uncheckactions");
|
||||
this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.checkboxTag = this.getAttribute("tag");
|
||||
this.checkboxField = this.getAttribute("field");
|
||||
@@ -197,4 +201,4 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||
|
||||
exports.checkbox = CheckboxWidget;
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
148
core/modules/widgets/diff-text.js
Normal file
148
core/modules/widgets/diff-text.js
Normal file
@@ -0,0 +1,148 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/diff-text.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Widget to display a diff between two texts
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget,
|
||||
dmp = require("$:/core/modules/utils/diff-match-patch/diff_match_patch.js");
|
||||
|
||||
var DiffTextWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
DiffTextWidget.prototype = new Widget();
|
||||
|
||||
DiffTextWidget.prototype.invisibleCharacters = {
|
||||
"\n": "↩︎\n",
|
||||
"\r": "⇠",
|
||||
"\t": "⇥\t"
|
||||
};
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
DiffTextWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
// Create the diff
|
||||
var dmpObject = new dmp.diff_match_patch(),
|
||||
diffs = dmpObject.diff_main(this.getAttribute("source"),this.getAttribute("dest"));
|
||||
// Apply required cleanup
|
||||
switch(this.getAttribute("cleanup","semantic")) {
|
||||
case "none":
|
||||
// No cleanup
|
||||
break;
|
||||
case "efficiency":
|
||||
dmpObject.diff_cleanupEfficiency(diffs);
|
||||
break;
|
||||
default: // case "semantic"
|
||||
dmpObject.diff_cleanupSemantic(diffs);
|
||||
break;
|
||||
}
|
||||
// Create the elements
|
||||
var domContainer = this.document.createElement("div"),
|
||||
domDiff = this.createDiffDom(diffs);
|
||||
parent.insertBefore(domContainer,nextSibling);
|
||||
// Set variables
|
||||
this.setVariable("diff-count",diffs.reduce(function(acc,diff) {
|
||||
if(diff[0] !== dmp.DIFF_EQUAL) {
|
||||
acc++;
|
||||
}
|
||||
return acc;
|
||||
},0).toString());
|
||||
// Render child widgets
|
||||
this.renderChildren(domContainer,null);
|
||||
// Render the diff
|
||||
domContainer.appendChild(domDiff);
|
||||
// Save our container
|
||||
this.domNodes.push(domContainer);
|
||||
};
|
||||
|
||||
/*
|
||||
Create DOM elements representing a list of diffs
|
||||
*/
|
||||
DiffTextWidget.prototype.createDiffDom = function(diffs) {
|
||||
var self = this;
|
||||
// Create the element and assign the attributes
|
||||
var domPre = this.document.createElement("pre"),
|
||||
domCode = this.document.createElement("code");
|
||||
$tw.utils.each(diffs,function(diff) {
|
||||
var tag = diff[0] === dmp.DIFF_INSERT ? "ins" : (diff[0] === dmp.DIFF_DELETE ? "del" : "span"),
|
||||
className = diff[0] === dmp.DIFF_INSERT ? "tc-diff-insert" : (diff[0] === dmp.DIFF_DELETE ? "tc-diff-delete" : "tc-diff-equal"),
|
||||
dom = self.document.createElement(tag),
|
||||
text = diff[1],
|
||||
currPos = 0,
|
||||
re = /([\x00-\x1F])/mg,
|
||||
match = re.exec(text),
|
||||
span,
|
||||
printable;
|
||||
dom.className = className;
|
||||
while(match) {
|
||||
if(currPos < match.index) {
|
||||
dom.appendChild(self.document.createTextNode(text.slice(currPos,match.index)));
|
||||
}
|
||||
span = self.document.createElement("span");
|
||||
span.className = "tc-diff-invisible";
|
||||
printable = self.invisibleCharacters[match[0]] || ("[0x" + match[0].charCodeAt(0).toString(16) + "]");
|
||||
span.appendChild(self.document.createTextNode(printable));
|
||||
dom.appendChild(span);
|
||||
currPos = match.index + match[0].length;
|
||||
match = re.exec(text);
|
||||
}
|
||||
if(currPos < text.length) {
|
||||
dom.appendChild(self.document.createTextNode(text.slice(currPos)));
|
||||
}
|
||||
domCode.appendChild(dom);
|
||||
});
|
||||
domPre.appendChild(domCode);
|
||||
return domPre;
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
DiffTextWidget.prototype.execute = function() {
|
||||
// Make child widgets
|
||||
var parseTreeNodes;
|
||||
if(this.parseTreeNode && this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {
|
||||
parseTreeNodes = this.parseTreeNode.children;
|
||||
} else {
|
||||
parseTreeNodes = [{
|
||||
type: "transclude",
|
||||
attributes: {
|
||||
tiddler: {type: "string", value: "$:/language/Diffs/CountMessage"}
|
||||
}
|
||||
}];
|
||||
}
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
DiffTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.source || changedAttributes.dest || changedAttributes.cleanup) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
}
|
||||
};
|
||||
|
||||
exports["diff-text"] = DiffTextWidget;
|
||||
|
||||
})();
|
||||
@@ -52,6 +52,8 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||
domNode: domNode,
|
||||
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
||||
dragFilterFn: function() {return self.getAttribute("filter");},
|
||||
startActions: self.startActions,
|
||||
endActions: self.endActions,
|
||||
widget: this
|
||||
});
|
||||
// Insert the link into the DOM and render any children
|
||||
@@ -67,6 +69,8 @@ DraggableWidget.prototype.execute = function() {
|
||||
// Pick up our attributes
|
||||
this.draggableTag = this.getAttribute("tag","div");
|
||||
this.draggableClasses = this.getAttribute("class");
|
||||
this.startActions = this.getAttribute("startactions");
|
||||
this.endActions = this.getAttribute("endactions");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
@@ -128,7 +128,9 @@ DroppableWidget.prototype.handleDropEvent = function(event) {
|
||||
|
||||
DroppableWidget.prototype.performActions = function(title,event) {
|
||||
if(this.droppableActions) {
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title});
|
||||
var modifierKey = event.ctrlKey && ! event.shiftKey ? "ctrl" : event.shiftKey && !event.ctrlKey ? "shift" :
|
||||
event.ctrlKey && event.shiftKey ? "ctrl-shift" : "normal" ;
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title, modifier: modifierKey});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -189,6 +189,35 @@ EditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) {
|
||||
ctx.drawImage(this.currCanvas,0,0);
|
||||
};
|
||||
|
||||
/*
|
||||
** Rotate the canvas left by 90 degrees
|
||||
*/
|
||||
EditBitmapWidget.prototype.rotateCanvasLeft = function() {
|
||||
// Get the current size of the image
|
||||
var origWidth = this.currCanvas.width,
|
||||
origHeight = this.currCanvas.height;
|
||||
// Create and size a new canvas
|
||||
var newCanvas = this.document.createElement("canvas"),
|
||||
newWidth = origHeight,
|
||||
newHeight = origWidth;
|
||||
this.initCanvas(newCanvas,newWidth,newHeight);
|
||||
// Copy the old image
|
||||
var ctx = newCanvas.getContext("2d");
|
||||
ctx.save();
|
||||
ctx.translate(newWidth / 2,newHeight / 2);
|
||||
ctx.rotate(-Math.PI / 2);
|
||||
ctx.drawImage(this.currCanvas,-origWidth / 2,-origHeight / 2);
|
||||
ctx.restore();
|
||||
// Set the new canvas as the current one
|
||||
this.currCanvas = newCanvas;
|
||||
// Set the size of the onscreen canvas
|
||||
this.canvasDomNode.width = newWidth;
|
||||
this.canvasDomNode.height = newHeight;
|
||||
// Paint the onscreen canvas with the offscreen canvas
|
||||
ctx = this.canvasDomNode.getContext("2d");
|
||||
ctx.drawImage(this.currCanvas,0,0);
|
||||
};
|
||||
|
||||
EditBitmapWidget.prototype.handleTouchStartEvent = function(event) {
|
||||
this.brushDown = true;
|
||||
this.strokeStart(event.touches[0].clientX,event.touches[0].clientY);
|
||||
|
||||
@@ -64,21 +64,27 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
var domNode = this.document.createElement(tag);
|
||||
// Assign classes
|
||||
var classes = [];
|
||||
if(this.linkClasses) {
|
||||
classes.push(this.linkClasses);
|
||||
}
|
||||
classes.push("tc-tiddlylink");
|
||||
if(this.isShadow) {
|
||||
classes.push("tc-tiddlylink-shadow");
|
||||
}
|
||||
if(this.isMissing && !this.isShadow) {
|
||||
classes.push("tc-tiddlylink-missing");
|
||||
} else {
|
||||
if(!this.isMissing) {
|
||||
classes.push("tc-tiddlylink-resolves");
|
||||
if(this.overrideClasses === undefined) {
|
||||
classes.push("tc-tiddlylink");
|
||||
if(this.isShadow) {
|
||||
classes.push("tc-tiddlylink-shadow");
|
||||
}
|
||||
if(this.isMissing && !this.isShadow) {
|
||||
classes.push("tc-tiddlylink-missing");
|
||||
} else {
|
||||
if(!this.isMissing) {
|
||||
classes.push("tc-tiddlylink-resolves");
|
||||
}
|
||||
}
|
||||
if(this.linkClasses) {
|
||||
classes.push(this.linkClasses);
|
||||
}
|
||||
} else if(this.overrideClasses !== "") {
|
||||
classes.push(this.overrideClasses)
|
||||
}
|
||||
if(classes.length > 0) {
|
||||
domNode.setAttribute("class",classes.join(" "));
|
||||
}
|
||||
domNode.setAttribute("class",classes.join(" "));
|
||||
// Set an href
|
||||
var wikilinkTransformFilter = this.getVariable("tv-filter-export-link"),
|
||||
wikiLinkText;
|
||||
@@ -169,6 +175,7 @@ LinkWidget.prototype.execute = function() {
|
||||
this.tooltip = this.getAttribute("tooltip");
|
||||
this["aria-label"] = this.getAttribute("aria-label");
|
||||
this.linkClasses = this.getAttribute("class");
|
||||
this.overrideClasses = this.getAttribute("overrideClass");
|
||||
this.tabIndex = this.getAttribute("tabindex");
|
||||
this.draggable = this.getAttribute("draggable","yes");
|
||||
this.linkTag = this.getAttribute("tag","a");
|
||||
|
||||
@@ -48,7 +48,9 @@ MacroCallWidget.prototype.execute = function() {
|
||||
}
|
||||
});
|
||||
// Get the macro value
|
||||
var text = this.getVariable(this.parseTreeNode.name || this.getAttribute("$name"),{params: params}),
|
||||
var macroName = this.parseTreeNode.name || this.getAttribute("$name"),
|
||||
variableInfo = this.getVariableInfo(macroName,{params: params}),
|
||||
text = variableInfo.text,
|
||||
parseTreeNodes;
|
||||
// Are we rendering to HTML?
|
||||
if(this.renderOutput === "text/html") {
|
||||
@@ -56,6 +58,21 @@ MacroCallWidget.prototype.execute = function() {
|
||||
var parser = this.wiki.parseText(this.parseType,text,
|
||||
{parseAsInline: !this.parseTreeNode.isBlock});
|
||||
parseTreeNodes = parser ? parser.tree : [];
|
||||
// Wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
||||
var attributes = {};
|
||||
$tw.utils.each(variableInfo.params,function(param) {
|
||||
var name = "__" + param.name + "__";
|
||||
attributes[name] = {
|
||||
name: name,
|
||||
type: "string",
|
||||
value: param.value
|
||||
};
|
||||
});
|
||||
parseTreeNodes = [{
|
||||
type: "vars",
|
||||
attributes: attributes,
|
||||
children: parseTreeNodes
|
||||
}];
|
||||
} else {
|
||||
// Otherwise, we'll render the text
|
||||
var plainText = this.wiki.renderText("text/plain",this.parseType,text,{parentWidget: this});
|
||||
|
||||
@@ -394,6 +394,7 @@ console.log("Relinking '" + draftOf + "' to '" + draftTitle + "'");
|
||||
|
||||
// Take a tiddler out of edit mode without saving the changes
|
||||
NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
|
||||
event = $tw.hooks.invokeHook("th-cancelling-tiddler", event);
|
||||
// Flip the specified tiddler from draft back to the original
|
||||
var draftTitle = event.param || event.tiddlerTitle,
|
||||
draftTiddler = this.wiki.getTiddler(draftTitle),
|
||||
@@ -438,6 +439,7 @@ NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
|
||||
//
|
||||
// If a draft of the target tiddler already exists then it is reused
|
||||
NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
event = $tw.hooks.invokeHook("th-new-tiddler", event);
|
||||
// Get the story details
|
||||
var storyList = this.getStoryList(),
|
||||
templateTiddler, additionalFields, title, draftTitle, existingTiddler;
|
||||
@@ -643,6 +645,7 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
|
||||
};
|
||||
|
||||
NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
|
||||
event = $tw.hooks.invokeHook("th-renaming-tiddler", event);
|
||||
var paramObject = event.paramObject || {},
|
||||
from = paramObject.from || event.tiddlerTitle,
|
||||
to = paramObject.to;
|
||||
|
||||
@@ -33,12 +33,15 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.computeAttributes();
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
var isChecked = this.getValue() === this.radioValue;
|
||||
// Create our elements
|
||||
this.labelDomNode = this.document.createElement("label");
|
||||
this.labelDomNode.setAttribute("class",this.radioClass);
|
||||
this.labelDomNode.setAttribute("class",
|
||||
"tc-radio " + this.radioClass + (isChecked ? " tc-radio-selected" : "")
|
||||
);
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","radio");
|
||||
if(this.getValue() == this.radioValue) {
|
||||
if(isChecked) {
|
||||
this.inputDomNode.setAttribute("checked","true");
|
||||
}
|
||||
this.labelDomNode.appendChild(this.inputDomNode);
|
||||
@@ -92,10 +95,6 @@ RadioWidget.prototype.execute = function() {
|
||||
this.radioIndex = this.getAttribute("index");
|
||||
this.radioValue = this.getAttribute("value");
|
||||
this.radioClass = this.getAttribute("class","");
|
||||
if(this.radioClass !== "") {
|
||||
this.radioClass += " ";
|
||||
}
|
||||
this.radioClass += "tc-radio";
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
114
core/modules/widgets/range.js
Normal file
114
core/modules/widgets/range.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/range.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Range widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var RangeWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
RangeWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
RangeWidget.prototype.render = function(parent,nextSibling) {
|
||||
// Save the parent dom node
|
||||
this.parentDomNode = parent;
|
||||
// Compute our attributes
|
||||
this.computeAttributes();
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
// Create our elements
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","range");
|
||||
this.inputDomNode.setAttribute("class",this.elementClass);
|
||||
if(this.minValue){
|
||||
this.inputDomNode.setAttribute("min", this.minValue);
|
||||
}
|
||||
if(this.maxValue){
|
||||
this.inputDomNode.setAttribute("max", this.maxValue);
|
||||
}
|
||||
if(this.increment){
|
||||
this.inputDomNode.setAttribute("step", this.increment);
|
||||
}
|
||||
this.inputDomNode.value = this.getValue();
|
||||
|
||||
|
||||
// Add a click event handler
|
||||
$tw.utils.addEventListeners(this.inputDomNode,[
|
||||
{name: "input", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
||||
]);
|
||||
// Insert the label into the DOM and render any children
|
||||
parent.insertBefore(this.inputDomNode,nextSibling);
|
||||
this.domNodes.push(this.inputDomNode);
|
||||
};
|
||||
|
||||
RangeWidget.prototype.getValue = function() {
|
||||
var tiddler = this.wiki.getTiddler(this.tiddlerTitle),
|
||||
value = this.defaultValue;
|
||||
if(tiddler) {
|
||||
if($tw.utils.hop(tiddler.fields,this.tiddlerField)) {
|
||||
value = tiddler.fields[this.tiddlerField] || "";
|
||||
} else {
|
||||
value = this.defaultValue || "";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
RangeWidget.prototype.handleChangeEvent = function(event) {
|
||||
this.wiki.setText(this.tiddlerTitle ,this.tiddlerField, null,this.inputDomNode.value);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
RangeWidget.prototype.execute = function() {
|
||||
// Get the parameters from the attributes
|
||||
this.tiddlerTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.tiddlerField = this.getAttribute("field");
|
||||
this.minValue = this.getAttribute("min");
|
||||
this.maxValue = this.getAttribute("max");
|
||||
this.increment = this.getAttribute("increment");
|
||||
this.defaultValue = this.getAttribute("default");
|
||||
this.elementClass = this.getAttribute("class","");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
RangeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes['min'] || changedAttributes['max'] || changedAttributes['increment'] || changedAttributes["default"] || changedAttributes["class"]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
var refreshed = false;
|
||||
if(changedTiddlers[this.tiddlerTitle]) {
|
||||
this.inputDomNode.checked = this.getValue();
|
||||
refreshed = true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||
}
|
||||
};
|
||||
|
||||
exports.range = RangeWidget;
|
||||
|
||||
})();
|
||||
@@ -121,17 +121,28 @@ RevealWidget.prototype.readState = function() {
|
||||
this.readPopupState(state);
|
||||
break;
|
||||
case "match":
|
||||
this.readMatchState(state);
|
||||
this.isOpen = !!(this.compareStateText(state) == 0);
|
||||
break;
|
||||
case "nomatch":
|
||||
this.readMatchState(state);
|
||||
this.isOpen = !this.isOpen;
|
||||
this.isOpen = !(this.compareStateText(state) == 0);
|
||||
break;
|
||||
case "lt":
|
||||
this.isOpen = !!(this.compareStateText(state) < 0);
|
||||
break;
|
||||
case "gt":
|
||||
this.isOpen = !!(this.compareStateText(state) > 0);
|
||||
break;
|
||||
case "lteq":
|
||||
this.isOpen = !(this.compareStateText(state) > 0);
|
||||
break;
|
||||
case "gteq":
|
||||
this.isOpen = !(this.compareStateText(state) < 0);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
RevealWidget.prototype.readMatchState = function(state) {
|
||||
this.isOpen = state === this.text;
|
||||
RevealWidget.prototype.compareStateText = function(state) {
|
||||
return state.localeCompare(this.text,undefined,{numeric: true,sensitivity: "case"});
|
||||
};
|
||||
|
||||
RevealWidget.prototype.readPopupState = function(state) {
|
||||
@@ -182,6 +193,7 @@ RevealWidget.prototype.refresh = function(changedTiddlers) {
|
||||
Called by refresh() to dynamically show or hide the content
|
||||
*/
|
||||
RevealWidget.prototype.updateState = function() {
|
||||
var self = this;
|
||||
// Read the current state
|
||||
this.readState();
|
||||
// Construct the child nodes if needed
|
||||
@@ -202,8 +214,12 @@ RevealWidget.prototype.updateState = function() {
|
||||
$tw.anim.perform(this.openAnimation,domNode);
|
||||
} else {
|
||||
$tw.anim.perform(this.closeAnimation,domNode,{callback: function() {
|
||||
domNode.setAttribute("hidden","true");
|
||||
}});
|
||||
//make sure that the state hasn't changed during the close animation
|
||||
self.readState()
|
||||
if(!self.isOpen) {
|
||||
domNode.setAttribute("hidden","true");
|
||||
}
|
||||
}});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
||||
var value = this.selectDefault;
|
||||
// Get the value
|
||||
if(this.selectIndex) {
|
||||
value = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex);
|
||||
value = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex,value);
|
||||
} else {
|
||||
var tiddler = this.wiki.getTiddler(this.selectTitle);
|
||||
if(tiddler) {
|
||||
|
||||
@@ -42,6 +42,7 @@ SetWidget.prototype.execute = function() {
|
||||
this.setFilter = this.getAttribute("filter");
|
||||
this.setSelect = this.getAttribute("select");
|
||||
this.setTiddler = this.getAttribute("tiddler");
|
||||
this.setSubTiddler = this.getAttribute("subtiddler");
|
||||
this.setField = this.getAttribute("field");
|
||||
this.setIndex = this.getAttribute("index");
|
||||
this.setValue = this.getAttribute("value");
|
||||
@@ -58,7 +59,12 @@ Get the value to be assigned
|
||||
SetWidget.prototype.getValue = function() {
|
||||
var value = this.setValue;
|
||||
if(this.setTiddler) {
|
||||
var tiddler = this.wiki.getTiddler(this.setTiddler);
|
||||
var tiddler;
|
||||
if(this.setSubTiddler) {
|
||||
tiddler = this.wiki.getSubTiddler(this.setTiddler,this.setSubTiddler);
|
||||
} else {
|
||||
tiddler = this.wiki.getTiddler(this.setTiddler);
|
||||
}
|
||||
if(!tiddler) {
|
||||
value = this.setEmptyValue;
|
||||
} else if(this.setField) {
|
||||
@@ -70,7 +76,7 @@ SetWidget.prototype.getValue = function() {
|
||||
}
|
||||
} else if(this.setFilter) {
|
||||
var results = this.wiki.filterTiddlers(this.setFilter,this);
|
||||
if(!this.setValue) {
|
||||
if(this.setValue == null) {
|
||||
var select;
|
||||
if(this.setSelect) {
|
||||
select = parseInt(this.setSelect,10);
|
||||
|
||||
@@ -83,52 +83,73 @@ options: see below
|
||||
Options include
|
||||
params: array of {name:, value:} for each parameter
|
||||
defaultValue: default value if the variable is not defined
|
||||
|
||||
Returns an object with the following fields:
|
||||
|
||||
params: array of {name:,value:} of parameters passed to wikitext variables
|
||||
text: text of variable, with parameters properly substituted
|
||||
*/
|
||||
Widget.prototype.getVariable = function(name,options) {
|
||||
Widget.prototype.getVariableInfo = function(name,options) {
|
||||
options = options || {};
|
||||
var actualParams = options.params || [],
|
||||
parentWidget = this.parentWidget;
|
||||
// Check for the variable defined in the parent widget (or an ancestor in the prototype chain)
|
||||
if(parentWidget && name in parentWidget.variables) {
|
||||
var variable = parentWidget.variables[name],
|
||||
value = variable.value;
|
||||
value = variable.value,
|
||||
params = this.resolveVariableParameters(variable.params,actualParams);
|
||||
// Substitute any parameters specified in the definition
|
||||
value = this.substituteVariableParameters(value,variable.params,actualParams);
|
||||
$tw.utils.each(params,function(param) {
|
||||
value = $tw.utils.replaceString(value,new RegExp("\\$" + $tw.utils.escapeRegExp(param.name) + "\\$","mg"),param.value);
|
||||
});
|
||||
value = this.substituteVariableReferences(value);
|
||||
return value;
|
||||
return {
|
||||
text: value,
|
||||
params: params
|
||||
};
|
||||
}
|
||||
// If the variable doesn't exist in the parent widget then look for a macro module
|
||||
return this.evaluateMacroModule(name,actualParams,options.defaultValue);
|
||||
return {
|
||||
text: this.evaluateMacroModule(name,actualParams,options.defaultValue)
|
||||
};
|
||||
};
|
||||
|
||||
Widget.prototype.substituteVariableParameters = function(text,formalParams,actualParams) {
|
||||
if(formalParams) {
|
||||
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
||||
paramInfo, paramValue;
|
||||
// Step through each of the parameters in the macro definition
|
||||
for(var p=0; p<formalParams.length; p++) {
|
||||
// Check if we've got a macro call parameter with the same name
|
||||
paramInfo = formalParams[p];
|
||||
paramValue = undefined;
|
||||
for(var m=0; m<actualParams.length; m++) {
|
||||
if(actualParams[m].name === paramInfo.name) {
|
||||
paramValue = actualParams[m].value;
|
||||
}
|
||||
/*
|
||||
Simplified version of getVariableInfo() that just returns the text
|
||||
*/
|
||||
Widget.prototype.getVariable = function(name,options) {
|
||||
return this.getVariableInfo(name,options).text;
|
||||
};
|
||||
|
||||
Widget.prototype.resolveVariableParameters = function(formalParams,actualParams) {
|
||||
formalParams = formalParams || [];
|
||||
actualParams = actualParams || [];
|
||||
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
||||
paramInfo, paramValue,
|
||||
results = [];
|
||||
// Step through each of the parameters in the macro definition
|
||||
for(var p=0; p<formalParams.length; p++) {
|
||||
// Check if we've got a macro call parameter with the same name
|
||||
paramInfo = formalParams[p];
|
||||
paramValue = undefined;
|
||||
for(var m=0; m<actualParams.length; m++) {
|
||||
if(actualParams[m].name === paramInfo.name) {
|
||||
paramValue = actualParams[m].value;
|
||||
}
|
||||
// If not, use the next available anonymous macro call parameter
|
||||
while(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {
|
||||
nextAnonParameter++;
|
||||
}
|
||||
if(paramValue === undefined && nextAnonParameter < actualParams.length) {
|
||||
paramValue = actualParams[nextAnonParameter++].value;
|
||||
}
|
||||
// If we've still not got a value, use the default, if any
|
||||
paramValue = paramValue || paramInfo["default"] || "";
|
||||
// Replace any instances of this parameter
|
||||
text = $tw.utils.replaceString(text,new RegExp("\\$" + $tw.utils.escapeRegExp(paramInfo.name) + "\\$","mg"),paramValue);
|
||||
}
|
||||
// If not, use the next available anonymous macro call parameter
|
||||
while(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {
|
||||
nextAnonParameter++;
|
||||
}
|
||||
if(paramValue === undefined && nextAnonParameter < actualParams.length) {
|
||||
paramValue = actualParams[nextAnonParameter++].value;
|
||||
}
|
||||
// If we've still not got a value, use the default, if any
|
||||
paramValue = paramValue || paramInfo["default"] || "";
|
||||
// Store the parameter name and value
|
||||
results.push({name: paramInfo.name, value: paramValue});
|
||||
}
|
||||
return text;
|
||||
return results;
|
||||
};
|
||||
|
||||
Widget.prototype.substituteVariableReferences = function(text) {
|
||||
|
||||
@@ -329,7 +329,7 @@ Sort an array of tiddler titles by a specified field
|
||||
isDescending: true if the sort should be descending
|
||||
isCaseSensitive: true if the sort should consider upper and lower case letters to be different
|
||||
*/
|
||||
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric) {
|
||||
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric,isAlphaNumeric) {
|
||||
var self = this;
|
||||
titles.sort(function(a,b) {
|
||||
var x,y,
|
||||
@@ -358,6 +358,8 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
|
||||
y = Number(b);
|
||||
if(isNumeric && (!isNaN(x) || !isNaN(y))) {
|
||||
return compareNumbers(x,y);
|
||||
} else if(isAlphaNumeric) {
|
||||
return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"});
|
||||
} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {
|
||||
return isDescending ? b - a : a - b;
|
||||
} else {
|
||||
@@ -567,6 +569,8 @@ exports.sortByList = function(array,listTitle) {
|
||||
afterTitle = tiddler.fields["list-after"];
|
||||
if(beforeTitle === "") {
|
||||
newPos = 0;
|
||||
} else if(afterTitle === "") {
|
||||
newPos = titles.length;
|
||||
} else if(beforeTitle) {
|
||||
newPos = titles.indexOf(beforeTitle);
|
||||
} else if(afterTitle) {
|
||||
|
||||
@@ -16,6 +16,14 @@ button-border:
|
||||
code-background: #f7f7f9
|
||||
code-border: #e1e1e8
|
||||
code-foreground: #dd1144
|
||||
diff-delete-background: #ffc9c9
|
||||
diff-delete-foreground: <<colour foreground>>
|
||||
diff-equal-background:
|
||||
diff-equal-foreground: <<colour foreground>>
|
||||
diff-insert-background: #aaefad
|
||||
diff-insert-foreground: <<colour foreground>>
|
||||
diff-invisible-background:
|
||||
diff-invisible-foreground: <<colour muted-foreground>>
|
||||
dirty-indicator: #ff0000
|
||||
download-background: #34c734
|
||||
download-foreground: <<colour background>>
|
||||
|
||||
@@ -20,6 +20,7 @@ caption: {{$:/language/ControlPanel/Basics/Caption}}
|
||||
|<$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="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers" class="tc-edit-texteditor"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
|<$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/Text"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler="$:/config/NewJournal/Text" tag="textarea" class="tc-edit-texteditor" default=""/> |
|
||||
|<$link to="$:/config/NewJournal/Tags"><<lingo NewJournal/Tags/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Tags" default="" tag="input"/> |
|
||||
|
||||
13
core/ui/ControlPanel/Settings/DefaultMoreSidebarTab.tid
Normal file
13
core/ui/ControlPanel/Settings/DefaultMoreSidebarTab.tid
Normal file
@@ -0,0 +1,13 @@
|
||||
caption: {{$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption}}
|
||||
tags: $:/tags/ControlPanel/Settings
|
||||
title: $:/core/ui/ControlPanel/Settings/DefaultMoreSidebarTab
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Settings/DefaultMoreSidebarTab/
|
||||
|
||||
<$link to="$:/config/DefaultMoreSidebarTab"><<lingo Hint>></$link>
|
||||
|
||||
<$select tiddler="$:/config/DefaultMoreSidebarTab">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]">
|
||||
<option value=<<currentTiddler>>><$transclude field="caption"><$text text=<<currentTiddler>>/></$transclude></option>
|
||||
</$list>
|
||||
</$select>
|
||||
9
core/ui/ControlPanel/Stylesheets.tid
Normal file
9
core/ui/ControlPanel/Stylesheets.tid
Normal file
@@ -0,0 +1,9 @@
|
||||
title: $:/core/ui/ControlPanel/Stylesheets
|
||||
tags: $:/tags/ControlPanel/Advanced
|
||||
caption: {{$:/language/ControlPanel/Stylesheets/Caption}}
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/
|
||||
|
||||
<<lingo Stylesheets/Hint>>
|
||||
|
||||
{{$:/snippets/peek-stylesheets}}
|
||||
@@ -11,7 +11,7 @@ title: $:/core/ui/EditTemplate
|
||||
\define frame-classes()
|
||||
tc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
|
||||
\end
|
||||
<div class=<<frame-classes>>>
|
||||
<div class=<<frame-classes>> data-tiddler-title=<<currentTiddler>>>
|
||||
<$fieldmangler>
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>>
|
||||
<$keyboard key="((cancel-edit-tiddler))" message="tm-cancel-tiddler">
|
||||
|
||||
11
core/ui/EditTemplate/Preview/diffs-current.tid
Normal file
11
core/ui/EditTemplate/Preview/diffs-current.tid
Normal file
@@ -0,0 +1,11 @@
|
||||
title: $:/core/ui/EditTemplate/body/preview/diffs-current
|
||||
tags: $:/tags/EditPreview
|
||||
caption: differences from current
|
||||
list-after: $:/core/ui/EditTemplate/body/preview/output
|
||||
|
||||
<$list filter="[<currentTiddler>!is[image]]" emptyMessage={{$:/core/ui/EditTemplate/body/preview/output}}>
|
||||
|
||||
<$macrocall $name="compareTiddlerText" sourceTiddlerTitle={{!!draft.of}} destTiddlerTitle=<<currentTiddler>>/>
|
||||
|
||||
</$list>
|
||||
|
||||
11
core/ui/EditTemplate/Preview/diffs-shadow.tid
Normal file
11
core/ui/EditTemplate/Preview/diffs-shadow.tid
Normal file
@@ -0,0 +1,11 @@
|
||||
title: $:/core/ui/EditTemplate/body/preview/diffs-shadow
|
||||
tags: $:/tags/EditPreview
|
||||
caption: differences from shadow (if any)
|
||||
list-after: $:/core/ui/EditTemplate/body/preview/output
|
||||
|
||||
<$list filter="[<currentTiddler>!is[image]]" emptyMessage={{$:/core/ui/EditTemplate/body/preview/output}}>
|
||||
|
||||
<$macrocall $name="compareTiddlerText" sourceTiddlerTitle={{{ [{!!draft.of}shadowsource[]] }}} sourceSubTiddlerTitle={{!!draft.of}} destTiddlerTitle=<<currentTiddler>>/>
|
||||
|
||||
</$list>
|
||||
|
||||
2
core/ui/EditTemplate/Preview/showeditpreview.tid
Normal file
2
core/ui/EditTemplate/Preview/showeditpreview.tid
Normal file
@@ -0,0 +1,2 @@
|
||||
title: $:/state/showeditpreview
|
||||
text: no
|
||||
@@ -10,10 +10,13 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
|
||||
[[hide]] -[title{$(config-title)$}]
|
||||
\end
|
||||
|
||||
\define new-field-inner()
|
||||
\define new-field()
|
||||
<$vars name={{$:/temp/newfieldname}}>
|
||||
<$reveal type="nomatch" text="" default=<<name>>>
|
||||
<$button>
|
||||
<$action-sendmessage $message="tm-add-field" $name=<<name>> $value=<<value>>/>
|
||||
<$action-sendmessage $message="tm-add-field"
|
||||
$name=<<name>>
|
||||
$value={{$:/temp/newfieldvalue}}/>
|
||||
<$action-deletetiddler $tiddler="$:/temp/newfieldname"/>
|
||||
<$action-deletetiddler $tiddler="$:/temp/newfieldvalue"/>
|
||||
<<lingo Fields/Add/Button>>
|
||||
@@ -24,14 +27,7 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
|
||||
<<lingo Fields/Add/Button>>
|
||||
</$button>
|
||||
</$reveal>
|
||||
\end
|
||||
|
||||
\define new-field()
|
||||
<$set name="name" value={{$:/temp/newfieldname}}>
|
||||
<$set name="value" value={{$:/temp/newfieldvalue}}>
|
||||
<<new-field-inner>>
|
||||
</$set>
|
||||
</$set>
|
||||
</$vars>
|
||||
\end
|
||||
|
||||
<div class="tc-edit-fields">
|
||||
|
||||
@@ -4,7 +4,7 @@ icon: $:/core/images/fixed-height
|
||||
custom-icon: yes
|
||||
caption: {{$:/language/Buttons/EditorHeight/Caption}}
|
||||
description: {{$:/language/Buttons/EditorHeight/Hint}}
|
||||
condition: [<targetTiddler>!is[image]]
|
||||
condition: [<targetTiddler>type[]] [<targetTiddler>get[type]prefix[text/]] +[first[]]
|
||||
dropdown: $:/core/ui/EditorToolbar/editor-height-dropdown
|
||||
|
||||
<$reveal tag="span" state="$:/config/TextEditor/EditorHeight/Mode" type="match" text="fixed">
|
||||
|
||||
@@ -3,7 +3,7 @@ tags: $:/tags/EditorToolbar
|
||||
icon: $:/core/images/excise
|
||||
caption: {{$:/language/Buttons/Excise/Caption}}
|
||||
description: {{$:/language/Buttons/Excise/Hint}}
|
||||
condition: [<targetTiddler>!is[image]]
|
||||
condition: [<targetTiddler>type[]] [<targetTiddler>type[text/vnc.tiddlywiki]] +[first[]]
|
||||
shortcuts: ((excise))
|
||||
dropdown: $:/core/ui/EditorToolbar/excise-dropdown
|
||||
|
||||
|
||||
@@ -2,51 +2,26 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
||||
|
||||
\define lingo-base() $:/language/Buttons/Link/
|
||||
|
||||
\define link-actions()
|
||||
<$action-sendmessage
|
||||
$message="tm-edit-text-operation"
|
||||
$param="make-link"
|
||||
text={{$(linkTiddler)$}}
|
||||
/>
|
||||
|
||||
<$action-deletetiddler
|
||||
$tiddler=<<dropdown-state>>
|
||||
/>
|
||||
|
||||
<$action-deletetiddler
|
||||
$tiddler=<<searchTiddler>>
|
||||
/>
|
||||
|
||||
<$action-deletetiddler
|
||||
$tiddler=<<linkTiddler>>
|
||||
/>
|
||||
\define add-link-actions()
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="make-link" text={{$(linkTiddler)$}} />
|
||||
<$action-deletetiddler $tiddler=<<dropdown-state>> />
|
||||
<$action-deletetiddler $tiddler=<<searchTiddler>> />
|
||||
<$action-deletetiddler $tiddler=<<linkTiddler>> />
|
||||
\end
|
||||
|
||||
\define external-link()
|
||||
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;">
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="make-link" text={{$(searchTiddler)$}}
|
||||
/>
|
||||
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
||||
{{$:/core/images/chevron-right}}
|
||||
<$action-deletetiddler
|
||||
$tiddler=<<dropdown-state>>
|
||||
/>
|
||||
|
||||
<$action-deletetiddler
|
||||
$tiddler=<<searchTiddler>>
|
||||
/>
|
||||
|
||||
<$action-deletetiddler
|
||||
$tiddler=<<linkTiddler>>
|
||||
/>
|
||||
</$button>
|
||||
\end
|
||||
|
||||
|
||||
\define body(config-title)
|
||||
''<<lingo Hint>>''
|
||||
|
||||
<$vars searchTiddler="""$config-title$/search""" linkTiddler="""$config-title$/link""" linktext="" >
|
||||
|
||||
<$vars linkTiddler=<<searchTiddler>>>
|
||||
<$keyboard key="ENTER" actions=<<add-link-actions>>>
|
||||
<$edit-text tiddler=<<searchTiddler>> type="search" tag="input" focus="true" placeholder={{$:/language/Search/Search}} default=""/>
|
||||
<$reveal tag="span" state=<<searchTiddler>> type="nomatch" text="">
|
||||
<<external-link>>
|
||||
@@ -55,10 +30,12 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
||||
{{$:/core/images/close-button}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$keyboard>
|
||||
</$vars>
|
||||
|
||||
<$reveal tag="div" state=<<searchTiddler>> type="nomatch" text="">
|
||||
|
||||
<$linkcatcher actions=<<link-actions>> to=<<linkTiddler>>>
|
||||
<$linkcatcher actions=<<add-link-actions>> to=<<linkTiddler>>>
|
||||
|
||||
{{$:/core/ui/SearchResults}}
|
||||
|
||||
|
||||
15
core/ui/EditorToolbar/linkify.tid
Normal file
15
core/ui/EditorToolbar/linkify.tid
Normal file
@@ -0,0 +1,15 @@
|
||||
caption: {{$:/language/Buttons/Linkify/Caption}}
|
||||
condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]
|
||||
description: {{$:/language/Buttons/Linkify/Hint}}
|
||||
icon: $:/core/images/linkify
|
||||
list-before: $:/core/ui/EditorToolbar/mono-block
|
||||
shortcuts: ((linkify))
|
||||
title: $:/core/ui/EditorToolbar/linkify
|
||||
tags: $:/tags/EditorToolbar
|
||||
|
||||
<$action-sendmessage
|
||||
$message="tm-edit-text-operation"
|
||||
$param="wrap-selection"
|
||||
prefix="[["
|
||||
suffix="]]"
|
||||
/>
|
||||
11
core/ui/EditorToolbar/rotate-left.tid
Normal file
11
core/ui/EditorToolbar/rotate-left.tid
Normal file
@@ -0,0 +1,11 @@
|
||||
title: $:/core/ui/EditorToolbar/rotate-left
|
||||
tags: $:/tags/EditorToolbar
|
||||
icon: $:/core/images/rotate-left
|
||||
caption: {{$:/language/Buttons/RotateLeft/Caption}}
|
||||
description: {{$:/language/Buttons/RotateLeft/Hint}}
|
||||
condition: [<targetTiddler>is[image]]
|
||||
|
||||
<$action-sendmessage
|
||||
$message="tm-edit-bitmap-operation"
|
||||
$param="rotate-left"
|
||||
/>
|
||||
@@ -3,7 +3,7 @@ tags: $:/tags/EditorToolbar
|
||||
icon: $:/core/images/stamp
|
||||
caption: {{$:/language/Buttons/Stamp/Caption}}
|
||||
description: {{$:/language/Buttons/Stamp/Hint}}
|
||||
condition: [<targetTiddler>!is[image]]
|
||||
condition: [<targetTiddler>type[]] [<targetTiddler>get[type]prefix[text/]] +[first[]]
|
||||
shortcuts: ((stamp))
|
||||
dropdown: $:/core/ui/EditorToolbar/stamp-dropdown
|
||||
text:
|
||||
|
||||
15
core/ui/EditorToolbar/transcludify.tid
Normal file
15
core/ui/EditorToolbar/transcludify.tid
Normal file
@@ -0,0 +1,15 @@
|
||||
caption: {{$:/language/Buttons/Transcludify/Caption}}
|
||||
condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]
|
||||
description: {{$:/language/Buttons/Transcludify/Hint}}
|
||||
icon: $:/core/images/transcludify
|
||||
list-before: $:/core/ui/EditorToolbar/mono-block
|
||||
shortcuts: ((transcludify))
|
||||
title: $:/core/ui/EditorToolbar/transcludify
|
||||
tags: $:/tags/EditorToolbar
|
||||
|
||||
<$action-sendmessage
|
||||
$message="tm-edit-text-operation"
|
||||
$param="wrap-selection"
|
||||
prefix="{{"
|
||||
suffix="}}"
|
||||
/>
|
||||
@@ -41,12 +41,12 @@ $(currentTiddler)$!!popup-$(payloadTiddler)$
|
||||
<$checkbox field=<<selectionField>> checked="checked" unchecked="unchecked" default="checked"/>
|
||||
</td>
|
||||
<td>
|
||||
<$reveal type="nomatch" state=<<previewPopupState>> text="yes">
|
||||
<$reveal type="nomatch" state=<<previewPopupState>> text="yes" tag="div">
|
||||
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="yes">
|
||||
{{$:/core/images/right-arrow}} <$text text=<<payloadTiddler>>/>
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<previewPopupState>> text="yes">
|
||||
<$reveal type="match" state=<<previewPopupState>> text="yes" tag="div">
|
||||
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="no">
|
||||
{{$:/core/images/down-arrow}} <$text text=<<payloadTiddler>>/>
|
||||
</$button>
|
||||
@@ -58,8 +58,10 @@ $(currentTiddler)$!!popup-$(payloadTiddler)$
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<$reveal type="match" text="yes" state=<<previewPopupState>>>
|
||||
<$transclude subtiddler=<<payloadTiddler>> mode="block"/>
|
||||
<$reveal type="match" text="yes" state=<<previewPopupState>> tag="div">
|
||||
<$list filter="[{$:/state/importpreviewtype}has[text]]" variable="listItem" emptyMessage={{$:/core/ui/ImportPreviews/Text}}>
|
||||
<$transclude tiddler={{$:/state/importpreviewtype}}/>
|
||||
</$list>
|
||||
</$reveal>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
5
core/ui/ImportPreviews/Diff.tid
Normal file
5
core/ui/ImportPreviews/Diff.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
title: $:/core/ui/ImportPreviews/Diff
|
||||
tags: $:/tags/ImportPreview
|
||||
caption: {{$:/language/Import/Listing/Preview/Diff}}
|
||||
|
||||
<$macrocall $name="compareTiddlerText" sourceTiddlerTitle=<<payloadTiddler>> destTiddlerTitle=<<currentTiddler>> destSubTiddlerTitle=<<payloadTiddler>>/>
|
||||
5
core/ui/ImportPreviews/DiffFields.tid
Normal file
5
core/ui/ImportPreviews/DiffFields.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
title: $:/core/ui/ImportPreviews/DiffFields
|
||||
tags: $:/tags/ImportPreview
|
||||
caption: {{$:/language/Import/Listing/Preview/DiffFields}}
|
||||
|
||||
<$macrocall $name="compareTiddlers" sourceTiddlerTitle=<<payloadTiddler>> destTiddlerTitle=<<currentTiddler>> destSubTiddlerTitle=<<payloadTiddler>> exclude="text"/>
|
||||
7
core/ui/ImportPreviews/Fields.tid
Normal file
7
core/ui/ImportPreviews/Fields.tid
Normal file
@@ -0,0 +1,7 @@
|
||||
title: $:/core/ui/ImportPreviews/Fields
|
||||
tags: $:/tags/ImportPreview
|
||||
caption: {{$:/language/Import/Listing/Preview/Fields}}
|
||||
|
||||
<$tiddler tiddler=<<payloadTiddler>>>
|
||||
<$transclude tiddler="$:/core/ui/TiddlerFields"/>
|
||||
</$tiddler>
|
||||
5
core/ui/ImportPreviews/Text.tid
Normal file
5
core/ui/ImportPreviews/Text.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
title: $:/core/ui/ImportPreviews/Text
|
||||
tags: $:/tags/ImportPreview
|
||||
caption: {{$:/language/Import/Listing/Preview/Text}}
|
||||
|
||||
<$transclude tiddler=<<payloadTiddler>> mode="block"/>
|
||||
5
core/ui/ImportPreviews/TextRaw.tid
Normal file
5
core/ui/ImportPreviews/TextRaw.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
title: $:/core/ui/ImportPreviews/TextRaw
|
||||
tags: $:/tags/ImportPreview
|
||||
caption: {{$:/language/Import/Listing/Preview/TextRaw}}
|
||||
|
||||
<pre><code><$view tiddler=<<payloadTiddler>>/></code></pre>
|
||||
@@ -21,34 +21,7 @@ $(languagePluginTitle)$/icon
|
||||
</$button>
|
||||
</span>
|
||||
<$reveal state=<<qualify "$:/state/popup/language">> type="popup" position="below" animate="yes">
|
||||
<div class="tc-drop-down tc-drop-down-language-chooser">
|
||||
<$linkcatcher to="$:/language">
|
||||
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[description]]">
|
||||
<$link>
|
||||
<span class="tc-drop-down-bullet">
|
||||
<$reveal type="match" state="$:/language" text=<<currentTiddler>>>
|
||||
•
|
||||
</$reveal>
|
||||
<$reveal type="nomatch" state="$:/language" text=<<currentTiddler>>>
|
||||
|
||||
</$reveal>
|
||||
</span>
|
||||
<span class="tc-image-button">
|
||||
<$set name="languagePluginTitle" value=<<currentTiddler>>>
|
||||
<$transclude subtiddler=<<flag-title>>>
|
||||
<$list filter="[all[current]field:title[$:/languages/en-GB]]">
|
||||
<$transclude tiddler="$:/languages/en-GB/icon"/>
|
||||
</$list>
|
||||
</$transclude>
|
||||
</$set>
|
||||
</span>
|
||||
<$view field="description">
|
||||
<$view field="name">
|
||||
<$view field="title"/>
|
||||
</$view>
|
||||
</$view>
|
||||
</$link>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
<div class="tc-drop-down">
|
||||
{{$:/snippets/languageswitcher}}
|
||||
</div>
|
||||
</$reveal>
|
||||
@@ -5,13 +5,20 @@ description: {{$:/language/Buttons/NewJournal/Hint}}
|
||||
|
||||
\define journalButton()
|
||||
<$button tooltip={{$:/language/Buttons/NewJournal/Hint}} aria-label={{$:/language/Buttons/NewJournal/Caption}} class=<<tv-config-toolbar-class>>>
|
||||
<$action-sendmessage $message="tm-new-tiddler" title=<<now "$(journalTitleTemplate)$">> tags="$(journalTags)$" text="$(journalText)$"/>
|
||||
<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
|
||||
<$reveal type="nomatch" state=<<journalTitle>> text="">
|
||||
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalTags>> text={{{ [<journalTitle>get[]] }}}/>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<journalTitle>> text="">
|
||||
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalTags>> text=<<journalText>>/>
|
||||
</$reveal>
|
||||
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
|
||||
{{$:/core/images/new-journal-button}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
|
||||
<span class="tc-btn-text"><$text text={{$:/language/Buttons/NewJournal/Caption}}/></span>
|
||||
</$list>
|
||||
</$wikify>
|
||||
</$button>
|
||||
\end
|
||||
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
|
||||
|
||||
@@ -20,20 +20,6 @@ $:/core/images/storyview-$(storyview)$
|
||||
</span>
|
||||
<$reveal state=<<qualify "$:/state/popup/storyview">> type="popup" position="below" animate="yes">
|
||||
<div class="tc-drop-down">
|
||||
<$linkcatcher to="$:/view">
|
||||
<$list filter="[storyviews[]]" variable="storyview">
|
||||
<$link to=<<storyview>>>
|
||||
<span class="tc-drop-down-bullet">
|
||||
<$reveal type="match" state="$:/view" text=<<storyview>>>
|
||||
•
|
||||
</$reveal>
|
||||
<$reveal type="nomatch" state="$:/view" text=<<storyview>>>
|
||||
|
||||
</$reveal>
|
||||
</span>
|
||||
<$transclude tiddler=<<icon>>/>
|
||||
<$text text=<<storyview>>/></$link>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
{{$:/snippets/viewswitcher}}
|
||||
</div>
|
||||
</$reveal>
|
||||
@@ -16,19 +16,7 @@ description: {{$:/language/Buttons/Theme/Hint}}
|
||||
<$reveal state=<<qualify "$:/state/popup/theme">> type="popup" position="below" animate="yes">
|
||||
<div class="tc-drop-down">
|
||||
<$linkcatcher to="$:/theme">
|
||||
<$list filter="[plugin-type[theme]sort[title]]" variable="themeTitle">
|
||||
<$link to=<<themeTitle>>>
|
||||
<span class="tc-drop-down-bullet">
|
||||
<$reveal type="match" state="$:/theme" text=<<themeTitle>>>
|
||||
•
|
||||
</$reveal>
|
||||
<$reveal type="nomatch" state="$:/theme" text=<<themeTitle>>>
|
||||
|
||||
</$reveal>
|
||||
</span>
|
||||
<$view tiddler=<<themeTitle>> field="name"/>
|
||||
</$link>
|
||||
</$list>
|
||||
{{$:/snippets/themeswitcher}}
|
||||
</$linkcatcher>
|
||||
</div>
|
||||
</$reveal>
|
||||
@@ -3,5 +3,5 @@ tags: $:/tags/SideBar
|
||||
caption: {{$:/language/SideBar/More/Caption}}
|
||||
|
||||
<div class="tc-more-sidebar">
|
||||
<<tabs "[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]" "$:/core/ui/MoreSideBar/Tags" "$:/state/tab/moresidebar" "tc-vertical">>
|
||||
</div>
|
||||
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]" default={{$:/config/DefaultMoreSidebarTab}} state="$:/state/tab/moresidebar" class="tc-vertical" />
|
||||
</div>
|
||||
@@ -1,11 +1,11 @@
|
||||
title: $:/core/ui/ViewTemplate
|
||||
|
||||
\define frame-classes()
|
||||
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$
|
||||
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$ $(userClass)$
|
||||
\end
|
||||
\define folded-state()
|
||||
$:/state/folded/$(currentTiddler)$
|
||||
\end
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">> userClass={{!!class}}><$tiddler tiddler=<<currentTiddler>>><div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
</div>
|
||||
</$tiddler></$set></$set>
|
||||
</$tiddler></$vars>
|
||||
|
||||
@@ -3,19 +3,27 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\define lingo-base() $:/language/Import/
|
||||
|
||||
\define buttons()
|
||||
<$button message="tm-delete-tiddler" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>
|
||||
<$button message="tm-perform-import" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>
|
||||
<<lingo Listing/Preview>> <$select tiddler="$:/state/importpreviewtype" default="$:/core/ui/ImportPreviews/Text">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ImportPreview]!has[draft.of]]">
|
||||
<option value=<<currentTiddler>>>{{!!caption}}</option>
|
||||
</$list>
|
||||
</$select>
|
||||
\end
|
||||
|
||||
<$list filter="[all[current]field:plugin-type[import]]">
|
||||
|
||||
<div class="tc-import">
|
||||
|
||||
<<lingo Listing/Hint>>
|
||||
|
||||
<$button message="tm-delete-tiddler" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>
|
||||
<$button message="tm-perform-import" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>
|
||||
<<buttons>>
|
||||
|
||||
{{||$:/core/ui/ImportListing}}
|
||||
|
||||
<$button message="tm-delete-tiddler" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>
|
||||
<$button message="tm-perform-import" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>
|
||||
<<buttons>>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $:/config/ViewToolbarButtons/Visibility/$(listItem)$
|
||||
</span>
|
||||
</$list>
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/popup/more">> type="popup" position="below" animate="yes">
|
||||
<$reveal state=<<qualify "$:/state/popup/more">> type="popup" position="belowleft" animate="yes">
|
||||
|
||||
<div class="tc-drop-down">
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ description: {{$:/language/Buttons/NewJournalHere/Hint}}
|
||||
\end
|
||||
\define journalButton()
|
||||
<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}} aria-label={{$:/language/Buttons/NewJournalHere/Caption}} class=<<tv-config-toolbar-class>>>
|
||||
<$action-sendmessage $message="tm-new-tiddler" title=<<now "$(journalTitleTemplate)$">> tags=<<journalButtonTags>>/>
|
||||
<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
|
||||
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalButtonTags>>/>
|
||||
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
|
||||
{{$:/core/images/new-journal-button}}
|
||||
</$list>
|
||||
@@ -18,6 +19,7 @@ description: {{$:/language/Buttons/NewJournalHere/Hint}}
|
||||
<$text text={{$:/language/Buttons/NewJournalHere/Caption}}/>
|
||||
</span>
|
||||
</$list>
|
||||
</$wikify>
|
||||
</$button>
|
||||
\end
|
||||
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
|
||||
|
||||
18
core/ui/ViewToolbar/print-window.tid
Normal file
18
core/ui/ViewToolbar/print-window.tid
Normal file
@@ -0,0 +1,18 @@
|
||||
title: $:/core/ui/Buttons/print-window
|
||||
tags: $:/tags/ViewToolbar
|
||||
caption: {{$:/core/images/print-button}} {{$:/language/Buttons/PrintWindow/Caption}}
|
||||
description: {{$:/language/Buttons/PrintWindow/Hint}}
|
||||
|
||||
\whitespace trim
|
||||
<$button tooltip={{$:/language/Buttons/PrintWindow/Hint}} aria-label={{$:/language/Buttons/PrintWindow/Caption}} class=<<tv-config-toolbar-class>>>
|
||||
<$action-sendmessage $message="tm-open-window" print="yes"/>
|
||||
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
|
||||
{{$:/core/images/print-button}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
|
||||
<span class="tc-btn-text">
|
||||
<$text text=" "/>
|
||||
<$text text={{$:/language/Buttons/PrintWindow/Caption}}/>
|
||||
</span>
|
||||
</$list>
|
||||
</$button>
|
||||
3
core/wiki/config/DefaultMoreSidebarTab.tid
Normal file
3
core/wiki/config/DefaultMoreSidebarTab.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/DefaultMoreSidebarTab
|
||||
|
||||
$:/core/ui/MoreSideBar/Tags
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/library/v5.1.15/index.html
|
||||
url: https://tiddlywiki.com/library/v5.1.17/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}}
|
||||
|
||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||
|
||||
3
core/wiki/config/TagsMinLength.tid
Normal file
3
core/wiki/config/TagsMinLength.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/config/Tags/MinLength
|
||||
|
||||
0
|
||||
@@ -10,6 +10,7 @@ core/ui/Buttons/new-journal-here: hide
|
||||
core/ui/Buttons/open-window: hide
|
||||
core/ui/Buttons/permalink: hide
|
||||
core/ui/Buttons/permaview: hide
|
||||
core/ui/Buttons/print-window: hide
|
||||
core/ui/Buttons/delete: hide
|
||||
core/ui/Buttons/fold: hide
|
||||
core/ui/Buttons/fold-bar: hide
|
||||
|
||||
@@ -9,6 +9,7 @@ heading-4: ctrl-4
|
||||
heading-5: ctrl-5
|
||||
heading-6: ctrl-6
|
||||
link: ctrl-L
|
||||
linkify: alt-shift-L
|
||||
list-bullet: ctrl-shift-L
|
||||
list-number: ctrl-shift-N
|
||||
mono-block: ctrl-shift-M
|
||||
@@ -21,3 +22,4 @@ stamp: ctrl-S
|
||||
strikethrough: ctrl-T
|
||||
subscript: ctrl-shift-B
|
||||
superscript: ctrl-shift-P
|
||||
transcludify: alt-shift-T
|
||||
|
||||
@@ -3,17 +3,16 @@ title: $:/snippets/currpalettepreview
|
||||
\define swatchStyle()
|
||||
background-color: $(swatchColour)$;
|
||||
\end
|
||||
\define swatch(colour)
|
||||
<$set name="swatchColour" value={{##$colour$}}>
|
||||
<div class="tc-swatch" style=<<swatchStyle>>/>
|
||||
</$set>
|
||||
\define swatch()
|
||||
<$set name="swatchColour" value={{##$(colour)$}}
|
||||
><div class="tc-swatch" style=<<swatchStyle>> title=<<colour>>/></$set>
|
||||
\end
|
||||
<div class="tc-swatches-horiz">
|
||||
<<swatch foreground>>
|
||||
<<swatch background>>
|
||||
<<swatch muted-foreground>>
|
||||
<<swatch primary>>
|
||||
<<swatch page-background>>
|
||||
<<swatch tab-background>>
|
||||
<<swatch tiddler-info-background>>
|
||||
</div>
|
||||
<div class="tc-swatches-horiz"><$list filter="
|
||||
foreground
|
||||
background
|
||||
muted-foreground
|
||||
primary
|
||||
page-background
|
||||
tab-background
|
||||
tiddler-info-background
|
||||
" variable="colour"><<swatch>></$list></div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user