Types
Types exported by @tiptap-pro/extension-content-protection. See also policy types and redaction types.
PolicyDocumentOptions
Shared input for utilities that inspect a document.
Properties
policy(ContentProtectionPolicy): The policy to evaluate.document(Node): The document to inspect.
PolicyIssue
One configuration or input error.
Properties
path(string): Location of the invalid value.code('invalidFormat' | 'unsupportedVersion' | 'duplicateRuleId' | 'unknownNodeType' | 'unknownMarkType' | 'unknownAttribute'): Error category.message(string): Human-readable explanation.
ProtectionConfigurationError
Extends Error. Thrown when a utility or the extension receives an invalid policy.
Properties
issues(PolicyIssue[]): Configuration diagnostics.name(string): Error class name.message(string): Summary of the failure.
ProtectionInputError
Extends ProtectionConfigurationError. Thrown for invalid utility inputs, incompatible schemas or missing extension state.
Properties
issues(PolicyIssue[]): Input diagnostics.name(string): Error class name.message(string): Summary of the failure.
ProtectionOperationKind
The mutation being checked.
| Value | Operation |
|---|---|
'insertNode' | Insert a Node. |
'removeNode' | Remove a Node. |
'changeNodeType' | Change a Node's type. |
'moveNode' | Move a Node. |
'changeChildren' | Change the direct child sequence. |
'insertText' | Insert text. |
'removeText' | Remove text. |
'changeAttribute' | Change a Node attribute. |
'addMark' | Add a Mark. |
'removeMark' | Remove a Mark. |
'changeMarkAttribute' | Change a Mark attribute. |
ProtectionOperation
Describes an affected part of the document without including its content.
Properties
kind(ProtectionOperationKind): Mutation category.from(number): Start position in the document before the transaction.to(number): End position in that document. Newly inserted content maps to its insertion point.nodeType?(string): Affected Node type, when applicable.markType?(string): Affected Mark type, when applicable.attribute?(string): Affected attribute, when applicable.
PermissionDecision
Result of resolving one permission.
Properties
allowed(boolean): Whether the permission is granted.ruleIds(string[]): IDs of winning rules that have IDs, in declaration order.ruleIndexes(number[]): Zero-based indexes of winning rules, including anonymous rules.reasons(string[]): Winning rules' reasons in declaration order; absent reasons are omitted.
ProtectionViolation
One reason a transaction is refused.
Properties
code('editDenied' | 'readDenied' | 'unsupportedStep'): Refusal category.operation(ProtectionOperation | null): Denied operation;nullfor an unsupported Step.ruleIds(string[]): Winning rule IDs, when supplied.ruleIndexes(number[]): Zero-based winning rule indexes.reasons(string[]): Matching refusal explanations.
ProtectionCheck
Result of checking a proposed transaction.
Properties
allowed(boolean):truewhen every operation is allowed.violations(ProtectionViolation[]): Refusals in deterministic position/operation order; empty when allowed.documentRevision(number | null): Editor document revision, ornullfor pure checks.policyRevision(number | null): Editor policy revision, ornullfor pure checks.
ProtectionRejection
Extends ProtectionCheck with allowed: false.
PermissionSummary
Aggregate permissions for a range. A region with editable text but protected attributes can report edit: 'some'.
Properties
read('all' | 'some' | 'none'): How much of the range is readable.edit('all' | 'some' | 'none'): Whether all, some or no evaluated edits are permitted.ruleIds(string[]): Contributing rule IDs, when supplied.ruleIndexes(number[]): Zero-based contributing rule indexes.
ProtectionSubject
An existing target to explain, discriminated by target.
target | Additional properties |
|---|---|
'node', 'nodeType', 'nodeContent', 'children' | pos (number): Node opening position; -1 for the document root. |
'attribute' | pos (number): Node position. name (string): Attribute name. |
'mark', 'markType', 'markContent' | from (number), to (number): Marked range. type (string): Mark name. |
'markAttribute' | from (number), to (number): Marked range. type (string): Mark name. name (string): Attribute name. |
The named Mark must cover the entire range. Invalid positions, absent Marks and unknown attribute names throw ProtectionInputError.
ProtectionExplanation
Permission decisions for one subject.
Properties
subject(ProtectionSubject): The inspected target.read(PermissionDecision | null): Read decision;nullforchildren.edit(PermissionDecision): Effective edit decision, including read restrictions.concealedBy(string[]): IDs of enclosing read-deny rules that conceal this target. Anonymous rules have no ID to include.
PolicyUpdate
An installed policy change.
Properties
policy(ContentProtectionPolicy): The new policy.policyRevision(number): Revision after the update.
ContentProtectionRejectedEvent
Extends ProtectionRejection with editor (Editor): the editor that refused the transaction. Contains diagnostics, not the transaction or hidden content.
ContentProtectionPolicyUpdateEvent
Extends PolicyUpdate with editor (Editor): the editor whose policy changed.
ContentProtectionPolicyErrorEvent
Properties
editor(Editor): The editor that rejected the policy update.issues(PolicyIssue[]): Configuration diagnostics.
ReadableMark
A visible Mark in a readable projection.
Properties
type(string): Mark type name.attrs?(Record<string, JsonValue>): Visible Mark attributes.
ReadableNode
A presentation-tree entry, discriminated by kind. This is not a Tiptap JSON Node.
kind: 'node'
type(string): Visible Node type or a projection wrapper for partially concealed content.attrs?(Record<string, JsonValue>): Visible Node attributes.marks?(ReadableMark[]): Visible Marks.content(ReadableNode[]): Readable children.
kind: 'text'
text(string): Visible text.marks(ReadableMark[]): Visible Marks.
kind: 'redacted'
inline(boolean): Whether the placeholder occupies an inline position.label(string): Neutral replacement text, supplied throughredactionText.
Redacted entries contain no original type, ID, attributes, Marks, text or content length.
ReadableContent
Output from getReadableContent.
Properties
content(ReadableNode[]): Presentation tree, retaining partial ancestor wrappers where needed.text(string): Plain-text representation of that tree.