【问题标题】:What is Document class in ace editorace编辑器中的文档类是什么
【发布时间】:2016-10-05 01:39:33
【问题描述】:

大家好,Ace 编辑器中的 Document 是什么,我不明白,正在阅读文档,但一直显示 Document class please explain here is an example

createEditSession(Document | String text, TextMode mode)

文档真的很差而且难以理解,您能否建议任何资源来了解 ACE 编辑器的工作原理以及如何嵌入它。

提前致谢。

【问题讨论】:

    标签: embed ace-editor


    【解决方案1】:

    文档类是https://github.com/ajaxorg/ace/blob/master/lib/ace/document.js,通常你会用一个字符串或字符串数​​组调用createEditSession。

    【讨论】:

      【解决方案2】:

      根据文档“在其核心,文档只是一个字符串数组,文档中的每一行都与数组索引匹配。”。 因此,文档就是您在 Ace 编辑器中编辑的“那个东西”。要创建一个新文档:

      var Document = require("ace/document").Document;
      var doc = new Document("Lorem ipsum");
      

      然后在 Ace 中编辑该文档:

      var lorem_session = ace.createEditSession(doc);
      my_ace_editor.setSession(lorem_session);
      

      【讨论】:

        猜你喜欢
        • 2014-01-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多