1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-11-12 15:36:32 +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() {
document.myCodeMirror = CodeMirror.fromTextArea(
document.getElementById("text"),
{ lineNumbers: true }
{ lineNumbers: true,
extraKeys: {Tab: false, "Shift-Tab": false}
}
);
};
};
</script>
<title>PlantUMLServer</title>
</head>
@ -56,24 +58,27 @@
<div id="content">
<%-- CONTENT --%>
<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>
<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>
</form>
<hr/>
<p>You can enter here a previously generated URL:</p>
<form method="post" action="<%= hostpath %>/form">
<p>
<input name="url" type="text" size="150" value="<%= imgurl %>" />
<p> <label for="url">previously generated URL</label>
<input id="url" name="url" type="text" size="150" value="<%= imgurl %>" />
<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>
</form>
<% if (hasImg) { %>
<hr/>
<a href="<%= svgurl %>">View as SVG</a>&nbsp;
<a href="<%= txturl %>">View as ASCII Art</a>&nbsp;
<a href="<%= imgurl %>" title="View diagram as PNG">View as PNG</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) { %>
<a href="<%= mapurl %>">View Map Data</a>
<% } %>
@ -86,7 +91,34 @@
</p>
<% } %>
</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 --%>
<%@ include file="footer.jspf" %>
</body>
</html>
</html>

View File

@ -24,17 +24,29 @@ h1, p, #content a {
/* Form inputs */
#content textarea, #content .CodeMirror, #content input[type=text] {
background-color: #ffc;
background-color: #ffffff;
font-family: monospace;
font-size: medium;
width: 100%;
resize: vertical;
border: 3px solid #ccc !important;
}
#content input[type=text] {
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 */
#content #diagram {
text-align: center;
@ -53,4 +65,4 @@ h1, p, #content a {
padding: 2px;
text-align: center;
width: 100%;
}
}