aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/gn_editor.html
diff options
context:
space:
mode:
authorAlexander Kabui2024-09-16 15:27:12 +0300
committerGitHub2024-09-16 15:27:12 +0300
commit1ee4e945dbc3b0fd8788341667f2e39f776cc3c4 (patch)
tree314fa913381eca6cf40a02cec2500192e5e891e2 /gn2/wqflask/templates/gn_editor.html
parente823d509b2e2485ab65b1e26a7d4c40042714c25 (diff)
parent304f3f35bfea61bdf9e6be2286b8f6e83b71edb6 (diff)
downloadgenenetwork2-1ee4e945dbc3b0fd8788341667f2e39f776cc3c4.tar.gz
Merge pull request #869 from genenetwork/features/Integrate-editing-doc-files
Integrate gn editor for files.
Diffstat (limited to 'gn2/wqflask/templates/gn_editor.html')
-rw-r--r--gn2/wqflask/templates/gn_editor.html9
1 files changed, 5 insertions, 4 deletions
diff --git a/gn2/wqflask/templates/gn_editor.html b/gn2/wqflask/templates/gn_editor.html
index e5c649d1..d89aaf0a 100644
--- a/gn2/wqflask/templates/gn_editor.html
+++ b/gn2/wqflask/templates/gn_editor.html
@@ -157,11 +157,13 @@
let fileExt = (filePath.substring(filePath.lastIndexOf('.')+1, filePath.length) || "md").toLowerCase();
let data = {{ content|tojson }}
- localStorage.setItem("gn_editor_sha" ,hash)
+ localStorage.setItem("gn_editor_sha" ,hash)
+ htmx.on("#output", "updateDataEvent", function(event){
+ data = editor.getValue()
+ })
htmx.on("#output", "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}})
- })
-
+ })
htmx.on("#output", "diffEvent", function(event){
var fileName = "{{ file_path }}"
var diffContent = Diff.createTwoFilesPatch(fileName,fileName, data, editor.getValue())
@@ -186,7 +188,6 @@
htmx.on("#diffBtn","click",function(event){
//dispatch your event here
- console.log("Clicked diff btn here")
htmx.find("#output").dispatchEvent(
new CustomEvent("diffEvent", {
bubbles: true,