mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-04-25 23:44:45 +00:00
Fixed reloading the Markdown editor when it's already initialized
This commit is contained in:
parent
a3ad5066aa
commit
71c5a4aa11
1 changed files with 6 additions and 1 deletions
|
|
@ -364,6 +364,7 @@ var MarkdownX = function (parent, editor, preview) {
|
|||
// Mounting the defined events.
|
||||
utils_1.mountEvents(editorListeners, documentListeners);
|
||||
// Set animation for image uploads lock down.
|
||||
properties.editor.setAttribute('data-markdownx-init', '');
|
||||
properties.editor.style.transition = "opacity 1s ease";
|
||||
properties.editor.style.webkitTransition = "opacity 1s ease";
|
||||
// Upload latency - must be a value >= 500 microseconds.
|
||||
|
|
@ -564,7 +565,11 @@ exports.MarkdownX = MarkdownX;
|
|||
})("docReady", window);
|
||||
docReady(function () {
|
||||
var ELEMENTS = document.getElementsByClassName('markdownx');
|
||||
return Object.keys(ELEMENTS).map(function (key) { return new MarkdownX(ELEMENTS[key], ELEMENTS[key].querySelector('.markdownx-editor'), ELEMENTS[key].querySelector('.markdownx-preview')); });
|
||||
return Object.keys(ELEMENTS).map(function (key) {
|
||||
if (!ELEMENTS[key].querySelector('.markdownx-editor').hasAttribute('data-markdownx-init')) {
|
||||
return new MarkdownX(ELEMENTS[key], ELEMENTS[key].querySelector('.markdownx-editor'), ELEMENTS[key].querySelector('.markdownx-preview'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
},{"./utils":2}],2:[function(require,module,exports){
|
||||
|
|
|
|||
Loading…
Reference in a new issue