Issue with links: next character being included into <a> tag in TinyMce ui-tinymce

59 Views Asked by At

I ran into an issue and I'm really struggling to find a workaround or solution.
This might be wrong setup or maybe I am missing something. But so far, I think it can be a bug as well.

I have this setup for TinyMce being applied in a Div (editable).

setup: function (editor) {
            forced_root_block: false,
            force_p_newlines: false,
            plugins: 'autolink link paste',
            valid_elements: 'a[href|rel|target=_blank],br,p',
            toolbar: false,
            menubar: false,
            statusbar: false,
            paste_auto_cleanup_on_paste: true,
            inline: true,
            default_link_target: '_blank'
        };

When I type a link in the div and press Enter, the next character, and also the <br> is included in the <a> generated. It stays like this: <a href="http://www.google.co">www.google.com<br>a</a>sda</div>

If I type Space instead, it works fine.

Do you guys have an idea of what can be happening?

1

There are 1 best solutions below

0
On

Workaround: I took that forced_root_block setting out and styled the <p> elements so they'd have no margins. Also, to save the content, I used innerText so I won't get any HTML element.

Some info can be found here: https://github.com/angular-ui/ui-tinymce/issues/250