branch feature/GIT updated (47ea742 -> ea128f1)
This is an automated email from the git hooks/post-receive script. New change to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from 47ea742 More errors are handled, code refactoring to make it more modular, added the "upload a new file" feature to the search page new ea128f1 Added an automatic refresh in the editor for the RST files The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ea128f1149f01b724fa5b1ac5db69c15ba877709 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Apr 29 12:29:26 2015 +0200 Added an automatic refresh in the editor for the RST files Summary of changes: .../webapp/WEB-INF/content/modificationViewer.jsp | 52 +++++++++++++++++----- src/main/webapp/css/main.css | 2 +- src/main/webapp/js/autoPreview.js | 36 +++++++++++++++ 3 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 src/main/webapp/js/autoPreview.js -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit ea128f1149f01b724fa5b1ac5db69c15ba877709 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Apr 29 12:29:26 2015 +0200 Added an automatic refresh in the editor for the RST files --- .../webapp/WEB-INF/content/modificationViewer.jsp | 52 +++++++++++++++++----- src/main/webapp/css/main.css | 2 +- src/main/webapp/js/autoPreview.js | 36 +++++++++++++++ 3 files changed, 77 insertions(+), 13 deletions(-) diff --git a/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/src/main/webapp/WEB-INF/content/modificationViewer.jsp index baa5b83..fa5fc52 100644 --- a/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -52,10 +52,19 @@ <script src="js/cancelRedirect.js" type="text/javascript"></script> <script src="js/pictureUpload.js" type="text/javascript"></script> - <link rel="icon" href="img/ScmWebEditor_little.png" type="image/png"> <link rel="stylesheet" type="text/css" href="css/main.css"> + <script type="text/javascript"> + function loadChange() { + document.getElementById('newTextId').value = editor.getValue(); + } + </script> + + <s:if test="format == 'rst'"> + <script type="text/javascript" src="js/autoPreview.js"></script> + </s:if> + </head> <body> @@ -319,9 +328,16 @@ value="numRevision"/></span> </p> +<s:if test="format == 'rst'"> + + <table> + <tr> + <td> + +</s:if> <textarea id="newTextId" name="newText"><s:property - escapeHtml="false" value="OrigText"/></textarea> + escapeHtml="false" value="OrigText"/></textarea> <script type="text/javascript"> @@ -332,6 +348,28 @@ </script> +<s:if test="format == 'rst'"> + </td> + <td> + <div id="htmlcontentPreview"></div> + </td> + </tr> + </table> + + <script type="text/javascript"> + + var editors = document.getElementsByClassName('CodeMirror'); + + if (editors.length == 1) { + var edit = editors[0]; + edit.style.width = "40em"; + edit.style.height = "100%"; + } + + </script> +</s:if> + + <label><s:text name="scm.language"/> <select id="language" name="langageSelection" onchange="changeModeBy(editor,this)"> @@ -353,13 +391,6 @@ </script> -<script type="text/javascript"> - function loadChange() { - document.getElementById('newTextId').value = editor.getValue(); - } -</script> - - <noscript><h4><s:text name="scm.modificationViewer.noJavascript"/></h4> </noscript> <noscript><h4><s:text name="scm.modificationViewer.betterUseJavascript"/></h4> @@ -427,9 +458,6 @@ <div id="targetContentUpload"></div> - -<div id="htmlcontentPreview"></div> - </div> <p align="right">©2004-2014 CodeLutin</p> </body> diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index e28d490..012038b 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -284,7 +284,7 @@ li { } #preview { - width:70%; + width:95%; margin:auto; display:block; padding:1%; diff --git a/src/main/webapp/js/autoPreview.js b/src/main/webapp/js/autoPreview.js new file mode 100644 index 0000000..6ed097e --- /dev/null +++ b/src/main/webapp/js/autoPreview.js @@ -0,0 +1,36 @@ +$(document).ready(function() { + + // the preview is updated every 2 seconds if something was changed since last update + + var lastValue = ""; + + function updatePreview() { + + if (lastValue != editor.getValue()) { + + lastValue = editor.getValue(); + loadChange(); + + $.post("preview.action", { + scmType: $("#scmType").val(), + username: $("#username").val(), + pw: $("#pw").val(), + projectUrl: $("#projectUrl").val(), + commitMessage: $("#commitMessage").val(), + format: $("#format").val(), + mimeType: $("#mimeType").val(), + newText: $("#newTextId").val(), + langageSelection: $("#language").val(), + address: $("#address").val(), + origText: $("#origText").val(), + scmEditorUrl: $("#scmEditorUrl").val() + }, function(data) { + $("#htmlcontentPreview").html(data); + }); + } + } + + window.setInterval(updatePreview, 2000); + + updatePreview(); +}); \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm