style

style.setNodeTag

setNodeTag(nodeId: string, tag: string | TagSpec): void

Convenience method: assign a tag to a single node by spec, id, or null to clear.

  • TagSpec — creates a new tag then assigns it.
  • TagId (string) — assigns an existing tag by id.
  • null — removes any existing tag from the node.

Undoable.

nodeIdstringTarget node identifier.
tagstring | TagSpecTag spec, tag id, or null to clear.

Returns: void