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

[QUESTIONS] Replacing selected text and getting html #1327

Closed
ezequiel-thalamus opened this issue Jul 31, 2018 · 2 comments
Closed

[QUESTIONS] Replacing selected text and getting html #1327

ezequiel-thalamus opened this issue Jul 31, 2018 · 2 comments
Labels

Comments

@ezequiel-thalamus
Copy link

ezequiel-thalamus commented Jul 31, 2018

Hi!
Im trying to replace selected text with a code (random code). It's works, i can see the code, but when i do editor.getHtml() not. If i deselect the component (selecting another one) the change takes effect.

var rte = editor.RichTextEditor;

rte.add('replace-text', {
    icon: '<b>${var}</b>',
    attributes: {title: 'Replace Text'},
    result: function(rte) {
        const codeToReplace = makeid(10);
        rte.exec('insertText', codeToReplace); // works
        
        //some magic(); 

        console.log(editor.getHtml());  //no showing the change.
    } 
});

Thanks!

@artf
Copy link
Member

artf commented Aug 1, 2018

The content of the model is actually updated once you blur from the editable component, so when you call getHtml it's just not yet there

@lock
Copy link

lock bot commented Sep 17, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the outdated label Sep 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants