Summer Sale! All accounts are 50% off this week.

Andreas94's avatar

How do I get data from Toast UI Editor?

Hi guys, I have correctly installed Toast UI Editor, but I have problems saving the markdown text in the database

      var initial_form_state, last_form_state;
      var editor = new tui.Editor({
        el: document.querySelector('#editSection'),
        language: 'it_IT',
        initialEditType: 'markdown',
        initialValue: determineValue(this.props),
        previewStyle: 'tab', //vertical
        height: '600px',
        events: {
            change: function() {
              last_form_state = $('form').serialize();
            }
        }
      });

How do I save the text in the db? so far with CKeditor it was enough to indicate the name, but here it does not use a textarea but a div...

0 likes
1 reply
Andreas94's avatar

No idea? for now I did

  $(document).on("submit", "form", function(event) {
    $('[name=document__text]').attr('value', editor.getMarkdown());
    $(window).off('beforeunload');
  });
    <div id="editor"></div>
    <input type="hidden" name="testo" />

But I don't think it's the right way even if it works

Please or to participate in this conversation.