Issue #2551Opened February 5, 2020by gagan3480 reactions

Unable to select link component without clicking on canvas in richtexteditor

Question

Code SnippetTEXT
I have created link toolbar in richtexteditor and want to select link component (dynamically added) in else statement after insertHTML. It is not created as a component until I click on canvas. Is there any method to achieve it?

Here is the following code:

 editor.RichTextEditor.add('link', {
                                icon: '<i class="fa fa-link"/>',
                                attributes: { title: 'Link' },
                                result:
                                function (rte) {
                                    if (isValidAnchor(rte))
                                        rte.exec('unlink');
                                    else {
                                        rte.insertHTML(`<a data-gjs-type="link" class="link" href="">${rte.selection()}</a>`);

                                    }
                                },
                            });

Answers (1)

gagan348February 6, 20200 reactions

I found the method which works for me 👍

editor.getSelected().view.syncContent();

Thanks

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.