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

Preload existing content #14

Closed
ingro opened this issue Jul 12, 2017 · 1 comment
Closed

Preload existing content #14

ingro opened this issue Jul 12, 2017 · 1 comment
Labels

Comments

@ingro
Copy link

ingro commented Jul 12, 2017

Maybe I'm missing something but how can I show pre-existing content inside an editor istance?

@peeratant
Copy link

peeratant commented Jul 12, 2017

@ingro, I solved this problem by adding return editor in init function ( pell.js file ).

then you can play around with editor-content in the way you want. (retrieve content to store in db or load DOM string to replace an old value).

Example 1:

<script> var test; test = window.pell.init({ /* actions: [ 'bold', { name: 'italic', icon: '&#9786;', title: 'Zitalic' }, 'underline' ], classes: { actionbar: 'pell-actionbar', button: 'pell-button', editor: 'pell-editor' }, */ onChange: html => { document.getElementById('text-output').innerHTML = html document.getElementById('html-output').textContent = html console.log(test.innerHTML) }, root: 'pell' }) </script>

If you don't want to touch/change the original code then you could try access Pell's root div by id and extract innerHTML from this element <div contenteditable="true" class="pell-editor"></div> .

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

No branches or pull requests

3 participants