|
24 | 24 | .CodeMirror {position: absolute; width: 409px; height: 180px; font-size: <?php echo $ICEcoder["fontSize"];?>} |
25 | 25 | .CodeMirror-scroll {overflow: hidden} |
26 | 26 | /* Make sure this next one remains the 3rd item, updated with JS */ |
27 | | -.cm-tab {border-left-width: <?php echo $ICEcoder["visibleTabs"] ? "1px" : "0";?>; margin-left: <?php echo $ICEcoder["visibleTabs"] ? "-1px" : "0";?>; border-left-style: solid; border-left-color: rgba(255,255,255,0.2)} |
| 27 | +.cm-tab {border-left-width: <?php echo $ICEcoder["visibleTabs"] ? "1px" : "0";?>; margin-left: <?php echo $ICEcoder["visibleTabs"] ? "-1px" : "0";?>; border-left-style: solid; border-left-color: rgba(255,255,255,0.15)} |
| 28 | +.cm-trailingspace { |
| 29 | + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==); |
| 30 | + background-position: bottom left; |
| 31 | + background-repeat: repeat-x; |
| 32 | + } |
| 33 | +.CodeMirror-foldmarker {font-family: arial; line-height: .3; color: #b00; cursor: pointer; |
| 34 | + text-shadow: #fff 1px 1px 2px, #fff -1px -1px 2px, #fff 1px -1px 2px, #fff -1px 1px 2px; |
| 35 | +} |
| 36 | +.CodeMirror-foldgutter {display: inline-block; width: 13px} |
| 37 | +.CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded {position: absolute; display: inline-block; width: 13px; height: 13px; font-size: 14px; text-align: center; cursor: pointer} |
| 38 | +.CodeMirror-foldgutter-open {background: rgba(255,255,255,0.04); color: #666} |
| 39 | +.CodeMirror-foldgutter-open:after {position: relative; top: -2px} |
| 40 | +.CodeMirror-foldgutter-folded {background: #800; color: #ddd} |
| 41 | +.CodeMirror-foldgutter-folded:after {position: relative; top: -3px} |
28 | 42 | </style> |
| 43 | +<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldcode.js?microtime=<?php echo microtime(true);?>"></script> |
| 44 | +<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldgutter.js?microtime=<?php echo microtime(true);?>"></script> |
| 45 | +<link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldgutter.css?microtime=<?php echo microtime(true);?>"> |
29 | 46 | <link rel="stylesheet" href="editor.css?microtime=<?php echo microtime(true);?>"> |
30 | 47 | <?php |
31 | 48 | $themeArray = array(); |
|
74 | 91 | <div style="display: none; width: 180px; margin-left: 30px" id="buttonsContainer"> |
75 | 92 | <div class="button" onclick="openNew()">Open in new tab</div> |
76 | 93 | <div class="button" onclick="openDiff()">Open in diff mode</div> |
77 | | - <!-- |
78 | | - <div class="button" onclick="alert('Function not available yet - Coming in v5.4')">Restore as new version</div> |
79 | | - //--> |
| 94 | + <div class="button" onclick="restoreVersion()">Restore as new version</div> |
80 | 95 | <div id="infoContainer"></div> |
81 | 96 | </div> |
82 | 97 | <div style="display: none"> |
|
93 | 108 | } |
94 | 109 | } |
95 | 110 |
|
| 111 | +<?php |
| 112 | +echo "fileName = '".basename($file)."';"; |
| 113 | +include(dirname(__FILE__)."/language-modes-partial.js"); |
| 114 | +?> |
| 115 | + |
96 | 116 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 117 | + mode: mode, |
97 | 118 | lineNumbers: top.ICEcoder.lineNumbers, |
98 | | - readOnly: "nocursor", |
| 119 | + gutters: ["CodeMirror-foldgutter","CodeMirror-lint-markers","CodeMirror-linenumbers"], |
| 120 | + foldGutter: {gutter: "CodeMirror-foldgutter"}, |
| 121 | + foldOptions: {minFoldSize: 1}, |
| 122 | + lineWrapping: top.ICEcoder.lineWrapping, |
| 123 | + indentWithTabs: top.ICEcoder.indentWithTabs, |
99 | 124 | indentUnit: top.ICEcoder.indentSize, |
100 | 125 | tabSize: top.ICEcoder.indentSize, |
101 | | - mode: "javascript", |
| 126 | + matchBrackets: top.ICEcoder.matchBrackets, |
| 127 | + electricChars: false, |
| 128 | + highlightSelectionMatches: true, |
| 129 | + showTrailingSpace: top.ICEcoder.showTrailingSpace, |
| 130 | + lint: false, |
| 131 | + readOnly: "nocursor", |
102 | 132 | theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>" |
103 | 133 | }); |
104 | 134 | editor.setSize("480px","500px"); |
|
121 | 151 | top.ICEcoder.focus('diff'); |
122 | 152 | cMDiff.setValue(editor.getValue()); |
123 | 153 | } |
| 154 | + |
| 155 | +var restoreVersion = function() { |
| 156 | + var cM; |
| 157 | + |
| 158 | + if (top.ICEcoder.ask("To confirm - this will paste the displayed backup content to your current tab and save, OK?")) { |
| 159 | + top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')) |
| 160 | + cM = top.ICEcoder.getcMInstance(); |
| 161 | + top.ICEcoder.focus(); |
| 162 | + cM.setValue(editor.getValue()); |
| 163 | + top.ICEcoder.saveFile(); |
| 164 | + } |
| 165 | +} |
124 | 166 | </script> |
125 | 167 |
|
126 | 168 | </body> |
|
0 commit comments