Packages
ckeditor5_phoenix
1.27.2
1.28.2
1.28.1
1.28.0
1.27.2
1.27.1
1.27.0
1.26.0
1.25.1
1.25.0
1.24.2
1.24.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.0
1.17.2
1.17.1
1.17.0
1.16.1
1.16.0
1.15.8
1.15.7
1.15.6
1.15.5
1.15.4
1.15.3
1.15.2
1.15.1
1.15.0
1.14.2
1.14.1
1.14.0
1.13.0
1.12.0
1.11.0
1.10.2
1.10.1
1.10.0
1.9.0
1.8.0
1.7.0
1.6.0
1.5.0
1.4.1
1.4.0
1.3.0
1.2.1
1.2.0
1.1.0
1.0.8
1.0.7
CKEditor 5 integration for Phoenix Framework
Current section
Files
Jump to
Current section
Files
dist/hooks/root-value-sentinel/root-value-sentinel.d.ts
import { Editor } from 'ckeditor5';
export declare class RootValueSentinel {
/**
* The DOM element being observed for attribute changes.
*/
private el;
/**
* The name of the specific root in a multi-root editor setup.
*/
private readonly rootName;
/**
* The name of the HTML attribute storing the value.
*/
private readonly valueAttrName;
/**
* The name of the HTML attribute storing the root attributes.
*/
private readonly rootAttrsAttrName;
/**
* A flag indicating whether the sentinel has been destroyed, used to prevent operations after cleanup.
*/
private isDestroyed;
/**
* Cleanup callbacks to be executed when the sentinel is destroyed.
*/
private cleanupCallbacks;
/**
* The editor instance.
*/
private editor;
/**
* When the editor is focused and the value attribute changes, we want to wait until it blurs to
* avoid disrupting the user while typing. This variable holds the pending value that should be applied
* once the editor blurs. It is set to null when there is no pending value or when the user makes changes in the editor,
* indicating that the pending value should be discarded.
*/
private pendingValue;
/**
* Cache the previous value to avoid reacting to attribute changes that don't actually change the value.
* This can happen when the parent LiveView re-renders and sets the same value again, which would otherwise cause an
* unnecessary update in the editor.
*/
private previousValue;
/**
* Updater created once the editor is ready. Tracks which root attributes
* were applied by this sentinel so it can clean them up independently of
* other consumers.
*/
private attrsUpdater;
/**
* When the hook is mounted, we will wait for the editor to be registered and then set the initial value of the root.
* Accepts an options object to configure element, identifiers, and custom attribute names.
*/
constructor({ el, editor, rootName, valueAttrName, rootAttrsAttrName, }: RootValueSentinelOptions);
/**
* Helper to read and parse attributes from the element.
* It uses dynamically provided attribute names.
*/
private get attrs();
/**
* When the value attribute changes, we want to update the editor root value.
* However, if the editor is focused, we want to wait until it blurs to avoid disrupting the user while typing.
*/
updated(): Promise<void>;
/**
* Sets up focus-aware sync handlers on the editor.
* Registers cleanup via onBeforeDestroy.
*/
private setupSyncHandlers;
/**
* Sets the value of a specific root in the editor.
*/
private setRootValue;
/**
* Disconnects the observer and cleans up editor event listeners.
* This should be called manually when the element is removed from the DOM.
*/
destroy(): void;
}
export type RootValueSentinelOptions = {
/**
* The DOM element being observed for attribute changes.
*/
el: HTMLElement;
/**
* Editor instance.
*/
editor: Editor;
/**
* The name of the specific root in a multi-root editor setup.
*/
rootName: string;
/**
* The name of the HTML attribute storing the value. Defaults to 'data-cke-value'.
*/
valueAttrName?: string;
/**
* The name of the HTML attribute storing the root attributes. Defaults to 'data-cke-root-attrs'.
*/
rootAttrsAttrName?: string;
};
//# sourceMappingURL=root-value-sentinel.d.ts.map