applySpellcheckMode
Sets the spellcheck attribute on an element from a SpellcheckMode.
The attribute has to be set explicitly, because both of the surfaces that need this are born with spellcheck="false": AbstractTextComponent forces it onto every text component, and Obsidian builds every SuggestModal input with it without consulting Editor > Spellcheck at all.
Which of those a given box wants is a call-site decision, and the distinction that holds up is what the box is FOR: one that only FINDS something is a search field and stays unchecked, because squiggles under half-typed fragments are noise; one that NAMES something is a prose field and follows the setting, the way Obsidian’s own inline title and file-explorer rename do.
Call it again whenever that answer changes — a picker that switches between finding and creating flips modes mid-open, and the attribute has to follow.
The name being typed may be a PATH rather than a bare basename, so folder segments get checked too. That is what Obsidian’s own inline rename does, and the alternative — checking only the last segment — cannot be expressed as an attribute.
Import:
import { applySpellcheckMode } from 'obsidian-dev-utils/obsidian/html-element';Signature:
function applySpellcheckMode(params: ApplySpellcheckModeParams): voidParameters:
| Parameter | Type | Description |
|---|---|---|
params | ApplySpellcheckModeParams | The parameters for applying the spellcheck mode. |
Returns: void
Links to this page: