diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 5b310f4a1..412e35f8f 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -76,6 +76,8 @@ Permalink/Caption: permalink Permalink/Hint: Set browser address bar to a direct link to this tiddler 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 Refresh/Caption: refresh Refresh/Hint: Perform a full refresh of the wiki Save/Caption: ok diff --git a/core/modules/startup/story.js b/core/modules/startup/story.js index 20eb5e71a..8ef57076f 100644 --- a/core/modules/startup/story.js +++ b/core/modules/startup/story.js @@ -55,7 +55,7 @@ exports.startup = function() { }); // Listen for the tm-print message $tw.rootWidget.addEventListener("tm-print",function(event) { - window.print(); + (event.event.view || window).print(); }); // Listen for the tm-home message $tw.rootWidget.addEventListener("tm-home",function(event) { diff --git a/core/modules/widgets/action-sendmessage.js b/core/modules/widgets/action-sendmessage.js index 2f1b9cae4..c53314b2d 100644 --- a/core/modules/widgets/action-sendmessage.js +++ b/core/modules/widgets/action-sendmessage.js @@ -78,7 +78,8 @@ SendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) { param: param, paramObject: paramObject, tiddlerTitle: this.getVariable("currentTiddler"), - navigateFromTitle: this.getVariable("storyTiddler") + navigateFromTitle: this.getVariable("storyTiddler"), + event: event }); return true; // Action was invoked }; diff --git a/core/modules/widgets/button.js b/core/modules/widgets/button.js index b53ca2e15..07c0c5ac1 100644 --- a/core/modules/widgets/button.js +++ b/core/modules/widgets/button.js @@ -131,12 +131,13 @@ ButtonWidget.prototype.navigateTo = function(event) { navigateFromNode: this, navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height }, - navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1) + navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1), + event: event }); }; ButtonWidget.prototype.dispatchMessage = function(event) { - this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("currentTiddler")}); + this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("currentTiddler"), event: event}); }; ButtonWidget.prototype.triggerPopup = function(event) { diff --git a/core/ui/PageControls/print.tid b/core/ui/PageControls/print.tid new file mode 100644 index 000000000..cc2709cd2 --- /dev/null +++ b/core/ui/PageControls/print.tid @@ -0,0 +1,13 @@ +title: $:/core/ui/Buttons/print +tags: $:/tags/PageControls +caption: {{$:/core/images/print-button}} {{$:/language/Buttons/Print/Caption}} +description: {{$:/language/Buttons/Print/Hint}} + +<$button message="tm-print" tooltip={{$:/language/Buttons/Print/Hint}} aria-label={{$:/language/Buttons/Print/Caption}} class=<>> +<$list filter="[prefix[yes]]"> +{{$:/core/images/print-button}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Print/Caption}}/> + + \ No newline at end of file diff --git a/core/wiki/config/PageControlButtons.multids b/core/wiki/config/PageControlButtons.multids index eb54546ed..9086e8f18 100644 --- a/core/wiki/config/PageControlButtons.multids +++ b/core/wiki/config/PageControlButtons.multids @@ -16,6 +16,7 @@ core/ui/Buttons/new-journal: hide core/ui/Buttons/new-image: hide core/ui/Buttons/palette: hide core/ui/Buttons/permaview: hide +core/ui/Buttons/print: hide core/ui/Buttons/storyview: hide core/ui/Buttons/theme: hide core/ui/Buttons/unfold-all: hide