Tui.editor: add an option for initial HTML text

Created on 15 Mar 2018  ·  4Comments  ·  Source: nhn/tui.editor

Is there a way to convert already rendered value to editor value? I mean initialValue from rendered html. For example;

<div id="markdownEditor">
    <span>rendered value</span>
</div>
var markdownEditor = new tui.Editor({
        el: document.querySelector('#markdownEditor'),
        initialEditType: 'markdown',
        previewStyle: 'tab',
        height: '400px'
});

I expect an editor with initialValue <span>rendered value</span>. Is there a way to achive this?

Good First Issue 🙋‍♀️ 🙋‍♂️ Help Wanted 🤝

Most helpful comment

It currently has no option for that.
We may add an option for the HTML text.

For now, as a workaround, you can use setHtml() after the editor initialization.

I'm going to tag this help wanted
anyone interested in implement this, please go ahead and send me a PR.

All 4 comments

It currently has no option for that.
We may add an option for the HTML text.

For now, as a workaround, you can use setHtml() after the editor initialization.

I'm going to tag this help wanted
anyone interested in implement this, please go ahead and send me a PR.

This is very important feature. For example think about github issues or stackoverflow question-answer flow. There need to be more than one viewer. And I expect that something like following;

HTML

<div class="viewer">
    <span>some pre-rendered html</span>
    ...
</div>

...

<div class="viewer">
    <span>some another pre-rendered html</span>
    ...
</div>

JS

$('.viewer').viewer();

What ever happened to this?

Adding an option for initial HTML text in Viewer is keep going in #360

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kelvinkoko picture kelvinkoko  ·  3Comments

bricepepin picture bricepepin  ·  3Comments

hellojsna picture hellojsna  ·  4Comments

dioscuroi picture dioscuroi  ·  3Comments

gincheong picture gincheong  ·  4Comments