diff --git a/javascript/src/Helper/codemirror.js b/javascript/src/Helper/codemirror.js index ea4cee8b9abee2d2bde0d8bb366316ae3ffc3045..74902794c5057167035c2a96f86c5915d6e196c2 100644 --- a/javascript/src/Helper/codemirror.js +++ b/javascript/src/Helper/codemirror.js @@ -107,6 +107,7 @@ $(document).ready(function(){ // Show same content editor with refreshed data again after save. Control it with the given get parameter. First fetch only needed html content again (form) and open it in same window. var urlParams = new URLSearchParams(window.location.search); var ttContentParam = urlParams.get('tt-content'); + var pageId = urlParams.get('id'); if(ttContentParam !== null && $(targetEditReportButton).next("#"+ttContentParam)[0] !== undefined){ var formContent = $($(targetEditReportButton).next("#"+ttContentParam)[0].outerHTML); @@ -117,8 +118,13 @@ $(document).ready(function(){ $(externWindow).submit(function() { $.post($(externWindow).attr('action'),$(externWindow).serializeArray()); alert("Changes have been saved. Reload your primary window after that."); + if(pageId === null){ + pageId = ''; + }else{ + pageId = 'id='+pageId+'&'; + } if(window.location.search !== '?'+"tt-content="+$('form').attr('id')){ - window.location.href += "?"+"tt-content="+$('form').attr('id'); + window.location.href = '//' + location.host + location.pathname + "?" +pageId+ "tt-content=" + $('form').attr('id'); } return false; });