зеркало из https://github.com/mozilla/pjs.git
Remove 'Save Image' menuitem from Composer context menu. b=156173, r=brade, sr=alecf
This commit is contained in:
Родитель
5b2e1ca085
Коммит
06d4b2c408
|
@ -35,11 +35,10 @@ function EditorFillContextMenu(event, contextMenuNode)
|
||||||
|
|
||||||
// Setup object property menuitem
|
// Setup object property menuitem
|
||||||
var objectName = InitObjectPropertiesMenuitem("objectProperties_cm");
|
var objectName = InitObjectPropertiesMenuitem("objectProperties_cm");
|
||||||
var isImage = objectName == "img";
|
|
||||||
var isInLink = objectName == "href";
|
var isInLink = objectName == "href";
|
||||||
|
|
||||||
// Special case of an image inside a link
|
// Special case of an image inside a link
|
||||||
if (isImage)
|
if (objectName == "img")
|
||||||
isInLink = gEditor.getElementOrParentByTagName("href", GetObjectForProperties());
|
isInLink = gEditor.getElementOrParentByTagName("href", GetObjectForProperties());
|
||||||
|
|
||||||
// Disable "Create Link" if in a link
|
// Disable "Create Link" if in a link
|
||||||
|
@ -66,9 +65,6 @@ function EditorFillContextMenu(event, contextMenuNode)
|
||||||
HideDisabledItem(children.item(i));
|
HideDisabledItem(children.item(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 'Save image (imagename)' menuitem:
|
|
||||||
ShowMenuItem("menu_saveImage_cm", isImage);
|
|
||||||
|
|
||||||
// Remove separators if all items in immediate group above are hidden
|
// Remove separators if all items in immediate group above are hidden
|
||||||
// A bit complicated to account if multiple groups are completely hidden!
|
// A bit complicated to account if multiple groups are completely hidden!
|
||||||
var haveUndo =
|
var haveUndo =
|
||||||
|
@ -87,38 +83,21 @@ function EditorFillContextMenu(event, contextMenuNode)
|
||||||
IsMenuItemShowing("removeLinksMenuitem_cm") ||
|
IsMenuItemShowing("removeLinksMenuitem_cm") ||
|
||||||
IsMenuItemShowing("removeNamedAnchorsMenuitem_cm");
|
IsMenuItemShowing("removeNamedAnchorsMenuitem_cm");
|
||||||
|
|
||||||
var havePropsOrImage =
|
var haveProps =
|
||||||
IsMenuItemShowing("objectProperties_cm") ||
|
IsMenuItemShowing("objectProperties_cm");
|
||||||
IsMenuItemShowing("menu_saveImage_cm");
|
|
||||||
|
|
||||||
ShowMenuItem("undoredo-separator", haveUndo && haveEdit);
|
ShowMenuItem("undoredo-separator", haveUndo && haveEdit);
|
||||||
|
|
||||||
ShowMenuItem("edit-separator", haveEdit || haveUndo);
|
ShowMenuItem("edit-separator", haveEdit || haveUndo);
|
||||||
|
|
||||||
if (isImage) //we have an image
|
|
||||||
{
|
|
||||||
var saveImageMenuItem= document.getElementById("menu_saveImage_cm");
|
|
||||||
|
|
||||||
var imagePtr = window.editorShell.GetSelectedElement(objectName);
|
|
||||||
var imageName = extractFileNameFromUrl(imagePtr.getAttribute("src"));
|
|
||||||
|
|
||||||
var menutext = window.editorShell.GetString("SaveImageAs").replace(/%NAME%/,imageName);
|
|
||||||
|
|
||||||
saveImageMenuItem.setAttribute('label',menutext);
|
|
||||||
|
|
||||||
// XXX BUSTED! This command was removed!
|
|
||||||
var onCommand = "saveURL('"+ imagePtr.getAttribute("src") + "','SaveImageTitle',false)";
|
|
||||||
saveImageMenuItem.setAttribute('oncommand',onCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Item "menu_selectAll_cm" and
|
// Note: Item "menu_selectAll_cm" and
|
||||||
// following separator are ALWAYS enabled,
|
// following separator are ALWAYS enabled,
|
||||||
// so there will always be 1 separator here
|
// so there will always be 1 separator here
|
||||||
|
|
||||||
var showStyleSep = haveStyle && (havePropsOrImage || inCell);
|
var showStyleSep = haveStyle && (haveProps || inCell);
|
||||||
ShowMenuItem("styles-separator", showStyleSep);
|
ShowMenuItem("styles-separator", showStyleSep);
|
||||||
|
|
||||||
var showPropSep = (havePropsOrImage && inCell);
|
var showPropSep = (haveProps && inCell);
|
||||||
ShowMenuItem("property-separator", showPropSep);
|
ShowMenuItem("property-separator", showPropSep);
|
||||||
|
|
||||||
// Remove table submenus if not in table
|
// Remove table submenus if not in table
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
|
|
||||||
<popupset id="editorContentContextSet">
|
<popupset id="editorContentContextSet">
|
||||||
<popup id="editorContentContext"
|
<popup id="editorContentContext"
|
||||||
onpopupshowing="EditorFillContextMenu(event, this);"
|
onpopupshowing="EditorFillContextMenu(event, this);">
|
||||||
onpopuphiding="EditorCleanupContextMenu(event, this);">
|
|
||||||
<menuitem id="menu_undo_cm" label="&undoCmd.label;" accesskey="&undo.accesskey;" oncommand="goDoCommand('cmd_undo')"/>
|
<menuitem id="menu_undo_cm" label="&undoCmd.label;" accesskey="&undo.accesskey;" oncommand="goDoCommand('cmd_undo')"/>
|
||||||
<menuitem id="menu_redo_cm" label="&redoCmd.label;" accesskey="&redo.accesskey;" oncommand="goDoCommand('cmd_redo')"/>
|
<menuitem id="menu_redo_cm" label="&redoCmd.label;" accesskey="&redo.accesskey;" oncommand="goDoCommand('cmd_redo')"/>
|
||||||
<menuseparator id="undoredo-separator"/>
|
<menuseparator id="undoredo-separator"/>
|
||||||
|
@ -60,7 +59,6 @@
|
||||||
|
|
||||||
<!-- label and accesskey are set in InitObjectProperties -->
|
<!-- label and accesskey are set in InitObjectProperties -->
|
||||||
<menuitem id="objectProperties_cm" observes="cmd_objectProperties"/>
|
<menuitem id="objectProperties_cm" observes="cmd_objectProperties"/>
|
||||||
<menuitem id="menu_saveImage_cm"/>
|
|
||||||
<menuitem id="editLink_cm" label="&editLinkCmd.label;" accesskey="&editlink.accesskey;" observes="cmd_editLink"/>
|
<menuitem id="editLink_cm" label="&editLinkCmd.label;" accesskey="&editlink.accesskey;" observes="cmd_editLink"/>
|
||||||
<menuseparator id="property-separator"/>
|
<menuseparator id="property-separator"/>
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче