diff --git a/db/db.sqlite3 b/db/db.sqlite3 index 5ace3b6..0741120 100644 Binary files a/db/db.sqlite3 and b/db/db.sqlite3 differ diff --git a/static/modules/md.js b/static/modules/md.js index dfdb329..833704f 100644 --- a/static/modules/md.js +++ b/static/modules/md.js @@ -1,5 +1,15 @@ import { saveSelection, loadSelection } from "./caret.js"; +function setEditable() { + let editModeButton = document.getElementById('editModeButton'); + let cheezenotes = document.getElementById('cheezenotes'); + if (editModeButton.classList.contains('buttonoff')) { + cheezenotes.contentEditable = false; + } else { + cheezenotes.contentEditable = true; + } +} + function load(textarea, div) { div.innerHTML = ''; let lines = textarea.value.split('\n'); @@ -89,7 +99,7 @@ function onlink(e) { let cheezenotes = document.getElementById('cheezenotes'); if (cheezenotes.contentEditable == 'false') { e.preventDefault(); - cheezenotes.contentEditable = true; + setEditable(); let link = e.currentTarget; if (link.host !== document.location.host) { open(link.href); @@ -104,13 +114,13 @@ function onlink(e) { window.history.pushState({}, "", link.href); document.title = 'CheezeNotes - ' + link.getAttribute('data-href'); ta.value = data; - load(document.getElementById('ta'), document.getElementById('cheezenotes')); + load(document.getElementById('ta'), cheezenotes); - let editModeButton = document.getElementById('editModeButton'); + /*let editModeButton = document.getElementById('editModeButton'); if (editModeButton.classList.contains('buttonoff')) { let cheezenotes = document.getElementById('cheezenotes'); cheezenotes.contentEditable = false; - } + }*/ content.scrollTop = 0; content.scrollLeft = 0; }); @@ -125,7 +135,7 @@ function onlink(e) { function onlinkout(e) { let cheezenotes = document.getElementById('cheezenotes'); if (cheezenotes.contentEditable == 'false') { - cheezenotes.contentEditable = true; + setEditable(); } }