Skip to content

Insert HTML code into editor? #218

@kvgc

Description

@kvgc

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions