【问题标题】:The ace editor not displaying some codeace 编辑器不显示某些代码
【发布时间】:2015-03-06 12:01:22
【问题描述】:

我正在使用 ace 编辑器,我注意到当我在某个 lua 文件中读取时,当我将数据放入 ace 编辑器 div 中时,它与文件中的实际内容没有 100% 匹配。您可以在下面的链接中看到这种效果。请注意,在 html 中有更多的 lua 代码,但在结果中只显示了 1 行。有没有其他方法可以将代码添加到 ace 编辑器中以便显示所有代码?

http://jsfiddle.net/wcevdmke/

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
             <h3 class="panel-title">Editor</h3>
        </div>
        <div class="panel-body">
<div id="editor">--if d<self.senseradius then
--  return entity.script
--else
--  local p = Transform:Point(entity:GetPosition(),nil,self.entity)
--  if (p.z>-math.abs(p.x) and p.z<-math.abs(p.y)) then
</div>
        </div>
    </div>
    <div class="text-center">---End of editor---</div>
</div>

【问题讨论】:

  • 看起来如果你有 "varname" 相同的错误。

标签: html ace-editor


【解决方案1】:

浏览器将&lt;self 解析为标签,然后将其传递给ace。您需要通过将&amp;amp; 替换为&amp;amp;&amp;lt; 替换为&amp;lt; 来转义特殊的html 字符

【讨论】:

  • 如果我使用 ace api editor.getSession().setValue(code) 似乎不是我自己做的,而是为我做这一切。
猜你喜欢
  • 1970-01-01
  • 2012-02-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-16
  • 1970-01-01
  • 2017-04-28
  • 1970-01-01
相关资源
最近更新 更多