django-markdownx icon indicating copy to clipboard operation
django-markdownx copied to clipboard

Do not render Markdown if editor has no content (solution attached)

Open trojkat opened this issue 6 years ago • 1 comments

Sorry, I want to help by I have no time to setup the dev environment :-(

Problem Right now for new forms with markdownx, there is an empty POST request after the editor initialization and each time when everything was removed and there is no content left.

Solution Please add this at the beginning of getMarkdown function.

if (!properties.editor.value) {
    properties.preview.innerHTML = '';
    properties.editor = updateHeight(properties.editor);
    return;
}

trojkat avatar Sep 18 '18 19:09 trojkat

I need to look into this. As far as I remember It was done on purpose (but I don't really remember now what exactly) or it was kind of a feature for some other functionality.

adi- avatar Oct 16 '18 18:10 adi-