(showCode)
| 58 | |
| 59 | //初始化编辑器 |
| 60 | function initCodeEditor(showCode) { |
| 61 | const codeBtn = document.getElementById("showCodeBtn"); |
| 62 | if(showCode === false){ |
| 63 | codeBtn.classList.add('hide'); |
| 64 | return |
| 65 | } |
| 66 | codeBtn.classList.remove('hide'); |
| 67 | if (!aceEditor) { |
| 68 | aceEditor = ace.edit("editor"); |
| 69 | aceEditor.setTheme("ace/theme/textmate"); |
| 70 | aceEditor.getSession().setMode("ace/mode/html"); |
| 71 | aceEditor.getSession().setUseWrapMode(true); |
| 72 | aceEditor.setShowPrintMargin(false); |
| 73 | aceEditor.$blockScrolling = Infinity; |
| 74 | } |
| 75 | aceEditor.setValue($('#editor').val()); |
| 76 | aceEditor.clearSelection(); |
| 77 | aceEditor.moveCursorTo(0, 0); |
| 78 | } |
| 79 | |
| 80 | //初始化编辑器以及预览内容 |
| 81 | function initEditor() { |
no test coverage detected