aboutsummaryrefslogtreecommitdiff
path: root/scripts/src/note-edit.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/src/note-edit.js')
-rw-r--r--scripts/src/note-edit.js86
1 files changed, 42 insertions, 44 deletions
diff --git a/scripts/src/note-edit.js b/scripts/src/note-edit.js
index 390b93d..57ef6c0 100644
--- a/scripts/src/note-edit.js
+++ b/scripts/src/note-edit.js
@@ -132,51 +132,49 @@ function notebookCreate(form) {
request.send(new FormData(form));
}
if (typeof(document.getElementById('note-edit-form')) != 'undefined' && document.getElementById('note-edit-form') != null) {
- document.addEventListener("DOMContentLoaded", function () {
- var quill = initQuill("#note-body");
- quill.change = false;
- var btn = document.getElementById('edit-toggle-btn'),
- qcontainer = document.getElementById('q-container'),
- title = document.getElementById('note-title'),
- tag_wrapper = document.getElementById('tag-wrapper'),
- form = document.getElementById('note-edit-form'),
- note_html = document.createElement('textarea'),
- note_qjson = document.createElement('textarea');
+ var quill = initQuill("#note-body");
+ quill.change = false;
+ var btn = document.getElementById('edit-toggle-btn'),
+ qcontainer = document.getElementById('q-container'),
+ title = document.getElementById('note-title'),
+ tag_wrapper = document.getElementById('tag-wrapper'),
+ form = document.getElementById('note-edit-form'),
+ note_html = document.createElement('textarea'),
+ note_qjson = document.createElement('textarea');
- note_html.setAttribute('name', 'body_html');
- note_html.setAttribute('class', 'hide');
- note_html.setAttribute('id', 'id_body_html');
- note_qjson.setAttribute('name', 'body_qjson');
- note_qjson.setAttribute('id', 'id_body_qjson');
- note_qjson.setAttribute('class', 'hide');
- form.appendChild(note_html);
- form.appendChild(note_qjson);
- form.formchange = false;
- form.addEventListener('input', function (e) {
- form.formchange = true;
- });
- var formbtn = document.getElementById('btn-js-hide')
- formbtn.classList.add('hide');
- console.log(formbtn);
- btn.classList.remove('hide');
- btn.editing = false;
- btn.addEventListener('click', function(e){
- e.preventDefault();
- edit_note(e.target, form, title, quill, qcontainer, window.location.href );
- }, false);
- var notebookAddForm = document.getElementById('nb-create-form');
- initColorPicker(notebookAddForm);
- ajaxHijack(notebookAddForm, notebookCreate)
- var create_notebook_btn = document.getElementById('add_id_notebook');
- addHandler(create_notebook_btn);
- function addHandler(el){
- el.addEventListener('click', function(e){
- e.preventDefault();
- var modalContent = document.getElementById('js-overlay-notebook');
- modalContent.wrapperClass = 'overlay'; //add a wrapper class to the modal for styling
- var modal = modalBox(modalContent, el);
- });
- }
+ note_html.setAttribute('name', 'body_html');
+ note_html.setAttribute('class', 'hide');
+ note_html.setAttribute('id', 'id_body_html');
+ note_qjson.setAttribute('name', 'body_qjson');
+ note_qjson.setAttribute('id', 'id_body_qjson');
+ note_qjson.setAttribute('class', 'hide');
+ form.appendChild(note_html);
+ form.appendChild(note_qjson);
+ form.formchange = false;
+ form.addEventListener('input', function (e) {
+ form.formchange = true;
});
+ var formbtn = document.getElementById('btn-js-hide')
+ formbtn.classList.add('hide');
+ console.log(formbtn);
+ btn.classList.remove('hide');
+ btn.editing = false;
+ btn.addEventListener('click', function(e){
+ e.preventDefault();
+ edit_note(e.target, form, title, quill, qcontainer, window.location.href );
+ }, false);
+ var notebookAddForm = document.getElementById('nb-create-form');
+ initColorPicker(notebookAddForm);
+ ajaxHijack(notebookAddForm, notebookCreate)
+ var create_notebook_btn = document.getElementById('add_id_notebook');
+ addHandler(create_notebook_btn);
+ function addHandler(el){
+ el.addEventListener('click', function(e){
+ e.preventDefault();
+ var modalContent = document.getElementById('js-overlay-notebook');
+ modalContent.wrapperClass = 'overlay'; //add a wrapper class to the modal for styling
+ var modal = modalBox(modalContent, el);
+ });
+ }
}