Socket
Socket
Sign inDemoInstall

roosterjs-content-model-core

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.26.4 to 0.27.0

lib-amd/corePlugin/createEditorCorePlugins.d.ts

2

lib-amd/coreApi/addUndoSnapshot.d.ts

@@ -5,3 +5,3 @@ import type { AddUndoSnapshot } from 'roosterjs-content-model-types';

* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).

@@ -8,0 +8,0 @@ * @param entityStates @optional Entity states related to this snapshot.

@@ -8,3 +8,3 @@ define(["require", "exports", "../utils/createSnapshotSelection"], function (require, exports, createSnapshotSelection_1) {

* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).

@@ -16,3 +16,3 @@ * @param entityStates @optional Entity states related to this snapshot.

var addUndoSnapshot = function (core, canUndoByBackspace, entityStates) {
var lifecycle = core.lifecycle, contentDiv = core.contentDiv, undo = core.undo;
var lifecycle = core.lifecycle, physicalRoot = core.physicalRoot, undo = core.undo;
var snapshot = null;

@@ -22,3 +22,3 @@ if (!lifecycle.shadowEditFragment) {

var selection = (0, createSnapshotSelection_1.createSnapshotSelection)(core);
var html = contentDiv.innerHTML;
var html = physicalRoot.innerHTML;
snapshot = {

@@ -25,0 +25,0 @@ html: html,

@@ -5,3 +5,3 @@ import type { AttachDomEvent } from 'roosterjs-content-model-types';

* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param eventName The DOM event name

@@ -8,0 +8,0 @@ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered

@@ -8,3 +8,3 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {

* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param eventName The DOM event name

@@ -29,5 +29,5 @@ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered

};
core.contentDiv.addEventListener(eventName, onEvent);
core.logicalRoot.addEventListener(eventName, onEvent);
return function () {
core.contentDiv.removeEventListener(eventName, onEvent);
core.logicalRoot.removeEventListener(eventName, onEvent);
};

@@ -34,0 +34,0 @@ });

@@ -31,3 +31,3 @@ define(["require", "exports", "../publicApi/model/cloneModel", "roosterjs-content-model-dom"], function (require, exports, cloneModel_1, roosterjs_content_model_dom_1) {

: (0, roosterjs_content_model_dom_1.createDomToModelContextWithConfig)(core.domToModelSettings.calculated, editorContext);
var model = (0, roosterjs_content_model_dom_1.domToContentModel)(core.contentDiv, domToModelContext, selection);
var model = (0, roosterjs_content_model_dom_1.domToContentModel)(core.logicalRoot, domToModelContext, selection);
if (saveIndex) {

@@ -34,0 +34,0 @@ core.cache.cachedModel = model;

@@ -11,5 +11,5 @@ define(["require", "exports", "tslib", "../utils/getRootComputedStyleForContext"], function (require, exports, tslib_1, getRootComputedStyleForContext_1) {

var _a;
var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, contentDiv = core.contentDiv, cache = core.cache, domHelper = core.domHelper;
var context = (0, tslib_1.__assign)({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale() }, (0, getRootComputedStyleForContext_1.getRootComputedStyleForContext)(contentDiv.ownerDocument));
checkRootRtl(contentDiv, context);
var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, logicalRoot = core.logicalRoot, cache = core.cache, domHelper = core.domHelper;
var context = (0, tslib_1.__assign)({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale() }, (0, getRootComputedStyleForContext_1.getRootComputedStyleForContext)(logicalRoot.ownerDocument));
checkRootRtl(logicalRoot, context);
return context;

@@ -16,0 +16,0 @@ };

@@ -5,4 +5,4 @@ import type { Focus } from 'roosterjs-content-model-types';

* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export declare const focus: Focus;

@@ -8,3 +8,3 @@ define(["require", "exports"], function (require, exports) {

* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/

@@ -20,3 +20,3 @@ var focus = function (core) {

if (!core.api.hasFocus(core)) {
core.contentDiv.focus();
core.logicalRoot.focus();
}

@@ -23,0 +23,0 @@ }

@@ -8,3 +8,3 @@ import type { FormatContentModel } from 'roosterjs-content-model-types';

* If there is cached model, it will be used and updated.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param formatter Formatter function, see ContentModelFormatter

@@ -11,0 +11,0 @@ * @param options More options, see FormatContentModelOptions

@@ -11,3 +11,3 @@ define(["require", "exports", "tslib", "../constants/ChangeSource"], function (require, exports, tslib_1, ChangeSource_1) {

* If there is cached model, it will be used and updated.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param formatter Formatter function, see ContentModelFormatter

@@ -35,5 +35,3 @@ * @param options More options, see FormatContentModelOptions

core.undo.isNested = true;
if (core.undo.snapshotsManager.hasNewContent || entityStates) {
core.api.addUndoSnapshot(core, !!canUndoByBackspace);
}
core.api.addUndoSnapshot(core, !!canUndoByBackspace, entityStates);
}

@@ -40,0 +38,0 @@ try {

@@ -22,5 +22,5 @@ define(["require", "exports"], function (require, exports) {

var _a;
var selection = (_a = core.contentDiv.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
var selection = (_a = core.logicalRoot.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
var range = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
return range && core.contentDiv.contains(range.commonAncestorContainer)
return range && core.logicalRoot.contains(range.commonAncestorContainer)
? {

@@ -27,0 +27,0 @@ type: 'range',

@@ -5,4 +5,4 @@ import type { GetVisibleViewport } from 'roosterjs-content-model-types';

* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export declare const getVisibleViewport: GetVisibleViewport;

@@ -8,7 +8,9 @@ define(["require", "exports", "tslib"], function (require, exports, tslib_1) {

* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
var getVisibleViewport = function (core) {
var scrollContainer = core.domEvent.scrollContainer;
return getIntersectedRect(scrollContainer == core.contentDiv ? [scrollContainer] : [scrollContainer, core.contentDiv]);
return getIntersectedRect(scrollContainer == core.physicalRoot
? [scrollContainer]
: [scrollContainer, core.physicalRoot]);
};

@@ -15,0 +17,0 @@ exports.getVisibleViewport = getVisibleViewport;

@@ -5,5 +5,5 @@ import type { HasFocus } from 'roosterjs-content-model-types';

* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @returns True if the editor has focus, otherwise false
*/
export declare const hasFocus: HasFocus;

@@ -8,8 +8,8 @@ define(["require", "exports"], function (require, exports) {

* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @returns True if the editor has focus, otherwise false
*/
var hasFocus = function (core) {
var activeElement = core.contentDiv.ownerDocument.activeElement;
return !!(activeElement && core.contentDiv.contains(activeElement));
var activeElement = core.logicalRoot.ownerDocument.activeElement;
return !!(activeElement && core.logicalRoot.contains(activeElement));
};

@@ -16,0 +16,0 @@ exports.hasFocus = hasFocus;

@@ -5,3 +5,3 @@ import type { Paste } from 'roosterjs-content-model-types';

* Paste into editor using a clipboardData object
* @param core The StandaloneEditorCore object.
* @param core The EditorCore object.
* @param clipboardData Clipboard data retrieved from clipboard

@@ -8,0 +8,0 @@ * @param pasteType Type of content to paste. @default normal

@@ -11,3 +11,3 @@ define(["require", "exports", "../publicApi/model/cloneModel", "../utils/convertInlineCss", "../utils/paste/createPasteFragment", "../utils/paste/generatePasteOptionFromPlugins", "../utils/paste/mergePasteContent", "../utils/paste/retrieveHtmlInfo"], function (require, exports, cloneModel_1, convertInlineCss_1, createPasteFragment_1, generatePasteOptionFromPlugins_1, mergePasteContent_1, retrieveHtmlInfo_1) {

* Paste into editor using a clipboardData object
* @param core The StandaloneEditorCore object.
* @param core The EditorCore object.
* @param clipboardData Clipboard data retrieved from clipboard

@@ -31,3 +31,3 @@ * @param pasteType Type of content to paste. @default normal

// 3. Create target fragment
var sourceFragment = (0, createPasteFragment_1.createPasteFragment)(core.contentDiv.ownerDocument, clipboardData, pasteType, (_a = (clipboardData.rawHtml == clipboardData.html
var sourceFragment = (0, createPasteFragment_1.createPasteFragment)(core.physicalRoot.ownerDocument, clipboardData, pasteType, (_a = (clipboardData.rawHtml == clipboardData.html
? doc

@@ -34,0 +34,0 @@ : createDOMFromHtml(clipboardData.html, core.trustedHTMLHandler))) === null || _a === void 0 ? void 0 : _a.body);

@@ -19,3 +19,3 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {

modelToDomContext.onNodeCreated = onNodeCreated;
var selection = (0, roosterjs_content_model_dom_1.contentModelToDom)(core.contentDiv.ownerDocument, core.contentDiv, model, modelToDomContext);
var selection = (0, roosterjs_content_model_dom_1.contentModelToDom)(core.logicalRoot.ownerDocument, core.logicalRoot, model, modelToDomContext);
if (!core.lifecycle.shadowEditFragment) {

@@ -22,0 +22,0 @@ core.cache.cachedSelection = selection || undefined;

@@ -20,3 +20,3 @@ define(["require", "exports", "../corePlugin/utils/addRangeToSelection", "roosterjs-content-model-dom", "../publicApi/domUtils/tableCellUtils"], function (require, exports, addRangeToSelection_1, roosterjs_content_model_dom_1, tableCellUtils_1) {

var skipReselectOnFocus = core.selection.skipReselectOnFocus;
var doc = core.contentDiv.ownerDocument;
var doc = core.physicalRoot.ownerDocument;
var sheet = (_a = core.selection.selectionStyleNode) === null || _a === void 0 ? void 0 : _a.sheet;

@@ -26,3 +26,3 @@ core.selection.skipReselectOnFocus = true;

var selectionRules = void 0;
var rootSelector = '#' + addUniqueId(core.contentDiv, CONTENT_DIV_ID);
var rootSelector = '#' + addUniqueId(core.physicalRoot, CONTENT_DIV_ID);
switch (selection === null || selection === void 0 ? void 0 : selection.type) {

@@ -29,0 +29,0 @@ case 'image':

@@ -5,5 +5,5 @@ import type { SwitchShadowEdit } from 'roosterjs-content-model-types';

* Switch the Shadow Edit mode of editor On/Off
* @param editorCore The StandaloneEditorCore object
* @param editorCore The EditorCore object
* @param isOn True to switch On, False to switch Off
*/
export declare const switchShadowEdit: SwitchShadowEdit;

@@ -8,3 +8,3 @@ define(["require", "exports", "../publicApi/selection/iterateSelections", "roosterjs-content-model-dom"], function (require, exports, iterateSelections_1, roosterjs_content_model_dom_1) {

* Switch the Shadow Edit mode of editor On/Off
* @param editorCore The StandaloneEditorCore object
* @param editorCore The EditorCore object
* @param isOn True to switch On, False to switch Off

@@ -17,4 +17,4 @@ */

var model = !core.cache.cachedModel ? core.api.createContentModel(core) : null;
var fragment = core.contentDiv.ownerDocument.createDocumentFragment();
var clonedRoot = core.contentDiv.cloneNode(true /*deep*/);
var fragment = core.logicalRoot.ownerDocument.createDocumentFragment();
var clonedRoot = core.logicalRoot.cloneNode(true /*deep*/);
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, clonedRoot);

@@ -21,0 +21,0 @@ core.api.triggerEvent(core, {

@@ -5,3 +5,3 @@ import type { TriggerEvent } from 'roosterjs-content-model-types';

* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param pluginEvent The event object to trigger

@@ -8,0 +8,0 @@ * @param broadcast Set to true to skip the shouldHandleEventExclusively check

@@ -14,3 +14,3 @@ define(["require", "exports"], function (require, exports) {

* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param pluginEvent The event object to trigger

@@ -17,0 +17,0 @@ * @param broadcast Set to true to skip the shouldHandleEventExclusively check

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

import type { CachePluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { CachePluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createCachePlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<CachePluginState>;
export declare function createCachePlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<CachePluginState>;

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

import type { ContextMenuPluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { ContextMenuPluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * @internal

*/
export declare function createContextMenuPlugin(options: StandaloneEditorOptions): PluginWithState<ContextMenuPluginState>;
export declare function createContextMenuPlugin(options: EditorOptions): PluginWithState<ContextMenuPluginState>;

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

import type { CopyPastePluginState, ContentModelTable, OnNodeCreated, StandaloneEditorOptions, PluginWithState, ContentModelDocument } from 'roosterjs-content-model-types';
import type { CopyPastePluginState, ContentModelTable, OnNodeCreated, EditorOptions, PluginWithState, ContentModelDocument } from 'roosterjs-content-model-types';
/**

@@ -22,2 +22,2 @@ * @internal

*/
export declare function createCopyPastePlugin(option: StandaloneEditorOptions): PluginWithState<CopyPastePluginState>;
export declare function createCopyPastePlugin(option: EditorOptions): PluginWithState<CopyPastePluginState>;

@@ -25,3 +25,3 @@ define(["require", "exports", "tslib", "./utils/addRangeToSelection", "../constants/ChangeSource", "./utils/deleteEmptyList", "../publicApi/selection/deleteSelection", "../utils/extractClipboardItems", "../publicApi/table/getSelectedCells", "../publicApi/selection/iterateSelections", "../override/pasteCopyBlockEntityParser", "roosterjs-content-model-dom"], function (require, exports, tslib_1, addRangeToSelection_1, ChangeSource_1, deleteEmptyList_1, deleteSelection_1, extractClipboardItems_1, getSelectedCells_1, iterateSelections_1, pasteCopyBlockEntityParser_1, roosterjs_content_model_dom_1) {

if (!editor_1.isDisposed()) {
editor_1.pasteFromClipboard(clipboardData);
editor_1.pasteFromClipboard(clipboardData, _this.state.defaultPasteType);
}

@@ -35,2 +35,3 @@ });

tempDiv: null,
defaultPasteType: option.defaultPasteType,
};

@@ -37,0 +38,0 @@ }

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

import type { DOMEventPluginState, StandaloneEditorOptions, PluginWithState } from 'roosterjs-content-model-types';
import type { DOMEventPluginState, EditorOptions, PluginWithState } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createDOMEventPlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<DOMEventPluginState>;
export declare function createDOMEventPlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<DOMEventPluginState>;

@@ -153,10 +153,7 @@ define(["require", "exports", "./utils/findAllEntities", "../publicApi/color/transformColor", "./utils/entityDelimiterUtils", "roosterjs-content-model-dom"], function (require, exports, findAllEntities_1, transformColor_1, entityDelimiterUtils_1, roosterjs_content_model_dom_1) {

// Entity is not in editor, which means it is deleted, use a temporary entity here to represent this entity
var tempEntity_1 = (0, roosterjs_content_model_dom_1.createEntity)(entry.element);
var isEntity_1 = false;
entry.element.classList.forEach(function (name) {
isEntity_1 = (0, roosterjs_content_model_dom_1.parseEntityClassName)(name, tempEntity_1.entityFormat) || isEntity_1;
});
if (isEntity_1) {
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(entry.element);
if (!format.isFakeEntity) {
var entity = (0, roosterjs_content_model_dom_1.createEntity)(entry.element, format.isReadonly, {}, format.entityType, format.id);
result.push({
entity: tempEntity_1,
entity: entity,
operation: 'overwrite',

@@ -178,6 +175,3 @@ });

EntityPlugin.prototype.triggerEvent = function (editor, wrapper, operation, rawEvent, state) {
var format = {};
wrapper.classList.forEach(function (name) {
(0, roosterjs_content_model_dom_1.parseEntityClassName)(name, format);
});
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(wrapper);
return format.id && format.entityType && !format.isFakeEntity

@@ -184,0 +178,0 @@ ? editor.triggerEvent('entityOperation', {

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

import type { FormatPluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { FormatPluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createFormatPlugin(option: StandaloneEditorOptions): PluginWithState<FormatPluginState>;
export declare function createFormatPlugin(option: EditorOptions): PluginWithState<FormatPluginState>;

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

import type { LifecyclePluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { LifecyclePluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createLifecyclePlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<LifecyclePluginState>;
export declare function createLifecyclePlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<LifecyclePluginState>;

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

import type { PluginWithState, SelectionPluginState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { PluginWithState, SelectionPluginState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createSelectionPlugin(options: StandaloneEditorOptions): PluginWithState<SelectionPluginState>;
export declare function createSelectionPlugin(options: EditorOptions): PluginWithState<SelectionPluginState>;

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

import type { PluginWithState, StandaloneEditorOptions, UndoPluginState } from 'roosterjs-content-model-types';
import type { PluginWithState, EditorOptions, UndoPluginState } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createUndoPlugin(option: StandaloneEditorOptions): PluginWithState<UndoPluginState>;
export declare function createUndoPlugin(option: EditorOptions): PluginWithState<UndoPluginState>;

@@ -1,8 +0,8 @@

import type { ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
import type { ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
/**
* @internal
* When necessary, set default format as current pending format so it will be applied when Input event is fired
* @param editor The Content Model Editor
* @param editor The editor object
* @param defaultFormat The default segment format to apply
*/
export declare function applyDefaultFormat(editor: IStandaloneEditor, defaultFormat: ContentModelSegmentFormat): void;
export declare function applyDefaultFormat(editor: IEditor, defaultFormat: ContentModelSegmentFormat): void;

@@ -8,3 +8,3 @@ define(["require", "exports", "tslib", "../../publicApi/selection/deleteSelection", "roosterjs-content-model-dom"], function (require, exports, tslib_1, deleteSelection_1, roosterjs_content_model_dom_1) {

* When necessary, set default format as current pending format so it will be applied when Input event is fired
* @param editor The Content Model Editor
* @param editor The editor object
* @param defaultFormat The default segment format to apply

@@ -11,0 +11,0 @@ */

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

import type { ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
import type { ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function applyPendingFormat(editor: IStandaloneEditor, data: string, format: ContentModelSegmentFormat): void;
export declare function applyPendingFormat(editor: IEditor, data: string, format: ContentModelSegmentFormat): void;

@@ -1,18 +0,18 @@

import type { CompositionEndEvent, ContentModelFormatter, IStandaloneEditor, KeyDownEvent } from 'roosterjs-content-model-types';
import type { CompositionEndEvent, ContentModelFormatter, IEditor, KeyDownEvent } from 'roosterjs-content-model-types';
/**
* @internal exported only for unit test
*/
export declare function preventTypeInDelimiter(node: HTMLElement, editor: IStandaloneEditor): void;
export declare function preventTypeInDelimiter(node: HTMLElement, editor: IEditor): void;
/**
* @internal
*/
export declare function handleDelimiterContentChangedEvent(editor: IStandaloneEditor): void;
export declare function handleDelimiterContentChangedEvent(editor: IEditor): void;
/**
* @internal
*/
export declare function handleCompositionEndEvent(editor: IStandaloneEditor, event: CompositionEndEvent): void;
export declare function handleCompositionEndEvent(editor: IEditor, event: CompositionEndEvent): void;
/**
* @internal
*/
export declare function handleDelimiterKeyDownEvent(editor: IStandaloneEditor, event: KeyDownEvent): void;
export declare function handleDelimiterKeyDownEvent(editor: IEditor, event: KeyDownEvent): void;
/**

@@ -19,0 +19,0 @@ * @internal Exported Only for unit test

@@ -51,3 +51,4 @@ define(["require", "exports"], function (require, exports) {

!snapshot.entityStates;
if (this.snapshots.currentIndex < 0 || !currentSnapshot || !isSameSnapshot) {
var addSnapshot = !currentSnapshot || shouldAddSnapshot(currentSnapshot, snapshot);
if (this.snapshots.currentIndex < 0 || addSnapshot) {
this.clearRedo();

@@ -112,3 +113,10 @@ this.snapshots.snapshots.push(snapshot);

exports.createSnapshotsManager = createSnapshotsManager;
function shouldAddSnapshot(currentSnapshot, snapshot) {
return (currentSnapshot.html !== snapshot.html ||
(currentSnapshot.entityStates &&
snapshot.entityStates &&
currentSnapshot.entityStates !== snapshot.entityStates) ||
(!currentSnapshot.entityStates && snapshot.entityStates));
}
});
//# sourceMappingURL=SnapshotsManagerImpl.js.map

@@ -19,3 +19,3 @@ export { CachedElementHandler, CloneModelOptions, cloneModel } from './publicApi/model/cloneModel';

export { applyTableFormat } from './publicApi/table/applyTableFormat';
export { normalizeTable } from './publicApi/table/normalizeTable';
export { normalizeTable, MIN_ALLOWED_TABLE_CELL_WIDTH } from './publicApi/table/normalizeTable';
export { setTableCellBackgroundColor } from './publicApi/table/setTableCellBackgroundColor';

@@ -29,2 +29,3 @@ export { getSelectedCells } from './publicApi/table/getSelectedCells';

export { readFile } from './publicApi/domUtils/readFile';
export { cacheGetEventData } from './publicApi/domUtils/cacheGetEventData';
export { undo } from './publicApi/undo/undo';

@@ -42,2 +43,2 @@ export { redo } from './publicApi/undo/redo';

export { TableBorderFormat } from './constants/TableBorderFormat';
export { StandaloneEditor } from './editor/StandaloneEditor';
export { Editor } from './editor/Editor';

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

define(["require", "exports", "./publicApi/model/cloneModel", "./publicApi/model/mergeModel", "./publicApi/model/isBlockGroupOfType", "./publicApi/model/getClosestAncestorBlockGroupIndex", "./publicApi/model/isBold", "./publicApi/model/createModelFromHtml", "./publicApi/model/exportContent", "./publicApi/selection/iterateSelections", "./publicApi/selection/getSelectionRootNode", "./publicApi/selection/deleteSelection", "./publicApi/selection/deleteSegment", "./publicApi/selection/deleteBlock", "./publicApi/selection/hasSelectionInBlock", "./publicApi/selection/hasSelectionInSegment", "./publicApi/selection/hasSelectionInBlockGroup", "./publicApi/selection/collectSelections", "./publicApi/selection/setSelection", "./publicApi/table/applyTableFormat", "./publicApi/table/normalizeTable", "./publicApi/table/setTableCellBackgroundColor", "./publicApi/table/getSelectedCells", "./publicApi/domUtils/eventUtils", "./publicApi/domUtils/borderValues", "./publicApi/domUtils/stringUtil", "./publicApi/domUtils/tableCellUtils", "./publicApi/domUtils/getSegmentTextFormat", "./publicApi/domUtils/readFile", "./publicApi/undo/undo", "./publicApi/undo/redo", "./publicApi/color/transformColor", "./publicApi/format/retrieveModelFormatState", "./metadata/updateImageMetadata", "./metadata/updateTableCellMetadata", "./metadata/updateTableMetadata", "./metadata/updateListMetadata", "./constants/ChangeSource", "./constants/BulletListType", "./constants/NumberingListType", "./constants/TableBorderFormat", "./editor/StandaloneEditor"], function (require, exports, cloneModel_1, mergeModel_1, isBlockGroupOfType_1, getClosestAncestorBlockGroupIndex_1, isBold_1, createModelFromHtml_1, exportContent_1, iterateSelections_1, getSelectionRootNode_1, deleteSelection_1, deleteSegment_1, deleteBlock_1, hasSelectionInBlock_1, hasSelectionInSegment_1, hasSelectionInBlockGroup_1, collectSelections_1, setSelection_1, applyTableFormat_1, normalizeTable_1, setTableCellBackgroundColor_1, getSelectedCells_1, eventUtils_1, borderValues_1, stringUtil_1, tableCellUtils_1, getSegmentTextFormat_1, readFile_1, undo_1, redo_1, transformColor_1, retrieveModelFormatState_1, updateImageMetadata_1, updateTableCellMetadata_1, updateTableMetadata_1, updateListMetadata_1, ChangeSource_1, BulletListType_1, NumberingListType_1, TableBorderFormat_1, StandaloneEditor_1) {
define(["require", "exports", "./publicApi/model/cloneModel", "./publicApi/model/mergeModel", "./publicApi/model/isBlockGroupOfType", "./publicApi/model/getClosestAncestorBlockGroupIndex", "./publicApi/model/isBold", "./publicApi/model/createModelFromHtml", "./publicApi/model/exportContent", "./publicApi/selection/iterateSelections", "./publicApi/selection/getSelectionRootNode", "./publicApi/selection/deleteSelection", "./publicApi/selection/deleteSegment", "./publicApi/selection/deleteBlock", "./publicApi/selection/hasSelectionInBlock", "./publicApi/selection/hasSelectionInSegment", "./publicApi/selection/hasSelectionInBlockGroup", "./publicApi/selection/collectSelections", "./publicApi/selection/setSelection", "./publicApi/table/applyTableFormat", "./publicApi/table/normalizeTable", "./publicApi/table/setTableCellBackgroundColor", "./publicApi/table/getSelectedCells", "./publicApi/domUtils/eventUtils", "./publicApi/domUtils/borderValues", "./publicApi/domUtils/stringUtil", "./publicApi/domUtils/tableCellUtils", "./publicApi/domUtils/getSegmentTextFormat", "./publicApi/domUtils/readFile", "./publicApi/domUtils/cacheGetEventData", "./publicApi/undo/undo", "./publicApi/undo/redo", "./publicApi/color/transformColor", "./publicApi/format/retrieveModelFormatState", "./metadata/updateImageMetadata", "./metadata/updateTableCellMetadata", "./metadata/updateTableMetadata", "./metadata/updateListMetadata", "./constants/ChangeSource", "./constants/BulletListType", "./constants/NumberingListType", "./constants/TableBorderFormat", "./editor/Editor"], function (require, exports, cloneModel_1, mergeModel_1, isBlockGroupOfType_1, getClosestAncestorBlockGroupIndex_1, isBold_1, createModelFromHtml_1, exportContent_1, iterateSelections_1, getSelectionRootNode_1, deleteSelection_1, deleteSegment_1, deleteBlock_1, hasSelectionInBlock_1, hasSelectionInSegment_1, hasSelectionInBlockGroup_1, collectSelections_1, setSelection_1, applyTableFormat_1, normalizeTable_1, setTableCellBackgroundColor_1, getSelectedCells_1, eventUtils_1, borderValues_1, stringUtil_1, tableCellUtils_1, getSegmentTextFormat_1, readFile_1, cacheGetEventData_1, undo_1, redo_1, transformColor_1, retrieveModelFormatState_1, updateImageMetadata_1, updateTableCellMetadata_1, updateTableMetadata_1, updateListMetadata_1, ChangeSource_1, BulletListType_1, NumberingListType_1, TableBorderFormat_1, Editor_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandaloneEditor = exports.TableBorderFormat = exports.NumberingListType = exports.BulletListType = exports.ChangeSource = exports.getListStyleTypeFromString = exports.updateListMetadata = exports.updateTableMetadata = exports.updateTableCellMetadata = exports.updateImageMetadata = exports.retrieveModelFormatState = exports.transformColor = exports.redo = exports.undo = exports.readFile = exports.getSegmentTextFormat = exports.createTableRanges = exports.parseTableCells = exports.normalizeText = exports.isSpace = exports.isPunctuation = exports.extractBorderValues = exports.combineBorderValue = exports.isModifierKey = exports.isCharacterValue = exports.getSelectedCells = exports.setTableCellBackgroundColor = exports.normalizeTable = exports.applyTableFormat = exports.setSelection = exports.getSelectedSegmentsAndParagraphs = exports.getSelectedSegments = exports.getSelectedParagraphs = exports.getOperationalBlocks = exports.getFirstSelectedTable = exports.getFirstSelectedListItem = exports.hasSelectionInBlockGroup = exports.hasSelectionInSegment = exports.hasSelectionInBlock = exports.deleteBlock = exports.deleteSegment = exports.deleteSelection = exports.getSelectionRootNode = exports.iterateSelections = exports.exportContent = exports.createModelFromHtml = exports.isBold = exports.getClosestAncestorBlockGroupIndex = exports.isBlockGroupOfType = exports.mergeModel = exports.cloneModel = void 0;
exports.Editor = exports.TableBorderFormat = exports.NumberingListType = exports.BulletListType = exports.ChangeSource = exports.getListStyleTypeFromString = exports.updateListMetadata = exports.updateTableMetadata = exports.updateTableCellMetadata = exports.updateImageMetadata = exports.retrieveModelFormatState = exports.transformColor = exports.redo = exports.undo = exports.cacheGetEventData = exports.readFile = exports.getSegmentTextFormat = exports.createTableRanges = exports.parseTableCells = exports.normalizeText = exports.isSpace = exports.isPunctuation = exports.extractBorderValues = exports.combineBorderValue = exports.isModifierKey = exports.isCharacterValue = exports.getSelectedCells = exports.setTableCellBackgroundColor = exports.MIN_ALLOWED_TABLE_CELL_WIDTH = exports.normalizeTable = exports.applyTableFormat = exports.setSelection = exports.getSelectedSegmentsAndParagraphs = exports.getSelectedSegments = exports.getSelectedParagraphs = exports.getOperationalBlocks = exports.getFirstSelectedTable = exports.getFirstSelectedListItem = exports.hasSelectionInBlockGroup = exports.hasSelectionInSegment = exports.hasSelectionInBlock = exports.deleteBlock = exports.deleteSegment = exports.deleteSelection = exports.getSelectionRootNode = exports.iterateSelections = exports.exportContent = exports.createModelFromHtml = exports.isBold = exports.getClosestAncestorBlockGroupIndex = exports.isBlockGroupOfType = exports.mergeModel = exports.cloneModel = void 0;
Object.defineProperty(exports, "cloneModel", { enumerable: true, get: function () { return cloneModel_1.cloneModel; } });

@@ -29,2 +29,3 @@ Object.defineProperty(exports, "mergeModel", { enumerable: true, get: function () { return mergeModel_1.mergeModel; } });

Object.defineProperty(exports, "normalizeTable", { enumerable: true, get: function () { return normalizeTable_1.normalizeTable; } });
Object.defineProperty(exports, "MIN_ALLOWED_TABLE_CELL_WIDTH", { enumerable: true, get: function () { return normalizeTable_1.MIN_ALLOWED_TABLE_CELL_WIDTH; } });
Object.defineProperty(exports, "setTableCellBackgroundColor", { enumerable: true, get: function () { return setTableCellBackgroundColor_1.setTableCellBackgroundColor; } });

@@ -43,2 +44,3 @@ Object.defineProperty(exports, "getSelectedCells", { enumerable: true, get: function () { return getSelectedCells_1.getSelectedCells; } });

Object.defineProperty(exports, "readFile", { enumerable: true, get: function () { return readFile_1.readFile; } });
Object.defineProperty(exports, "cacheGetEventData", { enumerable: true, get: function () { return cacheGetEventData_1.cacheGetEventData; } });
Object.defineProperty(exports, "undo", { enumerable: true, get: function () { return undo_1.undo; } });

@@ -57,4 +59,4 @@ Object.defineProperty(exports, "redo", { enumerable: true, get: function () { return redo_1.redo; } });

Object.defineProperty(exports, "TableBorderFormat", { enumerable: true, get: function () { return TableBorderFormat_1.TableBorderFormat; } });
Object.defineProperty(exports, "StandaloneEditor", { enumerable: true, get: function () { return StandaloneEditor_1.StandaloneEditor; } });
Object.defineProperty(exports, "Editor", { enumerable: true, get: function () { return Editor_1.Editor; } });
});
//# sourceMappingURL=index.js.map

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

import type { ExportContentMode, IStandaloneEditor, ModelToDomOption } from 'roosterjs-content-model-types';
import type { ExportContentMode, IEditor, ModelToDomOption } from 'roosterjs-content-model-types';
/**

@@ -11,2 +11,2 @@ * Export string content of editor

*/
export declare function exportContent(editor: IStandaloneEditor, mode?: ExportContentMode, options?: ModelToDomOption): string;
export declare function exportContent(editor: IEditor, mode?: ExportContentMode, options?: ModelToDomOption): string;

@@ -210,2 +210,3 @@ define(["require", "exports", "tslib", "../table/applyTableFormat", "../../publicApi/selection/deleteSelection", "./getClosestAncestorBlockGroupIndex", "../table/normalizeTable", "roosterjs-content-model-dom"], function (require, exports, tslib_1, applyTableFormat_1, deleteSelection_1, getClosestAncestorBlockGroupIndex_1, normalizeTable_1, roosterjs_content_model_dom_1) {

var _a;
mergeBlockFormat(applyDefaultFormatOption, block);
switch (block.blockType) {

@@ -240,2 +241,7 @@ case 'BlockGroup':

}
function mergeBlockFormat(applyDefaultFormatOption, block) {
if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {
delete block.format.backgroundColor;
}
}
function mergeSegmentFormat(applyDefaultFormatOption, targetformat, sourceFormat) {

@@ -242,0 +248,0 @@ return applyDefaultFormatOption == 'mergeAll'

@@ -15,3 +15,2 @@ define(["require", "exports"], function (require, exports) {

function deleteBlock(blocks, blockToDelete, replacement, context, direction) {
var _a;
var index = blocks.indexOf(blockToDelete);

@@ -32,4 +31,2 @@ switch (blockToDelete.blockType) {

if (operation !== undefined) {
var wrapper = blockToDelete.wrapper;
(_a = wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(wrapper);
replacement ? blocks.splice(index, 1, replacement) : blocks.splice(index, 1);

@@ -36,0 +33,0 @@ context === null || context === void 0 ? void 0 : context.deletedEntities.push({

@@ -14,3 +14,2 @@ define(["require", "exports", "../../modelApi/edit/deleteSingleChar", "roosterjs-content-model-dom", "../domUtils/stringUtil"], function (require, exports, deleteSingleChar_1, roosterjs_content_model_dom_1, stringUtil_1) {

function deleteSegment(paragraph, segmentToDelete, context, direction) {
var _a;
var segments = paragraph.segments;

@@ -39,4 +38,2 @@ var index = segments.indexOf(segmentToDelete);

if (operation !== undefined) {
var wrapper = segmentToDelete.wrapper;
(_a = wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(wrapper);
segments.splice(index, 1);

@@ -43,0 +40,0 @@ context === null || context === void 0 ? void 0 : context.deletedEntities.push({

import type { ContentModelSegmentFormat, ContentModelTable } from 'roosterjs-content-model-types';
/**
* Minimum width for a table cell
*/
export declare const MIN_ALLOWED_TABLE_CELL_WIDTH: number;
/**
* Normalize a Content Model table, make sure:

@@ -4,0 +8,0 @@ * 1. Fist cells are not spanned

define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeTable = void 0;
exports.normalizeTable = exports.MIN_ALLOWED_TABLE_CELL_WIDTH = void 0;
/**
* Minimum width for a table cell
*/
exports.MIN_ALLOWED_TABLE_CELL_WIDTH = 30;
var MIN_HEIGHT = 22;

@@ -58,2 +62,5 @@ /**

}
else if (table.widths[i] < exports.MIN_ALLOWED_TABLE_CELL_WIDTH) {
table.widths[i] = exports.MIN_ALLOWED_TABLE_CELL_WIDTH;
}
}

@@ -60,0 +67,0 @@ // Move blocks from spanned cell to its main cell if any,

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

import type { IStandaloneEditor } from 'roosterjs-content-model-types';
import type { IEditor } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * Redo to next undo snapshot

*/
export declare function redo(editor: IStandaloneEditor): void;
export declare function redo(editor: IEditor): void;

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

import type { IStandaloneEditor } from 'roosterjs-content-model-types';
import type { IEditor } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * Undo to last undo snapshot

*/
export declare function undo(editor: IStandaloneEditor): void;
export declare function undo(editor: IEditor): void;

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

import type { SnapshotSelection, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { SnapshotSelection, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function createSnapshotSelection(core: StandaloneEditorCore): SnapshotSelection;
export declare function createSnapshotSelection(core: EditorCore): SnapshotSelection;

@@ -9,3 +9,3 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {

function createSnapshotSelection(core) {
var contentDiv = core.contentDiv, api = core.api;
var physicalRoot = core.physicalRoot, api = core.api;
var selection = api.getDOMSelection(core);

@@ -15,8 +15,8 @@ // Normalize tables to ensure they have TBODY element between TABLE and TR so that the selection path will include correct values

var _a = selection.range, startContainer = _a.startContainer, startOffset = _a.startOffset, endContainer = _a.endContainer, endOffset = _a.endOffset;
var isDOMChanged = normalizeTableTree(startContainer, contentDiv);
var isDOMChanged = normalizeTableTree(startContainer, physicalRoot);
if (endContainer != startContainer) {
isDOMChanged = normalizeTableTree(endContainer, contentDiv) || isDOMChanged;
isDOMChanged = normalizeTableTree(endContainer, physicalRoot) || isDOMChanged;
}
if (isDOMChanged) {
var newRange = contentDiv.ownerDocument.createRange();
var newRange = physicalRoot.ownerDocument.createRange();
newRange.setStart(startContainer, startOffset);

@@ -50,4 +50,4 @@ newRange.setEnd(endContainer, endOffset);

type: 'range',
start: getPath(range.startContainer, range.startOffset, contentDiv),
end: getPath(range.endContainer, range.endOffset, contentDiv),
start: getPath(range.startContainer, range.startOffset, physicalRoot),
end: getPath(range.endContainer, range.endOffset, physicalRoot),
isReverted: !!selection.isReverted,

@@ -54,0 +54,0 @@ };

import type { HtmlFromClipboard } from './retrieveHtmlInfo';
import type { BeforePasteEvent, ClipboardData, PasteType, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { BeforePasteEvent, ClipboardData, PasteType, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function generatePasteOptionFromPlugins(core: StandaloneEditorCore, clipboardData: ClipboardData, fragment: DocumentFragment, htmlFromClipboard: HtmlFromClipboard, pasteType: PasteType): BeforePasteEvent;
export declare function generatePasteOptionFromPlugins(core: EditorCore, clipboardData: ClipboardData, fragment: DocumentFragment, htmlFromClipboard: HtmlFromClipboard, pasteType: PasteType): BeforePasteEvent;

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

import type { BeforePasteEvent, ClipboardData, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { BeforePasteEvent, ClipboardData, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function mergePasteContent(core: StandaloneEditorCore, eventResult: BeforePasteEvent, clipboardData: ClipboardData): void;
export declare function mergePasteContent(core: EditorCore, eventResult: BeforePasteEvent, clipboardData: ClipboardData): void;

@@ -25,3 +25,3 @@ define(["require", "exports", "tslib", "../../constants/ChangeSource", "../createDomToModelContextForSanitizing", "roosterjs-content-model-dom", "../../publicApi/domUtils/getSegmentTextFormat", "../../publicApi/selection/collectSelections", "../../publicApi/model/mergeModel"], function (require, exports, tslib_1, ChangeSource_1, createDomToModelContextForSanitizing_1, roosterjs_content_model_dom_1, getSegmentTextFormat_1, collectSelections_1, mergeModel_1) {

var selectedSegment = (0, collectSelections_1.getSelectedSegments)(model, true /*includeFormatHolder*/)[0];
var domToModelContext = (0, createDomToModelContextForSanitizing_1.createDomToModelContextForSanitizing)(core.contentDiv.ownerDocument, undefined /*defaultFormat*/, core.domToModelSettings.customized, domToModelOption);
var domToModelContext = (0, createDomToModelContextForSanitizing_1.createDomToModelContextForSanitizing)(core.physicalRoot.ownerDocument, undefined /*defaultFormat*/, core.domToModelSettings.customized, domToModelOption);
domToModelContext.segmentFormat = selectedSegment

@@ -28,0 +28,0 @@ ? (0, getSegmentTextFormat_1.getSegmentTextFormat)(selectedSegment)

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

import type { StandaloneEditorCore, Snapshot } from 'roosterjs-content-model-types';
import type { EditorCore, Snapshot } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotColors(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotColors(core: EditorCore, snapshot: Snapshot): void;

@@ -12,3 +12,3 @@ define(["require", "exports", "../publicApi/color/transformColor"], function (require, exports, transformColor_1) {

if (!!snapshot.isDarkMode != !!isDarkMode) {
(0, transformColor_1.transformColor)(core.contentDiv, false /*includeSelf*/, isDarkMode ? 'lightToDark' : 'darkToLight', core.darkColorHandler);
(0, transformColor_1.transformColor)(core.physicalRoot, false /*includeSelf*/, isDarkMode ? 'lightToDark' : 'darkToLight', core.darkColorHandler);
}

@@ -15,0 +15,0 @@ }

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

import type { Snapshot, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { Snapshot, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotHTML(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotHTML(core: EditorCore, snapshot: Snapshot): void;

@@ -11,4 +11,4 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {

var _a, _b, _c;
var contentDiv = core.contentDiv, entityMap = core.entity.entityMap;
var refNode = contentDiv.firstChild;
var physicalRoot = core.physicalRoot, entityMap = core.entity.entityMap;
var refNode = physicalRoot.firstChild;
var body = new DOMParser().parseFromString((_b = (_a = core.trustedHTMLHandler) === null || _a === void 0 ? void 0 : _a.call(core, snapshot.html)) !== null && _b !== void 0 ? _b : snapshot.html, 'text/html').body;

@@ -19,6 +19,6 @@ for (var currentNode = body.firstChild; currentNode;) {

if (originalEntityElement) {
refNode = (0, roosterjs_content_model_dom_1.reuseCachedElement)(contentDiv, originalEntityElement, refNode);
refNode = (0, roosterjs_content_model_dom_1.reuseCachedElement)(physicalRoot, originalEntityElement, refNode);
}
else {
contentDiv.insertBefore(currentNode, refNode);
physicalRoot.insertBefore(currentNode, refNode);
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(currentNode, 'ELEMENT_NODE')) {

@@ -35,3 +35,3 @@ var childEntities = (0, roosterjs_content_model_dom_1.getAllEntityWrappers)(currentNode);

var markerNode = wrapper.cloneNode();
contentDiv.insertBefore(markerNode, refNode);
physicalRoot.insertBefore(markerNode, refNode);
refNode = markerNode;

@@ -58,7 +58,4 @@ }

if ((0, roosterjs_content_model_dom_1.isEntityElement)(node)) {
var format_1 = {};
node.classList.forEach(function (name) {
(0, roosterjs_content_model_dom_1.parseEntityClassName)(name, format_1);
});
result = (format_1.id && ((_a = entityMap[format_1.id]) === null || _a === void 0 ? void 0 : _a.element)) || null;
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(node);
result = (format.id && ((_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element)) || null;
}

@@ -76,12 +73,14 @@ else if (isBlockEntityContainer(node)) {

var _a;
var format = {};
element.childNodes.forEach(function (node) {
for (var node = element.firstChild; node; node = node.nextSibling) {
if ((0, roosterjs_content_model_dom_1.isEntityElement)(node) && (0, roosterjs_content_model_dom_1.isNodeOfType)(node, 'ELEMENT_NODE')) {
node.classList.forEach(function (name) { return (0, roosterjs_content_model_dom_1.parseEntityClassName)(name, format); });
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(node);
var parent_1 = format.id ? (_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element.parentElement : null;
return (0, roosterjs_content_model_dom_1.isNodeOfType)(parent_1, 'ELEMENT_NODE') && isBlockEntityContainer(parent_1)
? parent_1
: null;
}
});
var parent = format.id ? (_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element.parentElement : null;
return (0, roosterjs_content_model_dom_1.isNodeOfType)(parent, 'ELEMENT_NODE') && isBlockEntityContainer(parent) ? parent : null;
}
return null;
}
});
//# sourceMappingURL=restoreSnapshotHTML.js.map

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

import type { StandaloneEditorCore, Snapshot } from 'roosterjs-content-model-types';
import type { EditorCore, Snapshot } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotSelection(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotSelection(core: EditorCore, snapshot: Snapshot): void;

@@ -10,3 +10,3 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {

var snapshotSelection = snapshot.selection;
var contentDiv = core.contentDiv;
var physicalRoot = core.physicalRoot;
var domSelection = null;

@@ -16,5 +16,5 @@ if (snapshotSelection) {

case 'range':
var startPos = getPositionFromPath(contentDiv, snapshotSelection.start);
var endPos = getPositionFromPath(contentDiv, snapshotSelection.end);
var range = contentDiv.ownerDocument.createRange();
var startPos = getPositionFromPath(physicalRoot, snapshotSelection.start);
var endPos = getPositionFromPath(physicalRoot, snapshotSelection.end);
var range = physicalRoot.ownerDocument.createRange();
range.setStart(startPos.node, startPos.offset);

@@ -29,3 +29,3 @@ range.setEnd(endPos.node, endPos.offset);

case 'table':
var table = contentDiv.querySelector('#' + snapshotSelection.tableId);
var table = physicalRoot.querySelector('#' + snapshotSelection.tableId);
if (table) {

@@ -43,3 +43,3 @@ domSelection = {

case 'image':
var image = contentDiv.querySelector('#' + snapshotSelection.imageId);
var image = physicalRoot.querySelector('#' + snapshotSelection.imageId);
if (image) {

@@ -46,0 +46,0 @@ domSelection = {

@@ -273,3 +273,3 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {

var newChild = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE')
? sanitizeElement(child, allowedTags, disallowedTags, styleSanitizers)
? sanitizeElement(child, allowedTags, disallowedTags, styleSanitizers, attributeSanitizers)
: (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'TEXT_NODE')

@@ -276,0 +276,0 @@ ? child.cloneNode()

@@ -5,3 +5,3 @@ import type { AddUndoSnapshot } from 'roosterjs-content-model-types';

* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).

@@ -8,0 +8,0 @@ * @param entityStates @optional Entity states related to this snapshot.

@@ -5,3 +5,3 @@ import { createSnapshotSelection } from '../utils/createSnapshotSelection';

* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).

@@ -13,3 +13,3 @@ * @param entityStates @optional Entity states related to this snapshot.

export var addUndoSnapshot = function (core, canUndoByBackspace, entityStates) {
var lifecycle = core.lifecycle, contentDiv = core.contentDiv, undo = core.undo;
var lifecycle = core.lifecycle, physicalRoot = core.physicalRoot, undo = core.undo;
var snapshot = null;

@@ -19,3 +19,3 @@ if (!lifecycle.shadowEditFragment) {

var selection = createSnapshotSelection(core);
var html = contentDiv.innerHTML;
var html = physicalRoot.innerHTML;
snapshot = {

@@ -22,0 +22,0 @@ html: html,

@@ -5,3 +5,3 @@ import type { AttachDomEvent } from 'roosterjs-content-model-types';

* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param eventName The DOM event name

@@ -8,0 +8,0 @@ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered

@@ -5,3 +5,3 @@ import { getObjectKeys } from 'roosterjs-content-model-dom';

* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param eventName The DOM event name

@@ -26,5 +26,5 @@ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered

};
core.contentDiv.addEventListener(eventName, onEvent);
core.logicalRoot.addEventListener(eventName, onEvent);
return function () {
core.contentDiv.removeEventListener(eventName, onEvent);
core.logicalRoot.removeEventListener(eventName, onEvent);
};

@@ -31,0 +31,0 @@ });

@@ -29,3 +29,3 @@ import { cloneModel } from '../publicApi/model/cloneModel';

: createDomToModelContextWithConfig(core.domToModelSettings.calculated, editorContext);
var model = domToContentModel(core.contentDiv, domToModelContext, selection);
var model = domToContentModel(core.logicalRoot, domToModelContext, selection);
if (saveIndex) {

@@ -32,0 +32,0 @@ core.cache.cachedModel = model;

@@ -9,5 +9,5 @@ import { __assign } from "tslib";

var _a;
var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, contentDiv = core.contentDiv, cache = core.cache, domHelper = core.domHelper;
var context = __assign({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale() }, getRootComputedStyleForContext(contentDiv.ownerDocument));
checkRootRtl(contentDiv, context);
var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, logicalRoot = core.logicalRoot, cache = core.cache, domHelper = core.domHelper;
var context = __assign({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale() }, getRootComputedStyleForContext(logicalRoot.ownerDocument));
checkRootRtl(logicalRoot, context);
return context;

@@ -14,0 +14,0 @@ };

@@ -5,4 +5,4 @@ import type { Focus } from 'roosterjs-content-model-types';

* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export declare const focus: Focus;
/**
* @internal
* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/

@@ -15,3 +15,3 @@ export var focus = function (core) {

if (!core.api.hasFocus(core)) {
core.contentDiv.focus();
core.logicalRoot.focus();
}

@@ -18,0 +18,0 @@ }

@@ -8,3 +8,3 @@ import type { FormatContentModel } from 'roosterjs-content-model-types';

* If there is cached model, it will be used and updated.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param formatter Formatter function, see ContentModelFormatter

@@ -11,0 +11,0 @@ * @param options More options, see FormatContentModelOptions

@@ -9,3 +9,3 @@ import { __assign } from "tslib";

* If there is cached model, it will be used and updated.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param formatter Formatter function, see ContentModelFormatter

@@ -33,5 +33,3 @@ * @param options More options, see FormatContentModelOptions

core.undo.isNested = true;
if (core.undo.snapshotsManager.hasNewContent || entityStates) {
core.api.addUndoSnapshot(core, !!canUndoByBackspace);
}
core.api.addUndoSnapshot(core, !!canUndoByBackspace, entityStates);
}

@@ -38,0 +36,0 @@ try {

@@ -17,5 +17,5 @@ /**

var _a;
var selection = (_a = core.contentDiv.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
var selection = (_a = core.logicalRoot.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
var range = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
return range && core.contentDiv.contains(range.commonAncestorContainer)
return range && core.logicalRoot.contains(range.commonAncestorContainer)
? {

@@ -22,0 +22,0 @@ type: 'range',

@@ -5,4 +5,4 @@ import type { GetVisibleViewport } from 'roosterjs-content-model-types';

* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export declare const getVisibleViewport: GetVisibleViewport;

@@ -5,7 +5,9 @@ import { __read, __spreadArray } from "tslib";

* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export var getVisibleViewport = function (core) {
var scrollContainer = core.domEvent.scrollContainer;
return getIntersectedRect(scrollContainer == core.contentDiv ? [scrollContainer] : [scrollContainer, core.contentDiv]);
return getIntersectedRect(scrollContainer == core.physicalRoot
? [scrollContainer]
: [scrollContainer, core.physicalRoot]);
};

@@ -12,0 +14,0 @@ /**

@@ -5,5 +5,5 @@ import type { HasFocus } from 'roosterjs-content-model-types';

* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @returns True if the editor has focus, otherwise false
*/
export declare const hasFocus: HasFocus;
/**
* @internal
* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @returns True if the editor has focus, otherwise false
*/
export var hasFocus = function (core) {
var activeElement = core.contentDiv.ownerDocument.activeElement;
return !!(activeElement && core.contentDiv.contains(activeElement));
var activeElement = core.logicalRoot.ownerDocument.activeElement;
return !!(activeElement && core.logicalRoot.contains(activeElement));
};
//# sourceMappingURL=hasFocus.js.map

@@ -5,3 +5,3 @@ import type { Paste } from 'roosterjs-content-model-types';

* Paste into editor using a clipboardData object
* @param core The StandaloneEditorCore object.
* @param core The EditorCore object.
* @param clipboardData Clipboard data retrieved from clipboard

@@ -8,0 +8,0 @@ * @param pasteType Type of content to paste. @default normal

@@ -13,3 +13,3 @@ import { cloneModel } from '../publicApi/model/cloneModel';

* Paste into editor using a clipboardData object
* @param core The StandaloneEditorCore object.
* @param core The EditorCore object.
* @param clipboardData Clipboard data retrieved from clipboard

@@ -33,3 +33,3 @@ * @param pasteType Type of content to paste. @default normal

// 3. Create target fragment
var sourceFragment = createPasteFragment(core.contentDiv.ownerDocument, clipboardData, pasteType, (_a = (clipboardData.rawHtml == clipboardData.html
var sourceFragment = createPasteFragment(core.physicalRoot.ownerDocument, clipboardData, pasteType, (_a = (clipboardData.rawHtml == clipboardData.html
? doc

@@ -36,0 +36,0 @@ : createDOMFromHtml(clipboardData.html, core.trustedHTMLHandler))) === null || _a === void 0 ? void 0 : _a.body);

@@ -16,3 +16,3 @@ import { contentModelToDom, createModelToDomContext, createModelToDomContextWithConfig, } from 'roosterjs-content-model-dom';

modelToDomContext.onNodeCreated = onNodeCreated;
var selection = contentModelToDom(core.contentDiv.ownerDocument, core.contentDiv, model, modelToDomContext);
var selection = contentModelToDom(core.logicalRoot.ownerDocument, core.logicalRoot, model, modelToDomContext);
if (!core.lifecycle.shadowEditFragment) {

@@ -19,0 +19,0 @@ core.cache.cachedSelection = selection || undefined;

@@ -19,3 +19,3 @@ import { addRangeToSelection } from '../corePlugin/utils/addRangeToSelection';

var skipReselectOnFocus = core.selection.skipReselectOnFocus;
var doc = core.contentDiv.ownerDocument;
var doc = core.physicalRoot.ownerDocument;
var sheet = (_a = core.selection.selectionStyleNode) === null || _a === void 0 ? void 0 : _a.sheet;

@@ -25,3 +25,3 @@ core.selection.skipReselectOnFocus = true;

var selectionRules = void 0;
var rootSelector = '#' + addUniqueId(core.contentDiv, CONTENT_DIV_ID);
var rootSelector = '#' + addUniqueId(core.physicalRoot, CONTENT_DIV_ID);
switch (selection === null || selection === void 0 ? void 0 : selection.type) {

@@ -28,0 +28,0 @@ case 'image':

@@ -5,5 +5,5 @@ import type { SwitchShadowEdit } from 'roosterjs-content-model-types';

* Switch the Shadow Edit mode of editor On/Off
* @param editorCore The StandaloneEditorCore object
* @param editorCore The EditorCore object
* @param isOn True to switch On, False to switch Off
*/
export declare const switchShadowEdit: SwitchShadowEdit;

@@ -6,3 +6,3 @@ import { iterateSelections } from '../publicApi/selection/iterateSelections';

* Switch the Shadow Edit mode of editor On/Off
* @param editorCore The StandaloneEditorCore object
* @param editorCore The EditorCore object
* @param isOn True to switch On, False to switch Off

@@ -15,4 +15,4 @@ */

var model = !core.cache.cachedModel ? core.api.createContentModel(core) : null;
var fragment = core.contentDiv.ownerDocument.createDocumentFragment();
var clonedRoot = core.contentDiv.cloneNode(true /*deep*/);
var fragment = core.logicalRoot.ownerDocument.createDocumentFragment();
var clonedRoot = core.logicalRoot.cloneNode(true /*deep*/);
moveChildNodes(fragment, clonedRoot);

@@ -19,0 +19,0 @@ core.api.triggerEvent(core, {

@@ -5,3 +5,3 @@ import type { TriggerEvent } from 'roosterjs-content-model-types';

* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param pluginEvent The event object to trigger

@@ -8,0 +8,0 @@ * @param broadcast Set to true to skip the shouldHandleEventExclusively check

@@ -10,3 +10,3 @@ var allowedEventsInShadowEdit = [

* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param pluginEvent The event object to trigger

@@ -13,0 +13,0 @@ * @param broadcast Set to true to skip the shouldHandleEventExclusively check

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

import type { CachePluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { CachePluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createCachePlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<CachePluginState>;
export declare function createCachePlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<CachePluginState>;

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

import type { ContextMenuPluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { ContextMenuPluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * @internal

*/
export declare function createContextMenuPlugin(options: StandaloneEditorOptions): PluginWithState<ContextMenuPluginState>;
export declare function createContextMenuPlugin(options: EditorOptions): PluginWithState<ContextMenuPluginState>;

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

import type { CopyPastePluginState, ContentModelTable, OnNodeCreated, StandaloneEditorOptions, PluginWithState, ContentModelDocument } from 'roosterjs-content-model-types';
import type { CopyPastePluginState, ContentModelTable, OnNodeCreated, EditorOptions, PluginWithState, ContentModelDocument } from 'roosterjs-content-model-types';
/**

@@ -22,2 +22,2 @@ * @internal

*/
export declare function createCopyPastePlugin(option: StandaloneEditorOptions): PluginWithState<CopyPastePluginState>;
export declare function createCopyPastePlugin(option: EditorOptions): PluginWithState<CopyPastePluginState>;

@@ -31,3 +31,3 @@ import { __assign } from "tslib";

if (!editor_1.isDisposed()) {
editor_1.pasteFromClipboard(clipboardData);
editor_1.pasteFromClipboard(clipboardData, _this.state.defaultPasteType);
}

@@ -41,2 +41,3 @@ });

tempDiv: null,
defaultPasteType: option.defaultPasteType,
};

@@ -43,0 +44,0 @@ }

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

import type { DOMEventPluginState, StandaloneEditorOptions, PluginWithState } from 'roosterjs-content-model-types';
import type { DOMEventPluginState, EditorOptions, PluginWithState } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createDOMEventPlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<DOMEventPluginState>;
export declare function createDOMEventPlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<DOMEventPluginState>;
import { findAllEntities } from './utils/findAllEntities';
import { transformColor } from '../publicApi/color/transformColor';
import { handleCompositionEndEvent, handleDelimiterContentChangedEvent, handleDelimiterKeyDownEvent, } from './utils/entityDelimiterUtils';
import { createEntity, generateEntityClassNames, getAllEntityWrappers, getObjectKeys, isEntityElement, parseEntityClassName, } from 'roosterjs-content-model-dom';
import { createEntity, generateEntityClassNames, getAllEntityWrappers, getObjectKeys, isEntityElement, parseEntityFormat, } from 'roosterjs-content-model-dom';
var ENTITY_ID_REGEX = /_(\d{1,8})$/;

@@ -153,10 +153,7 @@ /**

// Entity is not in editor, which means it is deleted, use a temporary entity here to represent this entity
var tempEntity_1 = createEntity(entry.element);
var isEntity_1 = false;
entry.element.classList.forEach(function (name) {
isEntity_1 = parseEntityClassName(name, tempEntity_1.entityFormat) || isEntity_1;
});
if (isEntity_1) {
var format = parseEntityFormat(entry.element);
if (!format.isFakeEntity) {
var entity = createEntity(entry.element, format.isReadonly, {}, format.entityType, format.id);
result.push({
entity: tempEntity_1,
entity: entity,
operation: 'overwrite',

@@ -178,6 +175,3 @@ });

EntityPlugin.prototype.triggerEvent = function (editor, wrapper, operation, rawEvent, state) {
var format = {};
wrapper.classList.forEach(function (name) {
parseEntityClassName(name, format);
});
var format = parseEntityFormat(wrapper);
return format.id && format.entityType && !format.isFakeEntity

@@ -184,0 +178,0 @@ ? editor.triggerEvent('entityOperation', {

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

import type { FormatPluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { FormatPluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createFormatPlugin(option: StandaloneEditorOptions): PluginWithState<FormatPluginState>;
export declare function createFormatPlugin(option: EditorOptions): PluginWithState<FormatPluginState>;

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

import type { LifecyclePluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { LifecyclePluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createLifecyclePlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<LifecyclePluginState>;
export declare function createLifecyclePlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<LifecyclePluginState>;

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

import type { PluginWithState, SelectionPluginState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { PluginWithState, SelectionPluginState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createSelectionPlugin(options: StandaloneEditorOptions): PluginWithState<SelectionPluginState>;
export declare function createSelectionPlugin(options: EditorOptions): PluginWithState<SelectionPluginState>;

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

import type { PluginWithState, StandaloneEditorOptions, UndoPluginState } from 'roosterjs-content-model-types';
import type { PluginWithState, EditorOptions, UndoPluginState } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createUndoPlugin(option: StandaloneEditorOptions): PluginWithState<UndoPluginState>;
export declare function createUndoPlugin(option: EditorOptions): PluginWithState<UndoPluginState>;

@@ -1,8 +0,8 @@

import type { ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
import type { ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
/**
* @internal
* When necessary, set default format as current pending format so it will be applied when Input event is fired
* @param editor The Content Model Editor
* @param editor The editor object
* @param defaultFormat The default segment format to apply
*/
export declare function applyDefaultFormat(editor: IStandaloneEditor, defaultFormat: ContentModelSegmentFormat): void;
export declare function applyDefaultFormat(editor: IEditor, defaultFormat: ContentModelSegmentFormat): void;

@@ -7,3 +7,3 @@ import { __assign } from "tslib";

* When necessary, set default format as current pending format so it will be applied when Input event is fired
* @param editor The Content Model Editor
* @param editor The editor object
* @param defaultFormat The default segment format to apply

@@ -10,0 +10,0 @@ */

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

import type { ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
import type { ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function applyPendingFormat(editor: IStandaloneEditor, data: string, format: ContentModelSegmentFormat): void;
export declare function applyPendingFormat(editor: IEditor, data: string, format: ContentModelSegmentFormat): void;

@@ -1,18 +0,18 @@

import type { CompositionEndEvent, ContentModelFormatter, IStandaloneEditor, KeyDownEvent } from 'roosterjs-content-model-types';
import type { CompositionEndEvent, ContentModelFormatter, IEditor, KeyDownEvent } from 'roosterjs-content-model-types';
/**
* @internal exported only for unit test
*/
export declare function preventTypeInDelimiter(node: HTMLElement, editor: IStandaloneEditor): void;
export declare function preventTypeInDelimiter(node: HTMLElement, editor: IEditor): void;
/**
* @internal
*/
export declare function handleDelimiterContentChangedEvent(editor: IStandaloneEditor): void;
export declare function handleDelimiterContentChangedEvent(editor: IEditor): void;
/**
* @internal
*/
export declare function handleCompositionEndEvent(editor: IStandaloneEditor, event: CompositionEndEvent): void;
export declare function handleCompositionEndEvent(editor: IEditor, event: CompositionEndEvent): void;
/**
* @internal
*/
export declare function handleDelimiterKeyDownEvent(editor: IStandaloneEditor, event: KeyDownEvent): void;
export declare function handleDelimiterKeyDownEvent(editor: IEditor, event: KeyDownEvent): void;
/**

@@ -19,0 +19,0 @@ * @internal Exported Only for unit test

@@ -47,3 +47,4 @@ // Max stack size that cannot be exceeded. When exceeded, old undo history will be dropped

!snapshot.entityStates;
if (this.snapshots.currentIndex < 0 || !currentSnapshot || !isSameSnapshot) {
var addSnapshot = !currentSnapshot || shouldAddSnapshot(currentSnapshot, snapshot);
if (this.snapshots.currentIndex < 0 || addSnapshot) {
this.clearRedo();

@@ -107,2 +108,9 @@ this.snapshots.snapshots.push(snapshot);

}
function shouldAddSnapshot(currentSnapshot, snapshot) {
return (currentSnapshot.html !== snapshot.html ||
(currentSnapshot.entityStates &&
snapshot.entityStates &&
currentSnapshot.entityStates !== snapshot.entityStates) ||
(!currentSnapshot.entityStates && snapshot.entityStates));
}
//# sourceMappingURL=SnapshotsManagerImpl.js.map

@@ -19,3 +19,3 @@ export { CachedElementHandler, CloneModelOptions, cloneModel } from './publicApi/model/cloneModel';

export { applyTableFormat } from './publicApi/table/applyTableFormat';
export { normalizeTable } from './publicApi/table/normalizeTable';
export { normalizeTable, MIN_ALLOWED_TABLE_CELL_WIDTH } from './publicApi/table/normalizeTable';
export { setTableCellBackgroundColor } from './publicApi/table/setTableCellBackgroundColor';

@@ -29,2 +29,3 @@ export { getSelectedCells } from './publicApi/table/getSelectedCells';

export { readFile } from './publicApi/domUtils/readFile';
export { cacheGetEventData } from './publicApi/domUtils/cacheGetEventData';
export { undo } from './publicApi/undo/undo';

@@ -42,2 +43,2 @@ export { redo } from './publicApi/undo/redo';

export { TableBorderFormat } from './constants/TableBorderFormat';
export { StandaloneEditor } from './editor/StandaloneEditor';
export { Editor } from './editor/Editor';

@@ -19,3 +19,3 @@ export { cloneModel } from './publicApi/model/cloneModel';

export { applyTableFormat } from './publicApi/table/applyTableFormat';
export { normalizeTable } from './publicApi/table/normalizeTable';
export { normalizeTable, MIN_ALLOWED_TABLE_CELL_WIDTH } from './publicApi/table/normalizeTable';
export { setTableCellBackgroundColor } from './publicApi/table/setTableCellBackgroundColor';

@@ -29,2 +29,3 @@ export { getSelectedCells } from './publicApi/table/getSelectedCells';

export { readFile } from './publicApi/domUtils/readFile';
export { cacheGetEventData } from './publicApi/domUtils/cacheGetEventData';
export { undo } from './publicApi/undo/undo';

@@ -42,3 +43,3 @@ export { redo } from './publicApi/undo/redo';

export { TableBorderFormat } from './constants/TableBorderFormat';
export { StandaloneEditor } from './editor/StandaloneEditor';
export { Editor } from './editor/Editor';
//# sourceMappingURL=index.js.map

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

import type { ExportContentMode, IStandaloneEditor, ModelToDomOption } from 'roosterjs-content-model-types';
import type { ExportContentMode, IEditor, ModelToDomOption } from 'roosterjs-content-model-types';
/**

@@ -11,2 +11,2 @@ * Export string content of editor

*/
export declare function exportContent(editor: IStandaloneEditor, mode?: ExportContentMode, options?: ModelToDomOption): string;
export declare function exportContent(editor: IEditor, mode?: ExportContentMode, options?: ModelToDomOption): string;

@@ -211,2 +211,3 @@ import { __assign } from "tslib";

var _a;
mergeBlockFormat(applyDefaultFormatOption, block);
switch (block.blockType) {

@@ -241,2 +242,7 @@ case 'BlockGroup':

}
function mergeBlockFormat(applyDefaultFormatOption, block) {
if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {
delete block.format.backgroundColor;
}
}
function mergeSegmentFormat(applyDefaultFormatOption, targetformat, sourceFormat) {

@@ -243,0 +249,0 @@ return applyDefaultFormatOption == 'mergeAll'

@@ -11,3 +11,2 @@ /**

export function deleteBlock(blocks, blockToDelete, replacement, context, direction) {
var _a;
var index = blocks.indexOf(blockToDelete);

@@ -28,4 +27,2 @@ switch (blockToDelete.blockType) {

if (operation !== undefined) {
var wrapper = blockToDelete.wrapper;
(_a = wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(wrapper);
replacement ? blocks.splice(index, 1, replacement) : blocks.splice(index, 1);

@@ -32,0 +29,0 @@ context === null || context === void 0 ? void 0 : context.deletedEntities.push({

@@ -13,3 +13,2 @@ import { deleteSingleChar } from '../../modelApi/edit/deleteSingleChar';

export function deleteSegment(paragraph, segmentToDelete, context, direction) {
var _a;
var segments = paragraph.segments;

@@ -38,4 +37,2 @@ var index = segments.indexOf(segmentToDelete);

if (operation !== undefined) {
var wrapper = segmentToDelete.wrapper;
(_a = wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(wrapper);
segments.splice(index, 1);

@@ -42,0 +39,0 @@ context === null || context === void 0 ? void 0 : context.deletedEntities.push({

import type { ContentModelSegmentFormat, ContentModelTable } from 'roosterjs-content-model-types';
/**
* Minimum width for a table cell
*/
export declare const MIN_ALLOWED_TABLE_CELL_WIDTH: number;
/**
* Normalize a Content Model table, make sure:

@@ -4,0 +8,0 @@ * 1. Fist cells are not spanned

import { __assign, __read, __spreadArray } from "tslib";
import { addBlock, addSegment, createBr, createParagraph } from 'roosterjs-content-model-dom';
/**
* Minimum width for a table cell
*/
export var MIN_ALLOWED_TABLE_CELL_WIDTH = 30;
var MIN_HEIGHT = 22;

@@ -56,2 +60,5 @@ /**

}
else if (table.widths[i] < MIN_ALLOWED_TABLE_CELL_WIDTH) {
table.widths[i] = MIN_ALLOWED_TABLE_CELL_WIDTH;
}
}

@@ -58,0 +65,0 @@ // Move blocks from spanned cell to its main cell if any,

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

import type { IStandaloneEditor } from 'roosterjs-content-model-types';
import type { IEditor } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * Redo to next undo snapshot

*/
export declare function redo(editor: IStandaloneEditor): void;
export declare function redo(editor: IEditor): void;

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

import type { IStandaloneEditor } from 'roosterjs-content-model-types';
import type { IEditor } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * Undo to last undo snapshot

*/
export declare function undo(editor: IStandaloneEditor): void;
export declare function undo(editor: IEditor): void;

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

import type { SnapshotSelection, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { SnapshotSelection, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function createSnapshotSelection(core: StandaloneEditorCore): SnapshotSelection;
export declare function createSnapshotSelection(core: EditorCore): SnapshotSelection;

@@ -6,3 +6,3 @@ import { isElementOfType, isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';

export function createSnapshotSelection(core) {
var contentDiv = core.contentDiv, api = core.api;
var physicalRoot = core.physicalRoot, api = core.api;
var selection = api.getDOMSelection(core);

@@ -12,8 +12,8 @@ // Normalize tables to ensure they have TBODY element between TABLE and TR so that the selection path will include correct values

var _a = selection.range, startContainer = _a.startContainer, startOffset = _a.startOffset, endContainer = _a.endContainer, endOffset = _a.endOffset;
var isDOMChanged = normalizeTableTree(startContainer, contentDiv);
var isDOMChanged = normalizeTableTree(startContainer, physicalRoot);
if (endContainer != startContainer) {
isDOMChanged = normalizeTableTree(endContainer, contentDiv) || isDOMChanged;
isDOMChanged = normalizeTableTree(endContainer, physicalRoot) || isDOMChanged;
}
if (isDOMChanged) {
var newRange = contentDiv.ownerDocument.createRange();
var newRange = physicalRoot.ownerDocument.createRange();
newRange.setStart(startContainer, startOffset);

@@ -47,4 +47,4 @@ newRange.setEnd(endContainer, endOffset);

type: 'range',
start: getPath(range.startContainer, range.startOffset, contentDiv),
end: getPath(range.endContainer, range.endOffset, contentDiv),
start: getPath(range.startContainer, range.startOffset, physicalRoot),
end: getPath(range.endContainer, range.endOffset, physicalRoot),
isReverted: !!selection.isReverted,

@@ -51,0 +51,0 @@ };

import type { HtmlFromClipboard } from './retrieveHtmlInfo';
import type { BeforePasteEvent, ClipboardData, PasteType, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { BeforePasteEvent, ClipboardData, PasteType, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function generatePasteOptionFromPlugins(core: StandaloneEditorCore, clipboardData: ClipboardData, fragment: DocumentFragment, htmlFromClipboard: HtmlFromClipboard, pasteType: PasteType): BeforePasteEvent;
export declare function generatePasteOptionFromPlugins(core: EditorCore, clipboardData: ClipboardData, fragment: DocumentFragment, htmlFromClipboard: HtmlFromClipboard, pasteType: PasteType): BeforePasteEvent;

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

import type { BeforePasteEvent, ClipboardData, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { BeforePasteEvent, ClipboardData, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function mergePasteContent(core: StandaloneEditorCore, eventResult: BeforePasteEvent, clipboardData: ClipboardData): void;
export declare function mergePasteContent(core: EditorCore, eventResult: BeforePasteEvent, clipboardData: ClipboardData): void;

@@ -28,3 +28,3 @@ import { __assign } from "tslib";

var selectedSegment = getSelectedSegments(model, true /*includeFormatHolder*/)[0];
var domToModelContext = createDomToModelContextForSanitizing(core.contentDiv.ownerDocument, undefined /*defaultFormat*/, core.domToModelSettings.customized, domToModelOption);
var domToModelContext = createDomToModelContextForSanitizing(core.physicalRoot.ownerDocument, undefined /*defaultFormat*/, core.domToModelSettings.customized, domToModelOption);
domToModelContext.segmentFormat = selectedSegment

@@ -31,0 +31,0 @@ ? getSegmentTextFormat(selectedSegment)

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

import type { StandaloneEditorCore, Snapshot } from 'roosterjs-content-model-types';
import type { EditorCore, Snapshot } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotColors(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotColors(core: EditorCore, snapshot: Snapshot): void;

@@ -9,5 +9,5 @@ import { transformColor } from '../publicApi/color/transformColor';

if (!!snapshot.isDarkMode != !!isDarkMode) {
transformColor(core.contentDiv, false /*includeSelf*/, isDarkMode ? 'lightToDark' : 'darkToLight', core.darkColorHandler);
transformColor(core.physicalRoot, false /*includeSelf*/, isDarkMode ? 'lightToDark' : 'darkToLight', core.darkColorHandler);
}
}
//# sourceMappingURL=restoreSnapshotColors.js.map

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

import type { Snapshot, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { Snapshot, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotHTML(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotHTML(core: EditorCore, snapshot: Snapshot): void;

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

import { getAllEntityWrappers, isEntityElement, isNodeOfType, parseEntityClassName, reuseCachedElement, } from 'roosterjs-content-model-dom';
import { getAllEntityWrappers, isEntityElement, isNodeOfType, parseEntityFormat, reuseCachedElement, } from 'roosterjs-content-model-dom';
var BlockEntityContainer = '_E_EBlockEntityContainer';

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

var _a, _b, _c;
var contentDiv = core.contentDiv, entityMap = core.entity.entityMap;
var refNode = contentDiv.firstChild;
var physicalRoot = core.physicalRoot, entityMap = core.entity.entityMap;
var refNode = physicalRoot.firstChild;
var body = new DOMParser().parseFromString((_b = (_a = core.trustedHTMLHandler) === null || _a === void 0 ? void 0 : _a.call(core, snapshot.html)) !== null && _b !== void 0 ? _b : snapshot.html, 'text/html').body;

@@ -16,6 +16,6 @@ for (var currentNode = body.firstChild; currentNode;) {

if (originalEntityElement) {
refNode = reuseCachedElement(contentDiv, originalEntityElement, refNode);
refNode = reuseCachedElement(physicalRoot, originalEntityElement, refNode);
}
else {
contentDiv.insertBefore(currentNode, refNode);
physicalRoot.insertBefore(currentNode, refNode);
if (isNodeOfType(currentNode, 'ELEMENT_NODE')) {

@@ -32,3 +32,3 @@ var childEntities = getAllEntityWrappers(currentNode);

var markerNode = wrapper.cloneNode();
contentDiv.insertBefore(markerNode, refNode);
physicalRoot.insertBefore(markerNode, refNode);
refNode = markerNode;

@@ -54,7 +54,4 @@ }

if (isEntityElement(node)) {
var format_1 = {};
node.classList.forEach(function (name) {
parseEntityClassName(name, format_1);
});
result = (format_1.id && ((_a = entityMap[format_1.id]) === null || _a === void 0 ? void 0 : _a.element)) || null;
var format = parseEntityFormat(node);
result = (format.id && ((_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element)) || null;
}

@@ -72,11 +69,13 @@ else if (isBlockEntityContainer(node)) {

var _a;
var format = {};
element.childNodes.forEach(function (node) {
for (var node = element.firstChild; node; node = node.nextSibling) {
if (isEntityElement(node) && isNodeOfType(node, 'ELEMENT_NODE')) {
node.classList.forEach(function (name) { return parseEntityClassName(name, format); });
var format = parseEntityFormat(node);
var parent_1 = format.id ? (_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element.parentElement : null;
return isNodeOfType(parent_1, 'ELEMENT_NODE') && isBlockEntityContainer(parent_1)
? parent_1
: null;
}
});
var parent = format.id ? (_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element.parentElement : null;
return isNodeOfType(parent, 'ELEMENT_NODE') && isBlockEntityContainer(parent) ? parent : null;
}
return null;
}
//# sourceMappingURL=restoreSnapshotHTML.js.map

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

import type { StandaloneEditorCore, Snapshot } from 'roosterjs-content-model-types';
import type { EditorCore, Snapshot } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotSelection(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotSelection(core: EditorCore, snapshot: Snapshot): void;

@@ -7,3 +7,3 @@ import { isNodeOfType } from 'roosterjs-content-model-dom';

var snapshotSelection = snapshot.selection;
var contentDiv = core.contentDiv;
var physicalRoot = core.physicalRoot;
var domSelection = null;

@@ -13,5 +13,5 @@ if (snapshotSelection) {

case 'range':
var startPos = getPositionFromPath(contentDiv, snapshotSelection.start);
var endPos = getPositionFromPath(contentDiv, snapshotSelection.end);
var range = contentDiv.ownerDocument.createRange();
var startPos = getPositionFromPath(physicalRoot, snapshotSelection.start);
var endPos = getPositionFromPath(physicalRoot, snapshotSelection.end);
var range = physicalRoot.ownerDocument.createRange();
range.setStart(startPos.node, startPos.offset);

@@ -26,3 +26,3 @@ range.setEnd(endPos.node, endPos.offset);

case 'table':
var table = contentDiv.querySelector('#' + snapshotSelection.tableId);
var table = physicalRoot.querySelector('#' + snapshotSelection.tableId);
if (table) {

@@ -40,3 +40,3 @@ domSelection = {

case 'image':
var image = contentDiv.querySelector('#' + snapshotSelection.imageId);
var image = physicalRoot.querySelector('#' + snapshotSelection.imageId);
if (image) {

@@ -43,0 +43,0 @@ domSelection = {

@@ -270,3 +270,3 @@ import { isNodeOfType } from 'roosterjs-content-model-dom';

var newChild = isNodeOfType(child, 'ELEMENT_NODE')
? sanitizeElement(child, allowedTags, disallowedTags, styleSanitizers)
? sanitizeElement(child, allowedTags, disallowedTags, styleSanitizers, attributeSanitizers)
: isNodeOfType(child, 'TEXT_NODE')

@@ -273,0 +273,0 @@ ? child.cloneNode()

@@ -5,3 +5,3 @@ import type { AddUndoSnapshot } from 'roosterjs-content-model-types';

* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).

@@ -8,0 +8,0 @@ * @param entityStates @optional Entity states related to this snapshot.

@@ -8,3 +8,3 @@ "use strict";

* Add an undo snapshot to current undo snapshot stack
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).

@@ -16,3 +16,3 @@ * @param entityStates @optional Entity states related to this snapshot.

var addUndoSnapshot = function (core, canUndoByBackspace, entityStates) {
var lifecycle = core.lifecycle, contentDiv = core.contentDiv, undo = core.undo;
var lifecycle = core.lifecycle, physicalRoot = core.physicalRoot, undo = core.undo;
var snapshot = null;

@@ -22,3 +22,3 @@ if (!lifecycle.shadowEditFragment) {

var selection = (0, createSnapshotSelection_1.createSnapshotSelection)(core);
var html = contentDiv.innerHTML;
var html = physicalRoot.innerHTML;
snapshot = {

@@ -25,0 +25,0 @@ html: html,

@@ -5,3 +5,3 @@ import type { AttachDomEvent } from 'roosterjs-content-model-types';

* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param eventName The DOM event name

@@ -8,0 +8,0 @@ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered

@@ -8,3 +8,3 @@ "use strict";

* Attach a DOM event to the editor content DIV
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param eventName The DOM event name

@@ -29,5 +29,5 @@ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered

};
core.contentDiv.addEventListener(eventName, onEvent);
core.logicalRoot.addEventListener(eventName, onEvent);
return function () {
core.contentDiv.removeEventListener(eventName, onEvent);
core.logicalRoot.removeEventListener(eventName, onEvent);
};

@@ -34,0 +34,0 @@ });

@@ -32,3 +32,3 @@ "use strict";

: (0, roosterjs_content_model_dom_1.createDomToModelContextWithConfig)(core.domToModelSettings.calculated, editorContext);
var model = (0, roosterjs_content_model_dom_1.domToContentModel)(core.contentDiv, domToModelContext, selection);
var model = (0, roosterjs_content_model_dom_1.domToContentModel)(core.logicalRoot, domToModelContext, selection);
if (saveIndex) {

@@ -35,0 +35,0 @@ core.cache.cachedModel = model;

@@ -12,5 +12,5 @@ "use strict";

var _a;
var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, contentDiv = core.contentDiv, cache = core.cache, domHelper = core.domHelper;
var context = (0, tslib_1.__assign)({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale() }, (0, getRootComputedStyleForContext_1.getRootComputedStyleForContext)(contentDiv.ownerDocument));
checkRootRtl(contentDiv, context);
var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, logicalRoot = core.logicalRoot, cache = core.cache, domHelper = core.domHelper;
var context = (0, tslib_1.__assign)({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale() }, (0, getRootComputedStyleForContext_1.getRootComputedStyleForContext)(logicalRoot.ownerDocument));
checkRootRtl(logicalRoot, context);
return context;

@@ -17,0 +17,0 @@ };

@@ -5,4 +5,4 @@ import type { Focus } from 'roosterjs-content-model-types';

* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export declare const focus: Focus;

@@ -7,3 +7,3 @@ "use strict";

* Focus to editor. If there is a cached selection range, use it as current selection
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/

@@ -19,3 +19,3 @@ var focus = function (core) {

if (!core.api.hasFocus(core)) {
core.contentDiv.focus();
core.logicalRoot.focus();
}

@@ -22,0 +22,0 @@ }

@@ -8,3 +8,3 @@ import type { FormatContentModel } from 'roosterjs-content-model-types';

* If there is cached model, it will be used and updated.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param formatter Formatter function, see ContentModelFormatter

@@ -11,0 +11,0 @@ * @param options More options, see FormatContentModelOptions

@@ -12,3 +12,3 @@ "use strict";

* If there is cached model, it will be used and updated.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param formatter Formatter function, see ContentModelFormatter

@@ -36,5 +36,3 @@ * @param options More options, see FormatContentModelOptions

core.undo.isNested = true;
if (core.undo.snapshotsManager.hasNewContent || entityStates) {
core.api.addUndoSnapshot(core, !!canUndoByBackspace);
}
core.api.addUndoSnapshot(core, !!canUndoByBackspace, entityStates);
}

@@ -41,0 +39,0 @@ try {

@@ -21,5 +21,5 @@ "use strict";

var _a;
var selection = (_a = core.contentDiv.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
var selection = (_a = core.logicalRoot.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
var range = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
return range && core.contentDiv.contains(range.commonAncestorContainer)
return range && core.logicalRoot.contains(range.commonAncestorContainer)
? {

@@ -26,0 +26,0 @@ type: 'range',

@@ -5,4 +5,4 @@ import type { GetVisibleViewport } from 'roosterjs-content-model-types';

* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
export declare const getVisibleViewport: GetVisibleViewport;

@@ -8,7 +8,9 @@ "use strict";

* Retrieves the rect of the visible viewport of the editor.
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
*/
var getVisibleViewport = function (core) {
var scrollContainer = core.domEvent.scrollContainer;
return getIntersectedRect(scrollContainer == core.contentDiv ? [scrollContainer] : [scrollContainer, core.contentDiv]);
return getIntersectedRect(scrollContainer == core.physicalRoot
? [scrollContainer]
: [scrollContainer, core.physicalRoot]);
};

@@ -15,0 +17,0 @@ exports.getVisibleViewport = getVisibleViewport;

@@ -5,5 +5,5 @@ import type { HasFocus } from 'roosterjs-content-model-types';

* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @returns True if the editor has focus, otherwise false
*/
export declare const hasFocus: HasFocus;

@@ -7,10 +7,10 @@ "use strict";

* Check if the editor has focus now
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @returns True if the editor has focus, otherwise false
*/
var hasFocus = function (core) {
var activeElement = core.contentDiv.ownerDocument.activeElement;
return !!(activeElement && core.contentDiv.contains(activeElement));
var activeElement = core.logicalRoot.ownerDocument.activeElement;
return !!(activeElement && core.logicalRoot.contains(activeElement));
};
exports.hasFocus = hasFocus;
//# sourceMappingURL=hasFocus.js.map

@@ -5,3 +5,3 @@ import type { Paste } from 'roosterjs-content-model-types';

* Paste into editor using a clipboardData object
* @param core The StandaloneEditorCore object.
* @param core The EditorCore object.
* @param clipboardData Clipboard data retrieved from clipboard

@@ -8,0 +8,0 @@ * @param pasteType Type of content to paste. @default normal

@@ -16,3 +16,3 @@ "use strict";

* Paste into editor using a clipboardData object
* @param core The StandaloneEditorCore object.
* @param core The EditorCore object.
* @param clipboardData Clipboard data retrieved from clipboard

@@ -36,3 +36,3 @@ * @param pasteType Type of content to paste. @default normal

// 3. Create target fragment
var sourceFragment = (0, createPasteFragment_1.createPasteFragment)(core.contentDiv.ownerDocument, clipboardData, pasteType, (_a = (clipboardData.rawHtml == clipboardData.html
var sourceFragment = (0, createPasteFragment_1.createPasteFragment)(core.physicalRoot.ownerDocument, clipboardData, pasteType, (_a = (clipboardData.rawHtml == clipboardData.html
? doc

@@ -39,0 +39,0 @@ : createDOMFromHtml(clipboardData.html, core.trustedHTMLHandler))) === null || _a === void 0 ? void 0 : _a.body);

@@ -19,3 +19,3 @@ "use strict";

modelToDomContext.onNodeCreated = onNodeCreated;
var selection = (0, roosterjs_content_model_dom_1.contentModelToDom)(core.contentDiv.ownerDocument, core.contentDiv, model, modelToDomContext);
var selection = (0, roosterjs_content_model_dom_1.contentModelToDom)(core.logicalRoot.ownerDocument, core.logicalRoot, model, modelToDomContext);
if (!core.lifecycle.shadowEditFragment) {

@@ -22,0 +22,0 @@ core.cache.cachedSelection = selection || undefined;

@@ -22,3 +22,3 @@ "use strict";

var skipReselectOnFocus = core.selection.skipReselectOnFocus;
var doc = core.contentDiv.ownerDocument;
var doc = core.physicalRoot.ownerDocument;
var sheet = (_a = core.selection.selectionStyleNode) === null || _a === void 0 ? void 0 : _a.sheet;

@@ -28,3 +28,3 @@ core.selection.skipReselectOnFocus = true;

var selectionRules = void 0;
var rootSelector = '#' + addUniqueId(core.contentDiv, CONTENT_DIV_ID);
var rootSelector = '#' + addUniqueId(core.physicalRoot, CONTENT_DIV_ID);
switch (selection === null || selection === void 0 ? void 0 : selection.type) {

@@ -31,0 +31,0 @@ case 'image':

@@ -5,5 +5,5 @@ import type { SwitchShadowEdit } from 'roosterjs-content-model-types';

* Switch the Shadow Edit mode of editor On/Off
* @param editorCore The StandaloneEditorCore object
* @param editorCore The EditorCore object
* @param isOn True to switch On, False to switch Off
*/
export declare const switchShadowEdit: SwitchShadowEdit;

@@ -9,3 +9,3 @@ "use strict";

* Switch the Shadow Edit mode of editor On/Off
* @param editorCore The StandaloneEditorCore object
* @param editorCore The EditorCore object
* @param isOn True to switch On, False to switch Off

@@ -18,4 +18,4 @@ */

var model = !core.cache.cachedModel ? core.api.createContentModel(core) : null;
var fragment = core.contentDiv.ownerDocument.createDocumentFragment();
var clonedRoot = core.contentDiv.cloneNode(true /*deep*/);
var fragment = core.logicalRoot.ownerDocument.createDocumentFragment();
var clonedRoot = core.logicalRoot.cloneNode(true /*deep*/);
(0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, clonedRoot);

@@ -22,0 +22,0 @@ core.api.triggerEvent(core, {

@@ -5,3 +5,3 @@ import type { TriggerEvent } from 'roosterjs-content-model-types';

* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param pluginEvent The event object to trigger

@@ -8,0 +8,0 @@ * @param broadcast Set to true to skip the shouldHandleEventExclusively check

@@ -13,3 +13,3 @@ "use strict";

* Trigger a plugin event
* @param core The StandaloneEditorCore object
* @param core The EditorCore object
* @param pluginEvent The event object to trigger

@@ -16,0 +16,0 @@ * @param broadcast Set to true to skip the shouldHandleEventExclusively check

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

import type { CachePluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { CachePluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createCachePlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<CachePluginState>;
export declare function createCachePlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<CachePluginState>;

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

import type { ContextMenuPluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { ContextMenuPluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * @internal

*/
export declare function createContextMenuPlugin(options: StandaloneEditorOptions): PluginWithState<ContextMenuPluginState>;
export declare function createContextMenuPlugin(options: EditorOptions): PluginWithState<ContextMenuPluginState>;

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

import type { CopyPastePluginState, ContentModelTable, OnNodeCreated, StandaloneEditorOptions, PluginWithState, ContentModelDocument } from 'roosterjs-content-model-types';
import type { CopyPastePluginState, ContentModelTable, OnNodeCreated, EditorOptions, PluginWithState, ContentModelDocument } from 'roosterjs-content-model-types';
/**

@@ -22,2 +22,2 @@ * @internal

*/
export declare function createCopyPastePlugin(option: StandaloneEditorOptions): PluginWithState<CopyPastePluginState>;
export declare function createCopyPastePlugin(option: EditorOptions): PluginWithState<CopyPastePluginState>;

@@ -34,3 +34,3 @@ "use strict";

if (!editor_1.isDisposed()) {
editor_1.pasteFromClipboard(clipboardData);
editor_1.pasteFromClipboard(clipboardData, _this.state.defaultPasteType);
}

@@ -44,2 +44,3 @@ });

tempDiv: null,
defaultPasteType: option.defaultPasteType,
};

@@ -46,0 +47,0 @@ }

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

import type { DOMEventPluginState, StandaloneEditorOptions, PluginWithState } from 'roosterjs-content-model-types';
import type { DOMEventPluginState, EditorOptions, PluginWithState } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createDOMEventPlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<DOMEventPluginState>;
export declare function createDOMEventPlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<DOMEventPluginState>;

@@ -156,10 +156,7 @@ "use strict";

// Entity is not in editor, which means it is deleted, use a temporary entity here to represent this entity
var tempEntity_1 = (0, roosterjs_content_model_dom_1.createEntity)(entry.element);
var isEntity_1 = false;
entry.element.classList.forEach(function (name) {
isEntity_1 = (0, roosterjs_content_model_dom_1.parseEntityClassName)(name, tempEntity_1.entityFormat) || isEntity_1;
});
if (isEntity_1) {
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(entry.element);
if (!format.isFakeEntity) {
var entity = (0, roosterjs_content_model_dom_1.createEntity)(entry.element, format.isReadonly, {}, format.entityType, format.id);
result.push({
entity: tempEntity_1,
entity: entity,
operation: 'overwrite',

@@ -181,6 +178,3 @@ });

EntityPlugin.prototype.triggerEvent = function (editor, wrapper, operation, rawEvent, state) {
var format = {};
wrapper.classList.forEach(function (name) {
(0, roosterjs_content_model_dom_1.parseEntityClassName)(name, format);
});
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(wrapper);
return format.id && format.entityType && !format.isFakeEntity

@@ -187,0 +181,0 @@ ? editor.triggerEvent('entityOperation', {

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

import type { FormatPluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { FormatPluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createFormatPlugin(option: StandaloneEditorOptions): PluginWithState<FormatPluginState>;
export declare function createFormatPlugin(option: EditorOptions): PluginWithState<FormatPluginState>;

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

import type { LifecyclePluginState, PluginWithState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { LifecyclePluginState, PluginWithState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function createLifecyclePlugin(option: StandaloneEditorOptions, contentDiv: HTMLDivElement): PluginWithState<LifecyclePluginState>;
export declare function createLifecyclePlugin(option: EditorOptions, contentDiv: HTMLDivElement): PluginWithState<LifecyclePluginState>;

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

import type { PluginWithState, SelectionPluginState, StandaloneEditorOptions } from 'roosterjs-content-model-types';
import type { PluginWithState, SelectionPluginState, EditorOptions } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createSelectionPlugin(options: StandaloneEditorOptions): PluginWithState<SelectionPluginState>;
export declare function createSelectionPlugin(options: EditorOptions): PluginWithState<SelectionPluginState>;

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

import type { PluginWithState, StandaloneEditorOptions, UndoPluginState } from 'roosterjs-content-model-types';
import type { PluginWithState, EditorOptions, UndoPluginState } from 'roosterjs-content-model-types';
/**

@@ -7,2 +7,2 @@ * @internal

*/
export declare function createUndoPlugin(option: StandaloneEditorOptions): PluginWithState<UndoPluginState>;
export declare function createUndoPlugin(option: EditorOptions): PluginWithState<UndoPluginState>;

@@ -1,8 +0,8 @@

import type { ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
import type { ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
/**
* @internal
* When necessary, set default format as current pending format so it will be applied when Input event is fired
* @param editor The Content Model Editor
* @param editor The editor object
* @param defaultFormat The default segment format to apply
*/
export declare function applyDefaultFormat(editor: IStandaloneEditor, defaultFormat: ContentModelSegmentFormat): void;
export declare function applyDefaultFormat(editor: IEditor, defaultFormat: ContentModelSegmentFormat): void;

@@ -10,3 +10,3 @@ "use strict";

* When necessary, set default format as current pending format so it will be applied when Input event is fired
* @param editor The Content Model Editor
* @param editor The editor object
* @param defaultFormat The default segment format to apply

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

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

import type { ContentModelSegmentFormat, IStandaloneEditor } from 'roosterjs-content-model-types';
import type { ContentModelSegmentFormat, IEditor } from 'roosterjs-content-model-types';
/**

@@ -8,2 +8,2 @@ * @internal

*/
export declare function applyPendingFormat(editor: IStandaloneEditor, data: string, format: ContentModelSegmentFormat): void;
export declare function applyPendingFormat(editor: IEditor, data: string, format: ContentModelSegmentFormat): void;

@@ -1,18 +0,18 @@

import type { CompositionEndEvent, ContentModelFormatter, IStandaloneEditor, KeyDownEvent } from 'roosterjs-content-model-types';
import type { CompositionEndEvent, ContentModelFormatter, IEditor, KeyDownEvent } from 'roosterjs-content-model-types';
/**
* @internal exported only for unit test
*/
export declare function preventTypeInDelimiter(node: HTMLElement, editor: IStandaloneEditor): void;
export declare function preventTypeInDelimiter(node: HTMLElement, editor: IEditor): void;
/**
* @internal
*/
export declare function handleDelimiterContentChangedEvent(editor: IStandaloneEditor): void;
export declare function handleDelimiterContentChangedEvent(editor: IEditor): void;
/**
* @internal
*/
export declare function handleCompositionEndEvent(editor: IStandaloneEditor, event: CompositionEndEvent): void;
export declare function handleCompositionEndEvent(editor: IEditor, event: CompositionEndEvent): void;
/**
* @internal
*/
export declare function handleDelimiterKeyDownEvent(editor: IStandaloneEditor, event: KeyDownEvent): void;
export declare function handleDelimiterKeyDownEvent(editor: IEditor, event: KeyDownEvent): void;
/**

@@ -19,0 +19,0 @@ * @internal Exported Only for unit test

@@ -50,3 +50,4 @@ "use strict";

!snapshot.entityStates;
if (this.snapshots.currentIndex < 0 || !currentSnapshot || !isSameSnapshot) {
var addSnapshot = !currentSnapshot || shouldAddSnapshot(currentSnapshot, snapshot);
if (this.snapshots.currentIndex < 0 || addSnapshot) {
this.clearRedo();

@@ -111,2 +112,9 @@ this.snapshots.snapshots.push(snapshot);

exports.createSnapshotsManager = createSnapshotsManager;
function shouldAddSnapshot(currentSnapshot, snapshot) {
return (currentSnapshot.html !== snapshot.html ||
(currentSnapshot.entityStates &&
snapshot.entityStates &&
currentSnapshot.entityStates !== snapshot.entityStates) ||
(!currentSnapshot.entityStates && snapshot.entityStates));
}
//# sourceMappingURL=SnapshotsManagerImpl.js.map

@@ -19,3 +19,3 @@ export { CachedElementHandler, CloneModelOptions, cloneModel } from './publicApi/model/cloneModel';

export { applyTableFormat } from './publicApi/table/applyTableFormat';
export { normalizeTable } from './publicApi/table/normalizeTable';
export { normalizeTable, MIN_ALLOWED_TABLE_CELL_WIDTH } from './publicApi/table/normalizeTable';
export { setTableCellBackgroundColor } from './publicApi/table/setTableCellBackgroundColor';

@@ -29,2 +29,3 @@ export { getSelectedCells } from './publicApi/table/getSelectedCells';

export { readFile } from './publicApi/domUtils/readFile';
export { cacheGetEventData } from './publicApi/domUtils/cacheGetEventData';
export { undo } from './publicApi/undo/undo';

@@ -42,2 +43,2 @@ export { redo } from './publicApi/undo/redo';

export { TableBorderFormat } from './constants/TableBorderFormat';
export { StandaloneEditor } from './editor/StandaloneEditor';
export { Editor } from './editor/Editor';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableBorderFormat = exports.NumberingListType = exports.BulletListType = exports.ChangeSource = exports.getListStyleTypeFromString = exports.updateListMetadata = exports.updateTableMetadata = exports.updateTableCellMetadata = exports.updateImageMetadata = exports.retrieveModelFormatState = exports.transformColor = exports.redo = exports.undo = exports.readFile = exports.getSegmentTextFormat = exports.createTableRanges = exports.parseTableCells = exports.normalizeText = exports.isSpace = exports.isPunctuation = exports.extractBorderValues = exports.combineBorderValue = exports.isModifierKey = exports.isCharacterValue = exports.getSelectedCells = exports.setTableCellBackgroundColor = exports.normalizeTable = exports.applyTableFormat = exports.setSelection = exports.getSelectedSegmentsAndParagraphs = exports.getSelectedSegments = exports.getSelectedParagraphs = exports.getOperationalBlocks = exports.getFirstSelectedTable = exports.getFirstSelectedListItem = exports.hasSelectionInBlockGroup = exports.hasSelectionInSegment = exports.hasSelectionInBlock = exports.deleteBlock = exports.deleteSegment = exports.deleteSelection = exports.getSelectionRootNode = exports.iterateSelections = exports.exportContent = exports.createModelFromHtml = exports.isBold = exports.getClosestAncestorBlockGroupIndex = exports.isBlockGroupOfType = exports.mergeModel = exports.cloneModel = void 0;
exports.StandaloneEditor = void 0;
exports.BulletListType = exports.ChangeSource = exports.getListStyleTypeFromString = exports.updateListMetadata = exports.updateTableMetadata = exports.updateTableCellMetadata = exports.updateImageMetadata = exports.retrieveModelFormatState = exports.transformColor = exports.redo = exports.undo = exports.cacheGetEventData = exports.readFile = exports.getSegmentTextFormat = exports.createTableRanges = exports.parseTableCells = exports.normalizeText = exports.isSpace = exports.isPunctuation = exports.extractBorderValues = exports.combineBorderValue = exports.isModifierKey = exports.isCharacterValue = exports.getSelectedCells = exports.setTableCellBackgroundColor = exports.MIN_ALLOWED_TABLE_CELL_WIDTH = exports.normalizeTable = exports.applyTableFormat = exports.setSelection = exports.getSelectedSegmentsAndParagraphs = exports.getSelectedSegments = exports.getSelectedParagraphs = exports.getOperationalBlocks = exports.getFirstSelectedTable = exports.getFirstSelectedListItem = exports.hasSelectionInBlockGroup = exports.hasSelectionInSegment = exports.hasSelectionInBlock = exports.deleteBlock = exports.deleteSegment = exports.deleteSelection = exports.getSelectionRootNode = exports.iterateSelections = exports.exportContent = exports.createModelFromHtml = exports.isBold = exports.getClosestAncestorBlockGroupIndex = exports.isBlockGroupOfType = exports.mergeModel = exports.cloneModel = void 0;
exports.Editor = exports.TableBorderFormat = exports.NumberingListType = void 0;
var cloneModel_1 = require("./publicApi/model/cloneModel");

@@ -48,2 +48,3 @@ Object.defineProperty(exports, "cloneModel", { enumerable: true, get: function () { return cloneModel_1.cloneModel; } });

Object.defineProperty(exports, "normalizeTable", { enumerable: true, get: function () { return normalizeTable_1.normalizeTable; } });
Object.defineProperty(exports, "MIN_ALLOWED_TABLE_CELL_WIDTH", { enumerable: true, get: function () { return normalizeTable_1.MIN_ALLOWED_TABLE_CELL_WIDTH; } });
var setTableCellBackgroundColor_1 = require("./publicApi/table/setTableCellBackgroundColor");

@@ -70,2 +71,4 @@ Object.defineProperty(exports, "setTableCellBackgroundColor", { enumerable: true, get: function () { return setTableCellBackgroundColor_1.setTableCellBackgroundColor; } });

Object.defineProperty(exports, "readFile", { enumerable: true, get: function () { return readFile_1.readFile; } });
var cacheGetEventData_1 = require("./publicApi/domUtils/cacheGetEventData");
Object.defineProperty(exports, "cacheGetEventData", { enumerable: true, get: function () { return cacheGetEventData_1.cacheGetEventData; } });
var undo_1 = require("./publicApi/undo/undo");

@@ -96,4 +99,4 @@ Object.defineProperty(exports, "undo", { enumerable: true, get: function () { return undo_1.undo; } });

Object.defineProperty(exports, "TableBorderFormat", { enumerable: true, get: function () { return TableBorderFormat_1.TableBorderFormat; } });
var StandaloneEditor_1 = require("./editor/StandaloneEditor");
Object.defineProperty(exports, "StandaloneEditor", { enumerable: true, get: function () { return StandaloneEditor_1.StandaloneEditor; } });
var Editor_1 = require("./editor/Editor");
Object.defineProperty(exports, "Editor", { enumerable: true, get: function () { return Editor_1.Editor; } });
//# sourceMappingURL=index.js.map

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

import type { ExportContentMode, IStandaloneEditor, ModelToDomOption } from 'roosterjs-content-model-types';
import type { ExportContentMode, IEditor, ModelToDomOption } from 'roosterjs-content-model-types';
/**

@@ -11,2 +11,2 @@ * Export string content of editor

*/
export declare function exportContent(editor: IStandaloneEditor, mode?: ExportContentMode, options?: ModelToDomOption): string;
export declare function exportContent(editor: IEditor, mode?: ExportContentMode, options?: ModelToDomOption): string;

@@ -215,2 +215,3 @@ "use strict";

var _a;
mergeBlockFormat(applyDefaultFormatOption, block);
switch (block.blockType) {

@@ -245,2 +246,7 @@ case 'BlockGroup':

}
function mergeBlockFormat(applyDefaultFormatOption, block) {
if (applyDefaultFormatOption == 'keepSourceEmphasisFormat' && block.format.backgroundColor) {
delete block.format.backgroundColor;
}
}
function mergeSegmentFormat(applyDefaultFormatOption, targetformat, sourceFormat) {

@@ -247,0 +253,0 @@ return applyDefaultFormatOption == 'mergeAll'

@@ -14,3 +14,2 @@ "use strict";

function deleteBlock(blocks, blockToDelete, replacement, context, direction) {
var _a;
var index = blocks.indexOf(blockToDelete);

@@ -31,4 +30,2 @@ switch (blockToDelete.blockType) {

if (operation !== undefined) {
var wrapper = blockToDelete.wrapper;
(_a = wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(wrapper);
replacement ? blocks.splice(index, 1, replacement) : blocks.splice(index, 1);

@@ -35,0 +32,0 @@ context === null || context === void 0 ? void 0 : context.deletedEntities.push({

@@ -16,3 +16,2 @@ "use strict";

function deleteSegment(paragraph, segmentToDelete, context, direction) {
var _a;
var segments = paragraph.segments;

@@ -41,4 +40,2 @@ var index = segments.indexOf(segmentToDelete);

if (operation !== undefined) {
var wrapper = segmentToDelete.wrapper;
(_a = wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(wrapper);
segments.splice(index, 1);

@@ -45,0 +42,0 @@ context === null || context === void 0 ? void 0 : context.deletedEntities.push({

import type { ContentModelSegmentFormat, ContentModelTable } from 'roosterjs-content-model-types';
/**
* Minimum width for a table cell
*/
export declare const MIN_ALLOWED_TABLE_CELL_WIDTH: number;
/**
* Normalize a Content Model table, make sure:

@@ -4,0 +8,0 @@ * 1. Fist cells are not spanned

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeTable = void 0;
exports.normalizeTable = exports.MIN_ALLOWED_TABLE_CELL_WIDTH = void 0;
var tslib_1 = require("tslib");
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
/**
* Minimum width for a table cell
*/
exports.MIN_ALLOWED_TABLE_CELL_WIDTH = 30;
var MIN_HEIGHT = 22;

@@ -59,2 +63,5 @@ /**

}
else if (table.widths[i] < exports.MIN_ALLOWED_TABLE_CELL_WIDTH) {
table.widths[i] = exports.MIN_ALLOWED_TABLE_CELL_WIDTH;
}
}

@@ -61,0 +68,0 @@ // Move blocks from spanned cell to its main cell if any,

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

import type { IStandaloneEditor } from 'roosterjs-content-model-types';
import type { IEditor } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * Redo to next undo snapshot

*/
export declare function redo(editor: IStandaloneEditor): void;
export declare function redo(editor: IEditor): void;

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

import type { IStandaloneEditor } from 'roosterjs-content-model-types';
import type { IEditor } from 'roosterjs-content-model-types';
/**

@@ -6,2 +6,2 @@ * Undo to last undo snapshot

*/
export declare function undo(editor: IStandaloneEditor): void;
export declare function undo(editor: IEditor): void;

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

import type { SnapshotSelection, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { SnapshotSelection, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function createSnapshotSelection(core: StandaloneEditorCore): SnapshotSelection;
export declare function createSnapshotSelection(core: EditorCore): SnapshotSelection;

@@ -9,3 +9,3 @@ "use strict";

function createSnapshotSelection(core) {
var contentDiv = core.contentDiv, api = core.api;
var physicalRoot = core.physicalRoot, api = core.api;
var selection = api.getDOMSelection(core);

@@ -15,8 +15,8 @@ // Normalize tables to ensure they have TBODY element between TABLE and TR so that the selection path will include correct values

var _a = selection.range, startContainer = _a.startContainer, startOffset = _a.startOffset, endContainer = _a.endContainer, endOffset = _a.endOffset;
var isDOMChanged = normalizeTableTree(startContainer, contentDiv);
var isDOMChanged = normalizeTableTree(startContainer, physicalRoot);
if (endContainer != startContainer) {
isDOMChanged = normalizeTableTree(endContainer, contentDiv) || isDOMChanged;
isDOMChanged = normalizeTableTree(endContainer, physicalRoot) || isDOMChanged;
}
if (isDOMChanged) {
var newRange = contentDiv.ownerDocument.createRange();
var newRange = physicalRoot.ownerDocument.createRange();
newRange.setStart(startContainer, startOffset);

@@ -50,4 +50,4 @@ newRange.setEnd(endContainer, endOffset);

type: 'range',
start: getPath(range.startContainer, range.startOffset, contentDiv),
end: getPath(range.endContainer, range.endOffset, contentDiv),
start: getPath(range.startContainer, range.startOffset, physicalRoot),
end: getPath(range.endContainer, range.endOffset, physicalRoot),
isReverted: !!selection.isReverted,

@@ -54,0 +54,0 @@ };

import type { HtmlFromClipboard } from './retrieveHtmlInfo';
import type { BeforePasteEvent, ClipboardData, PasteType, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { BeforePasteEvent, ClipboardData, PasteType, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function generatePasteOptionFromPlugins(core: StandaloneEditorCore, clipboardData: ClipboardData, fragment: DocumentFragment, htmlFromClipboard: HtmlFromClipboard, pasteType: PasteType): BeforePasteEvent;
export declare function generatePasteOptionFromPlugins(core: EditorCore, clipboardData: ClipboardData, fragment: DocumentFragment, htmlFromClipboard: HtmlFromClipboard, pasteType: PasteType): BeforePasteEvent;

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

import type { BeforePasteEvent, ClipboardData, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { BeforePasteEvent, ClipboardData, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function mergePasteContent(core: StandaloneEditorCore, eventResult: BeforePasteEvent, clipboardData: ClipboardData): void;
export declare function mergePasteContent(core: EditorCore, eventResult: BeforePasteEvent, clipboardData: ClipboardData): void;

@@ -31,3 +31,3 @@ "use strict";

var selectedSegment = (0, collectSelections_1.getSelectedSegments)(model, true /*includeFormatHolder*/)[0];
var domToModelContext = (0, createDomToModelContextForSanitizing_1.createDomToModelContextForSanitizing)(core.contentDiv.ownerDocument, undefined /*defaultFormat*/, core.domToModelSettings.customized, domToModelOption);
var domToModelContext = (0, createDomToModelContextForSanitizing_1.createDomToModelContextForSanitizing)(core.physicalRoot.ownerDocument, undefined /*defaultFormat*/, core.domToModelSettings.customized, domToModelOption);
domToModelContext.segmentFormat = selectedSegment

@@ -34,0 +34,0 @@ ? (0, getSegmentTextFormat_1.getSegmentTextFormat)(selectedSegment)

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

import type { StandaloneEditorCore, Snapshot } from 'roosterjs-content-model-types';
import type { EditorCore, Snapshot } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotColors(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotColors(core: EditorCore, snapshot: Snapshot): void;

@@ -12,3 +12,3 @@ "use strict";

if (!!snapshot.isDarkMode != !!isDarkMode) {
(0, transformColor_1.transformColor)(core.contentDiv, false /*includeSelf*/, isDarkMode ? 'lightToDark' : 'darkToLight', core.darkColorHandler);
(0, transformColor_1.transformColor)(core.physicalRoot, false /*includeSelf*/, isDarkMode ? 'lightToDark' : 'darkToLight', core.darkColorHandler);
}

@@ -15,0 +15,0 @@ }

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

import type { Snapshot, StandaloneEditorCore } from 'roosterjs-content-model-types';
import type { Snapshot, EditorCore } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotHTML(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotHTML(core: EditorCore, snapshot: Snapshot): void;

@@ -11,4 +11,4 @@ "use strict";

var _a, _b, _c;
var contentDiv = core.contentDiv, entityMap = core.entity.entityMap;
var refNode = contentDiv.firstChild;
var physicalRoot = core.physicalRoot, entityMap = core.entity.entityMap;
var refNode = physicalRoot.firstChild;
var body = new DOMParser().parseFromString((_b = (_a = core.trustedHTMLHandler) === null || _a === void 0 ? void 0 : _a.call(core, snapshot.html)) !== null && _b !== void 0 ? _b : snapshot.html, 'text/html').body;

@@ -19,6 +19,6 @@ for (var currentNode = body.firstChild; currentNode;) {

if (originalEntityElement) {
refNode = (0, roosterjs_content_model_dom_1.reuseCachedElement)(contentDiv, originalEntityElement, refNode);
refNode = (0, roosterjs_content_model_dom_1.reuseCachedElement)(physicalRoot, originalEntityElement, refNode);
}
else {
contentDiv.insertBefore(currentNode, refNode);
physicalRoot.insertBefore(currentNode, refNode);
if ((0, roosterjs_content_model_dom_1.isNodeOfType)(currentNode, 'ELEMENT_NODE')) {

@@ -35,3 +35,3 @@ var childEntities = (0, roosterjs_content_model_dom_1.getAllEntityWrappers)(currentNode);

var markerNode = wrapper.cloneNode();
contentDiv.insertBefore(markerNode, refNode);
physicalRoot.insertBefore(markerNode, refNode);
refNode = markerNode;

@@ -58,7 +58,4 @@ }

if ((0, roosterjs_content_model_dom_1.isEntityElement)(node)) {
var format_1 = {};
node.classList.forEach(function (name) {
(0, roosterjs_content_model_dom_1.parseEntityClassName)(name, format_1);
});
result = (format_1.id && ((_a = entityMap[format_1.id]) === null || _a === void 0 ? void 0 : _a.element)) || null;
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(node);
result = (format.id && ((_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element)) || null;
}

@@ -76,11 +73,13 @@ else if (isBlockEntityContainer(node)) {

var _a;
var format = {};
element.childNodes.forEach(function (node) {
for (var node = element.firstChild; node; node = node.nextSibling) {
if ((0, roosterjs_content_model_dom_1.isEntityElement)(node) && (0, roosterjs_content_model_dom_1.isNodeOfType)(node, 'ELEMENT_NODE')) {
node.classList.forEach(function (name) { return (0, roosterjs_content_model_dom_1.parseEntityClassName)(name, format); });
var format = (0, roosterjs_content_model_dom_1.parseEntityFormat)(node);
var parent_1 = format.id ? (_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element.parentElement : null;
return (0, roosterjs_content_model_dom_1.isNodeOfType)(parent_1, 'ELEMENT_NODE') && isBlockEntityContainer(parent_1)
? parent_1
: null;
}
});
var parent = format.id ? (_a = entityMap[format.id]) === null || _a === void 0 ? void 0 : _a.element.parentElement : null;
return (0, roosterjs_content_model_dom_1.isNodeOfType)(parent, 'ELEMENT_NODE') && isBlockEntityContainer(parent) ? parent : null;
}
return null;
}
//# sourceMappingURL=restoreSnapshotHTML.js.map

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

import type { StandaloneEditorCore, Snapshot } from 'roosterjs-content-model-types';
import type { EditorCore, Snapshot } from 'roosterjs-content-model-types';
/**
* @internal
*/
export declare function restoreSnapshotSelection(core: StandaloneEditorCore, snapshot: Snapshot): void;
export declare function restoreSnapshotSelection(core: EditorCore, snapshot: Snapshot): void;

@@ -10,3 +10,3 @@ "use strict";

var snapshotSelection = snapshot.selection;
var contentDiv = core.contentDiv;
var physicalRoot = core.physicalRoot;
var domSelection = null;

@@ -16,5 +16,5 @@ if (snapshotSelection) {

case 'range':
var startPos = getPositionFromPath(contentDiv, snapshotSelection.start);
var endPos = getPositionFromPath(contentDiv, snapshotSelection.end);
var range = contentDiv.ownerDocument.createRange();
var startPos = getPositionFromPath(physicalRoot, snapshotSelection.start);
var endPos = getPositionFromPath(physicalRoot, snapshotSelection.end);
var range = physicalRoot.ownerDocument.createRange();
range.setStart(startPos.node, startPos.offset);

@@ -29,3 +29,3 @@ range.setEnd(endPos.node, endPos.offset);

case 'table':
var table = contentDiv.querySelector('#' + snapshotSelection.tableId);
var table = physicalRoot.querySelector('#' + snapshotSelection.tableId);
if (table) {

@@ -43,3 +43,3 @@ domSelection = {

case 'image':
var image = contentDiv.querySelector('#' + snapshotSelection.imageId);
var image = physicalRoot.querySelector('#' + snapshotSelection.imageId);
if (image) {

@@ -46,0 +46,0 @@ domSelection = {

@@ -273,3 +273,3 @@ "use strict";

var newChild = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE')
? sanitizeElement(child, allowedTags, disallowedTags, styleSanitizers)
? sanitizeElement(child, allowedTags, disallowedTags, styleSanitizers, attributeSanitizers)
: (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'TEXT_NODE')

@@ -276,0 +276,0 @@ ? child.cloneNode()

@@ -6,6 +6,6 @@ {

"tslib": "^2.3.1",
"roosterjs-content-model-dom": "^0.26.4",
"roosterjs-content-model-types": "^0.26.4"
"roosterjs-content-model-dom": "^0.27.0",
"roosterjs-content-model-types": "^0.27.0"
},
"version": "0.26.4",
"version": "0.27.0",
"main": "./lib/index.js",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc