Insert HTML code into editor?
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 547
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
It would be great if a user is able to insert arbitrary HTML into the editor. I can get this functionality by initializing pell as follows:
```
const editor = pell.init({
element: document.getElementById("tooltip"),
onChange: html => {
},
defaultParagraphSeparator: 'p',
styleWithCSS: true,
actions: [
'bold',
'quote',
'olist',
'ulist',
'code',
'link',
'image',
{
icon: '✎',
title: 'Insert HTML',
result: () => {
const url = window.prompt('Enter HTML');
if (url) document.execCommand('insertHTML',false, url)
}
},
],
classes: {
actionbar: 'pell-actionbar',
button: 'pell-button',
content: 'pell-content',
selected: 'pell-button-selected'
}
})
```
This brings up a prompt for the user to enter the HTML code. Is there a better way to achieve this functionality with pell?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with pell.init and its actions configuration, using the custom action and document.execCommand('insertHTML') shown in the issue as the current workaround. Determine whether pell should expose a built-in way to insert arbitrary HTML, then verify the proposed behavior in the editor and document how users can invoke it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100