Arkpad
Extensions

Extensions

Understanding the core extensions included in Arkpad.

The Arkpad engine and StarterKit include several core functional extensions that provide baseline rich-text editing capabilities.

Extensions Overview

ExtensionPurposeIncluded In
FocusEventsFocus and blur lifecycle hooksEngine, Essentials, StarterKit
ClipboardTextSerializerPlain-text clipboard handlingEngine, Essentials, StarterKit
KeymapEnhanced keyboard shortcutsEngine, Essentials, StarterKit
ListKeymapSmart list keyboard navigationEngine, Essentials, StarterKit
TextDirectionRTL/LTR text direction supportStarterKit
DropcursorVisual drag-and-drop indicatorEssentials, StarterKit
GapcursorCursor in "impossible" spotsEssentials, StarterKit

FocusEvents

Dispatches onFocus and onBlur lifecycle hooks to all registered extensions.

onFocus?: (this: ExtensionContext) => boolean | void;
onBlur?: (this: ExtensionContext) => boolean | void;

ClipboardTextSerializer

Provides consistent plain-text copying across different block types.

{
  blockSeparator?: string; // Default: "\n\n"
}

Keymap

Enhanced keyboard shortcut handling.

KeyCommandDescription
EntersplitBlockSplits the current block or code block
Mod-EnterexitCodeExits a code block
BackspaceundoInputRuleReverts last auto-conversion
Mod-aselectAllSelects all content
DeletedeleteSelectionDeletes selection or joins forward

ListKeymap

Specialized keyboard shortcuts for lists.

KeyCommandDescription
TabsinkListItemIndents list item (sub-list)
Shift-TabliftListItemOutdents list item
BackspaceliftListItemOutdents into paragraph at start

TextDirection

Commands for RTL/LTR text direction.

editor.runCommand("setTextDirection", "rtl");
editor.runCommand("setTextDirection", "ltr");
editor.runCommand("unsetTextDirection");

Dropcursor

Visual indicator for drag-and-drop.

{
  width?: number;  // Default: 1
  color?: string;  // Default: "currentColor"
  class?: string;
}

Gapcursor

Enables cursor placement between block nodes that otherwise wouldn't allow one (e.g., between two tables).

The first Utility Command

Takes an array of commands and executes the first one that returns true.

editor.runCommand("first", [
  ({ editor }) => editor.commands.toggleBold(),
  ({ editor }) => editor.commands.toggleItalic(),
]);