Commit 3a41ffaf authored by Frank Bessou's avatar Frank Bessou 🍁
Browse files

fix: don't use jquery to load EditorJS

parent f4fb35a3c4dc
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
} }
function initEditorjs() { function initEditorjs() {
jQuery("textarea").each((_index, node) => { Array.from(document.getElementsByTagName("textarea")).forEach((node, index) => {
if (node.getAttribute("cubicweb:type") == "editorjs") { if (node.getAttribute("cubicweb:type") == "editorjs") {
const editor = document.createElement("div"); const editor = document.createElement("div");
...@@ -29,6 +29,6 @@ ...@@ -29,6 +29,6 @@
if (node.getAttribute("cubicweb:type") == "editorjs") { if (node.getAttribute("cubicweb:type") == "editorjs") {
const editor = document.createElement("div"); const editor = document.createElement("div");
$(node).hide(); node.style.display = "none";
node.parentNode.appendChild(editor); node.parentNode.appendChild(editor);
const editorJsConfig = { const editorJsConfig = {
/** /**
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
} }
}); });
} }
jQuery(document).ready(() => window.addEventListener("DOMContentLoaded", () => {
loadScript( loadScript(
"https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest" "https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"
).then(() => ).then(() =>
...@@ -78,4 +78,5 @@ ...@@ -78,4 +78,5 @@
) )
).then(initEditorjs) ).then(initEditorjs)
) )
}
); );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment