simplemde-markdown-editor icon indicating copy to clipboard operation
simplemde-markdown-editor copied to clipboard

default text does not render if inside a <detail> tag which is closed at render time

Open Nattle opened this issue 7 years ago • 2 comments

If the textarea/editor is inside a tag which is not open, the contents of the edit area will be blank. Clicking inside the edit area will force an update and render the initialValue properly. If the edit box is in a tag which is open is behaves properly. This is true if you set either the text inside the textarea, the initialValue, or both. Setting the initialValue and a placeholder still shows a blank box.

If there is no content then the placeholder text will display properly in all cases.

detail_closed_bug.html.txt

Nattle avatar Aug 16 '17 18:08 Nattle

Same issue here.

wolfmoritz avatar Feb 16 '20 17:02 wolfmoritz

Same here. This comment from simplemde editor source may explain what is happening:

// The codemirror component is only available after rendering
// so, the setter for the initialValue can only run after
// the element has been rendered

In my case, the text area is in a non-default bootstrap 5's tab so I've attached its show event to load its content and works exactly as expected:

  <script>
    document.getElementById('edit-tab')
      .addEventListener('shown.bs.tab', event => {
      simplemde.value(docsrc);
    });
  </script>

tenuki avatar Apr 02 '21 20:04 tenuki