diff --git a/core/images/open-window.tid b/core/images/open-window.tid new file mode 100644 index 000000000..337c582a1 --- /dev/null +++ b/core/images/open-window.tid @@ -0,0 +1,9 @@ +title: $:/core/images/open-window +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index f90c138ef..9cd9c6fd5 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -52,6 +52,8 @@ NewJournalHere/Caption: new journal here NewJournalHere/Hint: Create a new journal tiddler tagged with this one NewTiddler/Caption: new tiddler NewTiddler/Hint: Create a new tiddler +OpenWindow/Caption: open in new window +OpenWindow/Hint: Open tiddler in new window Permalink/Caption: permalink Permalink/Hint: Set browser address bar to a direct link to this tiddler Permaview/Caption: permaview diff --git a/core/modules/startup/windows.js b/core/modules/startup/windows.js new file mode 100644 index 000000000..cb4c755f5 --- /dev/null +++ b/core/modules/startup/windows.js @@ -0,0 +1,63 @@ +/*\ +title: $:/core/modules/startup/windows.js +type: application/javascript +module-type: startup + +Setup root widget handlers for the messages concerned with opening external browser windows + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +// Export name and synchronous status +exports.name = "windows"; +exports.platforms = ["browser"]; +exports.after = ["startup"]; +exports.synchronous = true; + +exports.startup = function() { + $tw.rootWidget.addEventListener("tm-open-window",function(event) { + // Get the parameters + var title = event.param || event.tiddlerTitle, + paramObject = event.paramObject || {}, + template = paramObject.template || "$:/core/ui/ViewTemplate/body", + width = paramObject.width || "700", + height = paramObject.height || "600"; + // Open the window + var srcWindow = window.open("","external-" + title,"width=" + width + ",height=" + height), + srcDocument = srcWindow.document; + srcWindow.onclose = function(event) { + console.log("closing popup"); + }; + srcWindow.addEventListener("close",function(event) { + console.log("closing2 popup"); + },false); + srcDocument.write(""); + srcDocument.close(); + // Set up the styles + var styleWidgetNode = $tw.wiki.makeTranscludeWidget("$:/core/ui/PageStylesheet",{document: $tw.fakeDocument}), + styleContainer = $tw.fakeDocument.createElement("style"); + styleWidgetNode.render(styleContainer,null); + var styleElement = srcDocument.createElement("style"); + styleElement.innerHTML = styleContainer.textContent; + srcDocument.head.insertBefore(styleElement,srcDocument.head.firstChild); + $tw.wiki.addEventListener("change",function(changes) { + if(styleWidgetNode.refresh(changes,styleContainer,null)) { + styleElement.innerHTML = styleContainer.textContent; + } + }); + // Render the text of the tiddler + var parser = $tw.wiki.parseTiddler(template), + widgetNode = $tw.wiki.makeWidget(parser,{document: srcDocument, variables: {currentTiddler: title}}); + widgetNode.render(srcDocument.body,null); + $tw.wiki.addEventListener("change",function(changes) { + widgetNode.refresh(changes); + }); + + }); +}; + +})(); diff --git a/core/ui/ViewToolbar/open-window.tid b/core/ui/ViewToolbar/open-window.tid new file mode 100644 index 000000000..6c885fc94 --- /dev/null +++ b/core/ui/ViewToolbar/open-window.tid @@ -0,0 +1,13 @@ +title: $:/core/ui/Buttons/open-window +tags: $:/tags/ViewToolbar +caption: {{$:/core/images/open-window}} {{$:/language/Buttons/OpenWindow/Caption}} +description: {{$:/language/Buttons/OpenWindow/Hint}} + +<$button message="tm-open-window" tooltip={{$:/language/Buttons/OpenWindow/Hint}} aria-label={{$:/language/Buttons/OpenWindow/Caption}} class=<>> +<$list filter="[prefix[yes]]"> +{{$:/core/images/open-window}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/OpenWindow/Caption}}/> + + \ No newline at end of file diff --git a/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid b/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid index 4b578e862..3de79fc5a 100644 --- a/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid +++ b/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid @@ -1,25 +1,38 @@ title: TiddlyWiki Pre-release modified: 20150428204930183 +\define colour-picker(tiddler,colour) +<$edit-text tiddler="""$tiddler$""" index="""$colour$""" type="color" tag="input"/> +\end + This is a pre-release build of TiddlyWiki. It is provided for testing purposes. Please don't try to use it for anything important -- you should use the latest official release from http://tiddlywiki.com. ! Features for 5.1.9 +!! New Tiddler Toolbar Button: "Open in new window" + +An experimental new tiddler toolbar button opens a single tiddler in a separate pop-up browser window. The tiddler will be dynamically updated just as in the main window. There are several uses: + +* Arranging reference tiddlers for easy access while editing in the main window +* Making good use of multi-screen layouts +* Printing the content of a single tiddler +* Running presentations in a separate window while maintaining notes in the main window + !! Improvements for visually impaired users -* Improved monochrome palettes: +* Improved monochrome palette variants: ** <$button> <$action-setfield $tiddler="$:/theme" text="$:/themes/tiddlywiki/vanilla"/> <$action-setfield $tiddler="$:/palette" text="$:/palettes/ContrastDark"/> -Set "Contrast (Light)" palette - +Dark palette +. Foreground: <>, Background: <> ** <$button> <$action-setfield $tiddler="$:/theme" text="$:/themes/tiddlywiki/vanilla"/> <$action-setfield $tiddler="$:/palette" text="$:/palettes/ContrastLight"/> -Set "Contrast (Dark)" palette - +Light palette +. Foreground: <>, Background: <> ** <$button> <$action-setfield $tiddler="$:/theme" text="$:/themes/tiddlywiki/snowwhite"/> <$action-setfield $tiddler="$:/palette" text="$:/palettes/Vanilla"/>