|
|
|
|
@ -45,7 +45,7 @@ function onedit(e) {
|
|
|
|
|
|
|
|
|
|
let newline = formatLine(line.innerText);
|
|
|
|
|
line.parentNode.replaceChild(newline, line);
|
|
|
|
|
formatTable(newline, 5.5);
|
|
|
|
|
formatTable(newline, dpwidth());
|
|
|
|
|
setStartPositionInLine(newline, position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -104,11 +104,28 @@ function oncopy(e) {
|
|
|
|
|
alert(e.clipboardData.getData('text/plain'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _dpwidth = null;
|
|
|
|
|
function dpwidth(div) {
|
|
|
|
|
if (_dpwidth != null) {
|
|
|
|
|
return _dpwidth;
|
|
|
|
|
}
|
|
|
|
|
let dp = document.createElement('span');
|
|
|
|
|
dp.classList.add('tokenfictif');
|
|
|
|
|
div.append(dp);
|
|
|
|
|
dp.innerText = ':';
|
|
|
|
|
_dpwidth = dp.getBoundingClientRect().width;
|
|
|
|
|
div.removeChild(dp);
|
|
|
|
|
return _dpwidth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function init(pagename = null) {
|
|
|
|
|
/*if (pagename != null) {
|
|
|
|
|
window.history.replaceState(null, '', '/page/' + pagename);
|
|
|
|
|
}*/
|
|
|
|
|
let mdnotesdiv = document.getElementById('mdnotes');
|
|
|
|
|
|
|
|
|
|
dpwidth(mdnotesdiv);
|
|
|
|
|
|
|
|
|
|
mdnotesdiv.addEventListener('input', onedit);
|
|
|
|
|
mdnotesdiv.addEventListener('keyup', onkeyup);
|
|
|
|
|
mdnotesdiv.addEventListener('keypress', onkeypress);
|
|
|
|
|
@ -116,10 +133,9 @@ function init(pagename = null) {
|
|
|
|
|
mdnotesdiv.addEventListener('paste', onpaste);
|
|
|
|
|
mdnotesdiv.addEventListener('copy', oncopy);
|
|
|
|
|
mdnotesdiv.addEventListener('blur', () => {redrawTables(mdnotesdiv);});
|
|
|
|
|
mdnotesdiv.addEventListener('focus', () => {redrawTables(mdnotesdiv, 5.5);});
|
|
|
|
|
mdnotesdiv.addEventListener('focus', () => {redrawTables(mdnotesdiv, dpwidth());});
|
|
|
|
|
let saveButton = document.getElementById('saveButton');
|
|
|
|
|
saveButton.addEventListener('click', onsave);
|
|
|
|
|
loadButton.addEventListener('click', onload);
|
|
|
|
|
taButton.addEventListener('click', ontextarea);
|
|
|
|
|
|
|
|
|
|
onload();
|
|
|
|
|
|