You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RnQ/Distro/Template/textedit.htm

46 lines
1.3 KiB
HTML

<html window-resizable="false" window-icon="themepicsingle:typing">
<head>
<include src="common.htm" />
<style src="textedit.css" />
<script>
var txt = $("#txt"),
saveBtn = $("#save"),
cancelBtn = $("#cancel");
view.uniqueid = "textedit";
view.isDialog = true;
CommonNative.ShowTaskbarButton(document);
setupWindow(false, false, false);
translateWindow("span");
function returnEdited() {
if (view.parameters.online === true && !CommonNative.CheckOnline()) return;
view.close(txt.value.trim());
}
txt.plaintext.content = view.parameters.text;
txt.execCommand("navigate:end");
saveBtn.on("click", () => returnEdited());
cancelBtn.on("click", () => view.close(null));
document.on("keydown", (e) => {
if (e.keyCode == Event.VK_ESCAPE || (e.ctrlKey && e.keyCode == Event.VK_W)) view.close(null);
else if (e.ctrlKey && e.keyCode == Event.VK_RETURN && e.target == txt) returnEdited();
}).on("closerequest", function(e){
if (e.reason == Event.REASON_BY_CHROME) {
view.close(null);
return false;
}
});
</script>
</head>
<body>
<plaintext id="txt" spellcheck="false"></plaintext>
<div class="row">
<button uwp id="save"><span>Save</span></button>
<button uwp right id="cancel"><span>Cancel</span></button>
</div>
</body>
</html>