diff options
author | luxagraf <sng@luxagraf.net> | 2018-12-29 08:42:12 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-12-29 08:42:12 -0600 |
commit | 219ac9b26feec3e2c5cd68cf530485d0dbaa943c (patch) | |
tree | 797f78ade6b125ee5f43f02a2fd34d297b6dbb53 /scripts/src/note-create.js | |
parent | a7b8b6cdc781ed45a616b2f64b9102c23bcb1625 (diff) |
renamed and cleaned up scripts dir
Diffstat (limited to 'scripts/src/note-create.js')
-rw-r--r-- | scripts/src/note-create.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/src/note-create.js b/scripts/src/note-create.js new file mode 100644 index 0000000..b8ecb46 --- /dev/null +++ b/scripts/src/note-create.js @@ -0,0 +1,27 @@ +if (typeof(document.getElementById('new-note-form')) != 'undefined' && document.getElementById('new-note-form') != null) { + document.addEventListener('readystatechange', event => { + if (event.target.readyState === "complete") { + var form = document.getElementById('new-note-form'); + form.quill = initQuill("#note-body"); + form.note_text = document.getElementById('id_body_text'); + form.fs_body_text = document.getElementById("fs-body_text"); + form.fs_body_text.classList.add('hide') + form.note_html = document.getElementById('id_body_html'); + form.note_html.innerHTML = form.quill.root.innerHTML; + form.onsubmit = function(e) { + var form_texts = e.target.getElementsByTagName('textarea'); + form_texts['body_text'].innerHTML = e.target.quill.getText(); + form_texts['body_html'].innerHTML = e.target.quill.root.innerHTML; + form_texts['body_qjson'].innerHTML = JSON.stringify(e.target.quill.getContents()); + }; + var create_notebook_btn = document.getElementById('add_id_notebook'); + addHandler(create_notebook_btn); + function addHandler(el){ + el.addEventListener('click', function(e){ + e.preventDefault(); + var modal = modalBox(el, document.getElementById('js-overlay-notebook')); + }); + } + } + }); +} |