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

Add Paste Without Formatting to context menu #6359

Merged
merged 1 commit into from
Jan 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,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 @@ -659,6 +659,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 @@ -979,7 +989,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