Wappler 6.8.0
Macos 14.6.0
Nodejs project
Got a new weird bug, on this particular content page the built-in browser preview window hangs/freezes and becomes unusable.
See:
It has something to do with this javascript:
// Function to initialize Tiptap
function initializeTiptapEditor(content) {
const form = document.getElementById('formLectureUpsert');
const editorElement = form.querySelector(".tiptap-editor");
const hiddenInput = document.getElementById('hiddenEditorContent');
// Initialize Tiptap
const editor = window.initTiptap({
element: editorElement,
content: hiddenInput.value,
buttons: Array.from(form.querySelectorAll('.tiptap-button')).map(btn => btn.id || btn.getAttribute('data-tiptap-command'))
});
// Function to update editor content
window.updateTiptapContent = (content) => {
if (editor) {
editor.commands.setContent(content);
hiddenInput.value = content; // Update hidden input as well
}
};
// Update hidden input before form submission
form.addEventListener('submit', (e) => {
e.preventDefault();
hiddenInput.value = editor.getHTML();
dmx.parse('content.formLectureUpdate.submit()');
});
// Return the editor instance in case you need to use it elsewhere
return editor;
}
// Keep this event listener to ensure the function is available after the DOM is loaded
document.addEventListener("DOMContentLoaded", () => {
// The function is now defined globally and can be called when needed
window.initializeTiptapEditor = initializeTiptapEditor;
});
</script>
As when I comment this out, it'll work as expected again.
@patrick let me know how I can provide more information to debug this. It's sadly very limiting as I can't use the preview at all.