Editor
Defined in: obsidian.d.ts:1163
A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6.
Extends
Constructors
new Editor()
new Editor():
Editor
Returns
Properties
cm
cm:
EditorView
Defined in: src/obsidian/internals/BaseEditor.d.ts:17
CodeMirror editor instance
Inherited from
containerEl
containerEl:
HTMLElement
Defined in: src/obsidian/internals/BaseEditor.d.ts:21
HTML instance the CM editor is attached to
Inherited from
editorComponent
editorComponent:
undefined
|MarkdownScrollableEditView
Defined in: src/obsidian/augmentations/Editor.d.ts:13
Linked Editor manager instance
Accessors
activeCm
Get Signature
get activeCm():
null
|EditorView
Defined in: src/obsidian/augmentations/Editor.d.ts:19
Currently active CM instance
Returns
null
| EditorView
inTableCell
Get Signature
get inTableCell():
boolean
Defined in: src/obsidian/augmentations/Editor.d.ts:23
Whether the editor is embedded in a table cell
Returns
boolean
Methods
addHighlights()
addHighlights(
ranges
,style
,remove_previous
,range
?):void
Defined in: src/obsidian/augmentations/Editor.d.ts:28
Make ranges of text highlighted within the editor given specified class (style)
Parameters
ranges
style
"is-flashing"
| "obsidian-search-match-highlight"
remove_previous
boolean
range?
Returns
void
afterIndent()
afterIndent():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:26
Clean-up function executed after indenting lists
Returns
void
Inherited from
blur()
abstract
blur():void
Defined in: obsidian.d.ts:1210
Returns
void
coordsAtPos()
coordsAtPos(
pos
,relative_to_editor
):object
Defined in: src/obsidian/augmentations/Editor.d.ts:40
Convert editor position to screen position
Parameters
pos
Editor position
relative_to_editor
boolean
Relative to the editor or the application window
Returns
object
bottom
bottom:
number
left
left:
number
right
right:
number
top
top:
number
exec()
abstract
exec(command
):void
Defined in: obsidian.d.ts:1229
Parameters
command
Returns
void
focus()
abstract
focus():void
Defined in: obsidian.d.ts:1208
Returns
void
foldLess()
foldLess():
void
Defined in: src/obsidian/augmentations/Editor.d.ts:49
Unfolds all folded lines one level up
Returns
void
foldMore()
foldMore():
void
Defined in: src/obsidian/augmentations/Editor.d.ts:55
Folds all the blocks that are of the lowest unfolded level
Returns
void
getAllFoldableLines()
getAllFoldableLines():
object
[]
Defined in: src/obsidian/augmentations/Editor.d.ts:59
Get all ranges that can be folded away in the editor
Returns
object
[]
getClickableTokenAt()
getClickableTokenAt(
pos
):null
| {end
:EditorPosition
;start
:EditorPosition
;text
:string
;type
:string
; }
Defined in: src/obsidian/augmentations/Editor.d.ts:63
Get a clickable link - if it exists - at specified position
Parameters
pos
Returns
null
| { end
: EditorPosition
; start
: EditorPosition
; text
: string
; type
: string
; }
getCursor()
abstract
getCursor(string
?):EditorPosition
Defined in: obsidian.d.ts:1198
Parameters
string?
"from"
| "to"
| "head"
| "anchor"
Returns
getDoc()
getDoc():
this
Defined in: obsidian.d.ts:1166
Returns
this
getFoldOffsets()
getFoldOffsets():
Set
<number
>
Defined in: src/obsidian/augmentations/Editor.d.ts:72
Get all blocks that were folded by their starting character position
Returns
Set
<number
>
getLine()
abstract
getLine(line
):string
Defined in: obsidian.d.ts:1177
Get the text at line (0-indexed)
Parameters
line
number
Returns
string
getRange()
abstract
getRange(from
,to
):string
Defined in: obsidian.d.ts:1192
Parameters
from
to
Returns
string
getScrollInfo()
abstract
getScrollInfo():object
Defined in: obsidian.d.ts:1214
Returns
object
left
left:
number
top
top:
number
getSelection()
abstract
getSelection():string
Defined in: obsidian.d.ts:1188
Returns
string
getValue()
abstract
getValue():string
Defined in: obsidian.d.ts:1170
Returns
string
hasFocus()
abstract
hasFocus():boolean
Defined in: obsidian.d.ts:1212
Returns
boolean
hasHighlight()
hasHighlight(
style
?):boolean
Defined in: src/obsidian/augmentations/Editor.d.ts:78
Checks whether the editor has a highlight of specified class
Parameters
style?
string
Returns
boolean
indentList()
indentList():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:36
Indents a list by one level
Returns
void
Inherited from
insertBlock()
insertBlock(
start
,end
):void
Defined in: src/obsidian/augmentations/Editor.d.ts:84
Wraps current line around specified characters
Parameters
start
string
end
string
Returns
void
insertCallout()
insertCallout():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:40
Insert a template callout at the current cursor position
Returns
void
Inherited from
insertCodeblock()
insertCodeblock():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:44
Insert a template code block at the current cursor position
Returns
void
Inherited from
insertLink()
insertLink():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:48
Insert a markdown link at the current cursor position
Returns
void
Inherited from
insertMathJax()
insertMathJax():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:52
Insert a mathjax equation block at the current cursor position
Returns
void
Inherited from
insertText()
insertText(
text
):void
Defined in: src/obsidian/internals/BaseEditor.d.ts:58
Insert specified text at the current cursor position
Parameters
text
string
Returns
void
Inherited from
lastLine()
abstract
lastLine():number
Defined in: obsidian.d.ts:1186
Returns
number
lineCount()
abstract
lineCount():number
Defined in: obsidian.d.ts:1184
Gets the number of lines in the document
Returns
number
listSelections()
abstract
listSelections():EditorSelection
[]
Defined in: obsidian.d.ts:1200
Returns
newlineAndIndentContinueMarkdownList()
newlineAndIndentContinueMarkdownList():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:62
Inserts a new line and continues a markdown bullet point list at the same level
Returns
void
Inherited from
BaseEditor
.newlineAndIndentContinueMarkdownList
newlineAndIndentOnly()
newlineAndIndentOnly():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:66
Inserts a new line at the same indent level
Returns
void
Inherited from
BaseEditor
.newlineAndIndentOnly
offsetToPos()
abstract
offsetToPos(offset
):EditorPosition
Defined in: obsidian.d.ts:1237
Parameters
offset
number
Returns
posAtCoords()
posAtCoords(
coords
):EditorPosition
Defined in: src/obsidian/augmentations/Editor.d.ts:88
Get the closest character position to the specified coordinates
Parameters
coords
left
number
top
number
Returns
posAtMouse()
posAtMouse(
e
):EditorPosition
Defined in: src/obsidian/internals/BaseEditor.d.ts:70
Get the character position at a mouse event
Parameters
e
Returns
Inherited from
posToOffset()
abstract
posToOffset(pos
):number
Defined in: obsidian.d.ts:1235
Parameters
pos
Returns
number
processLines()
processLines<
T
>(read
,write
,ignoreEmpty
?):void
Defined in: obsidian.d.ts:1240
Type Parameters
• T
Parameters
read
(line
, lineText
) => null
| T
write
(line
, lineText
, value
) => void
| EditorChange
ignoreEmpty?
boolean
Returns
void
redo()
abstract
redo():void
Defined in: obsidian.d.ts:1227
Returns
void
refresh()
abstract
refresh():void
Defined in: obsidian.d.ts:1168
Returns
void
removeHighlights()
removeHighlights(
style
):void
Defined in: src/obsidian/augmentations/Editor.d.ts:92
Removes all highlights of specified class
Parameters
style
string
Returns
void
replaceRange()
abstract
replaceRange(replacement
,from
,to
?,origin
?):void
Defined in: obsidian.d.ts:1196
Parameters
replacement
string
from
to?
origin?
string
Returns
void
replaceSelection()
abstract
replaceSelection(replacement
,origin
?):void
Defined in: obsidian.d.ts:1194
Parameters
replacement
string
origin?
string
Returns
void
scrollIntoView()
abstract
scrollIntoView(range
,center
?):void
Defined in: obsidian.d.ts:1223
Parameters
range
center?
boolean
Returns
void
scrollTo()
abstract
scrollTo(x
?,y
?):void
Defined in: obsidian.d.ts:1221
Parameters
x?
null
| number
y?
null
| number
Returns
void
searchCursor()
searchCursor(
searchString
):SearchCursor
Defined in: src/obsidian/augmentations/Editor.d.ts:96
Adds a search cursor to the editor
Parameters
searchString
string
Returns
setCursor()
setCursor(
pos
,ch
?):void
Defined in: obsidian.d.ts:1202
Parameters
pos
number
| EditorPosition
ch?
number
Returns
void
setLine()
setLine(
n
,text
):void
Defined in: obsidian.d.ts:1179
Parameters
n
number
text
string
Returns
void
setSelection()
abstract
setSelection(anchor
,head
?):void
Defined in: obsidian.d.ts:1204
Parameters
anchor
head?
Returns
void
setSelections()
abstract
setSelections(ranges
,main
?):void
Defined in: obsidian.d.ts:1206
Parameters
ranges
main?
number
Returns
void
setValue()
abstract
setValue(content
):void
Defined in: obsidian.d.ts:1172
Parameters
content
string
Returns
void
somethingSelected()
somethingSelected():
boolean
Defined in: obsidian.d.ts:1190
Returns
boolean
toggleBlockquote()
toggleBlockquote():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:74
Toggles blockquote syntax on paragraph under cursor
Returns
void
Inherited from
toggleBulletList()
toggleBulletList():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:78
Toggle bullet point list syntax on paragraph under cursor
Returns
void
Inherited from
toggleCheckList()
toggleCheckList():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:82
Toggle checkbox syntax on paragraph under cursor
Returns
void
Inherited from
toggleMarkdownFormatting()
toggleMarkdownFormatting(
syntax
):void
Defined in: src/obsidian/augmentations/Editor.d.ts:100
Applies specified markdown syntax to selected text or word under cursor
Parameters
syntax
"bold"
| "italic"
| "strikethrough"
| "highlight"
| "code"
| "math"
| "comment"
Returns
void
toggleNumberList()
toggleNumberList():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:86
Toggle numbered list syntax on paragraph under cursor
Returns
void
Inherited from
transaction()
abstract
transaction(tx
,origin
?):void
Defined in: obsidian.d.ts:1231
Parameters
tx
origin?
string
Returns
void
triggerWikiLink()
triggerWikiLink(
embed
):void
Defined in: src/obsidian/internals/BaseEditor.d.ts:92
Convert word under cursor into a wikilink
Parameters
embed
boolean
Whether to embed the link or not
Returns
void
Inherited from
undo()
abstract
undo():void
Defined in: obsidian.d.ts:1225
Returns
void
unindentList()
unindentList():
void
Defined in: src/obsidian/internals/BaseEditor.d.ts:96
Unindents a list by one level
Returns
void
Inherited from
wordAt()
abstract
wordAt(pos
):null
|EditorRange
Defined in: obsidian.d.ts:1233
Parameters
pos
Returns
null
| EditorRange