Arkpad
API Reference

Command Reference

Comprehensive list of all available Arkpad commands.

Execute commands using editor.runCommand(name, args) or via the editor.commands proxy.

Toolbar Commands

IconNameCommandArguments
BBoldtoggleBold-
IItalictoggleItalic-
UUnderlinetoggleUnderline-
SStriketoggleStrike-
🖍HighlightertoggleHighlighter-
<>CodetoggleCode-
🔗LinktoggleLink{ href: string }
SuperscripttoggleSuperscript-
x₂SubscripttoggleSubscript-
ErasertoggleEraser-
H1Heading 1toggleHeading{ level: 1 }
H2Heading 2toggleHeading{ level: 2 }
H3Heading 3toggleHeading{ level: 3 }
H4Heading 4toggleHeading{ level: 4 }
>_Code BlocktoggleCodeBlock-
DividerinsertHorizontalRule-
Bullet ListtoggleBulletList-
1.Ordered ListtoggleOrderedList-
Task ListtoggleTaskList-
AlignsetTextAlign{ align: 'left' | 'center' | 'right' | 'justify' }
🔍Searchsearchquery: string | RegExp
🖼ImagesetImage{ src: string, alt?: string }
Undoundo-
Redoredo-

API Examples

Basic Command Execution

editor.runCommand("toggleBold");
editor.commands.toggleBold();
editor.commands.toggleHeading({ level: 2 });

Checking Active State

const isBold = editor.isActive("strong");
const isH2 = editor.isActive("heading", { level: 2 });
const isCentered = editor.isActive("textAlign", { align: "center" });

Chaining Commands

editor.chain().focus().toggleBold().insertContent("Hello World").run();

Search and Replace

const results = editor.search("Arkpad");
console.log(`Found ${results.length} matches`);

editor.replace("old text", "new text");

Painting Tools

Arkpad includes unique "painting" tools for applying or removing marks by "drawing" over text.

  • Highlighter — Active when toggleHighlighter is on. Click and drag to apply highlight marks.
  • Eraser — Active when toggleEraser is on. Click and drag to remove all marks.
editor.commands.toggleHighlighter();
editor.commands.toggleEraser();