Created
April 5, 2024 15:03
-
-
Save HZ-labs/96dab031d92fe24d3daab7fe246aa5de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEF_TEMPLATE = `<p><b>Problem:</b></p> | |
<p></p> | |
<p><b>Result:</b></p> | |
<p></p> | |
<p><b>Solution or Comments:</b></p>`; | |
function pasteTemplateTask(event) { | |
const elm = event.target; | |
const editor = elm.closest(".ProseMirror") || elm.querySelector(".ProseMirror"); | |
if (editor && editor.querySelector('[class*="placeholder"]')) { | |
editor.innerHTML = DEF_TEMPLATE; | |
} | |
} | |
document.addEventListener("click", pasteTemplateTask); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment