ace -- api
Ace
The main class required to set up an Ace instance in the browser.
在浏览器中设置一个ace实例所需要的主要类。
Methods
Creates a new EditSession
, and returns the associated Document
.
创建一个新的 EditSession, 并返回相关联的Document
参数
1. text (Document | string)
必须,如果text 是 Document, 则它将 EditSession与它关联起来。否则, 使用初始的text创建一个新的Document。
2. mode (TextMode)
必须,文档使用的初始语言mode。
- edit(String | DOMElement el)
Embeds the Ace editor into the DOM, at the element provided by el
.
将Ace编辑器嵌入到在el提供的DOM元素中,
参数
1. el (String | DOMElement)
必须。元素id或者 一个 DOM 元素本身。
require(String moduleName)
Provides access to require in packed noconflict mode
提供打包后的无冲突的mode 的引用
参数
moduleName (string)
必须。
Anchor
Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
定义文档中的浮动指针。每当在光标之前插入或删除文本时,光标的位置就会被更新。
Constructors
Events
- Anchor.on("change", function(Object e))
Fires whenever the anchor position changes. Both of these objects have a row
and column
property corresponding to the position. Events that can trigger this function include setPosition()
每当anchor的位置发生变化是触发。 这两个对象都具有与位置对应的row和column的属性。可以触发此函数的事件包括 setPosition()
参数:
1. e (object)
必须。包含anchor位置的信息的对象。它有两个属性:
old: 描述原来 Anchor位置的对象。
value: 描述新 Anchor位置的对象。
Methods
- detach()
When called, the 'change'
event listener is removed.
当被调用时, ‘change’事件监听器被删除。
- getDocument() -----> Document
Returns the current document.
返回当前文档。
- getPosition() -----> Object
Returns an object identifying the row
and column
position of the current anchor.
返回一个对象,该对象标识当前 anchor的 row 和column的位置。
- onChange() Undocumented
Sets the anchor position to the specified row and column. If noClip
is true
, the position is not clipped.
将anchor的位置设置为指定的 row 和 column。 如果 noClip 为 true, 则不剪断位置,
参数
1. row (Number)
必须。将anchor移动到 row index
2. column (Number)
必须。将anchor 移动到 column index
3. noCLip (Boolean)
必须。标识是否希望建材该位置。
BackgroundTokenizer
Tokenizes the current Document
in the background, and caches the tokenized rows for future use.
在后台标记当前 Document, 并缓存当前标记的 rows以供将来使用。
If a certain row is changed, everything below that row is re-tokenized.
如果某行被更改,则该行下面的所有内容都被重新标记。
Constructors
Events
- BackgroundTokenizer.on("update", function(Object e))
Fires whenever the background tokeniziers between a range of rows are going to be updated.
每当一个行之间的后台记录器将被更新时触发。
参数:
1. e (Object)
必须。一个包含两个属性的对象, first 和 last, 指示正在更新的区域的行。
Methods
- getState(Number row)
Returns the state of tokenization at the end of a row.
返回行结束时的标记化状态。
参数
1. row (NUmber)
必须。获取状态的行。
- getTokens(Number row)
Gives list of tokens of the row. (tokens are cached)
给出行的tokens列表 (tokens被缓存)
参数
1. row (Number)
必须。获取token的行。
- setDocument(Document doc)
Sets a new document to associate with this object.
设置与此对象关联的新文档
参数
1. doc (Document)
必须。与之关联的新文档。
- setTokenizer(Tokenizer tokenizer)
Sets a new tokenizer for this object.
为这个对象设置一个新的记录器。
参数
1. tokenizer (Tokenizer)
必须。新的tokenizer使用
- start(Number startRow)
Starts tokenizing at the row indicated.
开始标记所指示的行
参数
1. startRow (Number)
必须。要开始的行。
- stop()
Stops tokenizing.
停止 标记
Document
Contains the text of the document. Document can be attached to several EditSession
s.
包含文本的文档。Document可以附加到多个 EditSessin中。
At its core, Document
s are just an array of strings, with each row in the document matching up to the array index.
在其核心,Document指示一个字符串数组。文档中的每一行与数组索引匹配。
Constructors
Events
- Document.on("change", function(Object e))
Fires whenever the document changes.
文档更改时触发。
Several methods trigger different "change"
events. Below is a list of each action type, followed by each property that's also available:
几种方法触发不同的 change 事件。 下面是每个动作类型的列表,后面还有每个可用的属性:
"insertLines"
(emitted byDocument.insertLines()
) 通过 Document.insertLines() 触发range
: theRange
of the change within the document 文档Range更改。lines
: the lines in the document that are changing 文档中行正在改变"insertText"
(emitted byDocument.insertNewLine()
) 通过 Document.insertNewLine() 触发range
: theRange
of the change within the documenttext
: the text that's being added 正在添加文本"removeLines"
(emitted byDocument.insertLines()
) 通过 Document.insertLines()触发range
: theRange
of the change within the documentlines
: the lines in the document that were removed 文档中行移除nl
: the new line character (as defined byDocument.getNewLineCharacter()
) 新行字符 (通过 Document.getNewLineCharater() 定义)"removeText"
(emitted byDocument.removeInLine()
andDocument.removeNewLine()
)range
: theRange
of the change within the documenttext
: the text that's being removed
参数
1. e (Object)
必须。包含至少一个名为 action 的属性。 action 指示触发更改的操作。每个action也有一组额外的属性。
Methods
- applyDeltas(Object deltas)
Applies all the changes previously accumulated. These can be either 'includeText'
, 'insertLines'
, 'removeText'
, and 'removeLines'
.
应用以前积累的所有更改。这些可以是 includeText,....
参数
1. deltas (Object)
必须。
- getAllLines()
Returns all lines in the document as string array. Warning: The caller should not modify this array!
将文档中的所有行作为字符串数组返回。 注意: 调用方不应该修改这个数组。
- getLength()
Returns the number of rows in the document.
返回文档的行数。
- getLine(Number row)
Returns a verbatim copy of the given line as it is in the document
返回文档中给定行的逐字拷贝。
- getNewLineCharacter() String
Returns the newline character that's being used, depending on the value of newLineMode
.
返回正在使用的换行符,这取决与newLineMode的值。
- getNewLineMode() String
Returns the type of newlines being used; either windows
, unix
, or auto
返回正在使用的换行类型。 可以是 windows, unix, 或者 auto。
- getTextRange(Range range)
Given a range within the document, this function returns all the text within that range as a single string.
在给定文档范围中,该函数将该范围内的所有文本作为单个字符串返回。
- getValue()
Returns all the lines in the document as a single string, split by the new line character.
将文档中的所有行作为单个字符串返回,由换行符分隔。
Converts an index position in a document to a {row, column}
object.
将文档中索引位置替换成 {row, column}对象。
Index refers to the "absolute position" of a character in the document. For example:
索引指的是文件中字符的绝对位置。比如
var x = 0; // 10 characters, plus one for newline
var y = -1;
Here, y
is an index 15: 11 characters for the first row, and 5 characters until y
in the second.
这里,y 是第一行的索引15:11字符, 第二行的5个字符直到 y。
- isNewLine(String text)
Returns true
if text
is a newline character (either \r\n
, \r
, or \n
).
- removeNewLine(Number row)
Removes the new line between row
and the row immediately following it. This method also triggers the 'change'
event.
- revertDeltas(Object deltas)
Reverts any changes previously applied. These can be either 'includeText'
, 'insertLines'
, 'removeText'
, and 'removeLines'
.
还原先前应用的任何更改。这些更改可以是 includeText .....
- setNewLineMode(String newLineMode)
Sets the new line mode.
- setValue(String text)
Replaces all the lines in the current Document
with the value of text
.
将当前Document中所有行替换为 text的值
EditSession
Constructors
Events
- EditSession.on("change", function(Object e))
Emitted when the document changes.
当文档改变时触发。
- EditSession.on("changeAnnotation", function())
Emitted when an annotation changes, like through EditSession.setAnnotations()
.
当注释改变时触发,比如通过 EditSession.setAnnotations()
- EditSession.on("changeBackMarker", function())
Emitted when a back marker changes.
当后置标记发生变化时触发。
- EditSession.on("changeBreakpoint", function())
Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change.
当gutters发生变化,或者通过设置或移除断点或者当gutters装饰发生变化时触发。
- EditSession.on("changeFold", function())
Emitted when a code fold is added or removed.
当代码折叠添加或者移除时触发。
- EditSession.on("changeFrontMarker", function())
Emitted when a front marker changes.
当 前标记改变时触发。
- EditSession.on("changeMode", function())
Emitted when the current mode changes.
当 当前mode改变时触发。
- EditSession.on("changeOverwrite", function())
Emitted when the ability to overwrite text changes, via EditSession.setOverwrite()
.
当通过 EditSession.setOverWrite() 更改覆盖文本的能力时触发。
- EditSession.on("changeScrollLeft", function(Number scrollLeft))
Emitted when the scroll left changes.
当滚动条左改变时触发。
- EditSession.on("changeScrollTop", function(Number scrollTop))
Emitted when the scroll top changes.
- EditSession.on("changeTabSize", function())
Emitted when the tab size changes, via EditSession.setTabSize()
.
通过 EditSession.setTabSize() 改变 tab 大小时触发。
- EditSession.on("changeWrapLimit", function())
Emitted when the wrapping limit changes.
当包装限制改变时触发。
- EditSession.on("changeWrapMode", function())
Emitted when the wrap mode changes.
当包裹mode改变时触发。
- EditSession.on("tokenizerUpdate", function(Object e))
Emitted when a background tokenizer asynchronously processes new rows.
当后台记录器异步处理新行时触发。参数e包含一个data属性的对象,该对象包含关于更改行的信息。
Methods
Adds a new marker to the given Range
. If inFront
is true
, a front marker is defined, and the 'changeFrontMarker'
event fires; otherwise, the 'changeBackMarker'
event fires.
在给定的Range中添加新的标记。 如果 inFront为true,则定义一个前端 标记, 并且触发 changeFrontMarker事件,否则,触发changeBackMarker事件。
- clearAnnotations()
Clears all the annotations for this session. This function also triggers the 'changeAnnotation'
event.
清除此会话的所有注释。该函数会触发 changeAnnotation事件。
- clearBreakpoint(Number row)
Removes a breakpoint on the row number given by rows
. This function also emits the 'changeBreakpoint'
event.
移除给定rows上所有的断点。该函数会触发 changeBreakpoint事件。
- clearBreakpoints()
Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint'
event.
- getAnnotations() Object
Returns the annotations for the EditSession
.
返回 EditSession的注释。
- getBreakpoints() Number
Returns an array of numbers, indicating which rows have breakpoints.
返回一个数字数组,指示哪些行具有断点。
- getDocument() Document
Returns the Document
associated with this session.
返回与此会话关联的Document
- getLength() Number
Returns the number of rows in the document.
返回文档中的行数。
- getMode() TextMode
Returns the current text mode.
- getNewLineMode() String
Returns the current new line mode.
- getOverwrite()
Returns true
if overwrites are enabled; false
otherwise.
如果启用重写,则返回 true,否则返回false。
- getScreenLength() Number
Returns the length of the screen.
获取从屏幕的长度。
- getScreenWidth() Number
Returns the width of the screen.
- getScrollLeft() Number
Returns the value of the distance between the left of the editor and the leftmost part of the visible content.
返回编辑器左侧与可见内容的最左边部分之间的距离值。
- getScrollTop() Number
Returns the value of the distance between the top of the editor and the topmost part of the visible content.
- getSelection()
Returns selection object.
- getState(Number row)
Returns the state of tokenization at the end of a row.
返回结束行时的标记化状态。
- getTabSize()
Returns the current tab size.
- getTabString()
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by getTabSize()
); otherwise it's simply '\t'
.
- getTokens(Number row)
Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
开始标记所指示的行。返回标记化行的对象列表。
- getUndoManager()
Returns the current undo manager.
返回当前撤销管理器。
- getUseSoftTabs() Boolean
Returns true
if soft tabs are being used, false
otherwise.
如果soft tab 正在使用返回true, 否则返回false
- getUseWorker()
Returns true
if workers are being used.
如果正在使用workers, 返回true。
- getUseWrapMode() Boolean
Returns true
if wrap mode is being used; false
otherwise.
- getWrapLimit() Number
Returns the value of wrap limit.
返回 wrap限制值。
- getWrapLimitRange() Object
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this: { min: wrapLimitRange_min, max: wrapLimitRange_max }
返回定义包限制的最小值和最大值的对象,
- highlight() Undocumented
- highlightLines() Undocumented
Indents all the rows, from startRow
to endRow
(inclusive), by prefixing each row with the token in indentString
. If indentString
contains the '\t'
character, it's replaced by whatever is defined by getTabString()
将从startRow到 endRow之间的所有行缩进,通过在indentString中用token预先装订每行。如果缩进字符串包含 '\t' 字符, 则有 getTabString()定的任何内容替换它。
- isTabStop(Object position)
Returns true
if the character at the position is a soft tab.
- onChange() Undocumented
- onChangeFold() Undocumented
- onReloadTokenizer(Object e)
Reloads all the tokens on the current session. This function calls BackgroundTokenizer.start ()
to all the rows; it also emits the 'tokenizerUpdate'
event.
- outdentRows(Range range)
Outdents all the rows defined by the start
and end
properties of range
.
- redo()Undocumented
- removeMarker(Number markerId)
Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker'
event is emitted. If the marker was in the back, the 'changeBackMarker'
event is emitted.
- reset()Undocumented
- resetCaches()Undocumented
- screenToDocumentColumn() Undocumented
- screenToDocumentRow() Undocumented
- setAnnotations(Array annotations)
Sets annotations for the EditSession
. This functions emits the 'changeAnnotation'
event.
- setBreakpoints(Array rows)
Sets a breakpoint on every row number given by rows
. This function also emites the 'changeBreakpoint'
event.
- setDocument(Document doc)
Sets the EditSession
to point to a new Document
. If a BackgroundTokenizer
exists, it also points to doc
.
- setMode() Undocumented
- setNewLineMode(String newLineMode)
Sets the new line mode.
- setOverwrite(Boolean overwrite)
Pass in true
to enable overwrites in your session, or false
to disable.
- setScrollLeft(Object scrollLeft)
Sets the value of the distance between the left of the editor and the leftmost part of the visible content.
- setScrollTop(Number scrollTop)
This function sets the scroll top value. It also emits the 'changeScrollTop'
event.
- setTabSize(Number tabSize)
Set the number of spaces that define a soft tab; for example, passing in 4
transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize
event.
- setUndoManager(UndoManager undoManager)
Sets the undo manager.
- setUndoSelect(Boolean enable)
Enables or disables highlighting of the range where an undo occured.
- setUseSoftTabs(Boolean useSoftTabs)
Pass true
to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t'
).
- setUseWorker(Boolean useWorker)
Identifies if you want to use a worker for the EditSession
.
- setUseWrapMode(Boolean useWrapMode)
Sets whether or not line wrapping is enabled. If useWrapMode
is different than the current value, the 'changeWrapMode'
event is emitted.
- setValue(String text)
Sets the session text.
- toggleOverwrite()
Sets the value of overwrite to the opposite of whatever it currently is.
- undo() Undocumented
ace -- api的更多相关文章
- ace -- 语法高亮
Creating a Syntax Highlighter for Ace 给ace创建一个语法高亮 Creating a new syntax highlighter for Ace is extr ...
- JS组件系列——基于Bootstrap Ace模板的菜单和Tab页效果分享(你值得拥有)
前言:最近园子里多了许多谈语言.谈环境.谈逼格(格局)的文章,看看笑笑过后,殊不知其实都是然并卵.提升自己的技术才是王道.之前博主分享过多篇bootstrap组件的文章,引起了很多园友的关注和支持,看 ...
- 微信小程序 不在以下合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html
微信小程序 不在以下合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html 友情提示: 大家 ...
- Android 的图片异步请求加三级缓存 ACE
使用xUtils等框架是很方便,但今天要用代码实现bitmapUtils 的功能,很简单, 1 AsyncTask请求一张图片 ####AsyncTask #####AsyncTask是线程池+han ...
- ACE - Reactor源码总结整理
ACE源码约10万行,是c++中非常大的一个网络编程代码库,包含了网络编程的边边角角. ACE代码可以分三个层次:OS层.OO层和框架层: OS层主要是为了兼容各个平台,将网络底层API统一化,这一层 ...
- ACE - 代码层次及Socket封装
原文出自http://www.cnblogs.com/binchen-china,禁止转载. ACE源码约10万行,是c++中非常大的一个网络编程代码库,包含了网络编程的边边角角.在实际使用时,并不是 ...
- ACE - Ubuntu下环境搭建
之前写了很多linux下的底层网络API的demo,这些demo可用于了解底层的网络通信过程,但是想做出好的服务器用于实际业务还是非常困难的,需要大量的代码实现,移植性也非常差,想要写出高性能架构的服 ...
- 在线API文档
http://www.ostools.net/apidocs A Ace akka2.0.2 Android Ant Apache CXF Apache HTTP服务器 ASM字节码操作 AutoCo ...
- 【阿里云产品公测】以开发者角度看ACE服务『ACE应用构建指南』
作者:阿里云用户mr_wid ,z)NKt# @I6A9do 如果感觉该评测对您有所帮助, 欢迎投票给本文: UO<claV RsfTUb)< 投票标题: 28.[阿里云 ...
随机推荐
- Alpha冲刺报告(9/12)(麻瓜制造者)
今日已完成 邓弘立: 正在进行主页逻辑的编写 符天愉: 部署商品发布和物品需求的接口 江郑: 尝试完善接口文档,进行进一步测试 刘双玉: 编写接口说明 肖小强: 进行逻辑模块的编写 李佳铭: 修改了U ...
- 关于datatables与jquerUI版本冲突问题
今天开发项目是,需要用到表格,于是想到,之前的项目中使用过datatables插件,于是就拿了过来,但是发现无法识别 Uncaught TypeError: $(...).DataTable is n ...
- Spark2.3文档翻阅的一点简略笔记(WaterMarking)
写本文原因是之前已经将官网文档阅读过几遍,但是后来工作接触spark机会较少所以没有跟进新特性,利用周末一点闲暇时间粗略阅读一篇,将自己之前遇见过的问题解决过的问题印象不深刻的问题做一下记录. 1关于 ...
- php 去除数组中指定的值
方法1: //去除值为"Cat"的元素 $a=array("a"=>"Dog","b"=>"Cat ...
- Docker Java应用日志时间和容器时间不一致
1.在docker容器和系统时间不一致是因为docker容器的原生时区为0时区,而国内系统为东八区. 2.还有容器中运行的java应用打出的日志时间和通过date -R方式获取的容器标准时间有八个小时 ...
- OpenCV——霍夫变换(直线检测、圆检测)
x #include <opencv2/opencv.hpp> #include <iostream> #include <math.h> using namesp ...
- easyui 如何引入
一:引入easyui 1:参考官网:http://www.jeasyui.net/ 2:引入 整个文件夹:themes,包括:icon.css.image 等等 3:引入easyui.css ...
- QT 用listveiw显示图片
很多的时候需要浏览图片,一般会使用listview 显示图片,接下来我用listview显示图片 代码如下: QStandardItem * s1; QStandardItem * s2; QStan ...
- HTTP请求header信息讲解
HTTP消息包括客户机向服务器的请求消息和服务器向客户机的响应消息.这两种类型的消息由一个起始行,一个或者多个头域,一个只是头域结束的空行和可选的消息体组成.HTTP的头域包括通用头,请求头,响应头和 ...
- Java设置以及获取JavaBean私有属性进阶
在上一篇博客中讲到使用Java提供的原生API设置以及获取一个JavaBean的私有属性. 但是使用Java的原生API过于复杂,有没有更加简单的方法呢?答案是肯定的.下面介绍一个开元工具包来非常方便 ...