1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-12-22 08:48:54 +00:00
Arnaud Roques 2023-01-15 18:08:07 +01:00
parent 823b506900
commit f62ba44e7d
2 changed files with 56 additions and 12 deletions

View File

@ -35,9 +35,11 @@
window.onload = function() { window.onload = function() {
document.myCodeMirror = CodeMirror.fromTextArea( document.myCodeMirror = CodeMirror.fromTextArea(
document.getElementById("text"), document.getElementById("text"),
{ lineNumbers: true } { lineNumbers: true,
extraKeys: {Tab: false, "Shift-Tab": false}
}
); );
}; };
</script> </script>
<title>PlantUMLServer</title> <title>PlantUMLServer</title>
</head> </head>
@ -56,24 +58,27 @@
<div id="content"> <div id="content">
<%-- CONTENT --%> <%-- CONTENT --%>
<form method="post" accept-charset="utf-8" action="<%= hostpath %>/form"> <form method="post" accept-charset="utf-8" action="<%= hostpath %>/form">
<p> <p> <label for="text">UML Editor Content</label>
<textarea id="text" name="text" cols="120" rows="10"><%= net.sourceforge.plantuml.servlet.PlantUmlServlet.stringToHTMLString(decoded) %></textarea> <textarea id="text" name="text" cols="120" rows="10"><%= net.sourceforge.plantuml.servlet.PlantUmlServlet.stringToHTMLString(decoded) %></textarea>
<input type="submit" /> <input type="submit" value="Submit" title="Submit Code and generate diagram"/>&nbsp;
<input type="submit" value="Copy Content to Clipboard" title="Copy Content to the clipboard" onclick="copyToClipboard('text','Content');return false; ">
</p> </p>
</form> </form>
<hr/> <hr/>
<p>You can enter here a previously generated URL:</p> <p>You can enter here a previously generated URL:</p>
<form method="post" action="<%= hostpath %>/form"> <form method="post" action="<%= hostpath %>/form">
<p> <p> <label for="url">previously generated URL</label>
<input name="url" type="text" size="150" value="<%= imgurl %>" /> <input id="url" name="url" type="text" size="150" value="<%= imgurl %>" />
<br/> <br/>
<input type="submit"/> <input type="submit" value="Decode URL" title="Decode URL and show code and diagram"/>&nbsp;
<input type="submit" value="Copy URL to Clipboard" title="Copy URL to the clipboard" onclick="copyToClipboard('url','URL');return false; ">
</p> </p>
</form> </form>
<% if (hasImg) { %> <% if (hasImg) { %>
<hr/> <hr/>
<a href="<%= svgurl %>">View as SVG</a>&nbsp; <a href="<%= imgurl %>" title="View diagram as PNG">View as PNG</a>&nbsp;
<a href="<%= txturl %>">View as ASCII Art</a>&nbsp; <a href="<%= svgurl %>" title="View diagram as SVG">View as SVG</a>&nbsp;
<a href="<%= txturl %>" title="View diagram as ASCII Art">View as ASCII Art</a>&nbsp;
<% if (hasMap) { %> <% if (hasMap) { %>
<a href="<%= mapurl %>">View Map Data</a> <a href="<%= mapurl %>">View Map Data</a>
<% } %> <% } %>
@ -86,7 +91,34 @@
</p> </p>
<% } %> <% } %>
</div> </div>
<script>
var clipboard_write=false;
var clipboard_read=false;
if (navigator.permissions){
navigator.permissions.query({ name: "clipboard-write" }).then((result) => {
if (result.state == "granted" || result.state == "prompt") {
clipboard_write = true;
}
});
navigator.permissions.query({ name: "clipboard-read" }).then((result) => {
if (result.state == "granted" || result.state == "prompt") {
clipboard_read = true;
}
});
};
function copyToClipboard(fieldid, fielddesc) {
if (clipboard_write == true){
var copyText = '';
copyText = document.getElementById(fieldid).value;
navigator.clipboard.writeText(document.getElementById(fieldid).value)
alert(fielddesc + " copied to clipboard");
}
return false;
}
</script>
<%-- FOOTER --%> <%-- FOOTER --%>
<%@ include file="footer.jspf" %> <%@ include file="footer.jspf" %>
</body> </body>
</html> </html>

View File

@ -24,17 +24,29 @@ h1, p, #content a {
/* Form inputs */ /* Form inputs */
#content textarea, #content .CodeMirror, #content input[type=text] { #content textarea, #content .CodeMirror, #content input[type=text] {
background-color: #ffc; background-color: #ffffff;
font-family: monospace; font-family: monospace;
font-size: medium; font-size: medium;
width: 100%; width: 100%;
resize: vertical; resize: vertical;
border: 3px solid #ccc !important;
} }
#content input[type=text] { #content input[type=text] {
border: 0; border: 0;
} }
#content input[type="submit"] {
margin-top: 10px;
padding: 5px;
background: #fafafa;
border: 1px solid black;
}
#content input[type="submit"]:hover {
background: #f0f0f0;
}
/* Diagram */ /* Diagram */
#content #diagram { #content #diagram {
text-align: center; text-align: center;
@ -53,4 +65,4 @@ h1, p, #content a {
padding: 2px; padding: 2px;
text-align: center; text-align: center;
width: 100%; width: 100%;
} }