【问题标题】:Can I open an HTML file in Ace Editor?我可以在 Ace Editor 中打开 HTML 文件吗?
【发布时间】:2014-09-05 11:05:48
【问题描述】:

我不知道是否可以在 Ace Editor 中打开预先保存的 HTML 文件。这可能吗?

其实我想在Ace编辑器中加载一个预先保存的HTML文件,以便在编辑器中查看文件的代码。

请告诉我这样做的方法。

【问题讨论】:

标签: html ace-editor


【解决方案1】:

我明白了。我使用 PHP 来做到这一点。

<div id="editor">
<?php echo htmlentities(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "html_file_address_here"));?>
</div>

【讨论】:

    【解决方案2】:

    是的,你可以做到

    `var editor = ace.edit('left_main_content'); // 带有 html 的区域 ... 或尝试其父级

        editor.setOptions({  
       theme: "ace/theme/dawn",     
       mode: "ace/mode/html",   
       setUseWrapMode: true,
    

    })`

    【讨论】:

      猜你喜欢
      • 2015-12-16
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      • 1970-01-01
      • 2013-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多