Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert HTML code into editor? #218

Open
kvgc opened this issue Feb 5, 2022 · 0 comments
Open

Insert HTML code into editor? #218

kvgc opened this issue Feb 5, 2022 · 0 comments

Comments

@kvgc
Copy link

kvgc commented Feb 5, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant