Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Add Paste Without Formatting to context menu
Browse files Browse the repository at this point in the history
Fixes #5822
  • Loading branch information
Liunkae authored and bsclifton committed Jan 17, 2017
1 parent dc7ac81 commit 88b91f2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ function getMisspelledSuggestions (selection, isMisspelled, suggestions) {
return menuUtil.sanitizeTemplateItems(template)
}

function getEditableItems (selection, editFlags) {
function getEditableItems (selection, editFlags, hasFormat) {
const hasSelection = selection.length > 0
const hasClipboard = clipboard.readText().length > 0
const template = []
Expand Down Expand Up @@ -657,6 +657,16 @@ function getEditableItems (selection, editFlags) {
enabled: hasClipboard,
role: 'paste'
})
if (hasFormat) {
template.push({
label: locale.translation('pasteWithoutFormatting'),
accelerator: 'Shift+CmdOrCtrl+V',
enabled: hasClipboard,
click: function (item, focusedWindow) {
focusedWindow.webContents.pasteAndMatchStyle()
}
})
}
}
return menuUtil.sanitizeTemplateItems(template)
}
Expand Down Expand Up @@ -977,7 +987,7 @@ function mainTemplateInit (nodeProps, frame) {
}
}

const editableItems = getEditableItems(nodeProps.selectionText, nodeProps.editFlags)
const editableItems = getEditableItems(nodeProps.selectionText, nodeProps.editFlags, true)
template.push(...misspelledSuggestions, {
label: locale.translation('undo'),
accelerator: 'CmdOrCtrl+Z',
Expand Down

0 comments on commit 88b91f2

Please sign in to comment.