66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="API_DocGen_Tester.Default" %>
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head runat="server">
|
|
<title>Text/JSON Editor</title>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.23.1/ace.js"></script>
|
|
|
|
<style>
|
|
#editor {
|
|
height: 400px;
|
|
width: 800px;
|
|
border: 1px solid #ccc;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<form id="form1" runat="server">
|
|
|
|
<h2>Text / JSON Editor</h2>
|
|
|
|
Dateiname:<br />
|
|
<asp:TextBox ID="txtFileName" runat="server" Width="400" /><br /><br />
|
|
|
|
<!-- Ace Editor -->
|
|
<div id="editor"></div>
|
|
|
|
<!-- HiddenField für Postback -->
|
|
<asp:HiddenField ID="hfContent" runat="server" />
|
|
|
|
<br />
|
|
<asp:Button ID="btnSave" runat="server" Text="Speichern"
|
|
OnClientClick="syncEditorContent();" />
|
|
|
|
<asp:Button ID="btnLoad" runat="server" Text="Laden"
|
|
OnClick="btnLoad_Click" />
|
|
|
|
<br /><br />
|
|
<asp:Label ID="lblStatus" runat="server" ForeColor="Green" />
|
|
|
|
</form>
|
|
|
|
<script>
|
|
var editor = ace.edit("editor");
|
|
editor.setTheme("ace/theme/chrome");
|
|
editor.session.setMode("ace/mode/json");
|
|
editor.setOptions({
|
|
fontSize: "14px",
|
|
showPrintMargin: false
|
|
});
|
|
|
|
function syncEditorContent() {
|
|
document.getElementById('<%= hfContent.ClientID %>').value = editor.getValue();
|
|
}
|
|
|
|
// Inhalt aus HiddenField nach Postback setzen
|
|
function setEditorContent(content) {
|
|
editor.setValue(content, -1);
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|