mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-05-26 13:04:00 +00:00
Add data-markdownx-init check to typescript file
This commit is contained in:
parent
71c5a4aa11
commit
50c730b9a4
3 changed files with 19 additions and 7 deletions
|
|
@ -363,8 +363,8 @@ 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', '');
|
||||
// Set animation for image uploads lock down.
|
||||
properties.editor.style.transition = "opacity 1s ease";
|
||||
properties.editor.style.webkitTransition = "opacity 1s ease";
|
||||
// Upload latency - must be a value >= 500 microseconds.
|
||||
|
|
@ -566,6 +566,7 @@ exports.MarkdownX = MarkdownX;
|
|||
docReady(function () {
|
||||
var ELEMENTS = document.getElementsByClassName('markdownx');
|
||||
return Object.keys(ELEMENTS).map(function (key) {
|
||||
// Only add the new MarkdownX instance to fields that have no MarkdownX instance yet
|
||||
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'));
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -534,6 +534,8 @@ const MarkdownX = function (parent: HTMLElement, editor: HTMLTextAreaElement, pr
|
|||
// Mounting the defined events.
|
||||
mountEvents(editorListeners, documentListeners);
|
||||
|
||||
properties.editor.setAttribute('data-markdownx-init', '');
|
||||
|
||||
// Set animation for image uploads lock down.
|
||||
properties.editor.style.transition = "opacity 1s ease";
|
||||
properties.editor.style.webkitTransition = "opacity 1s ease";
|
||||
|
|
@ -828,11 +830,20 @@ docReady(() => {
|
|||
|
||||
const ELEMENTS = document.getElementsByClassName('markdownx');
|
||||
|
||||
return Object.keys(ELEMENTS).map(key => new MarkdownX(
|
||||
ELEMENTS[key],
|
||||
ELEMENTS[key].querySelector('.markdownx-editor'),
|
||||
ELEMENTS[key].querySelector('.markdownx-preview')
|
||||
));
|
||||
return Object.keys(ELEMENTS).map(key => {
|
||||
|
||||
// Only add the new MarkdownX instance to fields that have no MarkdownX instance yet
|
||||
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')
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue