mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-24 11:54:41 +00:00
Compare commits
16 Commits
media-quer
...
fix-startu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffbcb38920 | ||
|
|
2ebf452abb | ||
|
|
d4bc3fcd99 | ||
|
|
d770d98aff | ||
|
|
f7043f6d43 | ||
|
|
76f40208af | ||
|
|
67e8670c73 | ||
|
|
b1843837ea | ||
|
|
42c22acba6 | ||
|
|
f02c9ebba3 | ||
|
|
94b325f41f | ||
|
|
843f133f5e | ||
|
|
903d0fb8e1 | ||
|
|
53edea9256 | ||
|
|
b04af8bf7a | ||
|
|
e9fb63affc |
@@ -2463,13 +2463,15 @@ $tw.boot.initStartup = function(options) {
|
||||
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/avif","base64",".avif",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("application/wasm","base64",".wasm");
|
||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
||||
$tw.utils.registerFileType("font/woff","base64",".woff");
|
||||
$tw.utils.registerFileType("font/woff2","base64",".woff2");
|
||||
$tw.utils.registerFileType("font/ttf","base64",".ttf");
|
||||
$tw.utils.registerFileType("font/otf","base64",".otf");
|
||||
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||||
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
|
||||
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
|
||||
|
||||
@@ -17,19 +17,24 @@ Export our filter function
|
||||
*/
|
||||
exports.function = function(source,operator,options) {
|
||||
var functionName = operator.operands[0],
|
||||
params = [];
|
||||
params = [],
|
||||
results;
|
||||
$tw.utils.each(operator.operands.slice(1),function(param) {
|
||||
params.push({value: param});
|
||||
});
|
||||
// console.log(`Calling ${functionName} with params ${JSON.stringify(params)}`);
|
||||
var variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(functionName,{params: params, source: source});
|
||||
if(variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
||||
return variableInfo.resultList ? variableInfo.resultList : [variableInfo.text];
|
||||
results = variableInfo.resultList ? variableInfo.resultList : [variableInfo.text];
|
||||
}
|
||||
// Return the input list if the function wasn't found
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
if(!results) {
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
}
|
||||
// console.log(`function ${functionName} with params ${JSON.stringify(params)} results: ${JSON.stringify(results)}`);
|
||||
return results;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ exports["image/gif"] = ImageParser;
|
||||
exports["image/webp"] = ImageParser;
|
||||
exports["image/heic"] = ImageParser;
|
||||
exports["image/heif"] = ImageParser;
|
||||
exports["image/avif"] = ImageParser;
|
||||
exports["image/x-icon"] = ImageParser;
|
||||
exports["image/vnd.microsoft.icon"] = ImageParser;
|
||||
|
||||
|
||||
@@ -46,8 +46,10 @@ function SaverHandler(options) {
|
||||
// Filter the changes so that we only count changes to tiddlers that we care about
|
||||
var filteredChanges = self.filterFn.call(self.wiki,function(iterator) {
|
||||
$tw.utils.each(changes,function(change,title) {
|
||||
var tiddler = self.wiki.getTiddler(title);
|
||||
iterator(tiddler,title);
|
||||
if(change.normal) {
|
||||
var tiddler = self.wiki.getTiddler(title);
|
||||
iterator(tiddler,title);
|
||||
}
|
||||
});
|
||||
});
|
||||
// Adjust the number of changes
|
||||
|
||||
@@ -75,7 +75,7 @@ exports.startup = function() {
|
||||
$tw.wiki.unpackPluginTiddlers();
|
||||
// Queue change events for the changed shadow tiddlers
|
||||
$tw.utils.each(Object.keys(changedShadowTiddlers),function(title) {
|
||||
$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title]);
|
||||
$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title], true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,9 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
|
||||
$tw.utils.copyToClipboard(event.param,{
|
||||
successNotification: event.paramObject && event.paramObject.successNotification,
|
||||
failureNotification: event.paramObject && event.paramObject.failureNotification
|
||||
});
|
||||
failureNotification: event.paramObject && event.paramObject.failureNotification,
|
||||
plainText: event.paramObject && event.paramObject.plainText
|
||||
},event.paramObject && event.paramObject.type);
|
||||
});
|
||||
// Install the tm-focus-selector message
|
||||
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
|
||||
|
||||
@@ -67,14 +67,6 @@ exports.startup = function() {
|
||||
wiki: $tw.wiki,
|
||||
document: $tw.browser ? document : $tw.fakeDocument
|
||||
});
|
||||
// Execute any startup actions
|
||||
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction");
|
||||
if($tw.browser) {
|
||||
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Browser");
|
||||
}
|
||||
if($tw.node) {
|
||||
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Node");
|
||||
}
|
||||
// Kick off the language manager and switcher
|
||||
$tw.language = new $tw.Language();
|
||||
$tw.languageSwitcher = new $tw.PluginSwitcher({
|
||||
@@ -117,6 +109,14 @@ exports.startup = function() {
|
||||
handlerMethod: "handleKeydownEvent"
|
||||
}]);
|
||||
}
|
||||
// Execute any startup actions
|
||||
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction");
|
||||
if($tw.browser) {
|
||||
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Browser");
|
||||
}
|
||||
if($tw.node) {
|
||||
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Node");
|
||||
}
|
||||
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
|
||||
$tw.wiki.clearTiddlerEventQueue();
|
||||
// Find a working syncadaptor
|
||||
|
||||
@@ -268,9 +268,10 @@ exports.copyStyles = function(srcDomNode,dstDomNode) {
|
||||
/*
|
||||
Copy plain text to the clipboard on browsers that support it
|
||||
*/
|
||||
exports.copyToClipboard = function(text,options) {
|
||||
options = options || {};
|
||||
text = text || "";
|
||||
exports.copyToClipboard = function(text,options,type) {
|
||||
var text = text || "";
|
||||
var options = options || {};
|
||||
var type = type || "text/plain";
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.style.position = "fixed";
|
||||
textArea.style.top = 0;
|
||||
@@ -283,10 +284,16 @@ exports.copyToClipboard = function(text,options) {
|
||||
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);
|
||||
textArea.addEventListener("copy",function(event) {
|
||||
event.preventDefault();
|
||||
if (options.plainText) {
|
||||
event.clipboardData.setData("text/plain",options.plainText);
|
||||
}
|
||||
event.clipboardData.setData(type,text);
|
||||
});
|
||||
var succeeded = false;
|
||||
try {
|
||||
succeeded = document.execCommand("copy");
|
||||
|
||||
@@ -216,11 +216,11 @@ HttpClientRequest.prototype.send = function(callback) {
|
||||
if(lengthComputable) {
|
||||
setBinding(self.bindProgress,"" + Math.floor((loaded/total) * 100))
|
||||
}
|
||||
self.wiki.invokeActionString(self.progressActions,undefined,{
|
||||
self.wiki.invokeActionString(self.progressActions,undefined,$tw.utils.extend({},self.variables,{
|
||||
lengthComputable: lengthComputable ? "yes" : "no",
|
||||
loaded: loaded,
|
||||
total: total
|
||||
},{parentWidget: $tw.rootWidget});
|
||||
}),{parentWidget: $tw.rootWidget});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,15 +43,6 @@ EditWidget.prototype.execute = function() {
|
||||
// Get our parameters
|
||||
this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.editField = this.getAttribute("field","text");
|
||||
this.editIndex = this.getAttribute("index");
|
||||
this.editClass = this.getAttribute("class");
|
||||
this.editPlaceholder = this.getAttribute("placeholder");
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editFocus = this.getAttribute("focus","");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","");
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
this.editAutoComplete = this.getAttribute("autocomplete");
|
||||
// Choose the appropriate edit widget
|
||||
this.editorType = this.getEditorType();
|
||||
// Make the child widgets
|
||||
@@ -89,8 +80,8 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (this.getEditorType() !== this.editorType)) {
|
||||
// Refresh if the editor type has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || (this.getEditorType() !== this.editorType)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -23,15 +23,21 @@ Inherit from the base widget class
|
||||
*/
|
||||
GenesisWidget.prototype = new Widget();
|
||||
|
||||
GenesisWidget.prototype.computeAttributes = function(options) {
|
||||
options = options || Object.create(null);
|
||||
options.filterFn = function(name) {
|
||||
// Only compute our own attributes which start with a single dollar
|
||||
return name.charAt(0) === "$" && name.charAt(1) !== "$";
|
||||
}
|
||||
return Widget.prototype.computeAttributes.call(this,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
GenesisWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes({filterFn: function(name) {
|
||||
// Only compute our own attributes which start with a single dollar
|
||||
return name.charAt(0) === "$" && name.charAt(1) !== "$";
|
||||
}});
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
@@ -141,12 +141,15 @@ This method should be called after the changes it describes have been made to th
|
||||
title: Title of tiddler
|
||||
isDeleted: defaults to false (meaning the tiddler has been created or modified),
|
||||
true if the tiddler has been deleted
|
||||
isShadow: defaults to false (meaning the change applies to the normal tiddler),
|
||||
true if the tiddler being changed is a shadow tiddler
|
||||
*/
|
||||
exports.enqueueTiddlerEvent = function(title,isDeleted) {
|
||||
exports.enqueueTiddlerEvent = function(title,isDeleted,isShadow) {
|
||||
// Record the touch in the list of changed tiddlers
|
||||
this.changedTiddlers = this.changedTiddlers || Object.create(null);
|
||||
this.changedTiddlers[title] = this.changedTiddlers[title] || Object.create(null);
|
||||
this.changedTiddlers[title][isDeleted ? "deleted" : "modified"] = true;
|
||||
this.changedTiddlers[title][isShadow ? "shadow" : "normal"] = true;
|
||||
// Increment the change count
|
||||
this.changeCount = this.changeCount || Object.create(null);
|
||||
if($tw.utils.hop(this.changeCount,title)) {
|
||||
|
||||
@@ -78,13 +78,13 @@ code-background: <<colour background>>
|
||||
code-border: <<colour flexoki-tx>>
|
||||
code-foreground: <<colour flexoki-tx>>
|
||||
diff-delete-background: <<colour flexoki-re>>
|
||||
diff-delete-foreground: <<colour flexoki-paper>>
|
||||
diff-delete-foreground: <<colour flexoki-bg-2>>
|
||||
diff-equal-background:
|
||||
diff-equal-foreground: inherit
|
||||
diff-insert-background: <<colour flexoki-gr>>
|
||||
diff-insert-foreground: <<colour flexoki-paper>>
|
||||
diff-insert-foreground: <<colour flexoki-bg-2>>
|
||||
diff-invisible-background: <<colour flexoki-ye>>
|
||||
diff-invisible-foreground: <<colour flexoki-paper>>
|
||||
diff-invisible-foreground: <<colour flexoki-bg-2>>
|
||||
dirty-indicator: <<colour flexoki-re>>
|
||||
download-background: <<colour flexoki-cy-2>>
|
||||
download-foreground: <<colour background>>
|
||||
@@ -103,8 +103,8 @@ external-link-foreground-visited: <<colour flexoki-bl>>
|
||||
external-link-foreground: <<colour flexoki-bl>>
|
||||
footnote-target-background: <<colour flexoki-bg-2>>
|
||||
foreground: #CECDC3
|
||||
highlight-background: <<colour flexoki-cyan-950>>
|
||||
highlight-foreground: <<colour flexoki-cyan-400>>
|
||||
highlight-background: <<colour flexoki-yellow-900>>
|
||||
highlight-foreground: inherit
|
||||
menubar-background: <<colour primary>>
|
||||
menubar-foreground: <<colour flexoki-paper>>
|
||||
message-background: <<colour background>>
|
||||
|
||||
@@ -105,7 +105,7 @@ external-link-foreground-visited: <<colour flexoki-bl>>
|
||||
external-link-foreground: <<colour flexoki-bl>>
|
||||
footnote-target-background: <<colour flexoki-bg-2>>
|
||||
foreground: #100F0F
|
||||
highlight-background: <<colour flexoki-cyan-050>>
|
||||
highlight-background: <<colour flexoki-yellow-100>>
|
||||
highlight-foreground: inherit
|
||||
menubar-background: <<colour primary>>
|
||||
menubar-foreground: <<colour flexoki-paper>>
|
||||
|
||||
@@ -3,9 +3,11 @@ tags: $:/tags/Macro
|
||||
|
||||
\whitespace trim
|
||||
|
||||
\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style)
|
||||
<$button message="tm-copy-to-clipboard"
|
||||
param=<<src>>
|
||||
\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style,type:"text/plain",plain)
|
||||
\procedure copy-to-clipboard-actions()
|
||||
<$action-sendmessage $message="tm-copy-to-clipboard" $param=<<src>> type=<<type>> plainText=<<plain>>/>
|
||||
\end copy-to-clipboard-actions
|
||||
<$button actions=<<copy-to-clipboard-actions>>
|
||||
class=<<class>>
|
||||
style=<<style>>
|
||||
tooltip={{$:/language/Buttons/CopyToClipboard/Hint}}
|
||||
@@ -15,12 +17,12 @@ tags: $:/tags/Macro
|
||||
<$text text={{$:/language/Buttons/CopyToClipboard/Caption}}/>
|
||||
</span>
|
||||
</$button>
|
||||
\end
|
||||
\end copy-to-clipboard
|
||||
|
||||
\procedure copy-to-clipboard-above-right(src,class:"tc-btn-invisible",style)
|
||||
<div style="position: relative;">
|
||||
<div style="position: absolute; bottom: 0; right: 0;">
|
||||
<$macrocall $name="copy-to-clipboard" src=<<src>> class=<<class>> style=<<style>>/>
|
||||
\procedure copy-to-clipboard-above-right(src,class:"tc-btn-invisible",style,type:"text/plain")
|
||||
<div style.position="relative">
|
||||
<div style.position="absolute" style.bottom="0" style.right="0">
|
||||
<$transclude $variable="copy-to-clipboard" src=<<src>> class=<<class>> style=<<style>> type=<<type>> plain=<<plain>>/>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
caption: copy-to-clipboard
|
||||
created: 20171216104754967
|
||||
modified: 20171216104941967
|
||||
modified: 20250127133558352
|
||||
tags: Macros [[Core Macros]]
|
||||
title: copy-to-clipboard Macro
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -15,5 +15,9 @@ The <<.def copy-to-clipboard>> [[macro|Macros]] displays a button that copies sp
|
||||
: Optional CSS classes to be assigned to the button (defaults to `tc-btn-invisible`)
|
||||
;style
|
||||
: Optional CSS styles to be assigned to the button
|
||||
;type
|
||||
: <<.from-version "5.3.7">> MIME type of the text to be copied, defaults to `text/plain`
|
||||
;plain
|
||||
: <<.from-version "5.3.7">> Additional plain text to be copied when `type` attribute isn't `text/plain`
|
||||
|
||||
<<.macro-examples "copy-to-clipboard">>
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
created: 20171216104946277
|
||||
modified: 20171216105109641
|
||||
modified: 20250127134344834
|
||||
tags: [[copy-to-clipboard Macro]] [[Macro Examples]]
|
||||
title: copy-to-clipboard Macro (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$macrocall $name=".example" n="1" eg="""<<copy-to-clipboard "Mary had a little lamb">>"""/>
|
||||
<$macrocall $name=".example" n="2" eg="""<$macrocall $name="copy-to-clipboard" src={{$:/SiteTitle}}/>"""/>
|
||||
<$macrocall $name=".example" n="2" eg="""<$transclude $variable="copy-to-clipboard" src={{$:/SiteTitle}}/>"""/>
|
||||
|
||||
In the following examples, press <kbd>ctrl-V</kbd> / <kbd>cmd-V</kbd> in tiddlywiki after copying to see its effects.
|
||||
|
||||
<$macrocall $name=".example" n="3" eg="""<<copy-to-clipboard src:"<em>Test</em>" type:"text/html" plain:"Test">> """/>
|
||||
<$macrocall $name=".example" n="4" eg="""<<copy-to-clipboard src:"The ''quick'' //brown// __fox__ jumps over a `lazy` @@dog@@." type:"text/vnd.tiddlywiki" plain:"The quick brown box jumps over a lazy dog.">> """/>
|
||||
<$macrocall $name=".example" n="5" eg="""<$transclude $variable="copy-to-clipboard" src=<<jsontiddlers filter:"[tag[Concepts]]">> type="text/vnd.tiddler"/>"""/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
caption: tm-copy-to-clipboard
|
||||
created: 20171215150056004
|
||||
modified: 20240523174013095
|
||||
modified: 20250127134445040
|
||||
tags: Messages
|
||||
title: WidgetMessage: tm-copy-to-clipboard
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -13,6 +13,8 @@ It requires the following properties on the `event` object:
|
||||
|param |Text to be copied to the clipboard |
|
||||
|successNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation succeeds |
|
||||
|failureNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation fails |
|
||||
|type |<<.from-version "5.3.7">> MIME type of the text to be copied, defaults to `text/plain` |
|
||||
|plainText |<<.from-version "5.3.7">> Additional plain text to be copied when `type` attribute isn't `text/plain` |
|
||||
|
||||
This message is usually generated with the ButtonWidget. It is handled by the TiddlyWiki core.
|
||||
|
||||
|
||||
@@ -605,3 +605,5 @@ Thomas E Tuoti, @well-noted, 2024/12/16
|
||||
@opn, 2025/01/04
|
||||
|
||||
J. Ryan Stinnett, @jryans, 2025/01/04
|
||||
|
||||
Galen Huntington, @galenhuntington, 2025/01/19
|
||||
|
||||
@@ -3,6 +3,8 @@ tags: $:/tags/PageTemplate
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<%if [<tv-config-static>!match[yes]] %>
|
||||
|
||||
<$reveal state="$:/state/consent-banner/accepted" type="match" text="" tag="div">
|
||||
|
||||
<div class="tc-consent-backdrop">
|
||||
@@ -26,3 +28,5 @@ tags: $:/tags/PageTemplate
|
||||
</div>
|
||||
|
||||
</$reveal>
|
||||
|
||||
<%endif%>
|
||||
@@ -6,7 +6,7 @@
|
||||
"isTiddlerFile": false,
|
||||
"fields": {
|
||||
"title": {"source": "filename", "prefix": "$:/plugins/tiddlywiki/katex/fonts/"},
|
||||
"type": "application/font-woff"
|
||||
"type": "font/woff"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -37,4 +37,4 @@
|
||||
"suffix": "})(require);\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
title: $:/themes/tiddlywiki/starlight/arvo.woff
|
||||
type: application/font-woff
|
||||
type: font/woff
|
||||
|
||||
Reference in New Issue
Block a user