Skip to content

CodeMirrorAdapterEx

Unofficial

Extended CodeMirror adapter providing CM5-compatible API over CM6.

Import:

import type { CodeMirrorAdapterEx } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface CodeMirrorAdapterEx

Properties

PropertyTypeDescription
commandsCodeMirrorAdapterExCommandsBuilt-in editor commands (undo, redo, indent, etc.).
isMacbooleanWhether the current platform is macOS.
keysCm5KeyMapMap of key names to their handlers.
Posnew (line: number, ch: number) => EditorPositionConstructor for creating editor position objects.
StringStreamConstructorBase<text: [string], Cm5StringStream>StringStream class for tokenizing input.
VimVimApiThe Vim API instance.

Methods

MethodReturnsDescription
addClass(element, className)voidAdd a CSS class to an HTML element.
e_preventDefault(event)voidCall preventDefault on the given event.
e_stop(event)voidStop propagation and prevent default on the given event.
findEnclosingTag(doc, pos)EnclosingTag | undefinedFind the enclosing HTML/XML tag at the given position.
findMatchingTag(doc, pos)voidFind the matching HTML/XML tag at the given position.
isWordChar(char)booleanCheck whether the given character is a word character.
keyName(event)stringGet the key name string from a keyboard event.
lookupKey(key, context, callback)voidLook up a key binding and invoke the callback with the associated action.
off(event, listener)voidRemove an event listener.
on(event, listener)voidAdd an event listener.
rmClass(element, className)voidRemove a CSS class from an HTML element.
signal(target, type, values?)voidEmit a signal/event on the given target.

Links to this page: