我尝试使用CodeMirror javascript库修复此源代码。
我找不到为什么“搜索”和“替换”按钮没有显示编辑区域的原因。
请参见source code。
javascript onclick区域:
document.querySelector("#SearchButton").onclick = function(){ editor.execCommand("find"); };
document.querySelector("#ReplaceButton").onclick = function(){ editor.execCommand("replace"); };
带有按钮的HTML区域:
<button id="SearchButton">Search Box</button>
<button id="ReplaceButton">Replace Box</button>
javascripts区域:
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/codemirror.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/mode/python/python.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/addon/hint/show-hint.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/addon/selection/active-line.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/addon/addon/search/search.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/addon/search/searchcursor.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/addon/search/jump-to-line.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.47.0/addon/dialog/dialog.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>