Socket
Socket
Sign inDemoInstall

roosterjs-content-model-types

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

roosterjs-content-model-types - npm Package Compare versions

Comparing version 0.21.2 to 0.22.0

lib-amd/event/ContentModelSelectionChangedEvent.d.ts

30

lib-amd/editor/IStandaloneEditor.d.ts

@@ -0,1 +1,4 @@

import type { DOMEventRecord } from '../parameter/DOMEventRecord';
import type { SnapshotsManager } from '../parameter/SnapshotsManager';
import type { Snapshot } from '../parameter/Snapshot';
import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';

@@ -10,3 +13,3 @@ import type { ContentModelDocument } from '../group/ContentModelDocument';

import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
import type { EditorUndoState, PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
import type { PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
/**

@@ -46,3 +49,3 @@ * An interface of standalone Content Model editor.

*/
setDOMSelection(selection: DOMSelection): void;
setDOMSelection(selection: DOMSelection | null): void;
/**

@@ -86,5 +89,5 @@ * The general API to do format change with Content Model

/**
* Whether there is an available undo/redo snapshot
* Get undo snapshots manager
*/
getUndoState(): EditorUndoState;
getSnapshotsManager(): SnapshotsManager;
/**

@@ -102,2 +105,21 @@ * Check if the editor is in dark mode

getZoomScale(): number;
/**
* Add a single undo snapshot to undo stack
*/
takeSnapshot(): void;
/**
* Restore an undo snapshot into editor
* @param snapshot The snapshot to restore
*/
restoreSnapshot(snapshot: Snapshot): void;
/**
* Check if editor is in IME input sequence
* @returns True if editor is in IME input sequence, otherwise false
*/
isInIME(): boolean;
/**
* Attach a DOM event to the editor content DIV
* @param eventMap A map from event name to its handler
*/
attachDomEvent(eventMap: Record<string, DOMEventRecord>): () => void;
}

206

lib-amd/editor/StandaloneEditorCore.d.ts

@@ -1,3 +0,6 @@

import type { CompatibleColorTransformDirection, CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
import type { ColorTransformDirection, ContentChangedData, ContentMetadata, DOMEventHandler, DarkColorHandler, EditorPlugin, GetContentMode, ImageSelectionRange, InsertOption, NodePosition, PluginEvent, PositionType, Rect, SelectionPath, SelectionRangeEx, StyleBasedFormatState, TableSelection, TableSelectionRange, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { DOMEventRecord } from '../parameter/DOMEventRecord';
import type { Snapshot } from '../parameter/Snapshot';
import type { EntityState } from '../parameter/FormatWithContentModelContext';
import type { CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
import type { ContentMetadata, DarkColorHandler, EditorPlugin, GetContentMode, InsertOption, NodePosition, PluginEvent, Rect, StyleBasedFormatState, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { ContentModelDocument } from '../group/ContentModelDocument';

@@ -42,4 +45,5 @@ import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';

* @param selection The selection to set
* @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent
*/
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection | null, skipSelectionChangedEvent?: boolean) => void;
/**

@@ -62,13 +66,2 @@ * The general API to do format change with Content Model

/**
* TODO: Remove this Core API and use setDOMSelection instead
* Select content according to the given information.
* There are a bunch of allowed combination of parameters. See IEditor.select for more details
* @param core The editor core object
* @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
* @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
* @param arg3 (optional) A Node
* @param arg4 (optional) An offset number, or a PositionType
*/
export declare type Select = (core: StandaloneEditorCore, arg1: Range | SelectionRangeEx | NodePosition | Node | SelectionPath | null, arg2?: NodePosition | number | PositionType | TableSelection | null, arg3?: Node, arg4?: number | PositionType) => boolean;
/**
* Trigger a plugin event

@@ -81,29 +74,10 @@ * @param core The StandaloneEditorCore object

/**
* Get current selection range
* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @returns A Range object of the selection range
*/
export declare type GetSelectionRangeEx = (core: StandaloneEditorCore) => SelectionRangeEx;
/**
* Edit and transform color of elements between light mode and dark mode
* @param core The StandaloneEditorCore object
* @param rootNode The root HTML node to transform
* @param includeSelf True to transform the root node as well, otherwise false
* @param callback The callback function to invoke before do color transformation
* @param direction To specify the transform direction, light to dark, or dark to light
* @param forceTransform By default this function will only work when editor core is in dark mode.
* Pass true to this value to force do color transformation even editor core is in light mode
* @param fromDarkModel Whether the given content is already in dark mode
*/
export declare type TransformColor = (core: StandaloneEditorCore, rootNode: Node | null, includeSelf: boolean, callback: (() => void) | null, direction: ColorTransformDirection | CompatibleColorTransformDirection, forceTransform?: boolean, fromDarkMode?: boolean) => void;
/**
* Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
* Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
* @param core The StandaloneEditorCore object
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
* @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
* @param entityStates @optional Entity states related to this snapshot.
* Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, canUndoByBackspace: boolean, entityStates?: EntityState[]) => void;
/**

@@ -115,27 +89,2 @@ * Retrieves the rect of the visible viewport of the editor.

/**
* Change the editor selection to the given range
* @param core The StandaloneEditorCore object
* @param range The range to select
* @param skipSameRange When set to true, do nothing if the given range is the same with current selection
* in editor, otherwise it will always remove current selection range and set to the given one.
* This parameter is always treated as true in Edge to avoid some weird runtime exception.
*/
export declare type SelectRange = (core: StandaloneEditorCore, range: Range, skipSameRange?: boolean) => boolean;
/**
* Select a table and save data of the selected range
* @param core The StandaloneEditorCore object
* @param image image to select
* @returns true if successful
*/
export declare type SelectImage = (core: StandaloneEditorCore, image: HTMLImageElement | null) => ImageSelectionRange | null;
/**
* Select a table and save data of the selected range
* @param core The StandaloneEditorCore object
* @param table table to select
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
* selecting, will unselect the table.
* @returns true if successful
*/
export declare type SelectTable = (core: StandaloneEditorCore, table: HTMLTableElement | null, coordinates?: TableSelection) => TableSelectionRange | null;
/**
* Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered

@@ -149,9 +98,2 @@ * if triggerContentChangedEvent is set to true

/**
* Get current or cached selection range
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
export declare type GetSelectionRange = (core: StandaloneEditorCore, tryGetFromCache: boolean) => Range | null;
/**
* Check if the editor has focus now

@@ -178,3 +120,3 @@ * @param core The StandaloneEditorCore object

*/
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventRecord>) => () => void;
/**

@@ -198,3 +140,3 @@ * Get current editor content as HTML string

*/
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, snapshot: Snapshot) => void;
/**

@@ -240,2 +182,3 @@ * Ensure user will type into a container element rather than into the editor content DIV directly

* @param selection The selection to set
* @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent
*/

@@ -264,80 +207,47 @@ setDOMSelection: SetDOMSelection;

getVisibleViewport: GetVisibleViewport;
}
/**
* Temp interface
* TODO: Port these core API
*/
export interface UnportedCoreApiMap {
/**
* Select content according to the given information.
* There are a bunch of allowed combination of parameters. See IEditor.select for more details
* @param core The editor core object
* @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
* @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
* @param arg3 (optional) A Node
* @param arg4 (optional) An offset number, or a PositionType
*/
select: Select;
/**
* Trigger a plugin event
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
* @returns True if the editor has focus, otherwise false
*/
triggerEvent: TriggerEvent;
hasFocus: HasFocus;
/**
* Get current or cached selection range
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
getSelectionRangeEx: GetSelectionRangeEx;
focus: Focus;
/**
* Edit and transform color of elements between light mode and dark mode
* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param rootNode The root HTML element to transform
* @param includeSelf True to transform the root node as well, otherwise false
* @param callback The callback function to invoke before do color transformation
* @param direction To specify the transform direction, light to dark, or dark to light
* @param forceTransform By default this function will only work when editor core is in dark mode.
* Pass true to this value to force do color transformation even editor core is in light mode
* @param fromDarkModel Whether the given content is already in dark mode
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
* @param entityStates @optional Entity states related to this snapshot.
* Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
transformColor: TransformColor;
/**
* Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
* Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
* @param core The StandaloneEditorCore object
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
* @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
*/
addUndoSnapshot: AddUndoSnapshot;
/**
* Change the editor selection to the given range
* @param core The StandaloneEditorCore object
* @param range The range to select
* @param skipSameRange When set to true, do nothing if the given range is the same with current selection
* in editor, otherwise it will always remove current selection range and set to the given one.
* This parameter is always treated as true in Edge to avoid some weird runtime exception.
* Restore an undo snapshot into editor
* @param core The editor core object
* @param step Steps to move, can be 0, positive or negative
*/
selectRange: SelectRange;
restoreUndoSnapshot: RestoreUndoSnapshot;
/**
* Select a image and save data of the selected range
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param image image to select
* @param imageId the id of the image element
* @returns true if successful
* @param eventMap A map from event name to its handler
*/
selectImage: SelectImage;
attachDomEvent: AttachDomEvent;
/**
* Select a table and save data of the selected range
* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param table table to select
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
* selecting, will unselect the table.
* @param shouldAddStyles Whether need to update the style elements
* @returns true if successful
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
selectTable: SelectTable;
triggerEvent: TriggerEvent;
}
/**
* Temp interface
* TODO: Port these core API
*/
export interface UnportedCoreApiMap {
/**

@@ -352,20 +262,2 @@ * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered

/**
* Get current or cached selection range
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
getSelectionRange: GetSelectionRange;
/**
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @returns True if the editor has focus, otherwise false
*/
hasFocus: HasFocus;
/**
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
*/
focus: Focus;
/**
* Insert a DOM node into editor content

@@ -377,10 +269,2 @@ * @param core The StandaloneEditorCore object. No op if null.

/**
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param eventName The DOM event name
* @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered
* @param beforeDispatch Optional callback function to be invoked when the DOM event is triggered before trigger plugin event
*/
attachDomEvent: AttachDomEvent;
/**
* Get current editor content as HTML string

@@ -399,8 +283,2 @@ * @param core The StandaloneEditorCore object

/**
* Restore an undo snapshot into editor
* @param core The editor core object
* @param step Steps to move, can be 0, positive or negative
*/
restoreUndoSnapshot: RestoreUndoSnapshot;
/**
* Ensure user will type into a container element rather than into the editor content DIV directly

@@ -407,0 +285,0 @@ * @param core The EditorCore object.

@@ -0,1 +1,3 @@

import type { CopyPastePluginState } from '../pluginState/CopyPastePluginState';
import type { UndoPluginState } from '../pluginState/UndoPluginState';
import type { SelectionPluginState } from '../pluginState/SelectionPluginState';

@@ -7,3 +9,3 @@ import type { EntityPluginState } from '../pluginState/EntityPluginState';

import type { ContentModelFormatPluginState } from '../pluginState/ContentModelFormatPluginState';
import type { CopyPastePluginState, PluginWithState } from 'roosterjs-editor-types';
import type { PluginWithState } from 'roosterjs-editor-types';
/**

@@ -38,2 +40,6 @@ * Core plugins for standalone editor

/**
* Undo plugin provides the ability to undo/redo
*/
readonly undo: PluginWithState<UndoPluginState>;
/**
* Lifecycle plugin handles editor initialization and disposing

@@ -40,0 +46,0 @@ */

@@ -7,2 +7,3 @@ import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';

import type { ContentModelDocument } from '../group/ContentModelDocument';
import type { SnapshotsManager } from '../parameter/SnapshotsManager';
/**

@@ -79,2 +80,7 @@ * Options for Content Model editor

inDarkMode?: boolean;
/**
* Undo snapshot service based on content metadata. Use this parameter to customize the undo snapshot service.
* When this property is set, value of undoSnapshotService will be ignored.
*/
snapshotsManager?: SnapshotsManager;
}

@@ -0,1 +1,2 @@

import type { EntityState } from '../parameter/FormatWithContentModelContext';
import type { ContentModelEntity } from '../entity/ContentModelEntity';

@@ -19,3 +20,3 @@ import type { EntityRemovalOperation } from '../enum/EntityOperation';

/**
* @optional Raw DOM event that causes the chagne
* @optional Raw DOM event that causes the change
*/

@@ -40,2 +41,6 @@ rawEvent?: Event;

readonly changedEntities?: ChangedEntity[];
/**
* Entity states related to this event
*/
readonly entityStates?: EntityState[];
}

@@ -42,0 +47,0 @@ /**

@@ -9,5 +9,6 @@ import type { BorderBoxFormat } from './formatParts/BorderBoxFormat';

import type { TableLayoutFormat } from './formatParts/TableLayoutFormat';
import type { SizeFormat } from './formatParts/SizeFormat';
/**
* Format of Table
*/
export declare type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat & BorderBoxFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat;
export declare type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat & BorderBoxFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat & SizeFormat;

@@ -95,2 +95,3 @@ export { ContentModelSegmentFormat } from './format/ContentModelSegmentFormat';

export { TableSelectionContext } from './selection/TableSelectionContext';
export { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';
export { ContentModelHandlerMap, DefaultImplicitFormatMap, FormatAppliers, FormatAppliersPerCategory, OnNodeCreated, ModelToDomSettings, FormatApplier, ApplyMetadata, MetadataApplier, MetadataAppliers, } from './context/ModelToDomSettings';

@@ -115,3 +116,3 @@ export { DefaultStyleMap, ElementProcessorMap, FormatParsers, FormatParsersPerCategory, DomToModelSettings, FormatParser, } from './context/DomToModelSettings';

export { StandaloneEditorOptions } from './editor/StandaloneEditorOptions';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, StandaloneEditorDefaultSettings, SwitchShadowEdit, Select, TriggerEvent, GetSelectionRangeEx, TransformColor, AddUndoSnapshot, SelectRange, PortedCoreApiMap, UnportedCoreApiMap, SelectImage, SelectTable, SetContent, GetSelectionRange, HasFocus, Focus, InsertNode, AttachDomEvent, GetContent, GetStyleBasedFormatState, RestoreUndoSnapshot, EnsureTypeInContainer, GetVisibleViewport, } from './editor/StandaloneEditorCore';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, StandaloneEditorDefaultSettings, SwitchShadowEdit, TriggerEvent, AddUndoSnapshot, PortedCoreApiMap, UnportedCoreApiMap, SetContent, HasFocus, Focus, InsertNode, AttachDomEvent, GetContent, GetStyleBasedFormatState, RestoreUndoSnapshot, EnsureTypeInContainer, GetVisibleViewport, } from './editor/StandaloneEditorCore';
export { StandaloneEditorCorePlugins } from './editor/StandaloneEditorCorePlugins';

@@ -125,4 +126,6 @@ export { ContentModelCachePluginState } from './pluginState/ContentModelCachePluginState';

export { SelectionPluginState } from './pluginState/SelectionPluginState';
export { UndoPluginState } from './pluginState/UndoPluginState';
export { CopyPastePluginState } from './pluginState/CopyPastePluginState';
export { EditorEnvironment } from './parameter/EditorEnvironment';
export { DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';
export { EntityState, DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';
export { FormatWithContentModelOptions, ContentModelFormatter, } from './parameter/FormatWithContentModelOptions';

@@ -134,3 +137,9 @@ export { ContentModelFormatState } from './parameter/ContentModelFormatState';

export { DeleteSelectionContext, DeleteSelectionResult, DeleteSelectionStep, ValidDeleteSelectionContext, } from './parameter/DeleteSelectionStep';
export { SnapshotSelectionBase, RangeSnapshotSelection, ImageSnapshotSelection, TableSnapshotSelection, SnapshotSelection, Snapshot, Snapshots, } from './parameter/Snapshot';
export { SnapshotsManager } from './parameter/SnapshotsManager';
export { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';
export { EdgeLinkPreview } from './parameter/EdgeLinkPreview';
export { ClipboardData } from './parameter/ClipboardData';
export { ContentModelBeforePasteEvent, ContentModelBeforePasteEventData, CompatibleContentModelBeforePasteEvent, } from './event/ContentModelBeforePasteEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, ChangedEntity, } from './event/ContentModelContentChangedEvent';
export { CompatibleContentModelSelectionChangedEvent, ContentModelSelectionChangedEvent, ContentModelSelectionChangedEventData, } from './event/ContentModelSelectionChangedEvent';

@@ -6,2 +6,21 @@ import type { ContentModelEntity } from '../entity/ContentModelEntity';

/**
* State for an entity. This is used for storing entity undo snapshot
*/
export interface EntityState {
/**
* Type of the entity
*/
type: string;
/**
* Id of the entity
*/
id: string;
/**
* The state of this entity to store into undo snapshot.
* The state can be any string, or a serialized JSON object.
* We are using string here instead of a JSON object to make sure the whole state is serializable.
*/
state: string;
}
/**
* Represents an entity that is deleted by a specified entity operation

@@ -58,2 +77,12 @@ */

newPendingFormat?: ContentModelSegmentFormat | 'preserve';
/**
* @optional Entity states related to the format API that will be added together with undo snapshot.
* When entity states are set, each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
entityStates?: EntityState[];
/**
* @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).
*/
canUndoByBackspace?: boolean;
}

@@ -1,2 +0,2 @@

import type { ImageSelectionRange, TableSelectionRange } from 'roosterjs-editor-types';
import type { DOMSelection } from '../selection/DOMSelection';
/**

@@ -9,12 +9,4 @@ * The state object for SelectionPlugin

*/
selectionRange: Range | null;
selection: DOMSelection | null;
/**
* Table selection range
*/
tableSelectionRange: TableSelectionRange | null;
/**
* Image selection range
*/
imageSelectionRange: ImageSelectionRange | null;
/**
* A style node in current document to help implement image and table selection

@@ -21,0 +13,0 @@ */

@@ -0,3 +1,5 @@

import type { CopyPastePluginState } from './CopyPastePluginState';
import type { UndoPluginState } from './UndoPluginState';
import type { SelectionPluginState } from './SelectionPluginState';
import type { CopyPastePluginState, EditPluginState, UndoPluginState } from 'roosterjs-editor-types';
import type { EditPluginState } from 'roosterjs-editor-types';
import type { ContentModelCachePluginState } from './ContentModelCachePluginState';

@@ -41,2 +43,6 @@ import type { ContentModelFormatPluginState } from './ContentModelFormatPluginState';

selection: SelectionPluginState;
/**
* Plugin state for UndoPlugin
*/
undo: UndoPluginState;
}

@@ -48,4 +54,3 @@ /**

export interface UnportedCorePluginState {
undo: UndoPluginState;
edit: EditPluginState;
}

@@ -0,1 +1,2 @@

import type { TableSelectionCoordinates } from '../selection/TableSelectionCoordinates';
/**

@@ -42,3 +43,3 @@ * Type of DOM selection, it can be one of the 3 below:

*/
export interface TableSelection extends SelectionBase<'table'> {
export interface TableSelection extends TableSelectionCoordinates, SelectionBase<'table'> {
/**

@@ -48,18 +49,2 @@ * The table that this selection is representing

table: HTMLTableElement;
/**
* Number of first selected row
*/
firstRow: number;
/**
* Number of last selected row
*/
lastRow: number;
/**
* Number of first selected column
*/
firstColumn: number;
/**
* Number of last selected column
*/
lastColumn: number;
}

@@ -66,0 +51,0 @@ /**

@@ -0,1 +1,4 @@

import type { DOMEventRecord } from '../parameter/DOMEventRecord';
import type { SnapshotsManager } from '../parameter/SnapshotsManager';
import type { Snapshot } from '../parameter/Snapshot';
import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';

@@ -10,3 +13,3 @@ import type { ContentModelDocument } from '../group/ContentModelDocument';

import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
import type { EditorUndoState, PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
import type { PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
/**

@@ -46,3 +49,3 @@ * An interface of standalone Content Model editor.

*/
setDOMSelection(selection: DOMSelection): void;
setDOMSelection(selection: DOMSelection | null): void;
/**

@@ -86,5 +89,5 @@ * The general API to do format change with Content Model

/**
* Whether there is an available undo/redo snapshot
* Get undo snapshots manager
*/
getUndoState(): EditorUndoState;
getSnapshotsManager(): SnapshotsManager;
/**

@@ -102,2 +105,21 @@ * Check if the editor is in dark mode

getZoomScale(): number;
/**
* Add a single undo snapshot to undo stack
*/
takeSnapshot(): void;
/**
* Restore an undo snapshot into editor
* @param snapshot The snapshot to restore
*/
restoreSnapshot(snapshot: Snapshot): void;
/**
* Check if editor is in IME input sequence
* @returns True if editor is in IME input sequence, otherwise false
*/
isInIME(): boolean;
/**
* Attach a DOM event to the editor content DIV
* @param eventMap A map from event name to its handler
*/
attachDomEvent(eventMap: Record<string, DOMEventRecord>): () => void;
}

@@ -1,3 +0,6 @@

import type { CompatibleColorTransformDirection, CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
import type { ColorTransformDirection, ContentChangedData, ContentMetadata, DOMEventHandler, DarkColorHandler, EditorPlugin, GetContentMode, ImageSelectionRange, InsertOption, NodePosition, PluginEvent, PositionType, Rect, SelectionPath, SelectionRangeEx, StyleBasedFormatState, TableSelection, TableSelectionRange, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { DOMEventRecord } from '../parameter/DOMEventRecord';
import type { Snapshot } from '../parameter/Snapshot';
import type { EntityState } from '../parameter/FormatWithContentModelContext';
import type { CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
import type { ContentMetadata, DarkColorHandler, EditorPlugin, GetContentMode, InsertOption, NodePosition, PluginEvent, Rect, StyleBasedFormatState, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { ContentModelDocument } from '../group/ContentModelDocument';

@@ -42,4 +45,5 @@ import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';

* @param selection The selection to set
* @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent
*/
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection | null, skipSelectionChangedEvent?: boolean) => void;
/**

@@ -62,13 +66,2 @@ * The general API to do format change with Content Model

/**
* TODO: Remove this Core API and use setDOMSelection instead
* Select content according to the given information.
* There are a bunch of allowed combination of parameters. See IEditor.select for more details
* @param core The editor core object
* @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
* @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
* @param arg3 (optional) A Node
* @param arg4 (optional) An offset number, or a PositionType
*/
export declare type Select = (core: StandaloneEditorCore, arg1: Range | SelectionRangeEx | NodePosition | Node | SelectionPath | null, arg2?: NodePosition | number | PositionType | TableSelection | null, arg3?: Node, arg4?: number | PositionType) => boolean;
/**
* Trigger a plugin event

@@ -81,29 +74,10 @@ * @param core The StandaloneEditorCore object

/**
* Get current selection range
* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @returns A Range object of the selection range
*/
export declare type GetSelectionRangeEx = (core: StandaloneEditorCore) => SelectionRangeEx;
/**
* Edit and transform color of elements between light mode and dark mode
* @param core The StandaloneEditorCore object
* @param rootNode The root HTML node to transform
* @param includeSelf True to transform the root node as well, otherwise false
* @param callback The callback function to invoke before do color transformation
* @param direction To specify the transform direction, light to dark, or dark to light
* @param forceTransform By default this function will only work when editor core is in dark mode.
* Pass true to this value to force do color transformation even editor core is in light mode
* @param fromDarkModel Whether the given content is already in dark mode
*/
export declare type TransformColor = (core: StandaloneEditorCore, rootNode: Node | null, includeSelf: boolean, callback: (() => void) | null, direction: ColorTransformDirection | CompatibleColorTransformDirection, forceTransform?: boolean, fromDarkMode?: boolean) => void;
/**
* Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
* Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
* @param core The StandaloneEditorCore object
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
* @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
* @param entityStates @optional Entity states related to this snapshot.
* Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, canUndoByBackspace: boolean, entityStates?: EntityState[]) => void;
/**

@@ -115,27 +89,2 @@ * Retrieves the rect of the visible viewport of the editor.

/**
* Change the editor selection to the given range
* @param core The StandaloneEditorCore object
* @param range The range to select
* @param skipSameRange When set to true, do nothing if the given range is the same with current selection
* in editor, otherwise it will always remove current selection range and set to the given one.
* This parameter is always treated as true in Edge to avoid some weird runtime exception.
*/
export declare type SelectRange = (core: StandaloneEditorCore, range: Range, skipSameRange?: boolean) => boolean;
/**
* Select a table and save data of the selected range
* @param core The StandaloneEditorCore object
* @param image image to select
* @returns true if successful
*/
export declare type SelectImage = (core: StandaloneEditorCore, image: HTMLImageElement | null) => ImageSelectionRange | null;
/**
* Select a table and save data of the selected range
* @param core The StandaloneEditorCore object
* @param table table to select
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
* selecting, will unselect the table.
* @returns true if successful
*/
export declare type SelectTable = (core: StandaloneEditorCore, table: HTMLTableElement | null, coordinates?: TableSelection) => TableSelectionRange | null;
/**
* Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered

@@ -149,9 +98,2 @@ * if triggerContentChangedEvent is set to true

/**
* Get current or cached selection range
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
export declare type GetSelectionRange = (core: StandaloneEditorCore, tryGetFromCache: boolean) => Range | null;
/**
* Check if the editor has focus now

@@ -178,3 +120,3 @@ * @param core The StandaloneEditorCore object

*/
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventRecord>) => () => void;
/**

@@ -198,3 +140,3 @@ * Get current editor content as HTML string

*/
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, snapshot: Snapshot) => void;
/**

@@ -240,2 +182,3 @@ * Ensure user will type into a container element rather than into the editor content DIV directly

* @param selection The selection to set
* @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent
*/

@@ -264,80 +207,47 @@ setDOMSelection: SetDOMSelection;

getVisibleViewport: GetVisibleViewport;
}
/**
* Temp interface
* TODO: Port these core API
*/
export interface UnportedCoreApiMap {
/**
* Select content according to the given information.
* There are a bunch of allowed combination of parameters. See IEditor.select for more details
* @param core The editor core object
* @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
* @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
* @param arg3 (optional) A Node
* @param arg4 (optional) An offset number, or a PositionType
*/
select: Select;
/**
* Trigger a plugin event
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
* @returns True if the editor has focus, otherwise false
*/
triggerEvent: TriggerEvent;
hasFocus: HasFocus;
/**
* Get current or cached selection range
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
getSelectionRangeEx: GetSelectionRangeEx;
focus: Focus;
/**
* Edit and transform color of elements between light mode and dark mode
* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param rootNode The root HTML element to transform
* @param includeSelf True to transform the root node as well, otherwise false
* @param callback The callback function to invoke before do color transformation
* @param direction To specify the transform direction, light to dark, or dark to light
* @param forceTransform By default this function will only work when editor core is in dark mode.
* Pass true to this value to force do color transformation even editor core is in light mode
* @param fromDarkModel Whether the given content is already in dark mode
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
* @param entityStates @optional Entity states related to this snapshot.
* Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
transformColor: TransformColor;
/**
* Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
* Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
* @param core The StandaloneEditorCore object
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
* @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
*/
addUndoSnapshot: AddUndoSnapshot;
/**
* Change the editor selection to the given range
* @param core The StandaloneEditorCore object
* @param range The range to select
* @param skipSameRange When set to true, do nothing if the given range is the same with current selection
* in editor, otherwise it will always remove current selection range and set to the given one.
* This parameter is always treated as true in Edge to avoid some weird runtime exception.
* Restore an undo snapshot into editor
* @param core The editor core object
* @param step Steps to move, can be 0, positive or negative
*/
selectRange: SelectRange;
restoreUndoSnapshot: RestoreUndoSnapshot;
/**
* Select a image and save data of the selected range
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param image image to select
* @param imageId the id of the image element
* @returns true if successful
* @param eventMap A map from event name to its handler
*/
selectImage: SelectImage;
attachDomEvent: AttachDomEvent;
/**
* Select a table and save data of the selected range
* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param table table to select
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
* selecting, will unselect the table.
* @param shouldAddStyles Whether need to update the style elements
* @returns true if successful
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
selectTable: SelectTable;
triggerEvent: TriggerEvent;
}
/**
* Temp interface
* TODO: Port these core API
*/
export interface UnportedCoreApiMap {
/**

@@ -352,20 +262,2 @@ * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered

/**
* Get current or cached selection range
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
getSelectionRange: GetSelectionRange;
/**
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @returns True if the editor has focus, otherwise false
*/
hasFocus: HasFocus;
/**
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
*/
focus: Focus;
/**
* Insert a DOM node into editor content

@@ -377,10 +269,2 @@ * @param core The StandaloneEditorCore object. No op if null.

/**
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param eventName The DOM event name
* @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered
* @param beforeDispatch Optional callback function to be invoked when the DOM event is triggered before trigger plugin event
*/
attachDomEvent: AttachDomEvent;
/**
* Get current editor content as HTML string

@@ -399,8 +283,2 @@ * @param core The StandaloneEditorCore object

/**
* Restore an undo snapshot into editor
* @param core The editor core object
* @param step Steps to move, can be 0, positive or negative
*/
restoreUndoSnapshot: RestoreUndoSnapshot;
/**
* Ensure user will type into a container element rather than into the editor content DIV directly

@@ -407,0 +285,0 @@ * @param core The EditorCore object.

@@ -0,1 +1,3 @@

import type { CopyPastePluginState } from '../pluginState/CopyPastePluginState';
import type { UndoPluginState } from '../pluginState/UndoPluginState';
import type { SelectionPluginState } from '../pluginState/SelectionPluginState';

@@ -7,3 +9,3 @@ import type { EntityPluginState } from '../pluginState/EntityPluginState';

import type { ContentModelFormatPluginState } from '../pluginState/ContentModelFormatPluginState';
import type { CopyPastePluginState, PluginWithState } from 'roosterjs-editor-types';
import type { PluginWithState } from 'roosterjs-editor-types';
/**

@@ -38,2 +40,6 @@ * Core plugins for standalone editor

/**
* Undo plugin provides the ability to undo/redo
*/
readonly undo: PluginWithState<UndoPluginState>;
/**
* Lifecycle plugin handles editor initialization and disposing

@@ -40,0 +46,0 @@ */

@@ -7,2 +7,3 @@ import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';

import type { ContentModelDocument } from '../group/ContentModelDocument';
import type { SnapshotsManager } from '../parameter/SnapshotsManager';
/**

@@ -79,2 +80,7 @@ * Options for Content Model editor

inDarkMode?: boolean;
/**
* Undo snapshot service based on content metadata. Use this parameter to customize the undo snapshot service.
* When this property is set, value of undoSnapshotService will be ignored.
*/
snapshotsManager?: SnapshotsManager;
}

@@ -0,1 +1,2 @@

import type { EntityState } from '../parameter/FormatWithContentModelContext';
import type { ContentModelEntity } from '../entity/ContentModelEntity';

@@ -19,3 +20,3 @@ import type { EntityRemovalOperation } from '../enum/EntityOperation';

/**
* @optional Raw DOM event that causes the chagne
* @optional Raw DOM event that causes the change
*/

@@ -40,2 +41,6 @@ rawEvent?: Event;

readonly changedEntities?: ChangedEntity[];
/**
* Entity states related to this event
*/
readonly entityStates?: EntityState[];
}

@@ -42,0 +47,0 @@ /**

@@ -9,5 +9,6 @@ import type { BorderBoxFormat } from './formatParts/BorderBoxFormat';

import type { TableLayoutFormat } from './formatParts/TableLayoutFormat';
import type { SizeFormat } from './formatParts/SizeFormat';
/**
* Format of Table
*/
export declare type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat & BorderBoxFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat;
export declare type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat & BorderBoxFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat & SizeFormat;

@@ -95,2 +95,3 @@ export { ContentModelSegmentFormat } from './format/ContentModelSegmentFormat';

export { TableSelectionContext } from './selection/TableSelectionContext';
export { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';
export { ContentModelHandlerMap, DefaultImplicitFormatMap, FormatAppliers, FormatAppliersPerCategory, OnNodeCreated, ModelToDomSettings, FormatApplier, ApplyMetadata, MetadataApplier, MetadataAppliers, } from './context/ModelToDomSettings';

@@ -115,3 +116,3 @@ export { DefaultStyleMap, ElementProcessorMap, FormatParsers, FormatParsersPerCategory, DomToModelSettings, FormatParser, } from './context/DomToModelSettings';

export { StandaloneEditorOptions } from './editor/StandaloneEditorOptions';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, StandaloneEditorDefaultSettings, SwitchShadowEdit, Select, TriggerEvent, GetSelectionRangeEx, TransformColor, AddUndoSnapshot, SelectRange, PortedCoreApiMap, UnportedCoreApiMap, SelectImage, SelectTable, SetContent, GetSelectionRange, HasFocus, Focus, InsertNode, AttachDomEvent, GetContent, GetStyleBasedFormatState, RestoreUndoSnapshot, EnsureTypeInContainer, GetVisibleViewport, } from './editor/StandaloneEditorCore';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, StandaloneEditorDefaultSettings, SwitchShadowEdit, TriggerEvent, AddUndoSnapshot, PortedCoreApiMap, UnportedCoreApiMap, SetContent, HasFocus, Focus, InsertNode, AttachDomEvent, GetContent, GetStyleBasedFormatState, RestoreUndoSnapshot, EnsureTypeInContainer, GetVisibleViewport, } from './editor/StandaloneEditorCore';
export { StandaloneEditorCorePlugins } from './editor/StandaloneEditorCorePlugins';

@@ -125,4 +126,6 @@ export { ContentModelCachePluginState } from './pluginState/ContentModelCachePluginState';

export { SelectionPluginState } from './pluginState/SelectionPluginState';
export { UndoPluginState } from './pluginState/UndoPluginState';
export { CopyPastePluginState } from './pluginState/CopyPastePluginState';
export { EditorEnvironment } from './parameter/EditorEnvironment';
export { DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';
export { EntityState, DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';
export { FormatWithContentModelOptions, ContentModelFormatter, } from './parameter/FormatWithContentModelOptions';

@@ -134,3 +137,9 @@ export { ContentModelFormatState } from './parameter/ContentModelFormatState';

export { DeleteSelectionContext, DeleteSelectionResult, DeleteSelectionStep, ValidDeleteSelectionContext, } from './parameter/DeleteSelectionStep';
export { SnapshotSelectionBase, RangeSnapshotSelection, ImageSnapshotSelection, TableSnapshotSelection, SnapshotSelection, Snapshot, Snapshots, } from './parameter/Snapshot';
export { SnapshotsManager } from './parameter/SnapshotsManager';
export { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';
export { EdgeLinkPreview } from './parameter/EdgeLinkPreview';
export { ClipboardData } from './parameter/ClipboardData';
export { ContentModelBeforePasteEvent, ContentModelBeforePasteEventData, CompatibleContentModelBeforePasteEvent, } from './event/ContentModelBeforePasteEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, ChangedEntity, } from './event/ContentModelContentChangedEvent';
export { CompatibleContentModelSelectionChangedEvent, ContentModelSelectionChangedEvent, ContentModelSelectionChangedEventData, } from './event/ContentModelSelectionChangedEvent';

@@ -6,2 +6,21 @@ import type { ContentModelEntity } from '../entity/ContentModelEntity';

/**
* State for an entity. This is used for storing entity undo snapshot
*/
export interface EntityState {
/**
* Type of the entity
*/
type: string;
/**
* Id of the entity
*/
id: string;
/**
* The state of this entity to store into undo snapshot.
* The state can be any string, or a serialized JSON object.
* We are using string here instead of a JSON object to make sure the whole state is serializable.
*/
state: string;
}
/**
* Represents an entity that is deleted by a specified entity operation

@@ -58,2 +77,12 @@ */

newPendingFormat?: ContentModelSegmentFormat | 'preserve';
/**
* @optional Entity states related to the format API that will be added together with undo snapshot.
* When entity states are set, each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
entityStates?: EntityState[];
/**
* @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).
*/
canUndoByBackspace?: boolean;
}

@@ -1,2 +0,2 @@

import type { ImageSelectionRange, TableSelectionRange } from 'roosterjs-editor-types';
import type { DOMSelection } from '../selection/DOMSelection';
/**

@@ -9,12 +9,4 @@ * The state object for SelectionPlugin

*/
selectionRange: Range | null;
selection: DOMSelection | null;
/**
* Table selection range
*/
tableSelectionRange: TableSelectionRange | null;
/**
* Image selection range
*/
imageSelectionRange: ImageSelectionRange | null;
/**
* A style node in current document to help implement image and table selection

@@ -21,0 +13,0 @@ */

@@ -0,3 +1,5 @@

import type { CopyPastePluginState } from './CopyPastePluginState';
import type { UndoPluginState } from './UndoPluginState';
import type { SelectionPluginState } from './SelectionPluginState';
import type { CopyPastePluginState, EditPluginState, UndoPluginState } from 'roosterjs-editor-types';
import type { EditPluginState } from 'roosterjs-editor-types';
import type { ContentModelCachePluginState } from './ContentModelCachePluginState';

@@ -41,2 +43,6 @@ import type { ContentModelFormatPluginState } from './ContentModelFormatPluginState';

selection: SelectionPluginState;
/**
* Plugin state for UndoPlugin
*/
undo: UndoPluginState;
}

@@ -48,4 +54,3 @@ /**

export interface UnportedCorePluginState {
undo: UndoPluginState;
edit: EditPluginState;
}

@@ -0,1 +1,2 @@

import type { TableSelectionCoordinates } from '../selection/TableSelectionCoordinates';
/**

@@ -42,3 +43,3 @@ * Type of DOM selection, it can be one of the 3 below:

*/
export interface TableSelection extends SelectionBase<'table'> {
export interface TableSelection extends TableSelectionCoordinates, SelectionBase<'table'> {
/**

@@ -48,18 +49,2 @@ * The table that this selection is representing

table: HTMLTableElement;
/**
* Number of first selected row
*/
firstRow: number;
/**
* Number of last selected row
*/
lastRow: number;
/**
* Number of first selected column
*/
firstColumn: number;
/**
* Number of last selected column
*/
lastColumn: number;
}

@@ -66,0 +51,0 @@ /**

@@ -0,1 +1,4 @@

import type { DOMEventRecord } from '../parameter/DOMEventRecord';
import type { SnapshotsManager } from '../parameter/SnapshotsManager';
import type { Snapshot } from '../parameter/Snapshot';
import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';

@@ -10,3 +13,3 @@ import type { ContentModelDocument } from '../group/ContentModelDocument';

import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
import type { EditorUndoState, PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
import type { PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
/**

@@ -46,3 +49,3 @@ * An interface of standalone Content Model editor.

*/
setDOMSelection(selection: DOMSelection): void;
setDOMSelection(selection: DOMSelection | null): void;
/**

@@ -86,5 +89,5 @@ * The general API to do format change with Content Model

/**
* Whether there is an available undo/redo snapshot
* Get undo snapshots manager
*/
getUndoState(): EditorUndoState;
getSnapshotsManager(): SnapshotsManager;
/**

@@ -102,2 +105,21 @@ * Check if the editor is in dark mode

getZoomScale(): number;
/**
* Add a single undo snapshot to undo stack
*/
takeSnapshot(): void;
/**
* Restore an undo snapshot into editor
* @param snapshot The snapshot to restore
*/
restoreSnapshot(snapshot: Snapshot): void;
/**
* Check if editor is in IME input sequence
* @returns True if editor is in IME input sequence, otherwise false
*/
isInIME(): boolean;
/**
* Attach a DOM event to the editor content DIV
* @param eventMap A map from event name to its handler
*/
attachDomEvent(eventMap: Record<string, DOMEventRecord>): () => void;
}

@@ -1,3 +0,6 @@

import type { CompatibleColorTransformDirection, CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
import type { ColorTransformDirection, ContentChangedData, ContentMetadata, DOMEventHandler, DarkColorHandler, EditorPlugin, GetContentMode, ImageSelectionRange, InsertOption, NodePosition, PluginEvent, PositionType, Rect, SelectionPath, SelectionRangeEx, StyleBasedFormatState, TableSelection, TableSelectionRange, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { DOMEventRecord } from '../parameter/DOMEventRecord';
import type { Snapshot } from '../parameter/Snapshot';
import type { EntityState } from '../parameter/FormatWithContentModelContext';
import type { CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
import type { ContentMetadata, DarkColorHandler, EditorPlugin, GetContentMode, InsertOption, NodePosition, PluginEvent, Rect, StyleBasedFormatState, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { ContentModelDocument } from '../group/ContentModelDocument';

@@ -42,4 +45,5 @@ import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';

* @param selection The selection to set
* @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent
*/
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection | null, skipSelectionChangedEvent?: boolean) => void;
/**

@@ -62,13 +66,2 @@ * The general API to do format change with Content Model

/**
* TODO: Remove this Core API and use setDOMSelection instead
* Select content according to the given information.
* There are a bunch of allowed combination of parameters. See IEditor.select for more details
* @param core The editor core object
* @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
* @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
* @param arg3 (optional) A Node
* @param arg4 (optional) An offset number, or a PositionType
*/
export declare type Select = (core: StandaloneEditorCore, arg1: Range | SelectionRangeEx | NodePosition | Node | SelectionPath | null, arg2?: NodePosition | number | PositionType | TableSelection | null, arg3?: Node, arg4?: number | PositionType) => boolean;
/**
* Trigger a plugin event

@@ -81,29 +74,10 @@ * @param core The StandaloneEditorCore object

/**
* Get current selection range
* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @returns A Range object of the selection range
*/
export declare type GetSelectionRangeEx = (core: StandaloneEditorCore) => SelectionRangeEx;
/**
* Edit and transform color of elements between light mode and dark mode
* @param core The StandaloneEditorCore object
* @param rootNode The root HTML node to transform
* @param includeSelf True to transform the root node as well, otherwise false
* @param callback The callback function to invoke before do color transformation
* @param direction To specify the transform direction, light to dark, or dark to light
* @param forceTransform By default this function will only work when editor core is in dark mode.
* Pass true to this value to force do color transformation even editor core is in light mode
* @param fromDarkModel Whether the given content is already in dark mode
*/
export declare type TransformColor = (core: StandaloneEditorCore, rootNode: Node | null, includeSelf: boolean, callback: (() => void) | null, direction: ColorTransformDirection | CompatibleColorTransformDirection, forceTransform?: boolean, fromDarkMode?: boolean) => void;
/**
* Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
* Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
* @param core The StandaloneEditorCore object
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
* @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
* @param entityStates @optional Entity states related to this snapshot.
* Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, canUndoByBackspace: boolean, entityStates?: EntityState[]) => void;
/**

@@ -115,27 +89,2 @@ * Retrieves the rect of the visible viewport of the editor.

/**
* Change the editor selection to the given range
* @param core The StandaloneEditorCore object
* @param range The range to select
* @param skipSameRange When set to true, do nothing if the given range is the same with current selection
* in editor, otherwise it will always remove current selection range and set to the given one.
* This parameter is always treated as true in Edge to avoid some weird runtime exception.
*/
export declare type SelectRange = (core: StandaloneEditorCore, range: Range, skipSameRange?: boolean) => boolean;
/**
* Select a table and save data of the selected range
* @param core The StandaloneEditorCore object
* @param image image to select
* @returns true if successful
*/
export declare type SelectImage = (core: StandaloneEditorCore, image: HTMLImageElement | null) => ImageSelectionRange | null;
/**
* Select a table and save data of the selected range
* @param core The StandaloneEditorCore object
* @param table table to select
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
* selecting, will unselect the table.
* @returns true if successful
*/
export declare type SelectTable = (core: StandaloneEditorCore, table: HTMLTableElement | null, coordinates?: TableSelection) => TableSelectionRange | null;
/**
* Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered

@@ -149,9 +98,2 @@ * if triggerContentChangedEvent is set to true

/**
* Get current or cached selection range
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
export declare type GetSelectionRange = (core: StandaloneEditorCore, tryGetFromCache: boolean) => Range | null;
/**
* Check if the editor has focus now

@@ -178,3 +120,3 @@ * @param core The StandaloneEditorCore object

*/
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventRecord>) => () => void;
/**

@@ -198,3 +140,3 @@ * Get current editor content as HTML string

*/
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, snapshot: Snapshot) => void;
/**

@@ -240,2 +182,3 @@ * Ensure user will type into a container element rather than into the editor content DIV directly

* @param selection The selection to set
* @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent
*/

@@ -264,80 +207,47 @@ setDOMSelection: SetDOMSelection;

getVisibleViewport: GetVisibleViewport;
}
/**
* Temp interface
* TODO: Port these core API
*/
export interface UnportedCoreApiMap {
/**
* Select content according to the given information.
* There are a bunch of allowed combination of parameters. See IEditor.select for more details
* @param core The editor core object
* @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
* @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
* @param arg3 (optional) A Node
* @param arg4 (optional) An offset number, or a PositionType
*/
select: Select;
/**
* Trigger a plugin event
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
* @returns True if the editor has focus, otherwise false
*/
triggerEvent: TriggerEvent;
hasFocus: HasFocus;
/**
* Get current or cached selection range
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
getSelectionRangeEx: GetSelectionRangeEx;
focus: Focus;
/**
* Edit and transform color of elements between light mode and dark mode
* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param rootNode The root HTML element to transform
* @param includeSelf True to transform the root node as well, otherwise false
* @param callback The callback function to invoke before do color transformation
* @param direction To specify the transform direction, light to dark, or dark to light
* @param forceTransform By default this function will only work when editor core is in dark mode.
* Pass true to this value to force do color transformation even editor core is in light mode
* @param fromDarkModel Whether the given content is already in dark mode
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
* @param entityStates @optional Entity states related to this snapshot.
* Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
transformColor: TransformColor;
/**
* Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
* Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
* @param core The StandaloneEditorCore object
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
* @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
*/
addUndoSnapshot: AddUndoSnapshot;
/**
* Change the editor selection to the given range
* @param core The StandaloneEditorCore object
* @param range The range to select
* @param skipSameRange When set to true, do nothing if the given range is the same with current selection
* in editor, otherwise it will always remove current selection range and set to the given one.
* This parameter is always treated as true in Edge to avoid some weird runtime exception.
* Restore an undo snapshot into editor
* @param core The editor core object
* @param step Steps to move, can be 0, positive or negative
*/
selectRange: SelectRange;
restoreUndoSnapshot: RestoreUndoSnapshot;
/**
* Select a image and save data of the selected range
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param image image to select
* @param imageId the id of the image element
* @returns true if successful
* @param eventMap A map from event name to its handler
*/
selectImage: SelectImage;
attachDomEvent: AttachDomEvent;
/**
* Select a table and save data of the selected range
* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param table table to select
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
* selecting, will unselect the table.
* @param shouldAddStyles Whether need to update the style elements
* @returns true if successful
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
selectTable: SelectTable;
triggerEvent: TriggerEvent;
}
/**
* Temp interface
* TODO: Port these core API
*/
export interface UnportedCoreApiMap {
/**

@@ -352,20 +262,2 @@ * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered

/**
* Get current or cached selection range
* @param core The StandaloneEditorCore object
* @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
* @returns A Range object of the selection range
*/
getSelectionRange: GetSelectionRange;
/**
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @returns True if the editor has focus, otherwise false
*/
hasFocus: HasFocus;
/**
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
*/
focus: Focus;
/**
* Insert a DOM node into editor content

@@ -377,10 +269,2 @@ * @param core The StandaloneEditorCore object. No op if null.

/**
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param eventName The DOM event name
* @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered
* @param beforeDispatch Optional callback function to be invoked when the DOM event is triggered before trigger plugin event
*/
attachDomEvent: AttachDomEvent;
/**
* Get current editor content as HTML string

@@ -399,8 +283,2 @@ * @param core The StandaloneEditorCore object

/**
* Restore an undo snapshot into editor
* @param core The editor core object
* @param step Steps to move, can be 0, positive or negative
*/
restoreUndoSnapshot: RestoreUndoSnapshot;
/**
* Ensure user will type into a container element rather than into the editor content DIV directly

@@ -407,0 +285,0 @@ * @param core The EditorCore object.

@@ -0,1 +1,3 @@

import type { CopyPastePluginState } from '../pluginState/CopyPastePluginState';
import type { UndoPluginState } from '../pluginState/UndoPluginState';
import type { SelectionPluginState } from '../pluginState/SelectionPluginState';

@@ -7,3 +9,3 @@ import type { EntityPluginState } from '../pluginState/EntityPluginState';

import type { ContentModelFormatPluginState } from '../pluginState/ContentModelFormatPluginState';
import type { CopyPastePluginState, PluginWithState } from 'roosterjs-editor-types';
import type { PluginWithState } from 'roosterjs-editor-types';
/**

@@ -38,2 +40,6 @@ * Core plugins for standalone editor

/**
* Undo plugin provides the ability to undo/redo
*/
readonly undo: PluginWithState<UndoPluginState>;
/**
* Lifecycle plugin handles editor initialization and disposing

@@ -40,0 +46,0 @@ */

@@ -7,2 +7,3 @@ import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';

import type { ContentModelDocument } from '../group/ContentModelDocument';
import type { SnapshotsManager } from '../parameter/SnapshotsManager';
/**

@@ -79,2 +80,7 @@ * Options for Content Model editor

inDarkMode?: boolean;
/**
* Undo snapshot service based on content metadata. Use this parameter to customize the undo snapshot service.
* When this property is set, value of undoSnapshotService will be ignored.
*/
snapshotsManager?: SnapshotsManager;
}

@@ -0,1 +1,2 @@

import type { EntityState } from '../parameter/FormatWithContentModelContext';
import type { ContentModelEntity } from '../entity/ContentModelEntity';

@@ -19,3 +20,3 @@ import type { EntityRemovalOperation } from '../enum/EntityOperation';

/**
* @optional Raw DOM event that causes the chagne
* @optional Raw DOM event that causes the change
*/

@@ -40,2 +41,6 @@ rawEvent?: Event;

readonly changedEntities?: ChangedEntity[];
/**
* Entity states related to this event
*/
readonly entityStates?: EntityState[];
}

@@ -42,0 +47,0 @@ /**

@@ -9,5 +9,6 @@ import type { BorderBoxFormat } from './formatParts/BorderBoxFormat';

import type { TableLayoutFormat } from './formatParts/TableLayoutFormat';
import type { SizeFormat } from './formatParts/SizeFormat';
/**
* Format of Table
*/
export declare type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat & BorderBoxFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat;
export declare type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat & BorderBoxFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat & SizeFormat;

@@ -95,2 +95,3 @@ export { ContentModelSegmentFormat } from './format/ContentModelSegmentFormat';

export { TableSelectionContext } from './selection/TableSelectionContext';
export { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';
export { ContentModelHandlerMap, DefaultImplicitFormatMap, FormatAppliers, FormatAppliersPerCategory, OnNodeCreated, ModelToDomSettings, FormatApplier, ApplyMetadata, MetadataApplier, MetadataAppliers, } from './context/ModelToDomSettings';

@@ -115,3 +116,3 @@ export { DefaultStyleMap, ElementProcessorMap, FormatParsers, FormatParsersPerCategory, DomToModelSettings, FormatParser, } from './context/DomToModelSettings';

export { StandaloneEditorOptions } from './editor/StandaloneEditorOptions';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, StandaloneEditorDefaultSettings, SwitchShadowEdit, Select, TriggerEvent, GetSelectionRangeEx, TransformColor, AddUndoSnapshot, SelectRange, PortedCoreApiMap, UnportedCoreApiMap, SelectImage, SelectTable, SetContent, GetSelectionRange, HasFocus, Focus, InsertNode, AttachDomEvent, GetContent, GetStyleBasedFormatState, RestoreUndoSnapshot, EnsureTypeInContainer, GetVisibleViewport, } from './editor/StandaloneEditorCore';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, StandaloneEditorDefaultSettings, SwitchShadowEdit, TriggerEvent, AddUndoSnapshot, PortedCoreApiMap, UnportedCoreApiMap, SetContent, HasFocus, Focus, InsertNode, AttachDomEvent, GetContent, GetStyleBasedFormatState, RestoreUndoSnapshot, EnsureTypeInContainer, GetVisibleViewport, } from './editor/StandaloneEditorCore';
export { StandaloneEditorCorePlugins } from './editor/StandaloneEditorCorePlugins';

@@ -125,4 +126,6 @@ export { ContentModelCachePluginState } from './pluginState/ContentModelCachePluginState';

export { SelectionPluginState } from './pluginState/SelectionPluginState';
export { UndoPluginState } from './pluginState/UndoPluginState';
export { CopyPastePluginState } from './pluginState/CopyPastePluginState';
export { EditorEnvironment } from './parameter/EditorEnvironment';
export { DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';
export { EntityState, DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';
export { FormatWithContentModelOptions, ContentModelFormatter, } from './parameter/FormatWithContentModelOptions';

@@ -134,3 +137,9 @@ export { ContentModelFormatState } from './parameter/ContentModelFormatState';

export { DeleteSelectionContext, DeleteSelectionResult, DeleteSelectionStep, ValidDeleteSelectionContext, } from './parameter/DeleteSelectionStep';
export { SnapshotSelectionBase, RangeSnapshotSelection, ImageSnapshotSelection, TableSnapshotSelection, SnapshotSelection, Snapshot, Snapshots, } from './parameter/Snapshot';
export { SnapshotsManager } from './parameter/SnapshotsManager';
export { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';
export { EdgeLinkPreview } from './parameter/EdgeLinkPreview';
export { ClipboardData } from './parameter/ClipboardData';
export { ContentModelBeforePasteEvent, ContentModelBeforePasteEventData, CompatibleContentModelBeforePasteEvent, } from './event/ContentModelBeforePasteEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, ChangedEntity, } from './event/ContentModelContentChangedEvent';
export { CompatibleContentModelSelectionChangedEvent, ContentModelSelectionChangedEvent, ContentModelSelectionChangedEventData, } from './event/ContentModelSelectionChangedEvent';

@@ -6,2 +6,21 @@ import type { ContentModelEntity } from '../entity/ContentModelEntity';

/**
* State for an entity. This is used for storing entity undo snapshot
*/
export interface EntityState {
/**
* Type of the entity
*/
type: string;
/**
* Id of the entity
*/
id: string;
/**
* The state of this entity to store into undo snapshot.
* The state can be any string, or a serialized JSON object.
* We are using string here instead of a JSON object to make sure the whole state is serializable.
*/
state: string;
}
/**
* Represents an entity that is deleted by a specified entity operation

@@ -58,2 +77,12 @@ */

newPendingFormat?: ContentModelSegmentFormat | 'preserve';
/**
* @optional Entity states related to the format API that will be added together with undo snapshot.
* When entity states are set, each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
* when undo/redo to this snapshot
*/
entityStates?: EntityState[];
/**
* @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).
*/
canUndoByBackspace?: boolean;
}

@@ -1,2 +0,2 @@

import type { ImageSelectionRange, TableSelectionRange } from 'roosterjs-editor-types';
import type { DOMSelection } from '../selection/DOMSelection';
/**

@@ -9,12 +9,4 @@ * The state object for SelectionPlugin

*/
selectionRange: Range | null;
selection: DOMSelection | null;
/**
* Table selection range
*/
tableSelectionRange: TableSelectionRange | null;
/**
* Image selection range
*/
imageSelectionRange: ImageSelectionRange | null;
/**
* A style node in current document to help implement image and table selection

@@ -21,0 +13,0 @@ */

@@ -0,3 +1,5 @@

import type { CopyPastePluginState } from './CopyPastePluginState';
import type { UndoPluginState } from './UndoPluginState';
import type { SelectionPluginState } from './SelectionPluginState';
import type { CopyPastePluginState, EditPluginState, UndoPluginState } from 'roosterjs-editor-types';
import type { EditPluginState } from 'roosterjs-editor-types';
import type { ContentModelCachePluginState } from './ContentModelCachePluginState';

@@ -41,2 +43,6 @@ import type { ContentModelFormatPluginState } from './ContentModelFormatPluginState';

selection: SelectionPluginState;
/**
* Plugin state for UndoPlugin
*/
undo: UndoPluginState;
}

@@ -48,4 +54,3 @@ /**

export interface UnportedCorePluginState {
undo: UndoPluginState;
edit: EditPluginState;
}

@@ -0,1 +1,2 @@

import type { TableSelectionCoordinates } from '../selection/TableSelectionCoordinates';
/**

@@ -42,3 +43,3 @@ * Type of DOM selection, it can be one of the 3 below:

*/
export interface TableSelection extends SelectionBase<'table'> {
export interface TableSelection extends TableSelectionCoordinates, SelectionBase<'table'> {
/**

@@ -48,18 +49,2 @@ * The table that this selection is representing

table: HTMLTableElement;
/**
* Number of first selected row
*/
firstRow: number;
/**
* Number of last selected row
*/
lastRow: number;
/**
* Number of first selected column
*/
firstColumn: number;
/**
* Number of last selected column
*/
lastColumn: number;
}

@@ -66,0 +51,0 @@ /**

@@ -7,3 +7,3 @@ {

},
"version": "0.21.2",
"version": "0.22.0",
"main": "./lib/index.js",

@@ -10,0 +10,0 @@ "typings": "./lib/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc