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.insertBlock
refBlock: 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.batchInsertText
refBlock: 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.batchInsertReprs
refBlock: 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.batchInsertHTML
refBlock: 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.deleteBlocks
blockIds: 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.setBlocksContent
content
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.moveBlocks
blockIds: 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.copyBlocks
blockIds: 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
.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.createAlias
name: string
: The desired alias name.blockId: DbId
: The ID (number) of the block to alias.const aliasName = "my-important-block"
const blockIdToAlias: DbId = 301
const error = await orca.commands.invokeEditorCommand(
"core.editor.createAlias",
null,
aliasName,
blockIdToAlias,
)
if (error) {
console.error("Failed to create alias:", error)
}
core.editor.deleteAlias
name: string
: The name of the alias to delete.const aliasToDelete = "my-old-alias"
await orca.commands.invokeEditorCommand(
"core.editor.deleteAlias",
null,
aliasToDelete,
)
core.editor.renameAlias
text
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.createRef
from: 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.setRefAlias
ref: 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.setProperties
blockIds: 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.deleteProperties
blockIds: 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.setRefData
RefType.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.deleteRefData
refId: 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.changeTagPropertyName
oldName
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,
)
These commands help you create various types of content blocks.
core.editor.newRootChild
await orca.commands.invokeEditorCommand("core.editor.newRootChild", cursor)
core.editor.insertBlockBeforeCursor
moveCursor: 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.appendBlockAfterCursor
id?: 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.insertTag
blockId: 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.editor.insertLink
isRef: 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.insertQuery
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertQuery", cursor)
core.editor.insertDate
id?: DbId
: Optional block ID to insert at.await orca.commands.invokeEditorCommand("core.editor.insertDate", cursor)
core.editor.insertImage
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertImage", cursor)
core.editor.insertVideo
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertVideo", cursor)
core.editor.insertAudio
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertAudio", cursor)
core.editor.insertMediaTimestamp
await orca.commands.invokeEditorCommand(
"core.editor.insertMediaTimestamp",
cursor,
)
core.editor.insertInlineMath
await orca.commands.invokeEditorCommand("core.editor.insertInlineMath", cursor)
core.editor.insertMath
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertMath", cursor)
core.editor.insertCode
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertCode", cursor)
core.editor.insertMermaid
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertMermaid", cursor)
core.editor.insertTable
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertTable", cursor)
core.editor.insertQuote
id?: DbId
: Optional block ID to insert at or modify.await orca.commands.invokeEditorCommand("core.editor.insertQuote", cursor)
These commands handle the removal and modification of content within blocks.
core.editor.deleteSelection
domDelete: 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.removeTag
blockId: 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.removeAllInstances
tagBlockId: 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.migrateTagInstances
sourceTagId: 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.indentSelection
ids?: 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.outdentSelection
ids?: 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.mergeBlocks
srcId: 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.mergePrecedingBlock
srcContent?: 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.formatSelectedText
formatType: 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.formatBold
await orca.commands.invokeEditorCommand("core.editor.formatBold", cursor)
core.editor.formatItalic
await orca.commands.invokeEditorCommand("core.editor.formatItalic", cursor)
core.editor.formatStrikethrough
await orca.commands.invokeEditorCommand(
"core.editor.formatStrikethrough",
cursor,
)
core.editor.formatUnderlineSolid
await orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineSolid",
cursor,
)
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.formatUnderlineWavyRed
await orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineWavyRed",
cursor,
)
core.editor.formatUnderlineWavyGreen
await orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineWavyGreen",
cursor,
)
core.editor.formatUnderlineWavyBlue
await orca.commands.invokeEditorCommand(
"core.editor.formatUnderlineWavyBlue",
cursor,
)
core.editor.formatInlineCode
await orca.commands.invokeEditorCommand("core.editor.formatInlineCode", cursor)
core.editor.formatTextBlue
await orca.commands.invokeEditorCommand("core.editor.formatTextBlue", cursor)
core.editor.formatTextGreen
await orca.commands.invokeEditorCommand("core.editor.formatTextGreen", cursor)
core.editor.formatTextRed
await orca.commands.invokeEditorCommand("core.editor.formatTextRed", cursor)
core.editor.formatHighlightYellow
await orca.commands.invokeEditorCommand(
"core.editor.formatHighlightYellow",
cursor,
)
core.editor.formatHighlightBlue
await orca.commands.invokeEditorCommand(
"core.editor.formatHighlightBlue",
cursor,
)
core.editor.formatHighlightGreen
await orca.commands.invokeEditorCommand(
"core.editor.formatHighlightGreen",
cursor,
)
core.editor.formatHighlightRed
await orca.commands.invokeEditorCommand(
"core.editor.formatHighlightRed",
cursor,
)
core.editor.formatTextCustomColor
color?: 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.formatHighlightCustomColor
color?: 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.formatSup
await orca.commands.invokeEditorCommand("core.editor.formatSup", cursor)
core.editor.formatSub
await orca.commands.invokeEditorCommand("core.editor.formatSub", cursor)
core.editor.convertSelectionIntoLink
await orca.commands.invokeEditorCommand(
"core.editor.convertSelectionIntoLink",
cursor,
)
core.editor.convertSelectionIntoMath
await orca.commands.invokeEditorCommand(
"core.editor.convertSelectionIntoMath",
cursor,
)
core.editor.convertSelectionIntoReference
await orca.commands.invokeEditorCommand(
"core.editor.convertSelectionIntoReference",
cursor,
)
core.editor.clearFormatting
await orca.commands.invokeEditorCommand("core.editor.clearFormatting", cursor)
core.editor.selectAll
await orca.commands.invokeEditorCommand("core.editor.selectAll", cursor)
core.editor.makeText
id?: 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.makeHeading1
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading1", cursor)
core.editor.makeHeading2
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading2", cursor)
core.editor.makeHeading3
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading3", cursor)
core.editor.makeHeading4
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeHeading4", cursor)
core.editor.makeNumberedList
id?: 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.makeBulletedList
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeBulletedList", cursor)
core.editor.makeQuote
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeQuote", cursor)
core.editor.makeMath
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeMath", cursor)
core.editor.makeTask
id?: DbId
: Optional specific block ID to convert.await orca.commands.invokeEditorCommand("core.editor.makeTask", cursor)
core.editor.insertFragments
fragments: 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" },
])
These commands provide miscellaneous functionality for manipulating blocks and UI elements.
core.editor.toggleShowAsLongForm
id?: 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.toggleAsTemplate
id?: 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.toggleFavorite
id?: 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.focusIn
id?: 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.openOnTheSide
id?: 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.copyBlockLink
id?: 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.foldBlock
id?: 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.unfoldBlock
id?: 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.moveBlockUp
ids?: 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.moveBlockDown
ids?: 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.pdf
id?: 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.png
id?: 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.txt
id?: 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)