MCPcopy Create free account
hub / github.com/editablejs/editable / setTextIndent

Function setTextIndent

packages/plugins/indent/src/utils.ts:4–14  ·  view source on GitHub ↗
(editor: Editor, blockEntry: NodeEntry<Indent>, size: number)

Source from the content-addressed store, hash-verified

2import { Indent } from './interfaces/indent'
3
4export const setTextIndent = (editor: Editor, blockEntry: NodeEntry<Indent>, size: number) => {
5 const [block, path] = blockEntry
6 const textIndent = block.textIndent ?? 0
7 const lineIndent = block.lineIndent ?? 0
8 const indent = Math.max(textIndent + size, 0)
9 if (size < 0 && textIndent === 0 && lineIndent > 0) {
10 setLineIndent(editor, [block, path], size)
11 return
12 }
13 Transforms.setNodes<Indent>(editor, { textIndent: indent }, { at: path })
14}
15
16export const setLineIndent = (editor: Editor, blockEntry: NodeEntry<Indent>, size: number) => {
17 const [block, path] = blockEntry

Callers 3

indent-editor.tsFile · 0.90
toggleNormalIndentFunction · 0.90
setLineIndentFunction · 0.85

Calls 1

setLineIndentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…