mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-08 09:48:05 +00:00
Add new "print tiddler" button for the view toolbar
It works by opening the tiddler in a new window and then triggering the browser print dialogue.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user