diff --git a/src/pell.js b/src/pell.js index c5a1bf2..3796045 100644 --- a/src/pell.js +++ b/src/pell.js @@ -88,6 +88,19 @@ const defaultActions = { const url = window.prompt('Enter the image URL') if (url) exec('insertImage', url) } + }, + eraser: { + icon: '✗', + title: 'Clear', + result: () => { + if (window.getSelection().toString()) { + let linesToDelete = window.getSelection().toString().split('\n').join('
'); + window.pell.exec(formatBlock, '
'); + document.execCommand('insertHTML', false, '
' + linesToDelete + '
'); + } else { + window.pell.exec(formatBlock, '
') + } + } } }