Skip to content

Type Editor


Type Editor / @type-editor/commands / util/is-code-block / isCodeBlock

Function: isCodeBlock()

ts
function isCodeBlock(state, codeNodeType?): boolean;

Defined in: util/is-code-block.ts:14

Checks if the current selection is within a code block.

Parameters

ParameterTypeDefault valueDescription
statePmEditorStateundefinedThe current editor state
codeNodeTypeNodeTypeschema.nodes.code_block-

Returns

boolean

true if the selection's parent node is a code block, false otherwise