Skip to content

CodeMirrorAdapterEx

Unofficial

Extended CodeMirror adapter providing CM5-compatible API over CM6.

Import:

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

Signature:

export interface CodeMirrorAdapterEx

Properties

Property Type Description
commands CodeMirrorAdapterExCommands Built-in editor commands (undo, redo, indent, etc.).
isMac boolean Whether the current platform is macOS.
keyMap Record<string, Cm5KeyMap> Map of key binding names to their handlers.
keys Cm5KeyMap Map of key names to their handlers.
Pos new (line: number, ch: number) => EditorPosition Constructor for creating editor position objects.
StringStream ConstructorBase<text: [string], Cm5StringStream> StringStream class for tokenizing input.
Vim VimApi The Vim API instance.

Methods

Method Returns Description
addClass(element, className) void Add a CSS class to an HTML element.
defineOption(option, defaultValue, handler) void Define a new editor option with a default value and change handler.
e_preventDefault(event) void Call preventDefault on the given event.
e_stop(event) void Stop propagation and prevent default on the given event.
findEnclosingTag(doc, pos) EnclosingTag | undefined Find the enclosing HTML/XML tag at the given position.
findMatchingTag(doc, pos) void Find the matching HTML/XML tag at the given position.
isWordChar(char) boolean Check whether the given character is a word character.
keyName(event) string Get the key name string from a keyboard event.
lookupKey(key, context, callback) void Look up a key binding and invoke the callback with the associated action.
off(event, listener) void Remove an event listener.
on(event, listener) void Add an event listener.
rmClass(element, className) void Remove a CSS class from an HTML element.
signal(target, type, values?) void Emit a signal/event on the given target.
vimKey(event) string Convert a keyboard event to its Vim key representation.

Links to this page: