* @param {Window} win parent window reference * @param {string} id menu ID * * @returns {Menu} */ function createEditContextMenu(win, id) { // Localized strings for the menu are loaded lazily. loadEditMenuStrings(win); const docshell = win.docShell; const menu = new Menu({ id }); menu.append( new MenuItem({ id: "editmenu-undo", l10nID: "text-action-undo", disabled: !docshell.isCommandEnabled("cmd_undo"), click: () => { docshell.doCommand("cmd_undo"); }, }) ); menu.append( new MenuItem({ type: "separator", }) ); menu.append( new MenuItem({ id: "editmenu-cut", l10nID: "text-action-cut", disabled: !docshell.isCommandEnabled("cmd_cut"), click: () => { docshell.doCommand("cmd_cut"); }, }) ); menu.append( new MenuItem({ id: "editmenu-copy", l10nID: "text-action-copy", disabled: !docshell.isCommandEnabled("cmd_copy"), click: () => { docshell.doCommand("cmd_copy"); }, }) ); menu.append( new MenuItem({ id: "editmenu-paste", l10nID: "text-action-paste", disabled: !docshell.isCommandEnabled("cmd_paste"), click: () => { docshell.doCommand("cmd_paste"); }, }) ); menu.append( new MenuItem({ id: "editmenu-delete", l10nID: "text-action-delete", disabled: !docshell.isCommandEnabled("cmd_delete"), click: () => { docshell.doCommand("cmd_delete"); }, }) ); menu.append( new MenuItem({ type: "separator", }) ); menu.append( new MenuItem({ id: "editmenu-selectAll", l10nID: "text-action-select-all", disabled: !docshell.isCommandEnabled("cmd_selectAll"), click: () => { docshell.doCommand("cmd_selectAll"); }, }) ); return menu; } module.exports.createEditContextMenu = createEditContextMenu; PK