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.20.0 to 0.21.0

lib-amd/editor/StandaloneEditorCorePlugins.d.ts

361

lib-amd/editor/StandaloneEditorCore.d.ts

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

import type { EditorCore, SwitchShadowEdit } from 'roosterjs-editor-types';
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 { ContentModelDocument } from '../group/ContentModelDocument';
import type { ContentModelPluginState } from '../pluginState/ContentModelPluginState';
import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';
import type { DOMSelection } from '../selection/DOMSelection';

@@ -16,3 +17,3 @@ import type { DomToModelOption } from '../context/DomToModelOption';

*/
export declare type CreateEditorContext = (core: StandaloneEditorCore & EditorCore) => EditorContext;
export declare type CreateEditorContext = (core: StandaloneEditorCore) => EditorContext;
/**

@@ -24,3 +25,3 @@ * Create Content Model from DOM tree in this editor

*/
export declare type CreateContentModel = (core: StandaloneEditorCore & EditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
export declare type CreateContentModel = (core: StandaloneEditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
/**

@@ -30,3 +31,3 @@ * Get current DOM selection from editor

*/
export declare type GetDOMSelection = (core: StandaloneEditorCore & EditorCore) => DOMSelection | null;
export declare type GetDOMSelection = (core: StandaloneEditorCore) => DOMSelection | null;
/**

@@ -39,3 +40,3 @@ * Set content with content model. This is the replacement of core API getSelectionRangeEx

*/
export declare type SetContentModel = (core: StandaloneEditorCore & EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
export declare type SetContentModel = (core: StandaloneEditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
/**

@@ -46,3 +47,3 @@ * Set current DOM selection from editor. This is the replacement of core API select

*/
export declare type SetDOMSelection = (core: StandaloneEditorCore & EditorCore, selection: DOMSelection) => void;
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
/**

@@ -57,8 +58,155 @@ * The general API to do format change with Content Model

*/
export declare type FormatContentModel = (core: StandaloneEditorCore & EditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
export declare type FormatContentModel = (core: StandaloneEditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
/**
* The interface for the map of core API for Content Model editor.
* Editor can call call API from this map under StandaloneEditorCore object
* Switch the Shadow Edit mode of editor On/Off
* @param core The StandaloneEditorCore object
* @param isOn True to switch On, False to switch Off
*/
export interface StandaloneCoreApiMap {
export declare type SwitchShadowEdit = (core: StandaloneEditorCore, isOn: boolean) => void;
/**
* 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
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
export declare type TriggerEvent = (core: StandaloneEditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;
/**
* Get current selection range
* @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.
*/
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
/**
* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
*/
export declare type GetVisibleViewport = (core: StandaloneEditorCore) => Rect | null;
/**
* 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
* if triggerContentChangedEvent is set to true
* @param core The StandaloneEditorCore object
* @param content HTML content to set in
* @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
*/
export declare type SetContent = (core: StandaloneEditorCore, content: string, triggerContentChangedEvent: boolean, metadata?: ContentMetadata) => void;
/**
* 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
* @param core The StandaloneEditorCore object
* @returns True if the editor has focus, otherwise false
*/
export declare type HasFocus = (core: StandaloneEditorCore) => boolean;
/**
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
*/
export declare type Focus = (core: StandaloneEditorCore) => void;
/**
* Insert a DOM node into editor content
* @param core The StandaloneEditorCore object. No op if null.
* @param option An insert option object to specify how to insert the node
*/
export declare type InsertNode = (core: StandaloneEditorCore, node: Node, option: InsertOption | null) => boolean;
/**
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param eventMap A map from event name to its handler
*/
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
/**
* Get current editor content as HTML string
* @param core The StandaloneEditorCore object
* @param mode specify what kind of HTML content to retrieve
* @returns HTML string representing current editor content
*/
export declare type GetContent = (core: StandaloneEditorCore, mode: GetContentMode | CompatibleGetContentMode) => string;
/**
* Get style based format state from current selection, including font name/size and colors
* @param core The StandaloneEditorCore objects
* @param node The node to get style from
*/
export declare type GetStyleBasedFormatState = (core: StandaloneEditorCore, node: Node | null) => StyleBasedFormatState;
/**
* Restore an undo snapshot into editor
* @param core The StandaloneEditorCore object
* @param step Steps to move, can be 0, positive or negative
*/
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
/**
* Ensure user will type into a container element rather than into the editor content DIV directly
* @param core The StandaloneEditorCore object.
* @param position The position that user is about to type to
* @param keyboardEvent Optional keyboard event object
* @param deprecated Deprecated parameter, not used
*/
export declare type EnsureTypeInContainer = (core: StandaloneEditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, deprecated?: boolean) => void;
/**
* Temp interface
* TODO: Port other core API
*/
export interface PortedCoreApiMap {
/**

@@ -103,8 +251,169 @@ * Create a EditorContext object used by ContentModel API

formatContentModel: FormatContentModel;
/**
* Switch the Shadow Edit mode of editor On/Off
* @param core The StandaloneEditorCore object
* @param isOn True to switch On, False to switch Off
*/
switchShadowEdit: SwitchShadowEdit;
/**
* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
*/
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
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
triggerEvent: TriggerEvent;
/**
* 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
*/
getSelectionRangeEx: GetSelectionRangeEx;
/**
* Edit and transform color of elements between light mode and dark mode
* @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
*/
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.
*/
selectRange: SelectRange;
/**
* Select a image and save data of the selected range
* @param core The StandaloneEditorCore object
* @param image image to select
* @param imageId the id of the image element
* @returns true if successful
*/
selectImage: SelectImage;
/**
* 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.
* @param shouldAddStyles Whether need to update the style elements
* @returns true if successful
*/
selectTable: SelectTable;
/**
* Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered
* if triggerContentChangedEvent is set to true
* @param core The StandaloneEditorCore object
* @param content HTML content to set in
* @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
*/
setContent: SetContent;
/**
* 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
* @param core The StandaloneEditorCore object. No op if null.
* @param option An insert option object to specify how to insert the node
*/
insertNode: InsertNode;
/**
* 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
* @param core The StandaloneEditorCore object
* @param mode specify what kind of HTML content to retrieve
* @returns HTML string representing current editor content
*/
getContent: GetContent;
/**
* Get style based format state from current selection, including font name/size and colors
* @param core The StandaloneEditorCore objects
* @param node The node to get style from
*/
getStyleBasedFormatState: GetStyleBasedFormatState;
/**
* 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
* @param core The EditorCore object.
* @param position The position that user is about to type to
* @param keyboardEvent Optional keyboard event object
* @param deprecated Deprecated parameter, not used
*/
ensureTypeInContainer: EnsureTypeInContainer;
}
/**
* The interface for the map of core API for Content Model editor.
* Editor can call call API from this map under StandaloneEditorCore object
*/
export interface StandaloneCoreApiMap extends PortedCoreApiMap, UnportedCoreApiMap {
}
/**
* Represents the core data structure of a Content Model editor
*/
export interface StandaloneEditorCore extends ContentModelPluginState {
export interface StandaloneEditorCore extends StandaloneEditorCorePluginState, UnportedCorePluginState, StandaloneEditorDefaultSettings {
/**

@@ -123,2 +432,26 @@ * The content DIV element of this editor

/**
* An array of editor plugins.
*/
readonly plugins: EditorPlugin[];
/**
* Editor running environment
*/
readonly environment: EditorEnvironment;
/**
* Dark model handler for the editor, used for variable-based solution.
* If keep it null, editor will still use original dataset-based dark mode solution.
*/
readonly darkColorHandler: DarkColorHandler;
/**
* A handler to convert HTML string to a trust HTML string.
* By default it will just return the original HTML string directly.
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
*/
readonly trustedHTMLHandler: TrustedHTMLHandler;
}
/**
* Default DOM and Content Model conversion settings for an editor
*/
export interface StandaloneEditorDefaultSettings {
/**
* Default DOM to Content Model options

@@ -141,6 +474,2 @@ */

defaultModelToDomConfig: ModelToDomSettings;
/**
* Editor running environment
*/
environment: EditorEnvironment;
}

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

import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';
import type { StandaloneCoreApiMap } from './StandaloneEditorCore';
import type { EditorPlugin, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { DomToModelOption } from '../context/DomToModelOption';
import type { ModelToDomOption } from '../context/ModelToDomOption';
import type { ContentModelDocument } from '../group/ContentModelDocument';
/**

@@ -19,2 +23,57 @@ * Options for Content Model editor

cacheModel?: boolean;
/**
* List of plugins.
* The order of plugins here determines in what order each event will be dispatched.
* Plugins not appear in this list will not be added to editor, including built-in plugins.
* Default value is empty array.
*/
plugins?: EditorPlugin[];
/**
* Default format of editor content. This will be applied to empty content.
* If there is already content inside editor, format of existing content will not be changed.
* Default value is the computed style of editor content DIV
*/
defaultSegmentFormat?: ContentModelSegmentFormat;
/**
* Allowed custom content type when paste besides text/plain, text/html and images
* Only text types are supported, and do not add "text/" prefix to the type values
*/
allowedCustomPasteType?: string[];
/**
* The scroll container to get scroll event from.
* By default, the scroll container will be the same with editor content DIV
*/
scrollContainer?: HTMLElement;
/**
* Base dark mode color. We will use this color to calculate the dark mode color from a given light mode color
* @default #333333
*/
baseDarkColor?: string;
/**
* Customized trusted type handler used for sanitizing HTML string before assign to DOM tree
* This is required when trusted-type Content-Security-Policy (CSP) is enabled.
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
*/
trustedHTMLHandler?: TrustedHTMLHandler;
/**
* A function map to override default core API implementation
* Default value is null
*/
coreApiOverride?: Partial<StandaloneCoreApiMap>;
/**
* Color of the border of a selectedImage. Default color: '#DB626C'
*/
imageSelectionBorderColor?: string;
/**
* Initial Content Model
*/
initialModel?: ContentModelDocument;
/**
* Whether to skip the adjust editor process when for light/dark mode
*/
doNotAdjustEditorColor?: boolean;
/**
* If the editor is currently in dark mode
*/
inDarkMode?: boolean;
}

@@ -25,4 +25,8 @@ /**

*/
| 'UpdateEntityState';
| 'updateEntityState'
/**
* Notify plugins that user is clicking target to an entity
*/
| 'click';
/**
* Define entity removal related operations

@@ -29,0 +33,0 @@ */

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

import type { ContentModelEntity } from '../entity/ContentModelEntity';
import type { EntityRemovalOperation } from '../enum/EntityOperation';
import type { ContentModelDocument } from '../group/ContentModelDocument';

@@ -5,2 +7,19 @@ import type { DOMSelection } from '../selection/DOMSelection';

/**
* Represents an entity that has been changed during a content change process
*/
export interface ChangedEntity {
/**
* The changed entity
*/
entity: ContentModelEntity;
/**
* Operation that causes the change
*/
operation: EntityRemovalOperation | 'newEntity';
/**
* @optional Raw DOM event that causes the chagne
*/
rawEvent?: Event;
}
/**
* Data of ContentModelContentChangedEvent

@@ -12,7 +31,11 @@ */

*/
contentModel?: ContentModelDocument;
readonly contentModel?: ContentModelDocument;
/**
* Selection range applied to the document
*/
selection?: DOMSelection;
readonly selection?: DOMSelection;
/**
* Entities got changed (added or removed) during the content change process
*/
readonly changedEntities?: ChangedEntity[];
}

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

150

lib-amd/format/metadata/ListMetadataFormat.d.ts
/**
* Enum used to control the different types of bullet list
*/
export declare enum BulletListType {
/**
* Minimum value of the enum
*/
Min = 1,
/**
* Bullet triggered by *
*/
Disc = 1,
/**
* Bullet triggered by -
*/
Dash = 2,
/**
* Bullet triggered by --
*/
Square = 3,
/**
* Bullet triggered by >
*/
ShortArrow = 4,
/**
* Bullet triggered by ->
*/
LongArrow = 5,
/**
* Bullet triggered by =>
*/
UnfilledArrow = 6,
/**
* Bullet triggered by —
*/
Hyphen = 7,
/**
* Bullet triggered by -->
*/
DoubleLongArrow = 8,
/**
* Bullet type circle
*/
Circle = 9,
/**
* Maximum value of the enum
*/
Max = 9
}
/**
* Enum used to control the different types of numbering list
*/
export declare enum NumberingListType {
/**
* Minimum value of the enum
*/
Min = 1,
/**
* Numbering triggered by 1.
*/
Decimal = 1,
/**
* Numbering triggered by 1-
*/
DecimalDash = 2,
/**
* Numbering triggered by 1)
*/
DecimalParenthesis = 3,
/**
* Numbering triggered by (1)
*/
DecimalDoubleParenthesis = 4,
/**
* Numbering triggered by a.
*/
LowerAlpha = 5,
/**
* Numbering triggered by a)
*/
LowerAlphaParenthesis = 6,
/**
* Numbering triggered by (a)
*/
LowerAlphaDoubleParenthesis = 7,
/**
* Numbering triggered by a-
*/
LowerAlphaDash = 8,
/**
* Numbering triggered by A.
*/
UpperAlpha = 9,
/**
* Numbering triggered by A)
*/
UpperAlphaParenthesis = 10,
/**
* Numbering triggered by (A)
*/
UpperAlphaDoubleParenthesis = 11,
/**
* Numbering triggered by A-
*/
UpperAlphaDash = 12,
/**
* Numbering triggered by i.
*/
LowerRoman = 13,
/**
* Numbering triggered by i)
*/
LowerRomanParenthesis = 14,
/**
* Numbering triggered by (i)
*/
LowerRomanDoubleParenthesis = 15,
/**
* Numbering triggered by i-
*/
LowerRomanDash = 16,
/**
* Numbering triggered by I.
*/
UpperRoman = 17,
/**
* Numbering triggered by I)
*/
UpperRomanParenthesis = 18,
/**
* Numbering triggered by (I)
*/
UpperRomanDoubleParenthesis = 19,
/**
* Numbering triggered by I-
*/
UpperRomanDash = 20,
/**
* Maximum value of the enum
*/
Max = 20
}
/**
* Format of list / list item that stored as metadata

@@ -148,9 +6,9 @@ */

/**
* Style type for Ordered list
* Style type for Ordered list. Use value of constant NumberingListType as value.
*/
orderedStyleType?: NumberingListType;
orderedStyleType?: number;
/**
* Style type for Unordered list
* Style type for Unordered list. Use value of constant BulletListType as value.
*/
unorderedStyleType?: BulletListType;
unorderedStyleType?: number;
};
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumberingListType = exports.BulletListType = void 0;
/**
* Enum used to control the different types of bullet list
*/
var BulletListType;
(function (BulletListType) {
/**
* Minimum value of the enum
*/
BulletListType[BulletListType["Min"] = 1] = "Min";
/**
* Bullet triggered by *
*/
BulletListType[BulletListType["Disc"] = 1] = "Disc";
/**
* Bullet triggered by -
*/
BulletListType[BulletListType["Dash"] = 2] = "Dash";
/**
* Bullet triggered by --
*/
BulletListType[BulletListType["Square"] = 3] = "Square";
/**
* Bullet triggered by >
*/
BulletListType[BulletListType["ShortArrow"] = 4] = "ShortArrow";
/**
* Bullet triggered by ->
*/
BulletListType[BulletListType["LongArrow"] = 5] = "LongArrow";
/**
* Bullet triggered by =>
*/
BulletListType[BulletListType["UnfilledArrow"] = 6] = "UnfilledArrow";
/**
* Bullet triggered by —
*/
BulletListType[BulletListType["Hyphen"] = 7] = "Hyphen";
/**
* Bullet triggered by -->
*/
BulletListType[BulletListType["DoubleLongArrow"] = 8] = "DoubleLongArrow";
/**
* Bullet type circle
*/
BulletListType[BulletListType["Circle"] = 9] = "Circle";
/**
* Maximum value of the enum
*/
BulletListType[BulletListType["Max"] = 9] = "Max";
})(BulletListType = exports.BulletListType || (exports.BulletListType = {}));
/**
* Enum used to control the different types of numbering list
*/
var NumberingListType;
(function (NumberingListType) {
/**
* Minimum value of the enum
*/
NumberingListType[NumberingListType["Min"] = 1] = "Min";
/**
* Numbering triggered by 1.
*/
NumberingListType[NumberingListType["Decimal"] = 1] = "Decimal";
/**
* Numbering triggered by 1-
*/
NumberingListType[NumberingListType["DecimalDash"] = 2] = "DecimalDash";
/**
* Numbering triggered by 1)
*/
NumberingListType[NumberingListType["DecimalParenthesis"] = 3] = "DecimalParenthesis";
/**
* Numbering triggered by (1)
*/
NumberingListType[NumberingListType["DecimalDoubleParenthesis"] = 4] = "DecimalDoubleParenthesis";
/**
* Numbering triggered by a.
*/
NumberingListType[NumberingListType["LowerAlpha"] = 5] = "LowerAlpha";
/**
* Numbering triggered by a)
*/
NumberingListType[NumberingListType["LowerAlphaParenthesis"] = 6] = "LowerAlphaParenthesis";
/**
* Numbering triggered by (a)
*/
NumberingListType[NumberingListType["LowerAlphaDoubleParenthesis"] = 7] = "LowerAlphaDoubleParenthesis";
/**
* Numbering triggered by a-
*/
NumberingListType[NumberingListType["LowerAlphaDash"] = 8] = "LowerAlphaDash";
/**
* Numbering triggered by A.
*/
NumberingListType[NumberingListType["UpperAlpha"] = 9] = "UpperAlpha";
/**
* Numbering triggered by A)
*/
NumberingListType[NumberingListType["UpperAlphaParenthesis"] = 10] = "UpperAlphaParenthesis";
/**
* Numbering triggered by (A)
*/
NumberingListType[NumberingListType["UpperAlphaDoubleParenthesis"] = 11] = "UpperAlphaDoubleParenthesis";
/**
* Numbering triggered by A-
*/
NumberingListType[NumberingListType["UpperAlphaDash"] = 12] = "UpperAlphaDash";
/**
* Numbering triggered by i.
*/
NumberingListType[NumberingListType["LowerRoman"] = 13] = "LowerRoman";
/**
* Numbering triggered by i)
*/
NumberingListType[NumberingListType["LowerRomanParenthesis"] = 14] = "LowerRomanParenthesis";
/**
* Numbering triggered by (i)
*/
NumberingListType[NumberingListType["LowerRomanDoubleParenthesis"] = 15] = "LowerRomanDoubleParenthesis";
/**
* Numbering triggered by i-
*/
NumberingListType[NumberingListType["LowerRomanDash"] = 16] = "LowerRomanDash";
/**
* Numbering triggered by I.
*/
NumberingListType[NumberingListType["UpperRoman"] = 17] = "UpperRoman";
/**
* Numbering triggered by I)
*/
NumberingListType[NumberingListType["UpperRomanParenthesis"] = 18] = "UpperRomanParenthesis";
/**
* Numbering triggered by (I)
*/
NumberingListType[NumberingListType["UpperRomanDoubleParenthesis"] = 19] = "UpperRomanDoubleParenthesis";
/**
* Numbering triggered by I-
*/
NumberingListType[NumberingListType["UpperRomanDash"] = 20] = "UpperRomanDash";
/**
* Maximum value of the enum
*/
NumberingListType[NumberingListType["Max"] = 20] = "Max";
})(NumberingListType = exports.NumberingListType || (exports.NumberingListType = {}));
});
//# sourceMappingURL=ListMetadataFormat.js.map
/**
* Table format border
*/
export declare enum TableBorderFormat {
/**
* All border of the table are displayed
* __ __ __
* |__|__|__|
* |__|__|__|
* |__|__|__|
*/
DEFAULT = 0,
/**
* Middle vertical border are not displayed
* __ __ __
* |__ __ __|
* |__ __ __|
* |__ __ __|
*/
LIST_WITH_SIDE_BORDERS = 1,
/**
* All borders except header rows borders are displayed
* __ __ __
* __|__|__
* __|__|__
*/
NO_HEADER_BORDERS = 2,
/**
* The left and right border of the table are not displayed
* __ __ __
* __|__|__
* __|__|__
* __|__|__
*/
NO_SIDE_BORDERS = 3,
/**
* Only the borders that divides the header row, first column and externals are displayed
* __ __ __
* |__ __ __|
* | | |
* |__|__ __|
*/
FIRST_COLUMN_HEADER_EXTERNAL = 4,
/**
* The header row has no vertical border, except for the first one
* The first column has no horizontal border, except for the first one
* __ __ __
* |__ __ __
* | |__|__|
* | |__|__|
*/
ESPECIAL_TYPE_1 = 5,
/**
* The header row has no vertical border, except for the first one
* The only horizontal border of the table is the top and bottom of header row
* __ __ __
* |__ __ __
* | | |
* | | |
*/
ESPECIAL_TYPE_2 = 6,
/**
* The only borders are the bottom of header row and the right border of first column
* __ __ __
* |
* |
*/
ESPECIAL_TYPE_3 = 7,
/**
* No border
*/
CLEAR = 8
}
/**
* Format of table that stored as metadata

@@ -119,5 +46,5 @@ */

/**
* Table Borders Type
* Table Borders Type. Use value of constant TableBorderFormat as value
*/
tableBorderFormat?: TableBorderFormat;
tableBorderFormat?: number;
/**

@@ -124,0 +51,0 @@ * Vertical alignment for each row

define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableBorderFormat = void 0;
/**
* Table format border
*/
var TableBorderFormat;
(function (TableBorderFormat) {
/**
* All border of the table are displayed
* __ __ __
* |__|__|__|
* |__|__|__|
* |__|__|__|
*/
TableBorderFormat[TableBorderFormat["DEFAULT"] = 0] = "DEFAULT";
/**
* Middle vertical border are not displayed
* __ __ __
* |__ __ __|
* |__ __ __|
* |__ __ __|
*/
TableBorderFormat[TableBorderFormat["LIST_WITH_SIDE_BORDERS"] = 1] = "LIST_WITH_SIDE_BORDERS";
/**
* All borders except header rows borders are displayed
* __ __ __
* __|__|__
* __|__|__
*/
TableBorderFormat[TableBorderFormat["NO_HEADER_BORDERS"] = 2] = "NO_HEADER_BORDERS";
/**
* The left and right border of the table are not displayed
* __ __ __
* __|__|__
* __|__|__
* __|__|__
*/
TableBorderFormat[TableBorderFormat["NO_SIDE_BORDERS"] = 3] = "NO_SIDE_BORDERS";
/**
* Only the borders that divides the header row, first column and externals are displayed
* __ __ __
* |__ __ __|
* | | |
* |__|__ __|
*/
TableBorderFormat[TableBorderFormat["FIRST_COLUMN_HEADER_EXTERNAL"] = 4] = "FIRST_COLUMN_HEADER_EXTERNAL";
/**
* The header row has no vertical border, except for the first one
* The first column has no horizontal border, except for the first one
* __ __ __
* |__ __ __
* | |__|__|
* | |__|__|
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_1"] = 5] = "ESPECIAL_TYPE_1";
/**
* The header row has no vertical border, except for the first one
* The only horizontal border of the table is the top and bottom of header row
* __ __ __
* |__ __ __
* | | |
* | | |
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_2"] = 6] = "ESPECIAL_TYPE_2";
/**
* The only borders are the bottom of header row and the right border of first column
* __ __ __
* |
* |
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_3"] = 7] = "ESPECIAL_TYPE_3";
/**
* No border
*/
TableBorderFormat[TableBorderFormat["CLEAR"] = 8] = "CLEAR";
})(TableBorderFormat = exports.TableBorderFormat || (exports.TableBorderFormat = {}));
});
//# sourceMappingURL=TableMetadataFormat.js.map

@@ -51,4 +51,4 @@ export { ContentModelSegmentFormat } from './format/ContentModelSegmentFormat';

export { DatasetFormat } from './format/metadata/DatasetFormat';
export { TableMetadataFormat, TableBorderFormat } from './format/metadata/TableMetadataFormat';
export { ListMetadataFormat, NumberingListType, BulletListType, } from './format/metadata/ListMetadataFormat';
export { TableMetadataFormat } from './format/metadata/TableMetadataFormat';
export { ListMetadataFormat } from './format/metadata/ListMetadataFormat';
export { ImageResizeMetadataFormat, ImageCropMetadataFormat, ImageMetadataFormat, ImageRotateMetadataFormat, } from './format/metadata/ImageMetadataFormat';

@@ -115,6 +115,11 @@ export { TableCellMetadataFormat } from './format/metadata/TableCellMetadataFormat';

export { StandaloneEditorOptions } from './editor/StandaloneEditorOptions';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, } from './editor/StandaloneEditorCore';
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 { StandaloneEditorCorePlugins } from './editor/StandaloneEditorCorePlugins';
export { ContentModelCachePluginState } from './pluginState/ContentModelCachePluginState';
export { ContentModelPluginState } from './pluginState/ContentModelPluginState';
export { StandaloneEditorCorePluginState, UnportedCorePluginState, } from './pluginState/StandaloneEditorPluginState';
export { ContentModelFormatPluginState, PendingFormat, } from './pluginState/ContentModelFormatPluginState';
export { DOMEventPluginState } from './pluginState/DOMEventPluginState';
export { LifecyclePluginState } from './pluginState/LifecyclePluginState';
export { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';
export { SelectionPluginState } from './pluginState/SelectionPluginState';
export { EditorEnvironment } from './parameter/EditorEnvironment';

@@ -129,2 +134,2 @@ export { DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';

export { ContentModelBeforePasteEvent, ContentModelBeforePasteEventData, CompatibleContentModelBeforePasteEvent, } from './event/ContentModelBeforePasteEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, } from './event/ContentModelContentChangedEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, ChangedEntity, } from './event/ContentModelContentChangedEvent';

@@ -1,9 +0,5 @@

define(["require", "exports", "./format/metadata/TableMetadataFormat", "./format/metadata/ListMetadataFormat"], function (require, exports, TableMetadataFormat_1, ListMetadataFormat_1) {
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BulletListType = exports.NumberingListType = exports.TableBorderFormat = void 0;
Object.defineProperty(exports, "TableBorderFormat", { enumerable: true, get: function () { return TableMetadataFormat_1.TableBorderFormat; } });
Object.defineProperty(exports, "NumberingListType", { enumerable: true, get: function () { return ListMetadataFormat_1.NumberingListType; } });
Object.defineProperty(exports, "BulletListType", { enumerable: true, get: function () { return ListMetadataFormat_1.BulletListType; } });
});
//# sourceMappingURL=index.js.map

@@ -13,2 +13,6 @@ /**

isAndroid?: boolean;
/**
* Whether editor is running on Safari browser
*/
isSafari?: boolean;
}

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

import type { EditorCore, SwitchShadowEdit } from 'roosterjs-editor-types';
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 { ContentModelDocument } from '../group/ContentModelDocument';
import type { ContentModelPluginState } from '../pluginState/ContentModelPluginState';
import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';
import type { DOMSelection } from '../selection/DOMSelection';

@@ -16,3 +17,3 @@ import type { DomToModelOption } from '../context/DomToModelOption';

*/
export declare type CreateEditorContext = (core: StandaloneEditorCore & EditorCore) => EditorContext;
export declare type CreateEditorContext = (core: StandaloneEditorCore) => EditorContext;
/**

@@ -24,3 +25,3 @@ * Create Content Model from DOM tree in this editor

*/
export declare type CreateContentModel = (core: StandaloneEditorCore & EditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
export declare type CreateContentModel = (core: StandaloneEditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
/**

@@ -30,3 +31,3 @@ * Get current DOM selection from editor

*/
export declare type GetDOMSelection = (core: StandaloneEditorCore & EditorCore) => DOMSelection | null;
export declare type GetDOMSelection = (core: StandaloneEditorCore) => DOMSelection | null;
/**

@@ -39,3 +40,3 @@ * Set content with content model. This is the replacement of core API getSelectionRangeEx

*/
export declare type SetContentModel = (core: StandaloneEditorCore & EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
export declare type SetContentModel = (core: StandaloneEditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
/**

@@ -46,3 +47,3 @@ * Set current DOM selection from editor. This is the replacement of core API select

*/
export declare type SetDOMSelection = (core: StandaloneEditorCore & EditorCore, selection: DOMSelection) => void;
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
/**

@@ -57,8 +58,155 @@ * The general API to do format change with Content Model

*/
export declare type FormatContentModel = (core: StandaloneEditorCore & EditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
export declare type FormatContentModel = (core: StandaloneEditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
/**
* The interface for the map of core API for Content Model editor.
* Editor can call call API from this map under StandaloneEditorCore object
* Switch the Shadow Edit mode of editor On/Off
* @param core The StandaloneEditorCore object
* @param isOn True to switch On, False to switch Off
*/
export interface StandaloneCoreApiMap {
export declare type SwitchShadowEdit = (core: StandaloneEditorCore, isOn: boolean) => void;
/**
* 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
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
export declare type TriggerEvent = (core: StandaloneEditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;
/**
* Get current selection range
* @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.
*/
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
/**
* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
*/
export declare type GetVisibleViewport = (core: StandaloneEditorCore) => Rect | null;
/**
* 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
* if triggerContentChangedEvent is set to true
* @param core The StandaloneEditorCore object
* @param content HTML content to set in
* @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
*/
export declare type SetContent = (core: StandaloneEditorCore, content: string, triggerContentChangedEvent: boolean, metadata?: ContentMetadata) => void;
/**
* 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
* @param core The StandaloneEditorCore object
* @returns True if the editor has focus, otherwise false
*/
export declare type HasFocus = (core: StandaloneEditorCore) => boolean;
/**
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
*/
export declare type Focus = (core: StandaloneEditorCore) => void;
/**
* Insert a DOM node into editor content
* @param core The StandaloneEditorCore object. No op if null.
* @param option An insert option object to specify how to insert the node
*/
export declare type InsertNode = (core: StandaloneEditorCore, node: Node, option: InsertOption | null) => boolean;
/**
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param eventMap A map from event name to its handler
*/
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
/**
* Get current editor content as HTML string
* @param core The StandaloneEditorCore object
* @param mode specify what kind of HTML content to retrieve
* @returns HTML string representing current editor content
*/
export declare type GetContent = (core: StandaloneEditorCore, mode: GetContentMode | CompatibleGetContentMode) => string;
/**
* Get style based format state from current selection, including font name/size and colors
* @param core The StandaloneEditorCore objects
* @param node The node to get style from
*/
export declare type GetStyleBasedFormatState = (core: StandaloneEditorCore, node: Node | null) => StyleBasedFormatState;
/**
* Restore an undo snapshot into editor
* @param core The StandaloneEditorCore object
* @param step Steps to move, can be 0, positive or negative
*/
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
/**
* Ensure user will type into a container element rather than into the editor content DIV directly
* @param core The StandaloneEditorCore object.
* @param position The position that user is about to type to
* @param keyboardEvent Optional keyboard event object
* @param deprecated Deprecated parameter, not used
*/
export declare type EnsureTypeInContainer = (core: StandaloneEditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, deprecated?: boolean) => void;
/**
* Temp interface
* TODO: Port other core API
*/
export interface PortedCoreApiMap {
/**

@@ -103,8 +251,169 @@ * Create a EditorContext object used by ContentModel API

formatContentModel: FormatContentModel;
/**
* Switch the Shadow Edit mode of editor On/Off
* @param core The StandaloneEditorCore object
* @param isOn True to switch On, False to switch Off
*/
switchShadowEdit: SwitchShadowEdit;
/**
* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
*/
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
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
triggerEvent: TriggerEvent;
/**
* 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
*/
getSelectionRangeEx: GetSelectionRangeEx;
/**
* Edit and transform color of elements between light mode and dark mode
* @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
*/
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.
*/
selectRange: SelectRange;
/**
* Select a image and save data of the selected range
* @param core The StandaloneEditorCore object
* @param image image to select
* @param imageId the id of the image element
* @returns true if successful
*/
selectImage: SelectImage;
/**
* 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.
* @param shouldAddStyles Whether need to update the style elements
* @returns true if successful
*/
selectTable: SelectTable;
/**
* Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered
* if triggerContentChangedEvent is set to true
* @param core The StandaloneEditorCore object
* @param content HTML content to set in
* @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
*/
setContent: SetContent;
/**
* 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
* @param core The StandaloneEditorCore object. No op if null.
* @param option An insert option object to specify how to insert the node
*/
insertNode: InsertNode;
/**
* 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
* @param core The StandaloneEditorCore object
* @param mode specify what kind of HTML content to retrieve
* @returns HTML string representing current editor content
*/
getContent: GetContent;
/**
* Get style based format state from current selection, including font name/size and colors
* @param core The StandaloneEditorCore objects
* @param node The node to get style from
*/
getStyleBasedFormatState: GetStyleBasedFormatState;
/**
* 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
* @param core The EditorCore object.
* @param position The position that user is about to type to
* @param keyboardEvent Optional keyboard event object
* @param deprecated Deprecated parameter, not used
*/
ensureTypeInContainer: EnsureTypeInContainer;
}
/**
* The interface for the map of core API for Content Model editor.
* Editor can call call API from this map under StandaloneEditorCore object
*/
export interface StandaloneCoreApiMap extends PortedCoreApiMap, UnportedCoreApiMap {
}
/**
* Represents the core data structure of a Content Model editor
*/
export interface StandaloneEditorCore extends ContentModelPluginState {
export interface StandaloneEditorCore extends StandaloneEditorCorePluginState, UnportedCorePluginState, StandaloneEditorDefaultSettings {
/**

@@ -123,2 +432,26 @@ * The content DIV element of this editor

/**
* An array of editor plugins.
*/
readonly plugins: EditorPlugin[];
/**
* Editor running environment
*/
readonly environment: EditorEnvironment;
/**
* Dark model handler for the editor, used for variable-based solution.
* If keep it null, editor will still use original dataset-based dark mode solution.
*/
readonly darkColorHandler: DarkColorHandler;
/**
* A handler to convert HTML string to a trust HTML string.
* By default it will just return the original HTML string directly.
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
*/
readonly trustedHTMLHandler: TrustedHTMLHandler;
}
/**
* Default DOM and Content Model conversion settings for an editor
*/
export interface StandaloneEditorDefaultSettings {
/**
* Default DOM to Content Model options

@@ -141,6 +474,2 @@ */

defaultModelToDomConfig: ModelToDomSettings;
/**
* Editor running environment
*/
environment: EditorEnvironment;
}

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

import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';
import type { StandaloneCoreApiMap } from './StandaloneEditorCore';
import type { EditorPlugin, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { DomToModelOption } from '../context/DomToModelOption';
import type { ModelToDomOption } from '../context/ModelToDomOption';
import type { ContentModelDocument } from '../group/ContentModelDocument';
/**

@@ -19,2 +23,57 @@ * Options for Content Model editor

cacheModel?: boolean;
/**
* List of plugins.
* The order of plugins here determines in what order each event will be dispatched.
* Plugins not appear in this list will not be added to editor, including built-in plugins.
* Default value is empty array.
*/
plugins?: EditorPlugin[];
/**
* Default format of editor content. This will be applied to empty content.
* If there is already content inside editor, format of existing content will not be changed.
* Default value is the computed style of editor content DIV
*/
defaultSegmentFormat?: ContentModelSegmentFormat;
/**
* Allowed custom content type when paste besides text/plain, text/html and images
* Only text types are supported, and do not add "text/" prefix to the type values
*/
allowedCustomPasteType?: string[];
/**
* The scroll container to get scroll event from.
* By default, the scroll container will be the same with editor content DIV
*/
scrollContainer?: HTMLElement;
/**
* Base dark mode color. We will use this color to calculate the dark mode color from a given light mode color
* @default #333333
*/
baseDarkColor?: string;
/**
* Customized trusted type handler used for sanitizing HTML string before assign to DOM tree
* This is required when trusted-type Content-Security-Policy (CSP) is enabled.
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
*/
trustedHTMLHandler?: TrustedHTMLHandler;
/**
* A function map to override default core API implementation
* Default value is null
*/
coreApiOverride?: Partial<StandaloneCoreApiMap>;
/**
* Color of the border of a selectedImage. Default color: '#DB626C'
*/
imageSelectionBorderColor?: string;
/**
* Initial Content Model
*/
initialModel?: ContentModelDocument;
/**
* Whether to skip the adjust editor process when for light/dark mode
*/
doNotAdjustEditorColor?: boolean;
/**
* If the editor is currently in dark mode
*/
inDarkMode?: boolean;
}

@@ -25,4 +25,8 @@ /**

*/
| 'UpdateEntityState';
| 'updateEntityState'
/**
* Notify plugins that user is clicking target to an entity
*/
| 'click';
/**
* Define entity removal related operations

@@ -29,0 +33,0 @@ */

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

import type { ContentModelEntity } from '../entity/ContentModelEntity';
import type { EntityRemovalOperation } from '../enum/EntityOperation';
import type { ContentModelDocument } from '../group/ContentModelDocument';

@@ -5,2 +7,19 @@ import type { DOMSelection } from '../selection/DOMSelection';

/**
* Represents an entity that has been changed during a content change process
*/
export interface ChangedEntity {
/**
* The changed entity
*/
entity: ContentModelEntity;
/**
* Operation that causes the change
*/
operation: EntityRemovalOperation | 'newEntity';
/**
* @optional Raw DOM event that causes the chagne
*/
rawEvent?: Event;
}
/**
* Data of ContentModelContentChangedEvent

@@ -12,7 +31,11 @@ */

*/
contentModel?: ContentModelDocument;
readonly contentModel?: ContentModelDocument;
/**
* Selection range applied to the document
*/
selection?: DOMSelection;
readonly selection?: DOMSelection;
/**
* Entities got changed (added or removed) during the content change process
*/
readonly changedEntities?: ChangedEntity[];
}

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

/**
* Enum used to control the different types of bullet list
*/
export declare enum BulletListType {
/**
* Minimum value of the enum
*/
Min = 1,
/**
* Bullet triggered by *
*/
Disc = 1,
/**
* Bullet triggered by -
*/
Dash = 2,
/**
* Bullet triggered by --
*/
Square = 3,
/**
* Bullet triggered by >
*/
ShortArrow = 4,
/**
* Bullet triggered by ->
*/
LongArrow = 5,
/**
* Bullet triggered by =>
*/
UnfilledArrow = 6,
/**
* Bullet triggered by —
*/
Hyphen = 7,
/**
* Bullet triggered by -->
*/
DoubleLongArrow = 8,
/**
* Bullet type circle
*/
Circle = 9,
/**
* Maximum value of the enum
*/
Max = 9
}
/**
* Enum used to control the different types of numbering list
*/
export declare enum NumberingListType {
/**
* Minimum value of the enum
*/
Min = 1,
/**
* Numbering triggered by 1.
*/
Decimal = 1,
/**
* Numbering triggered by 1-
*/
DecimalDash = 2,
/**
* Numbering triggered by 1)
*/
DecimalParenthesis = 3,
/**
* Numbering triggered by (1)
*/
DecimalDoubleParenthesis = 4,
/**
* Numbering triggered by a.
*/
LowerAlpha = 5,
/**
* Numbering triggered by a)
*/
LowerAlphaParenthesis = 6,
/**
* Numbering triggered by (a)
*/
LowerAlphaDoubleParenthesis = 7,
/**
* Numbering triggered by a-
*/
LowerAlphaDash = 8,
/**
* Numbering triggered by A.
*/
UpperAlpha = 9,
/**
* Numbering triggered by A)
*/
UpperAlphaParenthesis = 10,
/**
* Numbering triggered by (A)
*/
UpperAlphaDoubleParenthesis = 11,
/**
* Numbering triggered by A-
*/
UpperAlphaDash = 12,
/**
* Numbering triggered by i.
*/
LowerRoman = 13,
/**
* Numbering triggered by i)
*/
LowerRomanParenthesis = 14,
/**
* Numbering triggered by (i)
*/
LowerRomanDoubleParenthesis = 15,
/**
* Numbering triggered by i-
*/
LowerRomanDash = 16,
/**
* Numbering triggered by I.
*/
UpperRoman = 17,
/**
* Numbering triggered by I)
*/
UpperRomanParenthesis = 18,
/**
* Numbering triggered by (I)
*/
UpperRomanDoubleParenthesis = 19,
/**
* Numbering triggered by I-
*/
UpperRomanDash = 20,
/**
* Maximum value of the enum
*/
Max = 20
}
/**
* Format of list / list item that stored as metadata

@@ -148,9 +6,9 @@ */

/**
* Style type for Ordered list
* Style type for Ordered list. Use value of constant NumberingListType as value.
*/
orderedStyleType?: NumberingListType;
orderedStyleType?: number;
/**
* Style type for Unordered list
* Style type for Unordered list. Use value of constant BulletListType as value.
*/
unorderedStyleType?: BulletListType;
unorderedStyleType?: number;
};

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

/**
* Enum used to control the different types of bullet list
*/
export var BulletListType;
(function (BulletListType) {
/**
* Minimum value of the enum
*/
BulletListType[BulletListType["Min"] = 1] = "Min";
/**
* Bullet triggered by *
*/
BulletListType[BulletListType["Disc"] = 1] = "Disc";
/**
* Bullet triggered by -
*/
BulletListType[BulletListType["Dash"] = 2] = "Dash";
/**
* Bullet triggered by --
*/
BulletListType[BulletListType["Square"] = 3] = "Square";
/**
* Bullet triggered by >
*/
BulletListType[BulletListType["ShortArrow"] = 4] = "ShortArrow";
/**
* Bullet triggered by ->
*/
BulletListType[BulletListType["LongArrow"] = 5] = "LongArrow";
/**
* Bullet triggered by =>
*/
BulletListType[BulletListType["UnfilledArrow"] = 6] = "UnfilledArrow";
/**
* Bullet triggered by —
*/
BulletListType[BulletListType["Hyphen"] = 7] = "Hyphen";
/**
* Bullet triggered by -->
*/
BulletListType[BulletListType["DoubleLongArrow"] = 8] = "DoubleLongArrow";
/**
* Bullet type circle
*/
BulletListType[BulletListType["Circle"] = 9] = "Circle";
/**
* Maximum value of the enum
*/
BulletListType[BulletListType["Max"] = 9] = "Max";
})(BulletListType || (BulletListType = {}));
/**
* Enum used to control the different types of numbering list
*/
export var NumberingListType;
(function (NumberingListType) {
/**
* Minimum value of the enum
*/
NumberingListType[NumberingListType["Min"] = 1] = "Min";
/**
* Numbering triggered by 1.
*/
NumberingListType[NumberingListType["Decimal"] = 1] = "Decimal";
/**
* Numbering triggered by 1-
*/
NumberingListType[NumberingListType["DecimalDash"] = 2] = "DecimalDash";
/**
* Numbering triggered by 1)
*/
NumberingListType[NumberingListType["DecimalParenthesis"] = 3] = "DecimalParenthesis";
/**
* Numbering triggered by (1)
*/
NumberingListType[NumberingListType["DecimalDoubleParenthesis"] = 4] = "DecimalDoubleParenthesis";
/**
* Numbering triggered by a.
*/
NumberingListType[NumberingListType["LowerAlpha"] = 5] = "LowerAlpha";
/**
* Numbering triggered by a)
*/
NumberingListType[NumberingListType["LowerAlphaParenthesis"] = 6] = "LowerAlphaParenthesis";
/**
* Numbering triggered by (a)
*/
NumberingListType[NumberingListType["LowerAlphaDoubleParenthesis"] = 7] = "LowerAlphaDoubleParenthesis";
/**
* Numbering triggered by a-
*/
NumberingListType[NumberingListType["LowerAlphaDash"] = 8] = "LowerAlphaDash";
/**
* Numbering triggered by A.
*/
NumberingListType[NumberingListType["UpperAlpha"] = 9] = "UpperAlpha";
/**
* Numbering triggered by A)
*/
NumberingListType[NumberingListType["UpperAlphaParenthesis"] = 10] = "UpperAlphaParenthesis";
/**
* Numbering triggered by (A)
*/
NumberingListType[NumberingListType["UpperAlphaDoubleParenthesis"] = 11] = "UpperAlphaDoubleParenthesis";
/**
* Numbering triggered by A-
*/
NumberingListType[NumberingListType["UpperAlphaDash"] = 12] = "UpperAlphaDash";
/**
* Numbering triggered by i.
*/
NumberingListType[NumberingListType["LowerRoman"] = 13] = "LowerRoman";
/**
* Numbering triggered by i)
*/
NumberingListType[NumberingListType["LowerRomanParenthesis"] = 14] = "LowerRomanParenthesis";
/**
* Numbering triggered by (i)
*/
NumberingListType[NumberingListType["LowerRomanDoubleParenthesis"] = 15] = "LowerRomanDoubleParenthesis";
/**
* Numbering triggered by i-
*/
NumberingListType[NumberingListType["LowerRomanDash"] = 16] = "LowerRomanDash";
/**
* Numbering triggered by I.
*/
NumberingListType[NumberingListType["UpperRoman"] = 17] = "UpperRoman";
/**
* Numbering triggered by I)
*/
NumberingListType[NumberingListType["UpperRomanParenthesis"] = 18] = "UpperRomanParenthesis";
/**
* Numbering triggered by (I)
*/
NumberingListType[NumberingListType["UpperRomanDoubleParenthesis"] = 19] = "UpperRomanDoubleParenthesis";
/**
* Numbering triggered by I-
*/
NumberingListType[NumberingListType["UpperRomanDash"] = 20] = "UpperRomanDash";
/**
* Maximum value of the enum
*/
NumberingListType[NumberingListType["Max"] = 20] = "Max";
})(NumberingListType || (NumberingListType = {}));
export {};
//# sourceMappingURL=ListMetadataFormat.js.map
/**
* Table format border
*/
export declare enum TableBorderFormat {
/**
* All border of the table are displayed
* __ __ __
* |__|__|__|
* |__|__|__|
* |__|__|__|
*/
DEFAULT = 0,
/**
* Middle vertical border are not displayed
* __ __ __
* |__ __ __|
* |__ __ __|
* |__ __ __|
*/
LIST_WITH_SIDE_BORDERS = 1,
/**
* All borders except header rows borders are displayed
* __ __ __
* __|__|__
* __|__|__
*/
NO_HEADER_BORDERS = 2,
/**
* The left and right border of the table are not displayed
* __ __ __
* __|__|__
* __|__|__
* __|__|__
*/
NO_SIDE_BORDERS = 3,
/**
* Only the borders that divides the header row, first column and externals are displayed
* __ __ __
* |__ __ __|
* | | |
* |__|__ __|
*/
FIRST_COLUMN_HEADER_EXTERNAL = 4,
/**
* The header row has no vertical border, except for the first one
* The first column has no horizontal border, except for the first one
* __ __ __
* |__ __ __
* | |__|__|
* | |__|__|
*/
ESPECIAL_TYPE_1 = 5,
/**
* The header row has no vertical border, except for the first one
* The only horizontal border of the table is the top and bottom of header row
* __ __ __
* |__ __ __
* | | |
* | | |
*/
ESPECIAL_TYPE_2 = 6,
/**
* The only borders are the bottom of header row and the right border of first column
* __ __ __
* |
* |
*/
ESPECIAL_TYPE_3 = 7,
/**
* No border
*/
CLEAR = 8
}
/**
* Format of table that stored as metadata

@@ -119,5 +46,5 @@ */

/**
* Table Borders Type
* Table Borders Type. Use value of constant TableBorderFormat as value
*/
tableBorderFormat?: TableBorderFormat;
tableBorderFormat?: number;
/**

@@ -124,0 +51,0 @@ * Vertical alignment for each row

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

/**
* Table format border
*/
export var TableBorderFormat;
(function (TableBorderFormat) {
/**
* All border of the table are displayed
* __ __ __
* |__|__|__|
* |__|__|__|
* |__|__|__|
*/
TableBorderFormat[TableBorderFormat["DEFAULT"] = 0] = "DEFAULT";
/**
* Middle vertical border are not displayed
* __ __ __
* |__ __ __|
* |__ __ __|
* |__ __ __|
*/
TableBorderFormat[TableBorderFormat["LIST_WITH_SIDE_BORDERS"] = 1] = "LIST_WITH_SIDE_BORDERS";
/**
* All borders except header rows borders are displayed
* __ __ __
* __|__|__
* __|__|__
*/
TableBorderFormat[TableBorderFormat["NO_HEADER_BORDERS"] = 2] = "NO_HEADER_BORDERS";
/**
* The left and right border of the table are not displayed
* __ __ __
* __|__|__
* __|__|__
* __|__|__
*/
TableBorderFormat[TableBorderFormat["NO_SIDE_BORDERS"] = 3] = "NO_SIDE_BORDERS";
/**
* Only the borders that divides the header row, first column and externals are displayed
* __ __ __
* |__ __ __|
* | | |
* |__|__ __|
*/
TableBorderFormat[TableBorderFormat["FIRST_COLUMN_HEADER_EXTERNAL"] = 4] = "FIRST_COLUMN_HEADER_EXTERNAL";
/**
* The header row has no vertical border, except for the first one
* The first column has no horizontal border, except for the first one
* __ __ __
* |__ __ __
* | |__|__|
* | |__|__|
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_1"] = 5] = "ESPECIAL_TYPE_1";
/**
* The header row has no vertical border, except for the first one
* The only horizontal border of the table is the top and bottom of header row
* __ __ __
* |__ __ __
* | | |
* | | |
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_2"] = 6] = "ESPECIAL_TYPE_2";
/**
* The only borders are the bottom of header row and the right border of first column
* __ __ __
* |
* |
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_3"] = 7] = "ESPECIAL_TYPE_3";
/**
* No border
*/
TableBorderFormat[TableBorderFormat["CLEAR"] = 8] = "CLEAR";
})(TableBorderFormat || (TableBorderFormat = {}));
export {};
//# sourceMappingURL=TableMetadataFormat.js.map

@@ -51,4 +51,4 @@ export { ContentModelSegmentFormat } from './format/ContentModelSegmentFormat';

export { DatasetFormat } from './format/metadata/DatasetFormat';
export { TableMetadataFormat, TableBorderFormat } from './format/metadata/TableMetadataFormat';
export { ListMetadataFormat, NumberingListType, BulletListType, } from './format/metadata/ListMetadataFormat';
export { TableMetadataFormat } from './format/metadata/TableMetadataFormat';
export { ListMetadataFormat } from './format/metadata/ListMetadataFormat';
export { ImageResizeMetadataFormat, ImageCropMetadataFormat, ImageMetadataFormat, ImageRotateMetadataFormat, } from './format/metadata/ImageMetadataFormat';

@@ -115,6 +115,11 @@ export { TableCellMetadataFormat } from './format/metadata/TableCellMetadataFormat';

export { StandaloneEditorOptions } from './editor/StandaloneEditorOptions';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, } from './editor/StandaloneEditorCore';
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 { StandaloneEditorCorePlugins } from './editor/StandaloneEditorCorePlugins';
export { ContentModelCachePluginState } from './pluginState/ContentModelCachePluginState';
export { ContentModelPluginState } from './pluginState/ContentModelPluginState';
export { StandaloneEditorCorePluginState, UnportedCorePluginState, } from './pluginState/StandaloneEditorPluginState';
export { ContentModelFormatPluginState, PendingFormat, } from './pluginState/ContentModelFormatPluginState';
export { DOMEventPluginState } from './pluginState/DOMEventPluginState';
export { LifecyclePluginState } from './pluginState/LifecyclePluginState';
export { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';
export { SelectionPluginState } from './pluginState/SelectionPluginState';
export { EditorEnvironment } from './parameter/EditorEnvironment';

@@ -129,2 +134,2 @@ export { DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';

export { ContentModelBeforePasteEvent, ContentModelBeforePasteEventData, CompatibleContentModelBeforePasteEvent, } from './event/ContentModelBeforePasteEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, } from './event/ContentModelContentChangedEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, ChangedEntity, } from './event/ContentModelContentChangedEvent';

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

export { TableBorderFormat } from './format/metadata/TableMetadataFormat';
export { NumberingListType, BulletListType, } from './format/metadata/ListMetadataFormat';
export {};
//# sourceMappingURL=index.js.map

@@ -13,2 +13,6 @@ /**

isAndroid?: boolean;
/**
* Whether editor is running on Safari browser
*/
isSafari?: boolean;
}

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

import type { EditorCore, SwitchShadowEdit } from 'roosterjs-editor-types';
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 { ContentModelDocument } from '../group/ContentModelDocument';
import type { ContentModelPluginState } from '../pluginState/ContentModelPluginState';
import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';
import type { DOMSelection } from '../selection/DOMSelection';

@@ -16,3 +17,3 @@ import type { DomToModelOption } from '../context/DomToModelOption';

*/
export declare type CreateEditorContext = (core: StandaloneEditorCore & EditorCore) => EditorContext;
export declare type CreateEditorContext = (core: StandaloneEditorCore) => EditorContext;
/**

@@ -24,3 +25,3 @@ * Create Content Model from DOM tree in this editor

*/
export declare type CreateContentModel = (core: StandaloneEditorCore & EditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
export declare type CreateContentModel = (core: StandaloneEditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
/**

@@ -30,3 +31,3 @@ * Get current DOM selection from editor

*/
export declare type GetDOMSelection = (core: StandaloneEditorCore & EditorCore) => DOMSelection | null;
export declare type GetDOMSelection = (core: StandaloneEditorCore) => DOMSelection | null;
/**

@@ -39,3 +40,3 @@ * Set content with content model. This is the replacement of core API getSelectionRangeEx

*/
export declare type SetContentModel = (core: StandaloneEditorCore & EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
export declare type SetContentModel = (core: StandaloneEditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
/**

@@ -46,3 +47,3 @@ * Set current DOM selection from editor. This is the replacement of core API select

*/
export declare type SetDOMSelection = (core: StandaloneEditorCore & EditorCore, selection: DOMSelection) => void;
export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
/**

@@ -57,8 +58,155 @@ * The general API to do format change with Content Model

*/
export declare type FormatContentModel = (core: StandaloneEditorCore & EditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
export declare type FormatContentModel = (core: StandaloneEditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
/**
* The interface for the map of core API for Content Model editor.
* Editor can call call API from this map under StandaloneEditorCore object
* Switch the Shadow Edit mode of editor On/Off
* @param core The StandaloneEditorCore object
* @param isOn True to switch On, False to switch Off
*/
export interface StandaloneCoreApiMap {
export declare type SwitchShadowEdit = (core: StandaloneEditorCore, isOn: boolean) => void;
/**
* 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
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
export declare type TriggerEvent = (core: StandaloneEditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;
/**
* Get current selection range
* @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.
*/
export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
/**
* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
*/
export declare type GetVisibleViewport = (core: StandaloneEditorCore) => Rect | null;
/**
* 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
* if triggerContentChangedEvent is set to true
* @param core The StandaloneEditorCore object
* @param content HTML content to set in
* @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
*/
export declare type SetContent = (core: StandaloneEditorCore, content: string, triggerContentChangedEvent: boolean, metadata?: ContentMetadata) => void;
/**
* 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
* @param core The StandaloneEditorCore object
* @returns True if the editor has focus, otherwise false
*/
export declare type HasFocus = (core: StandaloneEditorCore) => boolean;
/**
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
*/
export declare type Focus = (core: StandaloneEditorCore) => void;
/**
* Insert a DOM node into editor content
* @param core The StandaloneEditorCore object. No op if null.
* @param option An insert option object to specify how to insert the node
*/
export declare type InsertNode = (core: StandaloneEditorCore, node: Node, option: InsertOption | null) => boolean;
/**
* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param eventMap A map from event name to its handler
*/
export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
/**
* Get current editor content as HTML string
* @param core The StandaloneEditorCore object
* @param mode specify what kind of HTML content to retrieve
* @returns HTML string representing current editor content
*/
export declare type GetContent = (core: StandaloneEditorCore, mode: GetContentMode | CompatibleGetContentMode) => string;
/**
* Get style based format state from current selection, including font name/size and colors
* @param core The StandaloneEditorCore objects
* @param node The node to get style from
*/
export declare type GetStyleBasedFormatState = (core: StandaloneEditorCore, node: Node | null) => StyleBasedFormatState;
/**
* Restore an undo snapshot into editor
* @param core The StandaloneEditorCore object
* @param step Steps to move, can be 0, positive or negative
*/
export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
/**
* Ensure user will type into a container element rather than into the editor content DIV directly
* @param core The StandaloneEditorCore object.
* @param position The position that user is about to type to
* @param keyboardEvent Optional keyboard event object
* @param deprecated Deprecated parameter, not used
*/
export declare type EnsureTypeInContainer = (core: StandaloneEditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, deprecated?: boolean) => void;
/**
* Temp interface
* TODO: Port other core API
*/
export interface PortedCoreApiMap {
/**

@@ -103,8 +251,169 @@ * Create a EditorContext object used by ContentModel API

formatContentModel: FormatContentModel;
/**
* Switch the Shadow Edit mode of editor On/Off
* @param core The StandaloneEditorCore object
* @param isOn True to switch On, False to switch Off
*/
switchShadowEdit: SwitchShadowEdit;
/**
* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
*/
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
* @param core The StandaloneEditorCore object
* @param pluginEvent The event object to trigger
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
*/
triggerEvent: TriggerEvent;
/**
* 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
*/
getSelectionRangeEx: GetSelectionRangeEx;
/**
* Edit and transform color of elements between light mode and dark mode
* @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
*/
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.
*/
selectRange: SelectRange;
/**
* Select a image and save data of the selected range
* @param core The StandaloneEditorCore object
* @param image image to select
* @param imageId the id of the image element
* @returns true if successful
*/
selectImage: SelectImage;
/**
* 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.
* @param shouldAddStyles Whether need to update the style elements
* @returns true if successful
*/
selectTable: SelectTable;
/**
* Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered
* if triggerContentChangedEvent is set to true
* @param core The StandaloneEditorCore object
* @param content HTML content to set in
* @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
*/
setContent: SetContent;
/**
* 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
* @param core The StandaloneEditorCore object. No op if null.
* @param option An insert option object to specify how to insert the node
*/
insertNode: InsertNode;
/**
* 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
* @param core The StandaloneEditorCore object
* @param mode specify what kind of HTML content to retrieve
* @returns HTML string representing current editor content
*/
getContent: GetContent;
/**
* Get style based format state from current selection, including font name/size and colors
* @param core The StandaloneEditorCore objects
* @param node The node to get style from
*/
getStyleBasedFormatState: GetStyleBasedFormatState;
/**
* 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
* @param core The EditorCore object.
* @param position The position that user is about to type to
* @param keyboardEvent Optional keyboard event object
* @param deprecated Deprecated parameter, not used
*/
ensureTypeInContainer: EnsureTypeInContainer;
}
/**
* The interface for the map of core API for Content Model editor.
* Editor can call call API from this map under StandaloneEditorCore object
*/
export interface StandaloneCoreApiMap extends PortedCoreApiMap, UnportedCoreApiMap {
}
/**
* Represents the core data structure of a Content Model editor
*/
export interface StandaloneEditorCore extends ContentModelPluginState {
export interface StandaloneEditorCore extends StandaloneEditorCorePluginState, UnportedCorePluginState, StandaloneEditorDefaultSettings {
/**

@@ -123,2 +432,26 @@ * The content DIV element of this editor

/**
* An array of editor plugins.
*/
readonly plugins: EditorPlugin[];
/**
* Editor running environment
*/
readonly environment: EditorEnvironment;
/**
* Dark model handler for the editor, used for variable-based solution.
* If keep it null, editor will still use original dataset-based dark mode solution.
*/
readonly darkColorHandler: DarkColorHandler;
/**
* A handler to convert HTML string to a trust HTML string.
* By default it will just return the original HTML string directly.
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
*/
readonly trustedHTMLHandler: TrustedHTMLHandler;
}
/**
* Default DOM and Content Model conversion settings for an editor
*/
export interface StandaloneEditorDefaultSettings {
/**
* Default DOM to Content Model options

@@ -141,6 +474,2 @@ */

defaultModelToDomConfig: ModelToDomSettings;
/**
* Editor running environment
*/
environment: EditorEnvironment;
}

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

import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';
import type { StandaloneCoreApiMap } from './StandaloneEditorCore';
import type { EditorPlugin, TrustedHTMLHandler } from 'roosterjs-editor-types';
import type { DomToModelOption } from '../context/DomToModelOption';
import type { ModelToDomOption } from '../context/ModelToDomOption';
import type { ContentModelDocument } from '../group/ContentModelDocument';
/**

@@ -19,2 +23,57 @@ * Options for Content Model editor

cacheModel?: boolean;
/**
* List of plugins.
* The order of plugins here determines in what order each event will be dispatched.
* Plugins not appear in this list will not be added to editor, including built-in plugins.
* Default value is empty array.
*/
plugins?: EditorPlugin[];
/**
* Default format of editor content. This will be applied to empty content.
* If there is already content inside editor, format of existing content will not be changed.
* Default value is the computed style of editor content DIV
*/
defaultSegmentFormat?: ContentModelSegmentFormat;
/**
* Allowed custom content type when paste besides text/plain, text/html and images
* Only text types are supported, and do not add "text/" prefix to the type values
*/
allowedCustomPasteType?: string[];
/**
* The scroll container to get scroll event from.
* By default, the scroll container will be the same with editor content DIV
*/
scrollContainer?: HTMLElement;
/**
* Base dark mode color. We will use this color to calculate the dark mode color from a given light mode color
* @default #333333
*/
baseDarkColor?: string;
/**
* Customized trusted type handler used for sanitizing HTML string before assign to DOM tree
* This is required when trusted-type Content-Security-Policy (CSP) is enabled.
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
*/
trustedHTMLHandler?: TrustedHTMLHandler;
/**
* A function map to override default core API implementation
* Default value is null
*/
coreApiOverride?: Partial<StandaloneCoreApiMap>;
/**
* Color of the border of a selectedImage. Default color: '#DB626C'
*/
imageSelectionBorderColor?: string;
/**
* Initial Content Model
*/
initialModel?: ContentModelDocument;
/**
* Whether to skip the adjust editor process when for light/dark mode
*/
doNotAdjustEditorColor?: boolean;
/**
* If the editor is currently in dark mode
*/
inDarkMode?: boolean;
}

@@ -25,4 +25,8 @@ /**

*/
| 'UpdateEntityState';
| 'updateEntityState'
/**
* Notify plugins that user is clicking target to an entity
*/
| 'click';
/**
* Define entity removal related operations

@@ -29,0 +33,0 @@ */

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

import type { ContentModelEntity } from '../entity/ContentModelEntity';
import type { EntityRemovalOperation } from '../enum/EntityOperation';
import type { ContentModelDocument } from '../group/ContentModelDocument';

@@ -5,2 +7,19 @@ import type { DOMSelection } from '../selection/DOMSelection';

/**
* Represents an entity that has been changed during a content change process
*/
export interface ChangedEntity {
/**
* The changed entity
*/
entity: ContentModelEntity;
/**
* Operation that causes the change
*/
operation: EntityRemovalOperation | 'newEntity';
/**
* @optional Raw DOM event that causes the chagne
*/
rawEvent?: Event;
}
/**
* Data of ContentModelContentChangedEvent

@@ -12,7 +31,11 @@ */

*/
contentModel?: ContentModelDocument;
readonly contentModel?: ContentModelDocument;
/**
* Selection range applied to the document
*/
selection?: DOMSelection;
readonly selection?: DOMSelection;
/**
* Entities got changed (added or removed) during the content change process
*/
readonly changedEntities?: ChangedEntity[];
}

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

/**
* Enum used to control the different types of bullet list
*/
export declare enum BulletListType {
/**
* Minimum value of the enum
*/
Min = 1,
/**
* Bullet triggered by *
*/
Disc = 1,
/**
* Bullet triggered by -
*/
Dash = 2,
/**
* Bullet triggered by --
*/
Square = 3,
/**
* Bullet triggered by >
*/
ShortArrow = 4,
/**
* Bullet triggered by ->
*/
LongArrow = 5,
/**
* Bullet triggered by =>
*/
UnfilledArrow = 6,
/**
* Bullet triggered by —
*/
Hyphen = 7,
/**
* Bullet triggered by -->
*/
DoubleLongArrow = 8,
/**
* Bullet type circle
*/
Circle = 9,
/**
* Maximum value of the enum
*/
Max = 9
}
/**
* Enum used to control the different types of numbering list
*/
export declare enum NumberingListType {
/**
* Minimum value of the enum
*/
Min = 1,
/**
* Numbering triggered by 1.
*/
Decimal = 1,
/**
* Numbering triggered by 1-
*/
DecimalDash = 2,
/**
* Numbering triggered by 1)
*/
DecimalParenthesis = 3,
/**
* Numbering triggered by (1)
*/
DecimalDoubleParenthesis = 4,
/**
* Numbering triggered by a.
*/
LowerAlpha = 5,
/**
* Numbering triggered by a)
*/
LowerAlphaParenthesis = 6,
/**
* Numbering triggered by (a)
*/
LowerAlphaDoubleParenthesis = 7,
/**
* Numbering triggered by a-
*/
LowerAlphaDash = 8,
/**
* Numbering triggered by A.
*/
UpperAlpha = 9,
/**
* Numbering triggered by A)
*/
UpperAlphaParenthesis = 10,
/**
* Numbering triggered by (A)
*/
UpperAlphaDoubleParenthesis = 11,
/**
* Numbering triggered by A-
*/
UpperAlphaDash = 12,
/**
* Numbering triggered by i.
*/
LowerRoman = 13,
/**
* Numbering triggered by i)
*/
LowerRomanParenthesis = 14,
/**
* Numbering triggered by (i)
*/
LowerRomanDoubleParenthesis = 15,
/**
* Numbering triggered by i-
*/
LowerRomanDash = 16,
/**
* Numbering triggered by I.
*/
UpperRoman = 17,
/**
* Numbering triggered by I)
*/
UpperRomanParenthesis = 18,
/**
* Numbering triggered by (I)
*/
UpperRomanDoubleParenthesis = 19,
/**
* Numbering triggered by I-
*/
UpperRomanDash = 20,
/**
* Maximum value of the enum
*/
Max = 20
}
/**
* Format of list / list item that stored as metadata

@@ -148,9 +6,9 @@ */

/**
* Style type for Ordered list
* Style type for Ordered list. Use value of constant NumberingListType as value.
*/
orderedStyleType?: NumberingListType;
orderedStyleType?: number;
/**
* Style type for Unordered list
* Style type for Unordered list. Use value of constant BulletListType as value.
*/
unorderedStyleType?: BulletListType;
unorderedStyleType?: number;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumberingListType = exports.BulletListType = void 0;
/**
* Enum used to control the different types of bullet list
*/
var BulletListType;
(function (BulletListType) {
/**
* Minimum value of the enum
*/
BulletListType[BulletListType["Min"] = 1] = "Min";
/**
* Bullet triggered by *
*/
BulletListType[BulletListType["Disc"] = 1] = "Disc";
/**
* Bullet triggered by -
*/
BulletListType[BulletListType["Dash"] = 2] = "Dash";
/**
* Bullet triggered by --
*/
BulletListType[BulletListType["Square"] = 3] = "Square";
/**
* Bullet triggered by >
*/
BulletListType[BulletListType["ShortArrow"] = 4] = "ShortArrow";
/**
* Bullet triggered by ->
*/
BulletListType[BulletListType["LongArrow"] = 5] = "LongArrow";
/**
* Bullet triggered by =>
*/
BulletListType[BulletListType["UnfilledArrow"] = 6] = "UnfilledArrow";
/**
* Bullet triggered by —
*/
BulletListType[BulletListType["Hyphen"] = 7] = "Hyphen";
/**
* Bullet triggered by -->
*/
BulletListType[BulletListType["DoubleLongArrow"] = 8] = "DoubleLongArrow";
/**
* Bullet type circle
*/
BulletListType[BulletListType["Circle"] = 9] = "Circle";
/**
* Maximum value of the enum
*/
BulletListType[BulletListType["Max"] = 9] = "Max";
})(BulletListType = exports.BulletListType || (exports.BulletListType = {}));
/**
* Enum used to control the different types of numbering list
*/
var NumberingListType;
(function (NumberingListType) {
/**
* Minimum value of the enum
*/
NumberingListType[NumberingListType["Min"] = 1] = "Min";
/**
* Numbering triggered by 1.
*/
NumberingListType[NumberingListType["Decimal"] = 1] = "Decimal";
/**
* Numbering triggered by 1-
*/
NumberingListType[NumberingListType["DecimalDash"] = 2] = "DecimalDash";
/**
* Numbering triggered by 1)
*/
NumberingListType[NumberingListType["DecimalParenthesis"] = 3] = "DecimalParenthesis";
/**
* Numbering triggered by (1)
*/
NumberingListType[NumberingListType["DecimalDoubleParenthesis"] = 4] = "DecimalDoubleParenthesis";
/**
* Numbering triggered by a.
*/
NumberingListType[NumberingListType["LowerAlpha"] = 5] = "LowerAlpha";
/**
* Numbering triggered by a)
*/
NumberingListType[NumberingListType["LowerAlphaParenthesis"] = 6] = "LowerAlphaParenthesis";
/**
* Numbering triggered by (a)
*/
NumberingListType[NumberingListType["LowerAlphaDoubleParenthesis"] = 7] = "LowerAlphaDoubleParenthesis";
/**
* Numbering triggered by a-
*/
NumberingListType[NumberingListType["LowerAlphaDash"] = 8] = "LowerAlphaDash";
/**
* Numbering triggered by A.
*/
NumberingListType[NumberingListType["UpperAlpha"] = 9] = "UpperAlpha";
/**
* Numbering triggered by A)
*/
NumberingListType[NumberingListType["UpperAlphaParenthesis"] = 10] = "UpperAlphaParenthesis";
/**
* Numbering triggered by (A)
*/
NumberingListType[NumberingListType["UpperAlphaDoubleParenthesis"] = 11] = "UpperAlphaDoubleParenthesis";
/**
* Numbering triggered by A-
*/
NumberingListType[NumberingListType["UpperAlphaDash"] = 12] = "UpperAlphaDash";
/**
* Numbering triggered by i.
*/
NumberingListType[NumberingListType["LowerRoman"] = 13] = "LowerRoman";
/**
* Numbering triggered by i)
*/
NumberingListType[NumberingListType["LowerRomanParenthesis"] = 14] = "LowerRomanParenthesis";
/**
* Numbering triggered by (i)
*/
NumberingListType[NumberingListType["LowerRomanDoubleParenthesis"] = 15] = "LowerRomanDoubleParenthesis";
/**
* Numbering triggered by i-
*/
NumberingListType[NumberingListType["LowerRomanDash"] = 16] = "LowerRomanDash";
/**
* Numbering triggered by I.
*/
NumberingListType[NumberingListType["UpperRoman"] = 17] = "UpperRoman";
/**
* Numbering triggered by I)
*/
NumberingListType[NumberingListType["UpperRomanParenthesis"] = 18] = "UpperRomanParenthesis";
/**
* Numbering triggered by (I)
*/
NumberingListType[NumberingListType["UpperRomanDoubleParenthesis"] = 19] = "UpperRomanDoubleParenthesis";
/**
* Numbering triggered by I-
*/
NumberingListType[NumberingListType["UpperRomanDash"] = 20] = "UpperRomanDash";
/**
* Maximum value of the enum
*/
NumberingListType[NumberingListType["Max"] = 20] = "Max";
})(NumberingListType = exports.NumberingListType || (exports.NumberingListType = {}));
//# sourceMappingURL=ListMetadataFormat.js.map
/**
* Table format border
*/
export declare enum TableBorderFormat {
/**
* All border of the table are displayed
* __ __ __
* |__|__|__|
* |__|__|__|
* |__|__|__|
*/
DEFAULT = 0,
/**
* Middle vertical border are not displayed
* __ __ __
* |__ __ __|
* |__ __ __|
* |__ __ __|
*/
LIST_WITH_SIDE_BORDERS = 1,
/**
* All borders except header rows borders are displayed
* __ __ __
* __|__|__
* __|__|__
*/
NO_HEADER_BORDERS = 2,
/**
* The left and right border of the table are not displayed
* __ __ __
* __|__|__
* __|__|__
* __|__|__
*/
NO_SIDE_BORDERS = 3,
/**
* Only the borders that divides the header row, first column and externals are displayed
* __ __ __
* |__ __ __|
* | | |
* |__|__ __|
*/
FIRST_COLUMN_HEADER_EXTERNAL = 4,
/**
* The header row has no vertical border, except for the first one
* The first column has no horizontal border, except for the first one
* __ __ __
* |__ __ __
* | |__|__|
* | |__|__|
*/
ESPECIAL_TYPE_1 = 5,
/**
* The header row has no vertical border, except for the first one
* The only horizontal border of the table is the top and bottom of header row
* __ __ __
* |__ __ __
* | | |
* | | |
*/
ESPECIAL_TYPE_2 = 6,
/**
* The only borders are the bottom of header row and the right border of first column
* __ __ __
* |
* |
*/
ESPECIAL_TYPE_3 = 7,
/**
* No border
*/
CLEAR = 8
}
/**
* Format of table that stored as metadata

@@ -119,5 +46,5 @@ */

/**
* Table Borders Type
* Table Borders Type. Use value of constant TableBorderFormat as value
*/
tableBorderFormat?: TableBorderFormat;
tableBorderFormat?: number;
/**

@@ -124,0 +51,0 @@ * Vertical alignment for each row

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableBorderFormat = void 0;
/**
* Table format border
*/
var TableBorderFormat;
(function (TableBorderFormat) {
/**
* All border of the table are displayed
* __ __ __
* |__|__|__|
* |__|__|__|
* |__|__|__|
*/
TableBorderFormat[TableBorderFormat["DEFAULT"] = 0] = "DEFAULT";
/**
* Middle vertical border are not displayed
* __ __ __
* |__ __ __|
* |__ __ __|
* |__ __ __|
*/
TableBorderFormat[TableBorderFormat["LIST_WITH_SIDE_BORDERS"] = 1] = "LIST_WITH_SIDE_BORDERS";
/**
* All borders except header rows borders are displayed
* __ __ __
* __|__|__
* __|__|__
*/
TableBorderFormat[TableBorderFormat["NO_HEADER_BORDERS"] = 2] = "NO_HEADER_BORDERS";
/**
* The left and right border of the table are not displayed
* __ __ __
* __|__|__
* __|__|__
* __|__|__
*/
TableBorderFormat[TableBorderFormat["NO_SIDE_BORDERS"] = 3] = "NO_SIDE_BORDERS";
/**
* Only the borders that divides the header row, first column and externals are displayed
* __ __ __
* |__ __ __|
* | | |
* |__|__ __|
*/
TableBorderFormat[TableBorderFormat["FIRST_COLUMN_HEADER_EXTERNAL"] = 4] = "FIRST_COLUMN_HEADER_EXTERNAL";
/**
* The header row has no vertical border, except for the first one
* The first column has no horizontal border, except for the first one
* __ __ __
* |__ __ __
* | |__|__|
* | |__|__|
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_1"] = 5] = "ESPECIAL_TYPE_1";
/**
* The header row has no vertical border, except for the first one
* The only horizontal border of the table is the top and bottom of header row
* __ __ __
* |__ __ __
* | | |
* | | |
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_2"] = 6] = "ESPECIAL_TYPE_2";
/**
* The only borders are the bottom of header row and the right border of first column
* __ __ __
* |
* |
*/
TableBorderFormat[TableBorderFormat["ESPECIAL_TYPE_3"] = 7] = "ESPECIAL_TYPE_3";
/**
* No border
*/
TableBorderFormat[TableBorderFormat["CLEAR"] = 8] = "CLEAR";
})(TableBorderFormat = exports.TableBorderFormat || (exports.TableBorderFormat = {}));
//# sourceMappingURL=TableMetadataFormat.js.map

@@ -51,4 +51,4 @@ export { ContentModelSegmentFormat } from './format/ContentModelSegmentFormat';

export { DatasetFormat } from './format/metadata/DatasetFormat';
export { TableMetadataFormat, TableBorderFormat } from './format/metadata/TableMetadataFormat';
export { ListMetadataFormat, NumberingListType, BulletListType, } from './format/metadata/ListMetadataFormat';
export { TableMetadataFormat } from './format/metadata/TableMetadataFormat';
export { ListMetadataFormat } from './format/metadata/ListMetadataFormat';
export { ImageResizeMetadataFormat, ImageCropMetadataFormat, ImageMetadataFormat, ImageRotateMetadataFormat, } from './format/metadata/ImageMetadataFormat';

@@ -115,6 +115,11 @@ export { TableCellMetadataFormat } from './format/metadata/TableCellMetadataFormat';

export { StandaloneEditorOptions } from './editor/StandaloneEditorOptions';
export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, FormatContentModel, StandaloneCoreApiMap, StandaloneEditorCore, } from './editor/StandaloneEditorCore';
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 { StandaloneEditorCorePlugins } from './editor/StandaloneEditorCorePlugins';
export { ContentModelCachePluginState } from './pluginState/ContentModelCachePluginState';
export { ContentModelPluginState } from './pluginState/ContentModelPluginState';
export { StandaloneEditorCorePluginState, UnportedCorePluginState, } from './pluginState/StandaloneEditorPluginState';
export { ContentModelFormatPluginState, PendingFormat, } from './pluginState/ContentModelFormatPluginState';
export { DOMEventPluginState } from './pluginState/DOMEventPluginState';
export { LifecyclePluginState } from './pluginState/LifecyclePluginState';
export { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';
export { SelectionPluginState } from './pluginState/SelectionPluginState';
export { EditorEnvironment } from './parameter/EditorEnvironment';

@@ -129,2 +134,2 @@ export { DeletedEntity, FormatWithContentModelContext, } from './parameter/FormatWithContentModelContext';

export { ContentModelBeforePasteEvent, ContentModelBeforePasteEventData, CompatibleContentModelBeforePasteEvent, } from './event/ContentModelBeforePasteEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, } from './event/ContentModelContentChangedEvent';
export { ContentModelContentChangedEvent, CompatibleContentModelContentChangedEvent, ContentModelContentChangedEventData, ChangedEntity, } from './event/ContentModelContentChangedEvent';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BulletListType = exports.NumberingListType = exports.TableBorderFormat = void 0;
var TableMetadataFormat_1 = require("./format/metadata/TableMetadataFormat");
Object.defineProperty(exports, "TableBorderFormat", { enumerable: true, get: function () { return TableMetadataFormat_1.TableBorderFormat; } });
var ListMetadataFormat_1 = require("./format/metadata/ListMetadataFormat");
Object.defineProperty(exports, "NumberingListType", { enumerable: true, get: function () { return ListMetadataFormat_1.NumberingListType; } });
Object.defineProperty(exports, "BulletListType", { enumerable: true, get: function () { return ListMetadataFormat_1.BulletListType; } });
//# sourceMappingURL=index.js.map

@@ -13,2 +13,6 @@ /**

isAndroid?: boolean;
/**
* Whether editor is running on Safari browser
*/
isSafari?: boolean;
}

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

},
"version": "0.20.0",
"version": "0.21.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

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