Orca provides a rich set of editor commands to manipulate blocks, text, and other content. These commands are registered under the core.editor namespace and can be invoked programmatically. This document describes all the available editor commands, their parameters, and usage examples.
Editor commands are invoked by calling the orca.commands.invokeEditorCommand function.
The commands are organized into several categories:
These commands form the basis for manipulating blocks and their content.
core.editor.insertBlockrefBlock: Block | null: The reference block relative to which the new block will be inserted. Can be null for inserting at the root level (if applicable).position: "before" | "after" | "firstChild" | "lastChild" | null: The position relative to refBlock. null might be used if refBlock is also null.content?: ContentFragment[]: Optional initial content for the new block.repr?: Repr: Optional representation type for the block (defaults to { type: "text" }).created?: Date: Optional creation timestamp.modified?: Date: Optional modification timestamp.// Insert a new text block after block 123
const someBlock = orca.state.blocks[123]
const newBlockId = await orca.commands.invokeEditorCommand(
"core.editor.insertBlock",
null, // cursor data (can be null if not needed for context)
someBlock,
"after",
[{ t: "t", v: "New block content" }],
)
core.editor.batchInsertTextrefBlock: Block: The reference block. DbId is a number.position: "before" | "after" | "firstChild" | "lastChild": The position relative to refBlock.text: string: A string containing lines of text to be inserted as separate blocks.const someBlock = orca.state.blocks[123]
const multiLineText = "First line\nSecond line\nThird line"
await orca.commands.invokeEditorCommand(
"core.editor.batchInsertText",
null,
someBlock,
"lastChild",
multiLineText,
)
core.editor.batchInsertReprsrefBlock: Block: The reference block. DbId is a number.position: "before" | "after" | "firstChild" | "lastChild": The position relative to refBlock.reprs: Repr[]: An array of representation objects, each defining a block to be inserted.const someBlock = orca.state.blocks[123]
const representations = [
{ type: "text", content: [{ t: "t", v: "Block 1" }] },
{ type: "heading", level: 2, content: [{ t: "t", v: "Block 2 Heading" }] },
]
await orca.commands.invokeEditorCommand(
"core.editor.batchInsertReprs",
null,
someBlock,
"after",
representations,
)
core.editor.batchInsertHTMLrefBlock: Block: The reference block. DbId is a number.position: "before" | "after" | "firstChild" | "lastChild": The position relative to refBlock.html: string: The HTML string to insert.const someBlock = orca.state.blocks[123]
const htmlContent = "<p>Paragraph 1</p><ul><li>Item 1</li><li>Item 2</li></ul>"
await orca.commands.invokeEditorCommand(
"core.editor.batchInsertHTML",
null, // Requires panel context, provide appropriate cursor data
someBlock,
"firstChild",
htmlContent,
)
core.editor.deleteBlocksblockIds: DbId[]: An array of block IDs (numbers) to delete.const blockIdsToDelete: DbId[] = [456, 789]
await orca.commands.invokeEditorCommand(
"core.editor.deleteBlocks",
null,
blockIdsToDelete,
)
core.editor.setBlocksContentcontent and derived text) of the given blocks.blocksToUpdate: IdContent[]: An array of objects, each containing id (a number) and content for a block to update. IdContent is { id: DbId, content: ContentFragment[] | null }.setBackCursor?: boolean: If true, attempts to restore the cursor position after the update (requires valid cursor data in the command invocation).const updates = [
{ id: 501, content: [{ t: "t", v: "Updated content for block 1" }] },
{ id: 502, content: null }, // Clear content for block 2
]
await orca.commands.invokeEditorCommand(
"core.editor.setBlocksContent",
null, // Provide cursor data if setBackCursor is true
updates,
false,
)
core.editor.moveBlocksblockIds: DbId[]: An array of block IDs (numbers) to move.refBlockId: DbId: The ID (number) of the reference block.position: "before" | "after" | "firstChild" | "lastChild": The target position relative to refBlockId.const blockIdsToMove: DbId[] = [101]
const targetRefBlockId: DbId = 102
await orca.commands.invokeEditorCommand(
"core.editor.moveBlocks",
null,
blockIdsToMove,
targetRefBlockId,
"lastChild", // Move block 101 to be the last child of block 102
)
core.editor.copyBlocksblockIds: DbId[]: An array of block IDs (numbers) to copy.refBlockId: DbId | null: The ID (number) of the reference block.position: "before" | "after" | "firstChild" | "lastChild | null": The target position relative to refBlockId.processVars?: boolean: Optional flag to process variables during copying (defaults to false).const blockIdsToCopy: DbId[] = [201]
const targetRefBlockId: DbId = 202
const newBlocks = await orca.commands.invokeEditorCommand(
"core.editor.copyBlocks",
null,
blockIdsToCopy,
targetRefBlockId,
"after", // Copy block 201 to appear after block 202
)
core.editor.crossRepoCopyBlockssourceRepoId: string: The ID of the source repository.blockIds: DbId[]: An array of block IDs to copy from the source repository.refBlockId: DbId | null: The ID of the reference block in the target repository.position: "before" | "after" | "firstChild" | "lastChild" | null: The target position relative to refBlockId.const sourceRepoId = "external-repo-id"
const blockIdsToCopy: DbId[] = [201]
const targetRefBlockId: DbId = 202
await orca.commands.invokeEditorCommand(
"core.editor.crossRepoCopyBlocks",
null,
sourceRepoId,
blockIdsToCopy,
targetRefBlockId,
"after",
)
core.editor.createAliasname: string: The desired alias name.blockId: DbId: The ID (number) of the block to alias.asPage?: boolean: Optional flag to create the block as a page alias (defaults to false).const aliasName = "my-important-block"
const blockIdToAlias: DbId = 301
const error = await orca.commands.invokeEditorCommand(
"core.editor.createAlias",
null,
aliasName,
blockIdToAlias,
false,
)
if (error) {
console.error("Failed to create alias:", error)
}
core.editor.deleteAliasname: string: The name of the alias to delete.const aliasToDelete = "my-old-alias"
await orca.commands.invokeEditorCommand(
"core.editor.deleteAlias",
null,
aliasToDelete,
)
core.editor.renameAliastext field of blocks that reference the alias via properties if necessary.oldName: string: The current name of the alias.newName: string: The desired new name for the alias.const oldAliasName = "current-alias"
const newAliasName = "new-alias-name"
await orca.commands.invokeEditorCommand(
"core.editor.renameAlias",
null,
oldAliasName,
newAliasName,
)
core.editor.createReffrom: DbId: The ID (number) of the block where the reference originates.to: DbId: The ID (number) of the block being referenced.type: number: The type of reference being created. Possible values are:
1 (RefType.Inline): An inline reference.2 (RefType.Property): A reference via a block property.3 (RefType.RefData): A reference via a reference data.4 (RefType.Whiteboard): A reference via a whiteboard.alias?: string: An optional alias for this specific reference instance (often used with RefType.Property).import { RefType } from "@/constants/db"
const sourceBlockId: DbId = 401
const targetBlockId: DbId = 402
const propertyAlias = "relatedDocument"
// Create a property reference from block 401 to block 402 with alias 'relatedDocument'
const refId = await orca.commands.invokeEditorCommand(
"core.editor.createRef",
null,
sourceBlockId,
targetBlockId,
RefType.Property,
propertyAlias,
)
core.editor.setRefAliasref: BlockRef: The reference object (containing id, from, to, etc.) whose alias needs to be set. id, from, to are numbers (DbId).alias: string: The new alias string.// Assume 'blockRef' is a BlockRef object obtained from a block's 'refs' array
const blockRef = orca.state.blocks[801]?.refs.find(
(r) => r.type === RefType.Property,
)
if (blockRef) {
const newAlias = "updatedRelation"
await orca.commands.invokeEditorCommand(
"core.editor.setRefAlias",
null,
blockRef,
newAlias,
)
}
core.editor.setPropertiesblockIds: DbId[]: An array of block IDs (numbers) whose properties are to be set.properties: BlockProperty[]: An array of property objects ({ name: string, value: any, type: number }) to set on the blocks.
name: string: The property's unique identifier.value: any: The data associated with the property. Its type should correspond to the type field.type: number: Specifies the data type of the property. This influences how the value is stored and interpreted. See PropType for possible values:0 (PropType.JSON): value is any valid JSON object or primitive.1 (PropType.Text): value is a string.2 (PropType.BlockRefs): value is an array of ref IDs.3 (PropType.Number): value is a number.4 (PropType.Boolean): value is true or false.5 (PropType.DateTime): value represents a date/time.6 (PropType.TextChoices): value is an array of strings representing selected options.import { PropType } from "@/constants/db" // Assuming PropType is exported
const blockIdsToUpdate: DbId[] = [601, 602]
const propertiesToSet = [
{ name: "status", value: "completed", type: PropType.Text },
{ name: "priority", value: 1, type: PropType.Number },
{ name: "archived", value: false, type: PropType.Boolean },
{ name: "dueDate", value: new Date(), type: PropType.DateTime },
{ name: "relatedTasks", value: [701, 702], type: PropType.BlockRefs },
{
name: "settings",
value: { theme: "dark", notifications: true },
type: PropType.JSON,
},
]
await orca.commands.invokeEditorCommand(
"core.editor.setProperties",
null,
blockIdsToUpdate,
propertiesToSet,
)
core.editor.deletePropertiesblockIds: DbId[]: An array of block IDs (numbers) from which to delete properties.propertyNames: string[]: An array of property names to delete.const blockIdsToUpdate: DbId[] = [701]
const propertiesToDelete = ["status", "priority"]
await orca.commands.invokeEditorCommand(
"core.editor.deleteProperties",
null,
blockIdsToUpdate,
propertiesToDelete,
)
core.editor.setRefDataRefType.RefData) exists.ref: BlockRef: The reference object (containing id, from, to, etc.) to which the data belongs. id, from, to are numbers (DbId).data: BlockRefData[]: An array of data objects ({ name: string, value: any }) to associate with the reference.// Assume 'propertyRef' is a BlockRef object for a property reference
const propertyRef = orca.state.blocks[801]?.refs.find(
(r) => r.type === RefType.Property && r.alias === "dueDate",
)
if (propertyRef) {
const refDataToSet = [
{ name: "date", value: new Date() }, // Will also create a RefType.RefData link to the journal page
{ name: "notes", value: "Due by end of week" },
]
await orca.commands.invokeEditorCommand(
"core.editor.setRefData",
null,
propertyRef,
refDataToSet,
)
}
core.editor.deleteRefDatarefId: DbId: The ID (number) of the reference from which to delete data.names: string[]: An array of data field names to delete.// Assume 'propertyRefId' is the ID of a BlockRef
const propertyRefId: DbId = 901
const refDataNamesToDelete = ["notes"]
await orca.commands.invokeEditorCommand(
"core.editor.deleteRefData",
null,
propertyRefId,
refDataNamesToDelete,
)
core.editor.changeTagPropertyNameoldName to newName) for a specific tag block (tagBlockId) across all blocks that reference this tag and have ref data associated with that property name.tagBlockId: DbId: The ID (number) of the tag block whose associated property name is changing.oldName: string: The current name of the property within the ref data.newName: string: The desired new name for the property within the ref data.const tagBlockId: DbId = 1001 // ID (number) of the block representing the tag/template
const oldPropertyName = "deadline"
const newPropertyName = "dueDate"
await orca.commands.invokeEditorCommand(
"core.editor.changeTagPropertyName",
null,
tagBlockId,
oldPropertyName,
newPropertyName,
)
core.editor.migrateReferencesAndAliasesfrom: DbId: The ID of the source block whose references and aliases should be migrated.to: DbId: The ID of the target block to migrate references and aliases to.const sourceBlockId: DbId = 501
const targetBlockId: DbId = 502
await orca.commands.invokeEditorCommand(
"core.editor.migrateReferencesAndAliases",
cursor,
sourceBlockId,
targetBlockId,
)
These commands help you create various types of content blocks.
core.editor.newRootChildawait orca.commands.invokeEditorCommand("core.editor.newRootChild", cursor)
core.editor.insertBlockBeforeCursormoveCursor: boolean: Whether to move the cursor to the new block after creation.id?: DbId: Optional block ID to insert before, if cursor is not specified.// Insert a block before the current one and move cursor to it
await orca.commands.invokeEditorCommand(
"core.editor.insertBlockBeforeCursor",
cursor,
true,
)
core.editor.appendBlockAfterCursorid?: DbId: Optional block ID to append after, if cursor is not specified.forceAfter: boolean: Force insertion after the block rather than as its first child.// Insert a block after the current one
await orca.commands.invokeEditorCommand(
"core.editor.appendBlockAfterCursor",
cursor,
)
// Force insert after even if the block has children
await orca.commands.invokeEditorCommand(
"core.editor.appendBlockAfterCursor",
cursor,
blockId,
true,
)
core.editor.insertTagblockId: DbId: The ID of the block to add the tag to.alias: string: The alias name of the tag.data?: BlockRefData[]: Optional data to associate with the tag._template property, will also copy template blocks as children.// Add a simple tag
const tagId = await orca.commands.invokeEditorCommand(
"core.editor.insertTag",
cursor,
blockId,
"project",
)
// Add a tag with associated data
await orca.commands.invokeEditorCommand(
"core.editor.insertTag",
cursor,
blockId,
"deadline",
[{ name: "date", value: "2023-12-31" }],
)
core.duplicateTagtagBlockId: DbId: The ID of the tag block to duplicate.newName?: string: Optional new name for the duplicated tag. If not provided, appends an underscore to the original name.// Duplicate a tag with automatic naming
const newTagId = await orca.commands.invokeEditorCommand(
"core.duplicateTag",
null,
tagBlockId,
)
// Duplicate with a specific name
const newTagId = await orca.commands.invokeEditorCommand(
"core.duplicateTag",
null,
tagBlockId,
"custom-tag-name",
)
core.editor.insertLinkisRef: boolean: Whether this is a reference to another block (true) or an external URL (false).link: DbId | string: Either a block ID (for references) or a URL string.text?: string: Optional display text for the link.// Insert an external link
await orca.commands.invokeEditorCommand(
"core.editor.insertLink",
cursor,
false,
"https://example.com",
"Example Website",
)
// Insert a block reference
await orca.commands.invokeEditorCommand(
"core.editor.insertLink",
cursor,
true,
blockId,
"Referenced Block",
)
core.editor.insertQueryid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertQuery", cursor)
core.editor.insertDateid?: DbId: Optional block ID to insert at.await orca.commands.invokeEditorCommand("core.editor.insertDate", cursor)
core.editor.insertImageid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertImage", cursor)
core.editor.insertVideoid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertVideo", cursor)
core.editor.insertAudioid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertAudio", cursor)
core.editor.insertMediaTimestampawait orca.commands.invokeEditorCommand(
"core.editor.insertMediaTimestamp",
cursor,
)
core.editor.insertInlineMathawait orca.commands.invokeEditorCommand("core.editor.insertInlineMath", cursor)
core.editor.insertMathid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertMath", cursor)
core.editor.insertCodeid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertCode", cursor)
core.editor.insertMermaidid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertMermaid", cursor)
core.editor.insertTableid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertTable", cursor)
core.editor.insertQuoteid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertQuote", cursor)
core.editor.insertPDFid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertPDF", cursor)
core.editor.insertHRid?: DbId: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertHR", cursor)
These commands handle the removal and modification of content within blocks.
core.editor.deleteSelectiondomDelete: boolean: Whether to also trigger a DOM-level delete operation (defaults to false).text?: string: Optional text to insert at the deletion point.// Delete the current selection
await orca.commands.invokeEditorCommand("core.editor.deleteSelection", cursor)
// Delete selection and replace with new text
await orca.commands.invokeEditorCommand(
"core.editor.deleteSelection",
cursor,
false,
"Replacement text",
)
core.editor.removeTagblockId: DbId: The ID of the block from which to remove the tag.alias: string: The alias name of the tag to remove.// Remove the "project" tag from a block
await orca.commands.invokeEditorCommand(
"core.editor.removeTag",
cursor,
blockId,
"project",
)
core.editor.deleteBlocksInSelection// Delete all blocks in the current selection
await orca.commands.invokeEditorCommand(
"core.editor.deleteBlocksInSelection",
cursor,
)
core.editor.removeAllInstancestagBlockId: DbId: The ID of the tag block whose instances should be removed.const tagBlockId: DbId = 501
await orca.commands.invokeEditorCommand(
"core.editor.removeAllInstances",
null,
tagBlockId,
)
core.editor.migrateTagInstancessourceTagId: DbId: The ID of the source tag block whose instances should be migrated.targetTagName: string: The name of the target tag to migrate instances to.const sourceTagId: DbId = 501
const targetTagName = "new-project-tag"
await orca.commands.invokeEditorCommand(
"core.editor.migrateTagInstances",
null,
sourceTagId,
targetTagName,
)
core.editor.indentSelectionids?: DbId[]: Optional array of block IDs to indent. If not provided, will use blocks from the cursor selection.// Indent specific blocks by ID
const blockIdsToIndent: DbId[] = [123, 124]
await orca.commands.invokeEditorCommand(
"core.editor.indentSelection",
cursor,
blockIdsToIndent,
)
// Or indent the current selection
await orca.commands.invokeEditorCommand("core.editor.indentSelection", cursor)
core.editor.outdentSelectionids?: DbId[]: Optional array of block IDs to outdent. If not provided, will use blocks from the cursor selection.// Outdent specific blocks by ID
const blockIdsToOutdent: DbId[] = [123, 124]
await orca.commands.invokeEditorCommand(
"core.editor.outdentSelection",
cursor,
blockIdsToOutdent,
)
// Or outdent the current selection
await orca.commands.invokeEditorCommand("core.editor.outdentSelection", cursor)
core.editor.mergeBlockssrcId: DbId: The ID of the source block (content to merge from).destId: DbId: The ID of the destination block (content to merge into).srcContent?: ContentFragment[]: Optional content to merge instead of using the source block's content.// Merge block 123's content into block 124
await orca.commands.invokeEditorCommand(
"core.editor.mergeBlocks",
cursor,
123, // source block ID
124, // destination block ID
)
core.editor.mergePrecedingBlocksrcContent?: ContentFragment[]: Optional content to merge instead of using the current block's content.// Merge the current block with the preceding block
await orca.commands.invokeEditorCommand(
"core.editor.mergePrecedingBlock",
cursor,
)
core.editor.mergeFollowingBlock// Merge the current block with the following block
await orca.commands.invokeEditorCommand(
"core.editor.mergeFollowingBlock",
cursor,
)
core.editor.splitBlock// Split the current block at the cursor position
const newBlockId = await orca.commands.invokeEditorCommand(
"core.editor.splitBlock",
cursor,
)
These commands control text formatting and block type conversion.
core.editor.formatSelectedTextformatType: string: The format to apply (e.g., "b" for bold, "i" for italic).formatArgs: Record<string, any>: Optional arguments for the format (e.g., color values).// Make selected text bold
await orca.commands.invokeEditorCommand(
"core.editor.formatSelectedText",
cursor,
"b",
)
// Apply custom text color
await orca.commands.invokeEditorCommand(
"core.editor.formatSelectedText",
cursor,
"fc",
{ fcc: "red" },
)
core.editor.formatBoldawait orca.commands.invokeEditorCommand("core.editor.formatBold", cursor)
core.editor.formatItalicawait orca.commands.invokeEditorCommand("core.editor.formatItalic", cursor)
core.editor.formatStrikethroughawait orca.commands.invokeEditorCommand(
"core.editor.formatStrikethrough",
cursor,
)
core.editor.formatUnderlineSolidawait orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineSolid",
cursor,
)
core.editor.formatUderlineCustomColorcolor?: string: Optional color value. If not provided, shows a color picker.// With color picker
await orca.commands.invokeEditorCommand(
"core.editor.formatUderlineCustomColor",
cursor,
)
// With predefined color
await orca.commands.invokeEditorCommand(
"core.editor.formatUderlineCustomColor",
cursor,
"#FF5500",
)
core.editor.formatUderlineWavyCustomColor (note the typo in command name)color?: string: Optional color value. If not provided, shows a color picker.// With color picker
await orca.commands.invokeEditorCommand(
"core.editor.formatUderlineWavyCustomColor",
cursor,
)
// With predefined color
await orca.commands.invokeEditorCommand(
"core.editor.formatUderlineWavyCustomColor",
cursor,
"#FF5500",
)
core.editor.formatUnderlineWavyRedawait orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineWavyRed",
cursor,
)
core.editor.formatUnderlineWavyGreenawait orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineWavyGreen",
cursor,
)
core.editor.formatUnderlineWavyBlueawait orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineWavyBlue",
cursor,
)
core.editor.formatInlineCodeawait orca.commands.invokeEditorCommand("core.editor.formatInlineCode", cursor)
core.editor.formatTextBlueawait orca.commands.invokeEditorCommand("core.editor.formatTextBlue", cursor)
core.editor.formatTextGreenawait orca.commands.invokeEditorCommand("core.editor.formatTextGreen", cursor)
core.editor.formatTextRedawait orca.commands.invokeEditorCommand("core.editor.formatTextRed", cursor)
core.editor.formatHighlightYellowawait orca.commands.invokeEditorCommand(
"core.editor.formatHighlightYellow",
cursor,
)
core.editor.formatHighlightBlueawait orca.commands.invokeEditorCommand(
"core.editor.formatHighlightBlue",
cursor,
)
core.editor.formatHighlightGreenawait orca.commands.invokeEditorCommand(
"core.editor.formatHighlightGreen",
cursor,
)
core.editor.formatHighlightRedawait orca.commands.invokeEditorCommand(
"core.editor.formatHighlightRed",
cursor,
)
core.editor.formatTextCustomColorcolor?: string: Optional color value. If not provided, shows a color picker.// With color picker
await orca.commands.invokeEditorCommand(
"core.editor.formatTextCustomColor",
cursor,
)
// With predefined color
await orca.commands.invokeEditorCommand(
"core.editor.formatTextCustomColor",
cursor,
"#7700FF",
)
core.editor.formatHighlightCustomColorcolor?: string: Optional color value. If not provided, shows a color picker.// With color picker
await orca.commands.invokeEditorCommand(
"core.editor.formatHighlightCustomColor",
cursor,
)
// With predefined color
await orca.commands.invokeEditorCommand(
"core.editor.formatHighlightCustomColor",
cursor,
"#FFFFAA",
)
core.editor.formatSupawait orca.commands.invokeEditorCommand("core.editor.formatSup", cursor)
core.editor.formatSubawait orca.commands.invokeEditorCommand("core.editor.formatSub", cursor)
core.editor.formatIncreaseFontSizeawait orca.commands.invokeEditorCommand(
"core.editor.formatIncreaseFontSize",
cursor,
)
core.editor.formatDecreaseFontSizeawait orca.commands.invokeEditorCommand(
"core.editor.formatDecreaseFontSize",
cursor,
)
core.editor.formatResetFontSizeawait orca.commands.invokeEditorCommand(
"core.editor.formatResetFontSize",
cursor,
)
core.editor.copyFormattingawait orca.commands.invokeEditorCommand("core.editor.copyFormatting", cursor)
core.editor.convertSelectionIntoLinkawait orca.commands.invokeEditorCommand(
"core.editor.convertSelectionIntoLink",
cursor,
)
core.editor.convertSelectionIntoMathawait orca.commands.invokeEditorCommand(
"core.editor.convertSelectionIntoMath",
cursor,
)
core.editor.convertSelectionIntoReferenceawait orca.commands.invokeEditorCommand(
"core.editor.convertSelectionIntoReference",
cursor,
)
core.editor.clearFormattingawait orca.commands.invokeEditorCommand("core.editor.clearFormatting", cursor)
core.editor.selectAllawait orca.commands.invokeEditorCommand("core.editor.selectAll", cursor)
core.editor.makeTextid?: DbId: Optional specific block ID to convert. If not provided, uses blocks from cursor selection.// Convert current selection to text blocks
await orca.commands.invokeEditorCommand("core.editor.makeText", cursor)
// Convert specific block to text
await orca.commands.invokeEditorCommand("core.editor.makeText", cursor, 123)
core.editor.makeHeading1id?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading1", cursor)
core.editor.makeHeading2id?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading2", cursor)
core.editor.makeHeading3id?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading3", cursor)
core.editor.makeHeading4id?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading4", cursor)
core.editor.makeNumberedListid?: DbId: Optional specific block ID to convert.start?: number: Optional starting number for the list.// Standard numbered list
await orca.commands.invokeEditorCommand("core.editor.makeNumberedList", cursor)
// Numbered list starting from 5
await orca.commands.invokeEditorCommand(
"core.editor.makeNumberedList",
cursor,
undefined,
5,
)
core.editor.makeBulletedListid?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeBulletedList", cursor)
core.editor.makeQuoteid?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeQuote", cursor)
core.editor.makeMathid?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeMath", cursor)
core.editor.makeTaskid?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeTask", cursor)
core.editor.insertFragmentsfragments: ContentFragment[]: Array of content fragments to insert.// Insert bold text
await orca.commands.invokeEditorCommand("core.editor.insertFragments", cursor, [
{ t: "t", v: "Important note", f: "b" },
])
// Insert link
await orca.commands.invokeEditorCommand("core.editor.insertFragments", cursor, [
{ t: "r", v: "Orca Documentation", u: "https://orca.so/docs" },
])
core.editor.toggleTaskid?: DbId: Optional specific block ID to toggle.// Toggle task on current block
await orca.commands.invokeEditorCommand("core.editor.toggleTask", cursor)
// Toggle task on specific block
await orca.commands.invokeEditorCommand("core.editor.toggleTask", null, blockId)
core.editor.makeAliasedid?: DbId: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeAliased", cursor)
These commands provide miscellaneous functionality for manipulating blocks and UI elements.
core.editor.toggleShowAsLongFormid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Toggle long-form display for the current block
await orca.commands.invokeEditorCommand(
"core.editor.toggleShowAsLongForm",
cursor,
)
// Toggle long-form display for a specific block
await orca.commands.invokeEditorCommand(
"core.editor.toggleShowAsLongForm",
cursor,
123,
)
core.editor.toggleAsTemplateid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Toggle template status for the current block
await orca.commands.invokeEditorCommand("core.editor.toggleAsTemplate", cursor)
// Toggle template status for a specific block
await orca.commands.invokeEditorCommand(
"core.editor.toggleAsTemplate",
cursor,
123,
)
core.editor.toggleFavoriteid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Toggle favorite status for the current block
await orca.commands.invokeEditorCommand("core.editor.toggleFavorite", cursor)
core.editor.toggleReadOnly// Toggle read-only mode for the current editor
await orca.commands.invokeEditorCommand("core.editor.toggleReadOnly", cursor)
core.editor.showBlockMenu// Show menu for the current block
await orca.commands.invokeEditorCommand("core.editor.showBlockMenu", cursor)
core.editor.focusInid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Focus in on the current block
await orca.commands.invokeEditorCommand("core.editor.focusIn", cursor)
// Focus in on a specific block
await orca.commands.invokeEditorCommand("core.editor.focusIn", cursor, 123)
core.editor.focusOutid?: DbId: Optional specific block ID to focus out from. If not provided, uses the current focused block.// Focus out from the current block
await orca.commands.invokeEditorCommand("core.editor.focusOut", cursor)
core.editor.openOnTheSideid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Open current block on the side
await orca.commands.invokeEditorCommand("core.editor.openOnTheSide", cursor)
core.editor.copyBlockLinkid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Copy link to current block
await orca.commands.invokeEditorCommand("core.editor.copyBlockLink", cursor)
core.editor.foldAll// Fold all blocks
await orca.commands.invokeEditorCommand("core.editor.foldAll", cursor)
core.editor.unfoldAll// Unfold all blocks
await orca.commands.invokeEditorCommand("core.editor.unfoldAll", cursor)
core.editor.foldBlockid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Fold the current block
await orca.commands.invokeEditorCommand("core.editor.foldBlock", cursor)
core.editor.unfoldBlockid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Unfold the current block
await orca.commands.invokeEditorCommand("core.editor.unfoldBlock", cursor)
core.editor.moveBlockUpids?: DbId[]: Optional array of block IDs to move. If not provided, uses the block at cursor position.// Move current block up
await orca.commands.invokeEditorCommand("core.editor.moveBlockUp", cursor)
// Move specific blocks up
await orca.commands.invokeEditorCommand(
"core.editor.moveBlockUp",
cursor,
[123, 124],
)
core.editor.moveBlockDownids?: DbId[]: Optional array of block IDs to move. If not provided, uses the block at cursor position.// Move current block down
await orca.commands.invokeEditorCommand("core.editor.moveBlockDown", cursor)
core.editor.export.pdfid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.landscape?: boolean: Optional flag to use landscape orientation (defaults to false).// Export current block as PDF
await orca.commands.invokeEditorCommand("core.editor.export.pdf", cursor)
// Export in landscape mode
await orca.commands.invokeEditorCommand(
"core.editor.export.pdf",
cursor,
123,
true,
)
core.editor.export.pngid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Export current block as PNG
await orca.commands.invokeEditorCommand("core.editor.export.png", cursor)
core.editor.export.txtid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Export current block as text
await orca.commands.invokeEditorCommand("core.editor.export.txt", cursor)
core.editor.pasteText// Paste text from clipboard
await orca.commands.invokeEditorCommand("core.editor.pasteText", cursor)
core.editor.pasteAsReference// Paste block as reference
await orca.commands.invokeEditorCommand("core.editor.pasteAsReference", cursor)
core.editor.pasteAsMirror// Paste block as mirror
await orca.commands.invokeEditorCommand("core.editor.pasteAsMirror", cursor)
core.editor.pasteAsMove// Move blocks to current position
await orca.commands.invokeEditorCommand("core.editor.pasteAsMove", cursor)
core.editor.pasteAsCopy// Paste as copy
await orca.commands.invokeEditorCommand("core.editor.pasteAsCopy", cursor)
core.editor.showAIMenu// Show AI menu
await orca.commands.invokeEditorCommand("core.editor.showAIMenu", cursor)
core.editor.insertCurrentTime// Insert current time
await orca.commands.invokeEditorCommand("core.editor.insertCurrentTime", cursor)
core.editor.copyBlockIDid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Copy the ID of the current block
await orca.commands.invokeEditorCommand("core.editor.copyBlockID", cursor)
core.editor.export.mdid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Export current block as Markdown
await orca.commands.invokeEditorCommand("core.editor.export.md", cursor)
core.editor.export.htmlid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Export current block as HTML
await orca.commands.invokeEditorCommand("core.editor.export.html", cursor)
core.editor.pasteHTML// Paste HTML from clipboard
await orca.commands.invokeEditorCommand("core.editor.pasteHTML", cursor)
core.editor.extractPageid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Extract current block as page
await orca.commands.invokeEditorCommand("core.editor.extractPage", cursor)
core.editor.inlinePageid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Inline a page reference
await orca.commands.invokeEditorCommand("core.editor.inlinePage", cursor)
core.editor.toggleFoldid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Toggle fold state for current block
await orca.commands.invokeEditorCommand("core.editor.toggleFold", cursor)
core.editor.toggleTaskStateid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.toggleTask but more explicit about task state.// Toggle task state
await orca.commands.invokeEditorCommand("core.editor.toggleTaskState", cursor)
core.editor.showAliasEditorid?: DbId: Optional specific block ID. If not provided, uses the block at cursor position.// Show alias editor for current block
await orca.commands.invokeEditorCommand("core.editor.showAliasEditor", cursor)
core.editor.showTagInsertion// Show tag insertion menu
await orca.commands.invokeEditorCommand("core.editor.showTagInsertion", cursor)