2024-03-24 09:53:17 +01:00
|
|
|
# EditorInfo
|
|
|
|
|
|
|
|
Location: `src/static/js/ace2_inner.js`
|
2024-03-23 20:58:05 +01:00
|
|
|
|
|
|
|
## editorInfo.ace_replaceRange(start, end, text)
|
|
|
|
This function replaces a range (from `start` to `end`) with `text`.
|
|
|
|
|
|
|
|
## editorInfo.ace_getRep()
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Returns the `rep` object. The rep object consists of the following properties:
|
|
|
|
|
|
|
|
- `lines`: Implemented as a skip list
|
|
|
|
- `selStart`: The start of the selection
|
|
|
|
- `selEnd`: The end of the selection
|
|
|
|
- `selFocusAtStart`: Whether the selection is focused at the start
|
|
|
|
- `alltext`: The entire text of the document
|
|
|
|
- `alines`: The entire text of the document, split into lines
|
|
|
|
- `apool`: The pool of attributes
|
2024-03-23 20:58:05 +01:00
|
|
|
|
|
|
|
## editorInfo.ace_getAuthor()
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Returns the authors of the pad. If the pad has no authors, it returns an empty object.
|
|
|
|
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_inCallStack()
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Returns true if the editor is in the call stack.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_inCallStackIfNecessary(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Executes the function if the editor is in the call stack.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_focus(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Focuses the editor.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_importText(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Imports text into the editor.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_importAText(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Imports text and attributes into the editor.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_exportText(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Exports the text from the editor.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_editorChangedSize(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Changes the size of the editor.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setOnKeyPress(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the key press event.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setOnKeyDown(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the key down event.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setNotifyDirty(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the dirty notification.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_dispose(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Disposes the editor.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setEditable(bool)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the editor to be editable or not.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_execCommand(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Executes a command.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_callWithAce(fn, callStack, normalize)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Calls a function with the ace instance.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setProperty(key, value)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets a property.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setBaseText(txt)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the base text.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setBaseAttributedText(atxt, apoolJsonObj)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the base attributed text.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_applyChangesToBase(c, optAuthor, apoolJsonObj)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Applies changes to the base.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_prepareUserChangeset()
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Prepares the user changeset.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_applyPreparedChangesetToBase()
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Applies the prepared changeset to the base.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setUserChangeNotificationCallback(f)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the user change notification callback.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setAuthorInfo(author, info)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Sets the author info.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_fastIncorp(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Incorporates changes quickly.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_isCaret(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Returns true if the caret is at the specified position.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_getLineAndCharForPoint(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Returns the line and character for a point.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_performDocumentApplyAttributesToCharRange(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Applies attributes to a character range.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_setAttributeOnSelection(attribute, enabled)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
Sets an attribute on current range.
|
|
|
|
Example: `call.editorInfo.ace_setAttributeOnSelection("turkey::balls", true); // turkey is the attribute here, balls is the value
|
|
|
|
Notes: to remove the attribute pass enabled as false
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_toggleAttributeOnSelection(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Toggles an attribute on the current range.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_getAttributeOnSelection(attribute, prevChar)
|
|
|
|
Returns a boolean if an attribute exists on a selected range.
|
|
|
|
prevChar value should be true if you want to get the previous Character attribute instead of the current selection for example
|
|
|
|
if the caret is at position 0,1 (after first character) it's probable you want the attributes on the character at 0,0
|
|
|
|
The attribute should be the string name of the attribute applied to the selection IE subscript
|
|
|
|
Example usage: Apply the activeButton Class to a button if an attribute is on a highlighted/selected caret position or range.
|
|
|
|
Example `var isItThere = documentAttributeManager.getAttributeOnSelection("turkey::balls", true);`
|
|
|
|
|
|
|
|
See the ep_subscript plugin for an example of this function in action.
|
|
|
|
Notes: Does not work on first or last character of a line. Suffers from a race condition if called with aceEditEvent.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_performSelectionChange(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Performs a selection change.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_doIndentOutdent(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Indents or outdents the selection.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_doUndoRedo(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Undoes or redoes the last action.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_doInsertUnorderedList(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Inserts an unordered list.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_doInsertOrderedList(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Inserts an ordered list.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_performDocumentApplyAttributesToRange()
|
|
|
|
|
2024-03-24 09:53:17 +01:00
|
|
|
Applies attributes to a range.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_getAuthorInfos()
|
|
|
|
Returns an info object about the author. Object key = author_id and info includes author's bg color value.
|
|
|
|
Use to define your own authorship.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_performDocumentReplaceRange(start, end, newText)
|
|
|
|
This function replaces a range (from [x1,y1] to [x2,y2]) with `newText`.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_performDocumentReplaceCharRange(startChar, endChar, newText)
|
|
|
|
This function replaces a range (from y1 to y2) with `newText`.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_renumberList(lineNum)
|
|
|
|
If you delete a line, calling this method will fix the line numbering.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_doReturnKey()
|
|
|
|
Forces a return key at the current caret position.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_isBlockElement(element)
|
2024-03-24 09:53:17 +01:00
|
|
|
Returns true if your passed element is registered as a block element.
|
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_getLineListType(lineNum)
|
|
|
|
Returns the line's html list type.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_caretLine()
|
|
|
|
Returns X position of the caret.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_caretColumn()
|
|
|
|
Returns Y position of the caret.
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_caretDocChar()
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
Returns the Y offset starting from [x=0,y=0]
|
2024-03-24 09:53:17 +01:00
|
|
|
|
2024-03-23 20:58:05 +01:00
|
|
|
## editorInfo.ace_isWordChar(?)
|
2024-03-24 09:53:17 +01:00
|
|
|
|
|
|
|
Returns true if the character is a word character.
|