1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-08 09:48:05 +00:00

Extend tm-open-window to support optional top and left position for new browser window (#6470)

* feat: extend tm-open-window to support optional top and left position for new browser window

* fix: whitespace correction

* Update WidgetMessage_ tm-open-window.tid
This commit is contained in:
Saq Imtiaz
2022-02-20 12:23:27 +01:00
committed by GitHub
parent 1d16206188
commit 59572cd75d
2 changed files with 9 additions and 5 deletions

View File

@@ -32,13 +32,15 @@ exports.startup = function() {
template = paramObject.template || "$:/core/templates/single.tiddler.window",
width = paramObject.width || "700",
height = paramObject.height || "600",
top = paramObject.top,
left = paramObject.left,
variables = $tw.utils.extend({},paramObject,{currentTiddler: title});
// Open the window
var srcWindow,
srcDocument;
// In case that popup blockers deny opening a new window
try {
srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height),
srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
srcDocument = srcWindow.document;
}
catch(e) {