зеркало из https://github.com/mozilla/pjs.git
Backing out 392820, tree was closed.
This commit is contained in:
Родитель
93262ff283
Коммит
f35388036a
|
@ -53,48 +53,12 @@ var PlacesCommandHook = {
|
|||
return document.getElementById("editBookmarkPanel");
|
||||
},
|
||||
|
||||
// list of command elements (by id) to disable when the panel is opened
|
||||
_blockedCommands: ["cmd_close", "cmd_closeWindow"],
|
||||
|
||||
_blockCommands: function PCH__blockCommands() {
|
||||
for each(var key in this._blockedCommands) {
|
||||
var elt = document.getElementById(key);
|
||||
if (elt.getAttribute("disabled") == "true")
|
||||
elt.setAttribute("wasDisabled", "true");
|
||||
else {
|
||||
elt.setAttribute("wasDisabled", "false");
|
||||
elt.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_restoreCommandsState: function PCH__restoreCommandsState() {
|
||||
for each(var key in this._blockedCommands) {
|
||||
var elt = document.getElementById(key);
|
||||
if (elt.getAttribute("wasDisabled") != "true")
|
||||
elt.removeAttribute("disabled");
|
||||
elt.removeAttribute("wasDisabled");
|
||||
}
|
||||
},
|
||||
|
||||
// nsIDOMEventListener
|
||||
handleEvent: function PCH_handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "popuphiding":
|
||||
if (aEvent.originalTarget == this.panel) {
|
||||
gEditItemOverlay.uninitPanel(true);
|
||||
this._restoreCommandsState();
|
||||
}
|
||||
break;
|
||||
case "keypress":
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE ||
|
||||
aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
|
||||
// focus the content area and hide the panel
|
||||
window.content.focus();
|
||||
this.panel.hidePopup();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (aEvent.originalTarget != this.panel)
|
||||
return;
|
||||
|
||||
gEditItemOverlay.uninitPanel(true);
|
||||
},
|
||||
|
||||
_overlayLoaded: false,
|
||||
|
@ -134,17 +98,10 @@ var PlacesCommandHook = {
|
|||
|
||||
_doShowEditBookmarkPanel:
|
||||
function PCH__doShowEditBookmarkPanel(aItemId, aAnchorElement, aPosition) {
|
||||
this.panel.addEventListener("keypress", this, true);
|
||||
this._blockCommands(); // un-done in the popuphiding handler
|
||||
this.panel.openPopup(aAnchorElement, aPosition, -1, -1);
|
||||
|
||||
gEditItemOverlay.initPanel(aItemId,
|
||||
{ hiddenRows: ["description", "location"] });
|
||||
setTimeout(function() {
|
||||
var namePicker = document.getElementById("editBMPanel_namePicker");
|
||||
namePicker.focus();
|
||||
namePicker.editor.selectAll();
|
||||
}, 0);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче