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 EditSessions.
包含文本的文档。Document可以附加到多个 EditSessin中。
At its core, Documents 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: theRangeof the change within the document 文档Range更改。lines: the lines in the document that are changing 文档中行正在改变"insertText"(emitted byDocument.insertNewLine()) 通过 Document.insertNewLine() 触发range: theRangeof the change within the documenttext: the text that's being added 正在添加文本"removeLines"(emitted byDocument.insertLines()) 通过 Document.insertLines()触发range: theRangeof 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: theRangeof 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.[阿里云 ...
随机推荐
- 第7章 Linux文件与目录管理
目录与路径 相对路径与绝对路径 目录的相关操作 . 代表此层目录 .. 代表上层目录 - 代表前一个工作目录 ~ 代表"目前用户身份"所在的文件夹 ~account 代表accou ...
- BZOJ3996:[TJOI2015]线性代数(最大权闭合子图)
Description 给出一个N*N的矩阵B和一个1*N的矩阵C.求出一个1*N的01矩阵A.使得 D=(A*B-C)*A^T最大.其中A^T为A的转置.输出D Input 第一行输入一个整数N,接 ...
- docker-machine create -d generic 运行的波折过程及遇见的问题
这是一个愚蠢的学习过程,但是因为觉得过程还是值得记录的,还是写了下来 2>driver = generic 1)在这个过程中使用的都是本地的mac系统,然后尝试在mac本地create -d g ...
- GDI+编程小结
GDI+(Graphics Device Interface Plus图形设备接口加)是Windows XP和Windows Server 2003操作系统的子系统,也是.NET框架的重要组成部分,负 ...
- dubbo和rabbitmq对比
随着项目越来越大,局势就是项目拆分,大项目拆分成很多项目,各种技术也应允而生.从应用交互层面,按我的理解dubbo和rabbitmq就对比分析进行学习.dubbo和zookeeper结合 1.zoo ...
- 树莓派学习笔记(5):成功实现NAS家庭服务器(流媒体播放、文件共享及下载机)
转载请注明:@小五义http://www.cnblogs.com/xiaowuyiQQ群:64770604 一.家庭服务器实现的主要功能 1.流媒体播放服务:利用DLNA实现电视.手机.电脑播放其上面 ...
- 人人都是产品经理<1.0>
用了大概2个月的时间,细细的读完了<人人都是产品经理>这本书,受益良多,期间也做了一些笔记,都在前面的博客————products系列中... 当然,更多的收获,还是沉滞在书中的注释,以及 ...
- 1-关于单片机通信数据传输(中断发送,大小端,IEEE754浮点型格式,共用体,空闲中断,环形队列)
补充: 程序优化 为避免普通发送和中断发送造成冲突(造成死机,复位重启),printf修改为中断发送 写这篇文章的目的呢,如题目所言,我承认自己是一个程序猿.....应该说很多很多学单片机的对于... ...
- Android之网络摄像头
实现的功能就是两个手机在一个局域网内可以互相观看对方的摄像头图像,当然如果都是连接公网那么就能远程互看了,,,,和视频聊天差不多,,不过没有声音,,,,,,,, 源码是在网上找的(具体地址忘了,如有侵 ...
- PRML5-神经网络(1)
本节来自<pattern recognition and machine learning>第5章. 五.神经网络 在本书的第3.4章分别是基于回归和分类的线性模型,都是通过将固定的基函数 ...