diff --git a/db/db.sqlite3 b/db/db.sqlite3 index d4757bc..9a67e74 100644 Binary files a/db/db.sqlite3 and b/db/db.sqlite3 differ diff --git a/src/commons.rs b/src/commons.rs index da976af..041edc2 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -13,6 +13,9 @@ pub struct Arguments { /// root of the url ending and starting with / #[arg(short, long, default_value_t = String::from("/"))] pub root: String, + /// sqlite database path + #[arg(short, long, default_value_t = String::from("db/db.sqlite3"))] + pub db: String, } impl Arguments { diff --git a/src/main.rs b/src/main.rs index bbaf1ee..2e13a9a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,8 +15,9 @@ async fn main() -> std::io::Result<()> { let ip = args.ip; let port = args.port; let root = args.root; + let db = args.db; - let manager = SqliteConnectionManager::file("db/db.sqlite3"); + let manager = SqliteConnectionManager::file(db); let pool = Pool::new(manager).unwrap(); let appdata = AppData { diff --git a/static/cheezenotes.css b/static/cheezenotes.css index 1f0cacc..a200c02 100644 --- a/static/cheezenotes.css +++ b/static/cheezenotes.css @@ -321,15 +321,16 @@ div#cheezenotes div.lasttablerow span.tablerow { div#cheezenotes div.cheezenotes_line span.token { font-weight: 1; - color: #1353b3; + color: transparent; overflow: hidden; -} - -div#cheezenotes div.cheezenotes_line span.token { font-size: 0; + vertical-align: baseline; + transition-property: font-size, color; + transition-duration: .2s; } div#cheezenotes:focus div.cheezenotes_line span.token { + color: #1353b3; font-size: 95%; } diff --git a/static/modules/cheezenotes.js b/static/modules/cheezenotes.js index 3778801..775f0a3 100644 --- a/static/modules/cheezenotes.js +++ b/static/modules/cheezenotes.js @@ -215,19 +215,6 @@ function oncopy(e) { //alert(e.clipboardData.getData('text/plain')); } -function onlockbutton(e) { - let lockButton = document.getElementById('lockButton'); - let lockButtonLabel = document.getElementById('lockButtonLabel'); - let cheezenotes = document.getElementById('cheezenotes'); - if (lockButton.checked) { - cheezenotes.contentEditable = false; - lockButtonLabel.innerText = 'visibility'; - } else { - cheezenotes.contentEditable = true; - lockButtonLabel.innerText = 'visibility_off'; - } -} - function ondrag(e) { // alert('drag'); } @@ -323,13 +310,21 @@ function onblur(e) { let cheezenotes = document.getElementById('cheezenotes'); redrawTables(cheezenotes); onsave(); - hideTokens(); + // hideTokens(); disableFormatButtons(); } -function onfocus() { +function onfocus(e) { + let editModeButton = document.getElementById('editModeButton'); + if (editModeButton.classList.contains('buttonoff')) { + e.preventDefault(); + let cheezenotes = document.getElementById('cheezenotes'); + cheezenotes.contentEditable = false; + cheezenotes.blur(); + return false; + } redrawTables(cheezenotes, dpwidth()); - showTokens(); + // showTokens(); enableFormatButtons(); }