我正在尝试在 ace 编辑器文本区域中实现选项卡,并希望能够在创建新选项卡时创建新会话,并在更改选项卡时在它们之间切换。
我坚持能够进行新的会话。
这是来自 ace 编辑器网站
new EditSession(Document | String text, TextMode mode)
Sets up a new EditSession and associates it with the given Document and TextMode.
Arguments
text Document | String
Required. If text is a Document, it associates the EditSession with it. Otherwise, a new Document is created, with the initial text
mode TextMode
Required. The inital language mode to use for the document
所以要进行新的会话,我已经尝试过
session1 = new EditSession("some text", "javascript");
我收到错误消息
ReferenceError: EditSession is not defined
我也试过
this.setSession(session || new EditSession(""));
eg. editor.setSession(new EditSession("session1"));
出现相同的错误消息