nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.2k stars 1.75k forks source link

How to use it on CDN? #2997

Open KIMKYEONGYONG opened 1 year ago

KIMKYEONGYONG commented 1 year ago

Summary

How to use it on CDN? Even if I use it according to the guide, an error "Viewer is not defined". Please CDN use example

Screenshots

0)

1)

<script src="https://uicdn.toast.com/editor/latest/toastui-editor-viewer.js"></script>

2)

result => Uncaught ReferenceError: Viewer is not defined

Version

latest

Additional context

Add any other context about the problem here.

CPSuperstore commented 1 year ago

I encountered the same error for the Editor, and was able to fix it by changing new Editor( to new toastui.Editor(. By changing your script to:

<script> 
    const data = $('#viewer_hidden').text(); 
    console.log(data); 
    new toastui.Viewer({ el: document.querySelector('#viewer'), viewer: true, initialValue: data }); 
</script> 

it might fix your problem. I hope this helps!