/** * Single enforcement owner for effective editability. * * Computes and applies the final editability state by reading: * 1. editor.storage.protection.state (protection enforcement) * 2. editor.storage.permissionRanges (allowed ranges for current user) * 3. editor.options.documentMode (consumer-set mode) * * Priority: protection enforcement > permission-range override > documentMode > consumer setEditable() * * Called after every event that could change the effective state: * - setDocumentMode() * - setEditingRestriction / clearEditingRestriction * - permission-ranges plugin apply() * - partChanged for word/settings.xml (remote sync) */ /** * Shape of editor.storage.protection, used for typed access across modules. * @typedef {{ * state: import('@superdoc/document-api').DocumentProtectionState; * initialized: boolean; * editableBaseline: boolean | null; * }} ProtectionStorage */ /** * Cast editor.storage.protection to its typed shape. * @param {import('../../core/Editor.js').Editor} editor * @returns {ProtectionStorage | undefined} */ export function getProtectionStorage(editor: import('../../core/Editor.js').Editor): ProtectionStorage | undefined; /** * Returns true when the document has runtime-enforced read-only protection. * @param {import('../../core/Editor.js').Editor} editor * @returns {boolean} */ export function isReadOnlyProtectionRuntimeEnforced(editor: import('../../core/Editor.js').Editor): boolean; /** * Returns true when the editor is effectively read-only, considering both * protection state and consumer documentMode. * @param {import('../../core/Editor.js').Editor} editor * @returns {boolean} */ export function isEffectivelyReadOnly(editor: import('../../core/Editor.js').Editor): boolean; /** * Refilter allowedRanges from allRanges using current protection state and * user principal matching, then compute and apply effective editability. * * This does NOT dispatch a synthetic PM transaction. It operates entirely * on storage and editor state. * * @param {import('../../core/Editor.js').Editor} editor * @param {{ refilterRanges?: boolean }} [opts] */ export function applyEffectiveEditability(editor: import('../../core/Editor.js').Editor, opts?: { refilterRanges?: boolean; }): void; /** * Build the set of identifiers the current user matches against. * Prefers explicit `permissionPrincipals` if set; falls back to email derivation. * * Exported so the permission-ranges extension can share the same logic * without duplicating the identifier derivation rules. * * @param {import('../../core/Editor.js').Editor} editor * @returns {Set} */ export function buildAllowedIdentifierSetFromEditor(editor: import('../../core/Editor.js').Editor): Set; /** * Shape of editor.storage.protection, used for typed access across modules. */ export type ProtectionStorage = { state: import('@superdoc/document-api').DocumentProtectionState; initialized: boolean; editableBaseline: boolean | null; }; //# sourceMappingURL=editability.d.ts.map