correction erreur bouton consultation simple

pull/25/head
Nicolas Sanchez 3 years ago
parent 7c59f67699
commit 591d152c9f

Binary file not shown.

@ -1,5 +1,15 @@
import { saveSelection, loadSelection } from "./caret.js"; 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) { function load(textarea, div) {
div.innerHTML = ''; div.innerHTML = '';
let lines = textarea.value.split('\n'); let lines = textarea.value.split('\n');
@ -89,7 +99,7 @@ function onlink(e) {
let cheezenotes = document.getElementById('cheezenotes'); let cheezenotes = document.getElementById('cheezenotes');
if (cheezenotes.contentEditable == 'false') { if (cheezenotes.contentEditable == 'false') {
e.preventDefault(); e.preventDefault();
cheezenotes.contentEditable = true; setEditable();
let link = e.currentTarget; let link = e.currentTarget;
if (link.host !== document.location.host) { if (link.host !== document.location.host) {
open(link.href); open(link.href);
@ -104,13 +114,13 @@ function onlink(e) {
window.history.pushState({}, "", link.href); window.history.pushState({}, "", link.href);
document.title = 'CheezeNotes - ' + link.getAttribute('data-href'); document.title = 'CheezeNotes - ' + link.getAttribute('data-href');
ta.value = data; 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')) { if (editModeButton.classList.contains('buttonoff')) {
let cheezenotes = document.getElementById('cheezenotes'); let cheezenotes = document.getElementById('cheezenotes');
cheezenotes.contentEditable = false; cheezenotes.contentEditable = false;
} }*/
content.scrollTop = 0; content.scrollTop = 0;
content.scrollLeft = 0; content.scrollLeft = 0;
}); });
@ -125,7 +135,7 @@ function onlink(e) {
function onlinkout(e) { function onlinkout(e) {
let cheezenotes = document.getElementById('cheezenotes'); let cheezenotes = document.getElementById('cheezenotes');
if (cheezenotes.contentEditable == 'false') { if (cheezenotes.contentEditable == 'false') {
cheezenotes.contentEditable = true; setEditable();
} }
} }

Loading…
Cancel
Save