зеркало из https://github.com/mozilla/gecko-dev.git
Opening a URL in editor always checks for existing window, b=64129, r=mjudge, sr=sfraser
This commit is contained in:
Родитель
6840989fca
Коммит
43b60cde06
|
@ -92,7 +92,9 @@ function open()
|
||||||
window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no", dialog.input.value);
|
window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no", dialog.input.value);
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
window.opener.delayedOpenWindow("chrome://editor/content", "chrome,all,dialog=no", dialog.input.value);
|
// editPage is in utilityOverlay.js (all editor openers with URL should use this)
|
||||||
|
// 3rd param tells editPage to use "delayedOpenWindow"
|
||||||
|
editPage(dialog.input.value, window.opener, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,10 +101,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function editPage(url)
|
//Note: "function editPage(url)" was moved to utilityOverlay.js
|
||||||
{
|
|
||||||
window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", url );
|
|
||||||
}
|
|
||||||
|
|
||||||
function findParentNode(node, parentNode)
|
function findParentNode(node, parentNode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -402,6 +402,44 @@ function NewEditorFromDraft()
|
||||||
// XXX not implemented
|
// XXX not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Any non-editor window wanting to create an editor with a URL
|
||||||
|
// should use this instead of "window.openDialog..."
|
||||||
|
// We must always find an existing window with requested URL
|
||||||
|
// (When calling from a dialog, "launchWindow" is dialog's "opener"
|
||||||
|
// and we need a delay to let dialog close)
|
||||||
|
function editPage(url, launchWindow, delay)
|
||||||
|
{
|
||||||
|
// User may not have supplied a window
|
||||||
|
if (!launchWindow)
|
||||||
|
launchWindow = window;
|
||||||
|
|
||||||
|
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
|
||||||
|
if (!windowManager) return;
|
||||||
|
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||||
|
if ( !windowManagerInterface ) return;
|
||||||
|
var enumerator = windowManagerInterface.getEnumerator( "composer:html" );
|
||||||
|
if ( !enumerator ) return;
|
||||||
|
|
||||||
|
while ( enumerator.hasMoreElements() )
|
||||||
|
{
|
||||||
|
var window = windowManagerInterface.convertISupportsToDOMWindow( enumerator.getNext() );
|
||||||
|
if ( window && window.editorShell)
|
||||||
|
{
|
||||||
|
if (window.editorShell.checkOpenWindowForURLMatch(url, window))
|
||||||
|
{
|
||||||
|
// We found an editor with our url
|
||||||
|
window.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new Composer window
|
||||||
|
if (delay)
|
||||||
|
launchWindow.delayedOpenWindow("chrome://editor/content", "chrome,all,dialog=no", url);
|
||||||
|
else
|
||||||
|
launchWindow.openDialog("chrome://editor/content", "_blank", "chrome,all,dialog=no", url);
|
||||||
|
}
|
||||||
|
|
||||||
function helpMenuCreate()
|
function helpMenuCreate()
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче