зеркало из 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);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,10 +101,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
function editPage(url)
|
||||
{
|
||||
window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", url );
|
||||
}
|
||||
//Note: "function editPage(url)" was moved to utilityOverlay.js
|
||||
|
||||
function findParentNode(node, parentNode)
|
||||
{
|
||||
|
|
|
@ -402,6 +402,44 @@ function NewEditorFromDraft()
|
|||
// 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()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче