branch develop updated (1516b0f -> 7de0954)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from 1516b0f Add the ability to compare 2 revisions of the edited file new 7de0954 Fix the preview's position not to make it use the CodeMirror's style 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 7de0954fa2c7070c2e411887672409accc2b2429 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Jun 17 15:45:38 2015 +0200 Fix the preview's position not to make it use the CodeMirror's style Summary of changes: .../webapp/WEB-INF/content/modificationViewer.jsp | 15 ++++------ .../webapp/codemirror-ui/css/codemirror-ui.css | 1 - swe-ui-web/src/main/webapp/css/main.css | 20 +++++++++++-- swe-ui-web/src/main/webapp/js/editor.js | 12 ++++++++ swe-ui-web/src/main/webapp/js/preview.js | 35 ++-------------------- 5 files changed, 38 insertions(+), 45 deletions(-) -- 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 develop in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 7de0954fa2c7070c2e411887672409accc2b2429 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Jun 17 15:45:38 2015 +0200 Fix the preview's position not to make it use the CodeMirror's style --- .../webapp/WEB-INF/content/modificationViewer.jsp | 15 ++++------ .../webapp/codemirror-ui/css/codemirror-ui.css | 1 - swe-ui-web/src/main/webapp/css/main.css | 20 +++++++++++-- swe-ui-web/src/main/webapp/js/editor.js | 12 ++++++++ swe-ui-web/src/main/webapp/js/preview.js | 35 ++-------------------- 5 files changed, 38 insertions(+), 45 deletions(-) diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp index 441d622..6813419 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -220,7 +220,7 @@ </div> -<div id="editBody"> +<div id="editorBody"> <s:hidden key="format" label=''/> <s:hidden key="mimeType" label=''/> @@ -667,14 +667,11 @@ var htmlcontentPreview = document.createElement("div"); htmlcontentPreview.id = "htmlcontentPreview"; - editor.mirror.getWrapperElement().appendChild(htmlcontentPreview); + var editorBody = document.getElementById("editorBody"); + editorBody.appendChild(htmlcontentPreview); - var vscrollbar = document.getElementsByClassName("CodeMirror-vscrollbar"); - vscrollbar[0].style.right = "50%"; - - var ed = document.getElementsByClassName("CodeMirror-scroll"); + var ed = document.getElementsByClassName("CodeMirror-wrap"); ed[0].style.width = "50%"; - ed[0].style.float = "left"; </script> </s:if> @@ -897,7 +894,7 @@ </span> <h4><s:text name="scm.info.ProblemWithRst"/> <a - href="http://docutils.sourceforge.net/docs/user/rst/quickref.html"><s:text + href="http://docutils.sourceforge.net/docs/user/rst/quickref.html" target="_blank"><s:text name="scm.info.rstWebsite"/></a>.</h4> </div> </s:if> @@ -908,7 +905,7 @@ </span> <h4><s:text name="scm.info.ProblemWithMd"/> <a - href="http://daringfireball.net/projects/markdown/syntax"><s:text + href="http://daringfireball.net/projects/markdown/syntax" target="_blank"><s:text name="scm.info.mdWebsite"/></a>.</h4> </div> </s:elseif> diff --git a/swe-ui-web/src/main/webapp/codemirror-ui/css/codemirror-ui.css b/swe-ui-web/src/main/webapp/codemirror-ui/css/codemirror-ui.css index 491ff59..aff9b10 100644 --- a/swe-ui-web/src/main/webapp/codemirror-ui/css/codemirror-ui.css +++ b/swe-ui-web/src/main/webapp/codemirror-ui/css/codemirror-ui.css @@ -86,7 +86,6 @@ iframe{ } .CodeMirror{ - border:1px solid #ccc; background:white; } diff --git a/swe-ui-web/src/main/webapp/css/main.css b/swe-ui-web/src/main/webapp/css/main.css index 3e29267..dc6cd0f 100644 --- a/swe-ui-web/src/main/webapp/css/main.css +++ b/swe-ui-web/src/main/webapp/css/main.css @@ -299,11 +299,11 @@ ul.flags li { } #htmlcontentPreview { + overflow: auto; width: 50%; - height: 100%; - float: right; + background-color: white; overflow: auto; - font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 13px; } .popin { @@ -488,6 +488,11 @@ ul.buttonsGroup li { height: 18px; } +#editorHeader { + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; +} + #editorHeader .fa-stack { color: #888; width: 12px; @@ -587,6 +592,7 @@ ul.buttonsGroup li { } #footer { + clear: both; padding: 5px; font-size: 12px; text-align: center; @@ -614,6 +620,14 @@ ul.buttonsGroup li { .CodeMirror-scroll { padding: 0; margin: 0; + width: 100%; + float: left; +} + +.CodeMirror-wrap { + float: left; + width: 100%; + height: 50%; } .signOutButton { diff --git a/swe-ui-web/src/main/webapp/js/editor.js b/swe-ui-web/src/main/webapp/js/editor.js index 0470484..778db4a 100644 --- a/swe-ui-web/src/main/webapp/js/editor.js +++ b/swe-ui-web/src/main/webapp/js/editor.js @@ -52,6 +52,18 @@ function resizeEditor() { var newHeight = windowHeight - headHeight - sweMenuHeight - editorHeaderHeight - footerHeight - 5; + var preview = document.getElementById("htmlcontentPreview"); + if (preview !== null) { + var previewBelowButton = document.getElementById("previewBelowButton"); + var previewBelow = (previewBelowButton.classList.length > 0); + + if (previewBelow) { + newHeight /= 2; + } + + preview.style.height = newHeight + "px"; + } + editor.mirror.getWrapperElement().style.height = newHeight + "px"; } diff --git a/swe-ui-web/src/main/webapp/js/preview.js b/swe-ui-web/src/main/webapp/js/preview.js index cc830ae..52f43b0 100644 --- a/swe-ui-web/src/main/webapp/js/preview.js +++ b/swe-ui-web/src/main/webapp/js/preview.js @@ -53,22 +53,17 @@ function updatePreview() { // change the preview's position function changePreviewPos(selectedPos) { - var $editor = $(".CodeMirror-scroll"); + var $editor = $(".CodeMirror-wrap"); var $preview = $("#htmlcontentPreview"); - var $scrollbar = $(".CodeMirror-vscrollbar"); var sideButton = document.getElementById("previewSideButton"); var belowButton = document.getElementById("previewBelowButton"); var noneButton = document.getElementById("previewNoneButton"); if (selectedPos === "none") { $editor.css("width", "100%"); - $editor.css("height", "100%"); $preview.hide(); - $scrollbar.css("right", "0"); - $scrollbar.css("height", "100%"); - sideButton.className = ""; belowButton.className = ""; noneButton.className = "previewPosSelected"; @@ -77,50 +72,26 @@ function changePreviewPos(selectedPos) { if (selectedPos === "side") { $editor.css("width", "50%"); - $editor.css("height", "100%"); - $preview.css("width", "50%"); - $preview.css("height", "100%"); - - $scrollbar.css("right", "50%"); - $scrollbar.css("height", "100%"); sideButton.className = "previewPosSelected"; belowButton.className = ""; noneButton.className = ""; } else { $editor.css("width", "100%"); - $editor.css("height", "50%"); - $preview.css("width", "100%"); - $preview.css("height", "50%"); - - $scrollbar.css("right", "0"); - $scrollbar.css("height", "50%"); sideButton.className = ""; belowButton.className = "previewPosSelected"; noneButton.className = ""; } } + + resizeEditor(); } $(document).ready(function() { - // setting the editor's height relative to the button's bar height - var editors = document.getElementsByClassName('CodeMirror'); - - if (editors.length === 1) { - var edit = editors[0]; - var findBar = document.getElementsByClassName("codemirror-ui-find-bar"); - - if (findBar.length === 1) { - var findBarHeight = findBar[0].offsetHeight; - - edit.style.height = (600 - findBarHeight) + "px"; - } - } - // the preview is updated every 2 seconds if something was changed since last update window.setInterval(updatePreview, 2000); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm