aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/gn_editor.html
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-12 14:55:01 +0300
committerBonfaceKilz2024-08-29 18:58:56 +0300
commit1663442724c43cf763d56592f505981cd911cceb (patch)
tree86814a003dd97cada25244fd8ce79c02383c2f7c /gn2/wqflask/templates/gn_editor.html
parente2e3a61aa12cd4376fa77431a6ddf03de0fd5b14 (diff)
downloadgenenetwork2-1663442724c43cf763d56592f505981cd911cceb.tar.gz
Use localstorage to track current commit.
Diffstat (limited to 'gn2/wqflask/templates/gn_editor.html')
-rw-r--r--gn2/wqflask/templates/gn_editor.html12
1 files changed, 8 insertions, 4 deletions
diff --git a/gn2/wqflask/templates/gn_editor.html b/gn2/wqflask/templates/gn_editor.html
index dca6d161..d55662c3 100644
--- a/gn2/wqflask/templates/gn_editor.html
+++ b/gn2/wqflask/templates/gn_editor.html
@@ -94,8 +94,7 @@
fixedWidthGutter: false, // boolean: true if the gutter should be fixed width
theme: "ace/theme/dracula", // theme string from ace/theme or custom?
scrollSpeed: 2, // number: the scroll speed index
-
- dragDelay: 0, // number: the drag delay before drag starts. it's 150ms for mac by default
+ dragDelay: 0,
dragEnabled: true, // boolean: enable dragging
focusTimout: 0, // number: the focus delay before focus starts.
tooltipFollowsMouse: true, // boolean: true if the gutter tooltip should follow mouse
@@ -112,8 +111,13 @@
foldStyle: 'markbegin', // enum: 'manual'/'markbegin'/'markbeginend'.
mode: 'ace/mode/markdown'
- }
-
+ }
+ let hash = {{ hash|tojson }}
+ let filePath = {{ file_path|tojson }}
+ localStorage.setItem("gn_editor_sha" ,hash)
+ document.querySelector("#output").addEventListener("commitEvent", function(event){
+ htmx.ajax("POST", "/editor/commit", {target: "#output", swap:"innerHTML",values: {'msg':event.detail.payload, 'content': editor.getValue(), "hash": localStorage.getItem("gn_editor_sha"), "file_path": filePath}})
+ })
document.querySelector("#output").addEventListener("updateEditor", function(event){
editor.setOptions({