diff src/cancel_edit_link.js.luan @ 0:8f4df159f06b

start public repo
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 11 Jul 2025 20:57:49 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cancel_edit_link.js.luan	Fri Jul 11 20:57:49 2025 -0600
@@ -0,0 +1,21 @@
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local Parsers = require "luan:Parsers.luan"
+local json_string = Parsers.json_string or error()
+local Io = require "luan:Io.luan"
+local Http = require "luan:http/Http.luan"
+local Link = require "site:/lib/Link.luan"
+local Shared = require "site:/lib/Shared.luan"
+local show_editable_link = Shared.show_editable_link or error()
+
+
+return function()
+	local link_id = Http.request.parameters.link or error()
+	local link = Link.get_by_id(link_id)
+	local html = ` show_editable_link(link) `
+	Io.stdout = Http.response.text_writer()
+%>
+	document.querySelector('div[link="<%=link_id%>"]').outerHTML = <%= json_string(html) %>;
+	dragInit();
+<%
+end