mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-16 23:04:50 +00:00
Add print tiddler toolbar button
This commit is contained in:
parent
33e636cbe7
commit
60ab25bf6e
@ -82,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
|
||||
|
@ -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)) {
|
||||
|
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>
|
@ -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
|
||||
|
@ -1,2 +1,2 @@
|
||||
title: $:/tags/ViewToolbar
|
||||
list: [[$:/core/ui/Buttons/more-tiddler-actions]] [[$:/core/ui/Buttons/info]] [[$:/core/ui/Buttons/new-here]] [[$:/core/ui/Buttons/new-journal-here]] [[$:/core/ui/Buttons/clone]] [[$:/core/ui/Buttons/export-tiddler]] [[$:/core/ui/Buttons/edit]] [[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/permalink]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/open-window]] [[$:/core/ui/Buttons/close-others]] [[$:/core/ui/Buttons/close]] [[$:/core/ui/Buttons/fold-others]] [[$:/core/ui/Buttons/fold]]
|
||||
list: [[$:/core/ui/Buttons/more-tiddler-actions]] [[$:/core/ui/Buttons/info]] [[$:/core/ui/Buttons/new-here]] [[$:/core/ui/Buttons/new-journal-here]] [[$:/core/ui/Buttons/clone]] [[$:/core/ui/Buttons/export-tiddler]] [[$:/core/ui/Buttons/edit]] [[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/permalink]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/print-window]] [[$:/core/ui/Buttons/open-window]] [[$:/core/ui/Buttons/close-others]] [[$:/core/ui/Buttons/close]] [[$:/core/ui/Buttons/fold-others]] [[$:/core/ui/Buttons/fold]]
|
||||
|
@ -12,6 +12,7 @@ The `tm-open-window` message opens a tiddler in a new //browser// window. If no
|
||||
|template |Template in which the tiddler will be rendered in |
|
||||
|width |Width of the new browser window |
|
||||
|height |Height of the new browser window |
|
||||
|print |Set to "yes" to trigger opening of the browser print dialogue |
|
||||
|paramObject |Hashmap of variables that will be provided to the window |
|
||||
|
||||
|
||||
|
@ -82,6 +82,8 @@ Permaview/Caption: Permaview
|
||||
Permaview/Hint: Die Adressleiste des Browsers enthält einen Link zu allen offenen Tiddlern in dieser Story
|
||||
Print/Caption: Seite drucken
|
||||
Print/Hint: Aktuelle Seite drucken
|
||||
PrintWindow/Caption: Drucken in neuem Fenster
|
||||
PrintWindow/Hint: Tiddler zum Drucken in neuem Fenster öffnen
|
||||
Refresh/Caption: Aktualisieren
|
||||
Refresh/Hint: Die Seite wird neu in den Browser geladen
|
||||
Save/Caption: Fertig
|
||||
|
@ -82,6 +82,8 @@ Permaview/Caption: 永久链接
|
||||
Permaview/Hint: 设置浏览器网址栏为直接链接到当前所有已开启条目
|
||||
Print/Caption: 打印页面
|
||||
Print/Hint: 打印当前页面
|
||||
PrintWindow/Caption: 在新窗口中打印
|
||||
PrintWindow/Hint: 在新窗口中打印条目
|
||||
Refresh/Caption: 刷新
|
||||
Refresh/Hint: 执行维基的完全刷新
|
||||
Save/Caption: 确定
|
||||
|
@ -82,6 +82,8 @@ Permaview/Caption: 固定連結
|
||||
Permaview/Hint: 設定瀏覽器網址列為直接連結到當前所有已開啟條目
|
||||
Print/Caption: 列印頁面
|
||||
Print/Hint: 列印當前頁面
|
||||
PrintWindow/Caption: 在新視窗中列印
|
||||
PrintWindow/Hint: 在新視窗中列印條目
|
||||
Refresh/Caption: 重新整理
|
||||
Refresh/Hint: 執行維基的完全刷新
|
||||
Save/Caption: 確定
|
||||
|
Loading…
Reference in New Issue
Block a user