roosterjs-content-model-types 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/editor/IStandaloneEditor.d.ts +99 -0
- package/lib/editor/IStandaloneEditor.js +3 -0
- package/lib/editor/IStandaloneEditor.js.map +1 -0
- package/lib/editor/StandaloneEditorCore.d.ts +137 -0
- package/lib/editor/StandaloneEditorCore.js +3 -0
- package/lib/editor/StandaloneEditorCore.js.map +1 -0
- package/lib/editor/StandaloneEditorOptions.d.ts +19 -0
- package/lib/editor/StandaloneEditorOptions.js +3 -0
- package/lib/editor/StandaloneEditorOptions.js.map +1 -0
- package/lib/enum/BorderOperations.d.ts +36 -0
- package/lib/enum/BorderOperations.js +3 -0
- package/lib/enum/BorderOperations.js.map +1 -0
- package/lib/enum/DeleteResult.d.ts +20 -0
- package/lib/enum/DeleteResult.js +3 -0
- package/lib/enum/DeleteResult.js.map +1 -0
- package/lib/enum/EntityOperation.d.ts +47 -0
- package/lib/enum/EntityOperation.js +3 -0
- package/lib/enum/EntityOperation.js.map +1 -0
- package/lib/enum/InsertEntityPosition.d.ts +8 -0
- package/lib/enum/InsertEntityPosition.js +3 -0
- package/lib/enum/InsertEntityPosition.js.map +1 -0
- package/lib/enum/PasteType.d.ts +20 -0
- package/lib/enum/PasteType.js +3 -0
- package/lib/enum/PasteType.js.map +1 -0
- package/lib/enum/TableOperation.d.ts +136 -0
- package/lib/enum/TableOperation.js +3 -0
- package/lib/enum/TableOperation.js.map +1 -0
- package/lib/event/ContentModelBeforePasteEvent.d.ts +27 -0
- package/lib/event/ContentModelBeforePasteEvent.js +3 -0
- package/lib/event/ContentModelBeforePasteEvent.js.map +1 -0
- package/lib/event/ContentModelContentChangedEvent.d.ts +26 -0
- package/lib/event/ContentModelContentChangedEvent.js +3 -0
- package/lib/event/ContentModelContentChangedEvent.js.map +1 -0
- package/lib/format/formatParts/MarginFormat.d.ts +8 -0
- package/lib/format/formatParts/MarginFormat.js.map +1 -1
- package/lib/index.d.ts +24 -0
- package/lib/index.js.map +1 -1
- package/lib/parameter/Border.d.ts +18 -0
- package/lib/parameter/Border.js +3 -0
- package/lib/parameter/Border.js.map +1 -0
- package/lib/parameter/ContentModelFormatState.d.ts +147 -0
- package/lib/parameter/ContentModelFormatState.js +3 -0
- package/lib/parameter/ContentModelFormatState.js.map +1 -0
- package/lib/parameter/DeleteSelectionStep.d.ts +49 -0
- package/lib/parameter/DeleteSelectionStep.js +3 -0
- package/lib/parameter/DeleteSelectionStep.js.map +1 -0
- package/lib/parameter/EditorEnvironment.d.ts +13 -0
- package/lib/parameter/EditorEnvironment.js +3 -0
- package/lib/parameter/EditorEnvironment.js.map +1 -0
- package/lib/parameter/FormatWithContentModelContext.d.ts +57 -0
- package/lib/parameter/FormatWithContentModelContext.js +3 -0
- package/lib/parameter/FormatWithContentModelContext.js.map +1 -0
- package/lib/parameter/FormatWithContentModelOptions.d.ts +42 -0
- package/lib/parameter/FormatWithContentModelOptions.js +3 -0
- package/lib/parameter/FormatWithContentModelOptions.js.map +1 -0
- package/lib/parameter/ImageFormatState.d.ts +25 -0
- package/lib/parameter/ImageFormatState.js +3 -0
- package/lib/parameter/ImageFormatState.js.map +1 -0
- package/lib/parameter/InsertEntityOptions.d.ts +21 -0
- package/lib/parameter/InsertEntityOptions.js +3 -0
- package/lib/parameter/InsertEntityOptions.js.map +1 -0
- package/lib/pluginState/ContentModelCachePluginState.d.ts +20 -0
- package/lib/pluginState/ContentModelCachePluginState.js +3 -0
- package/lib/pluginState/ContentModelCachePluginState.js.map +1 -0
- package/lib/pluginState/ContentModelFormatPluginState.d.ts +31 -0
- package/lib/pluginState/ContentModelFormatPluginState.js +3 -0
- package/lib/pluginState/ContentModelFormatPluginState.js.map +1 -0
- package/lib/pluginState/ContentModelPluginState.d.ts +21 -0
- package/lib/pluginState/ContentModelPluginState.js +3 -0
- package/lib/pluginState/ContentModelPluginState.js.map +1 -0
- package/lib/selection/InsertPoint.d.ts +25 -0
- package/lib/selection/InsertPoint.js +3 -0
- package/lib/selection/InsertPoint.js.map +1 -0
- package/lib/selection/TableSelectionContext.d.ts +22 -0
- package/lib/selection/TableSelectionContext.js +3 -0
- package/lib/selection/TableSelectionContext.js.map +1 -0
- package/lib-amd/editor/IStandaloneEditor.d.ts +99 -0
- package/lib-amd/editor/IStandaloneEditor.js +5 -0
- package/lib-amd/editor/IStandaloneEditor.js.map +1 -0
- package/lib-amd/editor/StandaloneEditorCore.d.ts +137 -0
- package/lib-amd/editor/StandaloneEditorCore.js +5 -0
- package/lib-amd/editor/StandaloneEditorCore.js.map +1 -0
- package/lib-amd/editor/StandaloneEditorOptions.d.ts +19 -0
- package/lib-amd/editor/StandaloneEditorOptions.js +5 -0
- package/lib-amd/editor/StandaloneEditorOptions.js.map +1 -0
- package/lib-amd/enum/BorderOperations.d.ts +36 -0
- package/lib-amd/enum/BorderOperations.js +5 -0
- package/lib-amd/enum/BorderOperations.js.map +1 -0
- package/lib-amd/enum/DeleteResult.d.ts +20 -0
- package/lib-amd/enum/DeleteResult.js +5 -0
- package/lib-amd/enum/DeleteResult.js.map +1 -0
- package/lib-amd/enum/EntityOperation.d.ts +47 -0
- package/lib-amd/enum/EntityOperation.js +5 -0
- package/lib-amd/enum/EntityOperation.js.map +1 -0
- package/lib-amd/enum/InsertEntityPosition.d.ts +8 -0
- package/lib-amd/enum/InsertEntityPosition.js +5 -0
- package/lib-amd/enum/InsertEntityPosition.js.map +1 -0
- package/lib-amd/enum/PasteType.d.ts +20 -0
- package/lib-amd/enum/PasteType.js +5 -0
- package/lib-amd/enum/PasteType.js.map +1 -0
- package/lib-amd/enum/TableOperation.d.ts +136 -0
- package/lib-amd/enum/TableOperation.js +5 -0
- package/lib-amd/enum/TableOperation.js.map +1 -0
- package/lib-amd/event/ContentModelBeforePasteEvent.d.ts +27 -0
- package/lib-amd/event/ContentModelBeforePasteEvent.js +5 -0
- package/lib-amd/event/ContentModelBeforePasteEvent.js.map +1 -0
- package/lib-amd/event/ContentModelContentChangedEvent.d.ts +26 -0
- package/lib-amd/event/ContentModelContentChangedEvent.js +5 -0
- package/lib-amd/event/ContentModelContentChangedEvent.js.map +1 -0
- package/lib-amd/format/formatParts/MarginFormat.d.ts +8 -0
- package/lib-amd/format/formatParts/MarginFormat.js.map +1 -1
- package/lib-amd/index.d.ts +24 -0
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/parameter/Border.d.ts +18 -0
- package/lib-amd/parameter/Border.js +5 -0
- package/lib-amd/parameter/Border.js.map +1 -0
- package/lib-amd/parameter/ContentModelFormatState.d.ts +147 -0
- package/lib-amd/parameter/ContentModelFormatState.js +5 -0
- package/lib-amd/parameter/ContentModelFormatState.js.map +1 -0
- package/lib-amd/parameter/DeleteSelectionStep.d.ts +49 -0
- package/lib-amd/parameter/DeleteSelectionStep.js +5 -0
- package/lib-amd/parameter/DeleteSelectionStep.js.map +1 -0
- package/lib-amd/parameter/EditorEnvironment.d.ts +13 -0
- package/lib-amd/parameter/EditorEnvironment.js +5 -0
- package/lib-amd/parameter/EditorEnvironment.js.map +1 -0
- package/lib-amd/parameter/FormatWithContentModelContext.d.ts +57 -0
- package/lib-amd/parameter/FormatWithContentModelContext.js +5 -0
- package/lib-amd/parameter/FormatWithContentModelContext.js.map +1 -0
- package/lib-amd/parameter/FormatWithContentModelOptions.d.ts +42 -0
- package/lib-amd/parameter/FormatWithContentModelOptions.js +5 -0
- package/lib-amd/parameter/FormatWithContentModelOptions.js.map +1 -0
- package/lib-amd/parameter/ImageFormatState.d.ts +25 -0
- package/lib-amd/parameter/ImageFormatState.js +5 -0
- package/lib-amd/parameter/ImageFormatState.js.map +1 -0
- package/lib-amd/parameter/InsertEntityOptions.d.ts +21 -0
- package/lib-amd/parameter/InsertEntityOptions.js +5 -0
- package/lib-amd/parameter/InsertEntityOptions.js.map +1 -0
- package/lib-amd/pluginState/ContentModelCachePluginState.d.ts +20 -0
- package/lib-amd/pluginState/ContentModelCachePluginState.js +5 -0
- package/lib-amd/pluginState/ContentModelCachePluginState.js.map +1 -0
- package/lib-amd/pluginState/ContentModelFormatPluginState.d.ts +31 -0
- package/lib-amd/pluginState/ContentModelFormatPluginState.js +5 -0
- package/lib-amd/pluginState/ContentModelFormatPluginState.js.map +1 -0
- package/lib-amd/pluginState/ContentModelPluginState.d.ts +21 -0
- package/lib-amd/pluginState/ContentModelPluginState.js +5 -0
- package/lib-amd/pluginState/ContentModelPluginState.js.map +1 -0
- package/lib-amd/selection/InsertPoint.d.ts +25 -0
- package/lib-amd/selection/InsertPoint.js +5 -0
- package/lib-amd/selection/InsertPoint.js.map +1 -0
- package/lib-amd/selection/TableSelectionContext.d.ts +22 -0
- package/lib-amd/selection/TableSelectionContext.js +5 -0
- package/lib-amd/selection/TableSelectionContext.js.map +1 -0
- package/lib-mjs/editor/IStandaloneEditor.d.ts +99 -0
- package/lib-mjs/editor/IStandaloneEditor.js +2 -0
- package/lib-mjs/editor/IStandaloneEditor.js.map +1 -0
- package/lib-mjs/editor/StandaloneEditorCore.d.ts +137 -0
- package/lib-mjs/editor/StandaloneEditorCore.js +2 -0
- package/lib-mjs/editor/StandaloneEditorCore.js.map +1 -0
- package/lib-mjs/editor/StandaloneEditorOptions.d.ts +19 -0
- package/lib-mjs/editor/StandaloneEditorOptions.js +2 -0
- package/lib-mjs/editor/StandaloneEditorOptions.js.map +1 -0
- package/lib-mjs/enum/BorderOperations.d.ts +36 -0
- package/lib-mjs/enum/BorderOperations.js +2 -0
- package/lib-mjs/enum/BorderOperations.js.map +1 -0
- package/lib-mjs/enum/DeleteResult.d.ts +20 -0
- package/lib-mjs/enum/DeleteResult.js +2 -0
- package/lib-mjs/enum/DeleteResult.js.map +1 -0
- package/lib-mjs/enum/EntityOperation.d.ts +47 -0
- package/lib-mjs/enum/EntityOperation.js +2 -0
- package/lib-mjs/enum/EntityOperation.js.map +1 -0
- package/lib-mjs/enum/InsertEntityPosition.d.ts +8 -0
- package/lib-mjs/enum/InsertEntityPosition.js +2 -0
- package/lib-mjs/enum/InsertEntityPosition.js.map +1 -0
- package/lib-mjs/enum/PasteType.d.ts +20 -0
- package/lib-mjs/enum/PasteType.js +2 -0
- package/lib-mjs/enum/PasteType.js.map +1 -0
- package/lib-mjs/enum/TableOperation.d.ts +136 -0
- package/lib-mjs/enum/TableOperation.js +2 -0
- package/lib-mjs/enum/TableOperation.js.map +1 -0
- package/lib-mjs/event/ContentModelBeforePasteEvent.d.ts +27 -0
- package/lib-mjs/event/ContentModelBeforePasteEvent.js +2 -0
- package/lib-mjs/event/ContentModelBeforePasteEvent.js.map +1 -0
- package/lib-mjs/event/ContentModelContentChangedEvent.d.ts +26 -0
- package/lib-mjs/event/ContentModelContentChangedEvent.js +2 -0
- package/lib-mjs/event/ContentModelContentChangedEvent.js.map +1 -0
- package/lib-mjs/format/formatParts/MarginFormat.d.ts +8 -0
- package/lib-mjs/format/formatParts/MarginFormat.js.map +1 -1
- package/lib-mjs/index.d.ts +24 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/parameter/Border.d.ts +18 -0
- package/lib-mjs/parameter/Border.js +2 -0
- package/lib-mjs/parameter/Border.js.map +1 -0
- package/lib-mjs/parameter/ContentModelFormatState.d.ts +147 -0
- package/lib-mjs/parameter/ContentModelFormatState.js +2 -0
- package/lib-mjs/parameter/ContentModelFormatState.js.map +1 -0
- package/lib-mjs/parameter/DeleteSelectionStep.d.ts +49 -0
- package/lib-mjs/parameter/DeleteSelectionStep.js +2 -0
- package/lib-mjs/parameter/DeleteSelectionStep.js.map +1 -0
- package/lib-mjs/parameter/EditorEnvironment.d.ts +13 -0
- package/lib-mjs/parameter/EditorEnvironment.js +2 -0
- package/lib-mjs/parameter/EditorEnvironment.js.map +1 -0
- package/lib-mjs/parameter/FormatWithContentModelContext.d.ts +57 -0
- package/lib-mjs/parameter/FormatWithContentModelContext.js +2 -0
- package/lib-mjs/parameter/FormatWithContentModelContext.js.map +1 -0
- package/lib-mjs/parameter/FormatWithContentModelOptions.d.ts +42 -0
- package/lib-mjs/parameter/FormatWithContentModelOptions.js +2 -0
- package/lib-mjs/parameter/FormatWithContentModelOptions.js.map +1 -0
- package/lib-mjs/parameter/ImageFormatState.d.ts +25 -0
- package/lib-mjs/parameter/ImageFormatState.js +2 -0
- package/lib-mjs/parameter/ImageFormatState.js.map +1 -0
- package/lib-mjs/parameter/InsertEntityOptions.d.ts +21 -0
- package/lib-mjs/parameter/InsertEntityOptions.js +2 -0
- package/lib-mjs/parameter/InsertEntityOptions.js.map +1 -0
- package/lib-mjs/pluginState/ContentModelCachePluginState.d.ts +20 -0
- package/lib-mjs/pluginState/ContentModelCachePluginState.js +2 -0
- package/lib-mjs/pluginState/ContentModelCachePluginState.js.map +1 -0
- package/lib-mjs/pluginState/ContentModelFormatPluginState.d.ts +31 -0
- package/lib-mjs/pluginState/ContentModelFormatPluginState.js +2 -0
- package/lib-mjs/pluginState/ContentModelFormatPluginState.js.map +1 -0
- package/lib-mjs/pluginState/ContentModelPluginState.d.ts +21 -0
- package/lib-mjs/pluginState/ContentModelPluginState.js +2 -0
- package/lib-mjs/pluginState/ContentModelPluginState.js.map +1 -0
- package/lib-mjs/selection/InsertPoint.d.ts +25 -0
- package/lib-mjs/selection/InsertPoint.js +2 -0
- package/lib-mjs/selection/InsertPoint.js.map +1 -0
- package/lib-mjs/selection/TableSelectionContext.d.ts +22 -0
- package/lib-mjs/selection/TableSelectionContext.js +2 -0
- package/lib-mjs/selection/TableSelectionContext.js.map +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';
|
|
2
|
+
import type { ContentModelDocument } from '../group/ContentModelDocument';
|
|
3
|
+
import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';
|
|
4
|
+
import type { DOMSelection } from '../selection/DOMSelection';
|
|
5
|
+
import type { DomToModelOption } from '../context/DomToModelOption';
|
|
6
|
+
import type { EditorEnvironment } from '../parameter/EditorEnvironment';
|
|
7
|
+
import type { ModelToDomOption } from '../context/ModelToDomOption';
|
|
8
|
+
import type { OnNodeCreated } from '../context/ModelToDomSettings';
|
|
9
|
+
import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
|
|
10
|
+
import type { EditorUndoState, PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
|
|
11
|
+
/**
|
|
12
|
+
* An interface of standalone Content Model editor.
|
|
13
|
+
* (This interface is still under development, and may still be changed in the future with some breaking changes)
|
|
14
|
+
*/
|
|
15
|
+
export interface IStandaloneEditor {
|
|
16
|
+
/**
|
|
17
|
+
* Create Content Model from DOM tree in this editor
|
|
18
|
+
* @param rootNode Optional start node. If provided, Content Model will be created from this node (including itself),
|
|
19
|
+
* otherwise it will create Content Model for the whole content in editor.
|
|
20
|
+
* @param option The options to customize the behavior of DOM to Content Model conversion
|
|
21
|
+
* @param selectionOverride When specified, use this selection to override existing selection inside editor
|
|
22
|
+
*/
|
|
23
|
+
createContentModel(option?: DomToModelOption, selectionOverride?: DOMSelection): ContentModelDocument;
|
|
24
|
+
/**
|
|
25
|
+
* Set content with content model
|
|
26
|
+
* @param model The content model to set
|
|
27
|
+
* @param option Additional options to customize the behavior of Content Model to DOM conversion
|
|
28
|
+
* @param onNodeCreated An optional callback that will be called when a DOM node is created
|
|
29
|
+
*/
|
|
30
|
+
setContentModel(model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated): DOMSelection | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get current running environment, such as if editor is running on Mac
|
|
33
|
+
*/
|
|
34
|
+
getEnvironment(): EditorEnvironment;
|
|
35
|
+
/**
|
|
36
|
+
* Get current DOM selection.
|
|
37
|
+
* This is the replacement of IEditor.getSelectionRangeEx.
|
|
38
|
+
*/
|
|
39
|
+
getDOMSelection(): DOMSelection | null;
|
|
40
|
+
/**
|
|
41
|
+
* Set DOMSelection into editor content.
|
|
42
|
+
* This is the replacement of IEditor.select.
|
|
43
|
+
* @param selection The selection to set
|
|
44
|
+
*/
|
|
45
|
+
setDOMSelection(selection: DOMSelection): void;
|
|
46
|
+
/**
|
|
47
|
+
* The general API to do format change with Content Model
|
|
48
|
+
* It will grab a Content Model for current editor content, and invoke a callback function
|
|
49
|
+
* to do format change. Then according to the return value, write back the modified content model into editor.
|
|
50
|
+
* If there is cached model, it will be used and updated.
|
|
51
|
+
* @param formatter Formatter function, see ContentModelFormatter
|
|
52
|
+
* @param options More options, see FormatWithContentModelOptions
|
|
53
|
+
*/
|
|
54
|
+
formatContentModel(formatter: ContentModelFormatter, options?: FormatWithContentModelOptions): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get pending format of editor if any, or return null
|
|
57
|
+
*/
|
|
58
|
+
getPendingFormat(): ContentModelSegmentFormat | null;
|
|
59
|
+
/**
|
|
60
|
+
* Get whether this editor is disposed
|
|
61
|
+
* @returns True if editor is disposed, otherwise false
|
|
62
|
+
*/
|
|
63
|
+
isDisposed(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Get document which contains this editor
|
|
66
|
+
* @returns The HTML document which contains this editor
|
|
67
|
+
*/
|
|
68
|
+
getDocument(): Document;
|
|
69
|
+
/**
|
|
70
|
+
* Focus to this editor, the selection was restored to where it was before, no unexpected scroll.
|
|
71
|
+
*/
|
|
72
|
+
focus(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Trigger an event to be dispatched to all plugins
|
|
75
|
+
* @param eventType Type of the event
|
|
76
|
+
* @param data data of the event with given type, this is the rest part of PluginEvent with the given type
|
|
77
|
+
* @param broadcast indicates if the event needs to be dispatched to all plugins
|
|
78
|
+
* True means to all, false means to allow exclusive handling from one plugin unless no one wants that
|
|
79
|
+
* @returns the event object which is really passed into plugins. Some plugin may modify the event object so
|
|
80
|
+
* the result of this function provides a chance to read the modified result
|
|
81
|
+
*/
|
|
82
|
+
triggerPluginEvent<T extends PluginEventType | CompatiblePluginEventType>(eventType: T, data: PluginEventData<T>, broadcast?: boolean): PluginEventFromType<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Whether there is an available undo/redo snapshot
|
|
85
|
+
*/
|
|
86
|
+
getUndoState(): EditorUndoState;
|
|
87
|
+
/**
|
|
88
|
+
* Check if the editor is in dark mode
|
|
89
|
+
* @returns True if the editor is in dark mode, otherwise false
|
|
90
|
+
*/
|
|
91
|
+
isDarkMode(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get current zoom scale, default value is 1
|
|
94
|
+
* When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale
|
|
95
|
+
* to let editor behave correctly especially for those mouse drag/drop behaviors
|
|
96
|
+
* @returns current zoom scale number
|
|
97
|
+
*/
|
|
98
|
+
getZoomScale(): number;
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStandaloneEditor.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/editor/IStandaloneEditor.ts"],"names":[],"mappings":"","sourcesContent":["import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type {\n ContentModelFormatter,\n FormatWithContentModelOptions,\n} from '../parameter/FormatWithContentModelOptions';\nimport type {\n EditorUndoState,\n PluginEventData,\n PluginEventFromType,\n PluginEventType,\n} from 'roosterjs-editor-types';\n\n/**\n * An interface of standalone Content Model editor.\n * (This interface is still under development, and may still be changed in the future with some breaking changes)\n */\nexport interface IStandaloneEditor {\n /**\n * Create Content Model from DOM tree in this editor\n * @param rootNode Optional start node. If provided, Content Model will be created from this node (including itself),\n * otherwise it will create Content Model for the whole content in editor.\n * @param option The options to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When specified, use this selection to override existing selection inside editor\n */\n createContentModel(\n option?: DomToModelOption,\n selectionOverride?: DOMSelection\n ): ContentModelDocument;\n\n /**\n * Set content with content model\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n */\n setContentModel(\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated\n ): DOMSelection | null;\n\n /**\n * Get current running environment, such as if editor is running on Mac\n */\n getEnvironment(): EditorEnvironment;\n\n /**\n * Get current DOM selection.\n * This is the replacement of IEditor.getSelectionRangeEx.\n */\n getDOMSelection(): DOMSelection | null;\n\n /**\n * Set DOMSelection into editor content.\n * This is the replacement of IEditor.select.\n * @param selection The selection to set\n */\n setDOMSelection(selection: DOMSelection): void;\n\n /**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatWithContentModelOptions\n */\n formatContentModel(\n formatter: ContentModelFormatter,\n options?: FormatWithContentModelOptions\n ): void;\n\n /**\n * Get pending format of editor if any, or return null\n */\n getPendingFormat(): ContentModelSegmentFormat | null;\n\n //#region Editor API copied from legacy editor, will be ported to use Content Model instead\n\n /**\n * Get whether this editor is disposed\n * @returns True if editor is disposed, otherwise false\n */\n isDisposed(): boolean;\n\n /**\n * Get document which contains this editor\n * @returns The HTML document which contains this editor\n */\n getDocument(): Document;\n\n /**\n * Focus to this editor, the selection was restored to where it was before, no unexpected scroll.\n */\n focus(): void;\n\n /**\n * Trigger an event to be dispatched to all plugins\n * @param eventType Type of the event\n * @param data data of the event with given type, this is the rest part of PluginEvent with the given type\n * @param broadcast indicates if the event needs to be dispatched to all plugins\n * True means to all, false means to allow exclusive handling from one plugin unless no one wants that\n * @returns the event object which is really passed into plugins. Some plugin may modify the event object so\n * the result of this function provides a chance to read the modified result\n */\n triggerPluginEvent<T extends PluginEventType | CompatiblePluginEventType>(\n eventType: T,\n data: PluginEventData<T>,\n broadcast?: boolean\n ): PluginEventFromType<T>;\n\n /**\n * Whether there is an available undo/redo snapshot\n */\n getUndoState(): EditorUndoState;\n\n /**\n * Check if the editor is in dark mode\n * @returns True if the editor is in dark mode, otherwise false\n */\n isDarkMode(): boolean;\n\n /**\n * Get current zoom scale, default value is 1\n * When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale\n * to let editor behave correctly especially for those mouse drag/drop behaviors\n * @returns current zoom scale number\n */\n getZoomScale(): number;\n\n //#endregion\n}\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { EditorCore, SwitchShadowEdit } from 'roosterjs-editor-types';
|
|
2
|
+
import type { ContentModelDocument } from '../group/ContentModelDocument';
|
|
3
|
+
import type { ContentModelPluginState } from '../pluginState/ContentModelPluginState';
|
|
4
|
+
import type { DOMSelection } from '../selection/DOMSelection';
|
|
5
|
+
import type { DomToModelOption } from '../context/DomToModelOption';
|
|
6
|
+
import type { DomToModelSettings } from '../context/DomToModelSettings';
|
|
7
|
+
import type { EditorContext } from '../context/EditorContext';
|
|
8
|
+
import type { EditorEnvironment } from '../parameter/EditorEnvironment';
|
|
9
|
+
import type { ModelToDomOption } from '../context/ModelToDomOption';
|
|
10
|
+
import type { ModelToDomSettings, OnNodeCreated } from '../context/ModelToDomSettings';
|
|
11
|
+
import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
|
|
12
|
+
/**
|
|
13
|
+
* Create a EditorContext object used by ContentModel API
|
|
14
|
+
* @param core The StandaloneEditorCore object
|
|
15
|
+
*/
|
|
16
|
+
export declare type CreateEditorContext = (core: StandaloneEditorCore & EditorCore) => EditorContext;
|
|
17
|
+
/**
|
|
18
|
+
* Create Content Model from DOM tree in this editor
|
|
19
|
+
* @param core The StandaloneEditorCore object
|
|
20
|
+
* @param option The option to customize the behavior of DOM to Content Model conversion
|
|
21
|
+
* @param selectionOverride When passed, use this selection range instead of current selection in editor
|
|
22
|
+
*/
|
|
23
|
+
export declare type CreateContentModel = (core: StandaloneEditorCore & EditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
|
|
24
|
+
/**
|
|
25
|
+
* Get current DOM selection from editor
|
|
26
|
+
* @param core The StandaloneEditorCore object
|
|
27
|
+
*/
|
|
28
|
+
export declare type GetDOMSelection = (core: StandaloneEditorCore & EditorCore) => DOMSelection | null;
|
|
29
|
+
/**
|
|
30
|
+
* Set content with content model. This is the replacement of core API getSelectionRangeEx
|
|
31
|
+
* @param core The StandaloneEditorCore object
|
|
32
|
+
* @param model The content model to set
|
|
33
|
+
* @param option Additional options to customize the behavior of Content Model to DOM conversion
|
|
34
|
+
* @param onNodeCreated An optional callback that will be called when a DOM node is created
|
|
35
|
+
*/
|
|
36
|
+
export declare type SetContentModel = (core: StandaloneEditorCore & EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
|
|
37
|
+
/**
|
|
38
|
+
* Set current DOM selection from editor. This is the replacement of core API select
|
|
39
|
+
* @param core The StandaloneEditorCore object
|
|
40
|
+
* @param selection The selection to set
|
|
41
|
+
*/
|
|
42
|
+
export declare type SetDOMSelection = (core: StandaloneEditorCore & EditorCore, selection: DOMSelection) => void;
|
|
43
|
+
/**
|
|
44
|
+
* The general API to do format change with Content Model
|
|
45
|
+
* It will grab a Content Model for current editor content, and invoke a callback function
|
|
46
|
+
* to do format change. Then according to the return value, write back the modified content model into editor.
|
|
47
|
+
* If there is cached model, it will be used and updated.
|
|
48
|
+
* @param core The StandaloneEditorCore object
|
|
49
|
+
* @param formatter Formatter function, see ContentModelFormatter
|
|
50
|
+
* @param options More options, see FormatWithContentModelOptions
|
|
51
|
+
*/
|
|
52
|
+
export declare type FormatContentModel = (core: StandaloneEditorCore & EditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
|
|
53
|
+
/**
|
|
54
|
+
* The interface for the map of core API for Content Model editor.
|
|
55
|
+
* Editor can call call API from this map under StandaloneEditorCore object
|
|
56
|
+
*/
|
|
57
|
+
export interface StandaloneCoreApiMap {
|
|
58
|
+
/**
|
|
59
|
+
* Create a EditorContext object used by ContentModel API
|
|
60
|
+
* @param core The StandaloneEditorCore object
|
|
61
|
+
*/
|
|
62
|
+
createEditorContext: CreateEditorContext;
|
|
63
|
+
/**
|
|
64
|
+
* Create Content Model from DOM tree in this editor
|
|
65
|
+
* @param core The StandaloneEditorCore object
|
|
66
|
+
* @param option The option to customize the behavior of DOM to Content Model conversion
|
|
67
|
+
*/
|
|
68
|
+
createContentModel: CreateContentModel;
|
|
69
|
+
/**
|
|
70
|
+
* Get current DOM selection from editor
|
|
71
|
+
* @param core The StandaloneEditorCore object
|
|
72
|
+
*/
|
|
73
|
+
getDOMSelection: GetDOMSelection;
|
|
74
|
+
/**
|
|
75
|
+
* Set content with content model
|
|
76
|
+
* @param core The StandaloneEditorCore object
|
|
77
|
+
* @param model The content model to set
|
|
78
|
+
* @param option Additional options to customize the behavior of Content Model to DOM conversion
|
|
79
|
+
*/
|
|
80
|
+
setContentModel: SetContentModel;
|
|
81
|
+
/**
|
|
82
|
+
* Set current DOM selection from editor. This is the replacement of core API select
|
|
83
|
+
* @param core The StandaloneEditorCore object
|
|
84
|
+
* @param selection The selection to set
|
|
85
|
+
*/
|
|
86
|
+
setDOMSelection: SetDOMSelection;
|
|
87
|
+
/**
|
|
88
|
+
* The general API to do format change with Content Model
|
|
89
|
+
* It will grab a Content Model for current editor content, and invoke a callback function
|
|
90
|
+
* to do format change. Then according to the return value, write back the modified content model into editor.
|
|
91
|
+
* If there is cached model, it will be used and updated.
|
|
92
|
+
* @param core The StandaloneEditorCore object
|
|
93
|
+
* @param formatter Formatter function, see ContentModelFormatter
|
|
94
|
+
* @param options More options, see FormatWithContentModelOptions
|
|
95
|
+
*/
|
|
96
|
+
formatContentModel: FormatContentModel;
|
|
97
|
+
switchShadowEdit: SwitchShadowEdit;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Represents the core data structure of a Content Model editor
|
|
101
|
+
*/
|
|
102
|
+
export interface StandaloneEditorCore extends ContentModelPluginState {
|
|
103
|
+
/**
|
|
104
|
+
* The content DIV element of this editor
|
|
105
|
+
*/
|
|
106
|
+
readonly contentDiv: HTMLDivElement;
|
|
107
|
+
/**
|
|
108
|
+
* Core API map of this editor
|
|
109
|
+
*/
|
|
110
|
+
readonly api: StandaloneCoreApiMap;
|
|
111
|
+
/**
|
|
112
|
+
* Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.
|
|
113
|
+
*/
|
|
114
|
+
readonly originalApi: StandaloneCoreApiMap;
|
|
115
|
+
/**
|
|
116
|
+
* Default DOM to Content Model options
|
|
117
|
+
*/
|
|
118
|
+
defaultDomToModelOptions: (DomToModelOption | undefined)[];
|
|
119
|
+
/**
|
|
120
|
+
* Default Content Model to DOM options
|
|
121
|
+
*/
|
|
122
|
+
defaultModelToDomOptions: (ModelToDomOption | undefined)[];
|
|
123
|
+
/**
|
|
124
|
+
* Default DOM to Content Model config, calculated from defaultDomToModelOptions,
|
|
125
|
+
* will be used for creating content model if there is no other customized options
|
|
126
|
+
*/
|
|
127
|
+
defaultDomToModelConfig: DomToModelSettings;
|
|
128
|
+
/**
|
|
129
|
+
* Default Content Model to DOM config, calculated from defaultModelToDomOptions,
|
|
130
|
+
* will be used for setting content model if there is no other customized options
|
|
131
|
+
*/
|
|
132
|
+
defaultModelToDomConfig: ModelToDomSettings;
|
|
133
|
+
/**
|
|
134
|
+
* Editor running environment
|
|
135
|
+
*/
|
|
136
|
+
environment: EditorEnvironment;
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StandaloneEditorCore.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/editor/StandaloneEditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { EditorCore, SwitchShadowEdit } from 'roosterjs-editor-types';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { ContentModelPluginState } from '../pluginState/ContentModelPluginState';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { DomToModelSettings } from '../context/DomToModelSettings';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { ModelToDomSettings, OnNodeCreated } from '../context/ModelToDomSettings';\nimport type {\n ContentModelFormatter,\n FormatWithContentModelOptions,\n} from '../parameter/FormatWithContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The StandaloneEditorCore object\n */\nexport type CreateEditorContext = (core: StandaloneEditorCore & EditorCore) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The StandaloneEditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed, use this selection range instead of current selection in editor\n */\nexport type CreateContentModel = (\n core: StandaloneEditorCore & EditorCore,\n option?: DomToModelOption,\n selectionOverride?: DOMSelection\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The StandaloneEditorCore object\n */\nexport type GetDOMSelection = (core: StandaloneEditorCore & EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The StandaloneEditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n */\nexport type SetContentModel = (\n core: StandaloneEditorCore & EditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The StandaloneEditorCore object\n * @param selection The selection to set\n */\nexport type SetDOMSelection = (\n core: StandaloneEditorCore & EditorCore,\n selection: DOMSelection\n) => void;\n\n/**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The StandaloneEditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatWithContentModelOptions\n */\nexport type FormatContentModel = (\n core: StandaloneEditorCore & EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatWithContentModelOptions\n) => void;\n\n/**\n * The interface for the map of core API for Content Model editor.\n * Editor can call call API from this map under StandaloneEditorCore object\n */\nexport interface StandaloneCoreApiMap {\n /**\n * Create a EditorContext object used by ContentModel API\n * @param core The StandaloneEditorCore object\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The StandaloneEditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n */\n createContentModel: CreateContentModel;\n\n /**\n * Get current DOM selection from editor\n * @param core The StandaloneEditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The StandaloneEditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n */\n setContentModel: SetContentModel;\n\n /**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The StandaloneEditorCore object\n * @param selection The selection to set\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The StandaloneEditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatWithContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n // TODO: This is copied from legacy editor core, will be ported to use new types later\n switchShadowEdit: SwitchShadowEdit;\n}\n\n/**\n * Represents the core data structure of a Content Model editor\n */\nexport interface StandaloneEditorCore extends ContentModelPluginState {\n /**\n * The content DIV element of this editor\n */\n readonly contentDiv: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: StandaloneCoreApiMap;\n\n /**\n * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.\n */\n readonly originalApi: StandaloneCoreApiMap;\n\n /**\n * Default DOM to Content Model options\n */\n defaultDomToModelOptions: (DomToModelOption | undefined)[];\n\n /**\n * Default Content Model to DOM options\n */\n defaultModelToDomOptions: (ModelToDomOption | undefined)[];\n\n /**\n * Default DOM to Content Model config, calculated from defaultDomToModelOptions,\n * will be used for creating content model if there is no other customized options\n */\n defaultDomToModelConfig: DomToModelSettings;\n\n /**\n * Default Content Model to DOM config, calculated from defaultModelToDomOptions,\n * will be used for setting content model if there is no other customized options\n */\n defaultModelToDomConfig: ModelToDomSettings;\n\n /**\n * Editor running environment\n */\n environment: EditorEnvironment;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DomToModelOption } from '../context/DomToModelOption';
|
|
2
|
+
import type { ModelToDomOption } from '../context/ModelToDomOption';
|
|
3
|
+
/**
|
|
4
|
+
* Options for Content Model editor
|
|
5
|
+
*/
|
|
6
|
+
export interface StandaloneEditorOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Default options used for DOM to Content Model conversion
|
|
9
|
+
*/
|
|
10
|
+
defaultDomToModelOptions?: DomToModelOption;
|
|
11
|
+
/**
|
|
12
|
+
* Default options used for Content Model to DOM conversion
|
|
13
|
+
*/
|
|
14
|
+
defaultModelToDomOptions?: ModelToDomOption;
|
|
15
|
+
/**
|
|
16
|
+
* Reuse existing DOM structure if possible, and update the model when content or selection is changed
|
|
17
|
+
*/
|
|
18
|
+
cacheModel?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StandaloneEditorOptions.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/editor/StandaloneEditorOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { DomToModelOption } from '../context/DomToModelOption';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\n\n/**\n * Options for Content Model editor\n */\nexport interface StandaloneEditorOptions {\n /**\n * Default options used for DOM to Content Model conversion\n */\n defaultDomToModelOptions?: DomToModelOption;\n\n /**\n * Default options used for Content Model to DOM conversion\n */\n defaultModelToDomOptions?: ModelToDomOption;\n\n /**\n * Reuse existing DOM structure if possible, and update the model when content or selection is changed\n */\n cacheModel?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All Border operations
|
|
3
|
+
*/
|
|
4
|
+
export declare type BorderOperations =
|
|
5
|
+
/**
|
|
6
|
+
* Apply border format to all borders
|
|
7
|
+
*/
|
|
8
|
+
'allBorders'
|
|
9
|
+
/**
|
|
10
|
+
* Remove al borders
|
|
11
|
+
*/
|
|
12
|
+
| 'noBorders'
|
|
13
|
+
/**
|
|
14
|
+
* Apply border format to left borders
|
|
15
|
+
*/
|
|
16
|
+
| 'leftBorders'
|
|
17
|
+
/**
|
|
18
|
+
* Apply border format to right borders
|
|
19
|
+
*/
|
|
20
|
+
| 'rightBorders'
|
|
21
|
+
/**
|
|
22
|
+
* Apply border format to top borders
|
|
23
|
+
*/
|
|
24
|
+
| 'topBorders'
|
|
25
|
+
/**
|
|
26
|
+
* Apply border format to bottom borders
|
|
27
|
+
*/
|
|
28
|
+
| 'bottomBorders'
|
|
29
|
+
/**
|
|
30
|
+
* Apply border format to inside borders
|
|
31
|
+
*/
|
|
32
|
+
| 'insideBorders'
|
|
33
|
+
/**
|
|
34
|
+
* Apply border format to outside borders
|
|
35
|
+
*/
|
|
36
|
+
| 'outsideBorders';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BorderOperations.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/enum/BorderOperations.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * All Border operations\n */\nexport type BorderOperations =\n /**\n * Apply border format to all borders\n */\n | 'allBorders'\n /**\n * Remove al borders\n */\n | 'noBorders'\n /**\n * Apply border format to left borders\n */\n | 'leftBorders'\n /**\n * Apply border format to right borders\n */\n | 'rightBorders'\n /**\n * Apply border format to top borders\n */\n | 'topBorders'\n /**\n * Apply border format to bottom borders\n */\n | 'bottomBorders'\n /**\n * Apply border format to inside borders\n */\n | 'insideBorders'\n /**\n * Apply border format to outside borders\n */\n | 'outsideBorders';\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete selection result
|
|
3
|
+
*/
|
|
4
|
+
export declare type DeleteResult =
|
|
5
|
+
/**
|
|
6
|
+
* Content Model could not finish deletion, need to let browser handle it
|
|
7
|
+
*/
|
|
8
|
+
'notDeleted'
|
|
9
|
+
/**
|
|
10
|
+
* Deleted a single char, no need to let browser keep handling
|
|
11
|
+
*/
|
|
12
|
+
| 'singleChar'
|
|
13
|
+
/**
|
|
14
|
+
* Deleted a range, no need to let browser keep handling
|
|
15
|
+
*/
|
|
16
|
+
| 'range'
|
|
17
|
+
/**
|
|
18
|
+
* There is nothing to delete, no need to let browser keep handling
|
|
19
|
+
*/
|
|
20
|
+
| 'nothingToDelete';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteResult.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/enum/DeleteResult.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Delete selection result\n */\nexport type DeleteResult =\n /**\n * Content Model could not finish deletion, need to let browser handle it\n */\n | 'notDeleted'\n\n /**\n * Deleted a single char, no need to let browser keep handling\n */\n | 'singleChar'\n\n /**\n * Deleted a range, no need to let browser keep handling\n */\n | 'range'\n\n /**\n * There is nothing to delete, no need to let browser keep handling\n */\n | 'nothingToDelete';\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define entity lifecycle related operations
|
|
3
|
+
*/
|
|
4
|
+
export declare type EntityLifecycleOperation =
|
|
5
|
+
/**
|
|
6
|
+
* Notify plugins that there is a new plugin was added into editor.
|
|
7
|
+
* Plugin can handle this event to entity hydration.
|
|
8
|
+
* This event will be only fired once for each entity DOM node.
|
|
9
|
+
* After undo, or copy/paste, since new DOM nodes were added, this event will be fired
|
|
10
|
+
* for those entities represented by newly added nodes.
|
|
11
|
+
*/
|
|
12
|
+
'newEntity'
|
|
13
|
+
/**
|
|
14
|
+
* Notify plugins that editor is generating HTML content for save.
|
|
15
|
+
* Plugin should use this event to remove any temporary content, and only leave DOM nodes that
|
|
16
|
+
* should be saved as HTML string.
|
|
17
|
+
* This event will provide a cloned DOM tree for each entity, do NOT compare the DOM nodes with cached nodes
|
|
18
|
+
* because it will always return false.
|
|
19
|
+
*/
|
|
20
|
+
| 'replaceTemporaryContent'
|
|
21
|
+
/**
|
|
22
|
+
* Notify plugins that a new entity state need to be updated to an entity.
|
|
23
|
+
* This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity
|
|
24
|
+
*/
|
|
25
|
+
| 'UpdateEntityState';
|
|
26
|
+
/**
|
|
27
|
+
* Define entity removal related operations
|
|
28
|
+
*/
|
|
29
|
+
export declare type EntityRemovalOperation =
|
|
30
|
+
/**
|
|
31
|
+
* Notify plugins that user is removing an entity from its start position using DELETE key
|
|
32
|
+
*/
|
|
33
|
+
'removeFromStart'
|
|
34
|
+
/**
|
|
35
|
+
* Notify plugins that user is remove an entity from its end position using BACKSPACE key
|
|
36
|
+
*/
|
|
37
|
+
| 'removeFromEnd'
|
|
38
|
+
/**
|
|
39
|
+
* Notify plugins that an entity is being overwritten.
|
|
40
|
+
* This can be caused by key in, cut, paste, delete, backspace ... on a selection
|
|
41
|
+
* which contains some entities.
|
|
42
|
+
*/
|
|
43
|
+
| 'overwrite';
|
|
44
|
+
/**
|
|
45
|
+
* Define possible operations to an entity
|
|
46
|
+
*/
|
|
47
|
+
export declare type EntityOperation = EntityLifecycleOperation | EntityRemovalOperation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityOperation.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/enum/EntityOperation.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Define entity lifecycle related operations\n */\nexport type EntityLifecycleOperation =\n /**\n * Notify plugins that there is a new plugin was added into editor.\n * Plugin can handle this event to entity hydration.\n * This event will be only fired once for each entity DOM node.\n * After undo, or copy/paste, since new DOM nodes were added, this event will be fired\n * for those entities represented by newly added nodes.\n */\n | 'newEntity'\n\n /**\n * Notify plugins that editor is generating HTML content for save.\n * Plugin should use this event to remove any temporary content, and only leave DOM nodes that\n * should be saved as HTML string.\n * This event will provide a cloned DOM tree for each entity, do NOT compare the DOM nodes with cached nodes\n * because it will always return false.\n */\n | 'replaceTemporaryContent'\n /**\n * Notify plugins that a new entity state need to be updated to an entity.\n * This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity\n */\n | 'UpdateEntityState';\n\n/**\n * Define entity removal related operations\n */\nexport type EntityRemovalOperation =\n /**\n * Notify plugins that user is removing an entity from its start position using DELETE key\n */\n | 'removeFromStart'\n\n /**\n * Notify plugins that user is remove an entity from its end position using BACKSPACE key\n */\n | 'removeFromEnd'\n\n /**\n * Notify plugins that an entity is being overwritten.\n * This can be caused by key in, cut, paste, delete, backspace ... on a selection\n * which contains some entities.\n */\n | 'overwrite';\n\n/**\n * Define possible operations to an entity\n */\nexport type EntityOperation = EntityLifecycleOperation | EntityRemovalOperation;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define the position of the entity to insert. It can be:
|
|
3
|
+
* "focus": insert at current focus. If insert a block entity, it will be inserted under the paragraph where focus is
|
|
4
|
+
* "begin": insert at beginning of content. When insert an inline entity, it will be wrapped with a paragraph.
|
|
5
|
+
* "end": insert at end of content. When insert an inline entity, it will be wrapped with a paragraph.
|
|
6
|
+
* "root": insert at the root level of current region
|
|
7
|
+
*/
|
|
8
|
+
export declare type InsertEntityPosition = 'focus' | 'begin' | 'end' | 'root';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsertEntityPosition.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/enum/InsertEntityPosition.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Define the position of the entity to insert. It can be:\n * \"focus\": insert at current focus. If insert a block entity, it will be inserted under the paragraph where focus is\n * \"begin\": insert at beginning of content. When insert an inline entity, it will be wrapped with a paragraph.\n * \"end\": insert at end of content. When insert an inline entity, it will be wrapped with a paragraph.\n * \"root\": insert at the root level of current region\n */\nexport type InsertEntityPosition = 'focus' | 'begin' | 'end' | 'root';\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specify what type of content to paste
|
|
3
|
+
*/
|
|
4
|
+
export declare type PasteType =
|
|
5
|
+
/**
|
|
6
|
+
* Default paste behavior
|
|
7
|
+
*/
|
|
8
|
+
'normal'
|
|
9
|
+
/**
|
|
10
|
+
* Paste only the plain text
|
|
11
|
+
*/
|
|
12
|
+
| 'asPlainText'
|
|
13
|
+
/**
|
|
14
|
+
* Apply the current style to pasted content
|
|
15
|
+
*/
|
|
16
|
+
| 'mergeFormat'
|
|
17
|
+
/**
|
|
18
|
+
* If there is a image uri in the clipboard, paste the content as image element
|
|
19
|
+
*/
|
|
20
|
+
| 'asImage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasteType.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/enum/PasteType.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Specify what type of content to paste\n */\nexport type PasteType =\n /**\n * Default paste behavior\n */\n | 'normal'\n\n /**\n * Paste only the plain text\n */\n | 'asPlainText'\n\n /**\n * Apply the current style to pasted content\n */\n | 'mergeFormat'\n\n /**\n * If there is a image uri in the clipboard, paste the content as image element\n */\n | 'asImage';\n"]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations used by editTable() API for insert table cell vertically
|
|
3
|
+
*/
|
|
4
|
+
export declare type TableVerticalInsertOperation =
|
|
5
|
+
/**
|
|
6
|
+
* Insert a row above current row
|
|
7
|
+
*/
|
|
8
|
+
'insertAbove'
|
|
9
|
+
/**
|
|
10
|
+
* Insert a row below current row
|
|
11
|
+
*/
|
|
12
|
+
| 'insertBelow';
|
|
13
|
+
/**
|
|
14
|
+
* Operations used by editTable() API for insert table cell horizontally
|
|
15
|
+
*/
|
|
16
|
+
export declare type TableHorizontalInsertOperation =
|
|
17
|
+
/**
|
|
18
|
+
* Insert a column on the left of current column
|
|
19
|
+
*/
|
|
20
|
+
'insertLeft'
|
|
21
|
+
/**
|
|
22
|
+
* Insert a column on the right of current column
|
|
23
|
+
*/
|
|
24
|
+
| 'insertRight';
|
|
25
|
+
/**
|
|
26
|
+
* Operations used by editTable() API for delete table cells
|
|
27
|
+
*/
|
|
28
|
+
export declare type TableDeleteOperation =
|
|
29
|
+
/**
|
|
30
|
+
* Delete the whole table
|
|
31
|
+
*/
|
|
32
|
+
'deleteTable'
|
|
33
|
+
/**
|
|
34
|
+
* Delete current column
|
|
35
|
+
*/
|
|
36
|
+
| 'deleteColumn'
|
|
37
|
+
/**
|
|
38
|
+
* Delete current row
|
|
39
|
+
*/
|
|
40
|
+
| 'deleteRow';
|
|
41
|
+
/**
|
|
42
|
+
* Operations used by editTable() API for merge table cells vertically
|
|
43
|
+
*/
|
|
44
|
+
export declare type TableVerticalMergeOperation =
|
|
45
|
+
/**
|
|
46
|
+
* Merge current row with the row above
|
|
47
|
+
*/
|
|
48
|
+
'mergeAbove'
|
|
49
|
+
/**
|
|
50
|
+
* Merge current row with the row below
|
|
51
|
+
*/
|
|
52
|
+
| 'mergeBelow';
|
|
53
|
+
/**
|
|
54
|
+
* Operations used by editTable() API for merge table cells horizontally
|
|
55
|
+
*/
|
|
56
|
+
export declare type TableHorizontalMergeOperation =
|
|
57
|
+
/**
|
|
58
|
+
* Merge current column with the column on the left
|
|
59
|
+
*/
|
|
60
|
+
'mergeLeft'
|
|
61
|
+
/**
|
|
62
|
+
* Merge current column with the column on the right
|
|
63
|
+
*/
|
|
64
|
+
| 'mergeRight';
|
|
65
|
+
/**
|
|
66
|
+
* Operations used by editTable() API for merge selected table cells
|
|
67
|
+
*/
|
|
68
|
+
export declare type TableCellMergeOperation =
|
|
69
|
+
/**
|
|
70
|
+
* Merge all selected cells
|
|
71
|
+
*/
|
|
72
|
+
'mergeCells';
|
|
73
|
+
/**
|
|
74
|
+
* Operations used by editTable() API for split table cells
|
|
75
|
+
*/
|
|
76
|
+
export declare type TableSplitOperation =
|
|
77
|
+
/**
|
|
78
|
+
* Split current table cell horizontally
|
|
79
|
+
*/
|
|
80
|
+
'splitHorizontally'
|
|
81
|
+
/**
|
|
82
|
+
* Split current table cell vertically
|
|
83
|
+
*/
|
|
84
|
+
| 'splitVertically';
|
|
85
|
+
/**
|
|
86
|
+
* Operations used by editTable() API for align table
|
|
87
|
+
*/
|
|
88
|
+
export declare type TableAlignOperation =
|
|
89
|
+
/**
|
|
90
|
+
* Align current table at the center
|
|
91
|
+
*/
|
|
92
|
+
'alignCenter'
|
|
93
|
+
/**
|
|
94
|
+
* Align current table at the left
|
|
95
|
+
*/
|
|
96
|
+
| 'alignLeft'
|
|
97
|
+
/**
|
|
98
|
+
* Align current table at the right
|
|
99
|
+
*/
|
|
100
|
+
| 'alignRight';
|
|
101
|
+
/**
|
|
102
|
+
* Operations used by editTable() API for align table cell horizontally
|
|
103
|
+
*/
|
|
104
|
+
export declare type TableCellHorizontalAlignOperation =
|
|
105
|
+
/**
|
|
106
|
+
* Align current content table cell at the left
|
|
107
|
+
*/
|
|
108
|
+
'alignCellLeft'
|
|
109
|
+
/**
|
|
110
|
+
* Align current content table cell at the center
|
|
111
|
+
*/
|
|
112
|
+
| 'alignCellCenter'
|
|
113
|
+
/**
|
|
114
|
+
* Align current content table cell at the right
|
|
115
|
+
*/
|
|
116
|
+
| 'alignCellRight';
|
|
117
|
+
/**
|
|
118
|
+
* Operations used by editTable() API for align table cell vertically
|
|
119
|
+
*/
|
|
120
|
+
export declare type TableCellVerticalAlignOperation =
|
|
121
|
+
/**
|
|
122
|
+
* Align current content table cell at the top
|
|
123
|
+
*/
|
|
124
|
+
'alignCellTop'
|
|
125
|
+
/**
|
|
126
|
+
* Align current table cell at the middle
|
|
127
|
+
*/
|
|
128
|
+
| 'alignCellMiddle'
|
|
129
|
+
/**
|
|
130
|
+
* Align current table cell at the bottom
|
|
131
|
+
*/
|
|
132
|
+
| 'alignCellBottom';
|
|
133
|
+
/**
|
|
134
|
+
* Operations used by editTable() API
|
|
135
|
+
*/
|
|
136
|
+
export declare type TableOperation = TableVerticalInsertOperation | TableHorizontalInsertOperation | TableDeleteOperation | TableVerticalMergeOperation | TableHorizontalMergeOperation | TableCellMergeOperation | TableSplitOperation | TableAlignOperation | TableCellHorizontalAlignOperation | TableCellVerticalAlignOperation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableOperation.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/enum/TableOperation.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Operations used by editTable() API for insert table cell vertically\n */\nexport type TableVerticalInsertOperation =\n /**\n * Insert a row above current row\n */\n | 'insertAbove'\n\n /**\n * Insert a row below current row\n */\n | 'insertBelow';\n\n/**\n * Operations used by editTable() API for insert table cell horizontally\n */\nexport type TableHorizontalInsertOperation =\n /**\n * Insert a column on the left of current column\n */\n | 'insertLeft'\n\n /**\n * Insert a column on the right of current column\n */\n | 'insertRight';\n\n/**\n * Operations used by editTable() API for delete table cells\n */\nexport type TableDeleteOperation =\n /**\n * Delete the whole table\n */\n | 'deleteTable'\n\n /**\n * Delete current column\n */\n | 'deleteColumn'\n\n /**\n * Delete current row\n */\n | 'deleteRow';\n\n/**\n * Operations used by editTable() API for merge table cells vertically\n */\nexport type TableVerticalMergeOperation =\n /**\n * Merge current row with the row above\n */\n | 'mergeAbove'\n\n /**\n * Merge current row with the row below\n */\n | 'mergeBelow';\n\n/**\n * Operations used by editTable() API for merge table cells horizontally\n */\nexport type TableHorizontalMergeOperation =\n /**\n * Merge current column with the column on the left\n */\n | 'mergeLeft'\n\n /**\n * Merge current column with the column on the right\n */\n | 'mergeRight';\n\n/**\n * Operations used by editTable() API for merge selected table cells\n */\nexport type TableCellMergeOperation =\n /**\n * Merge all selected cells\n */\n 'mergeCells';\n\n/**\n * Operations used by editTable() API for split table cells\n */\nexport type TableSplitOperation =\n /**\n * Split current table cell horizontally\n */\n | 'splitHorizontally'\n\n /**\n * Split current table cell vertically\n */\n | 'splitVertically';\n\n/**\n * Operations used by editTable() API for align table\n */\nexport type TableAlignOperation =\n /**\n * Align current table at the center\n */\n | 'alignCenter'\n\n /**\n * Align current table at the left\n */\n | 'alignLeft'\n\n /**\n * Align current table at the right\n */\n | 'alignRight';\n\n/**\n * Operations used by editTable() API for align table cell horizontally\n */\nexport type TableCellHorizontalAlignOperation =\n /**\n * Align current content table cell at the left\n */\n | 'alignCellLeft'\n\n /**\n * Align current content table cell at the center\n */\n | 'alignCellCenter'\n\n /**\n * Align current content table cell at the right\n */\n | 'alignCellRight';\n\n/**\n * Operations used by editTable() API for align table cell vertically\n */\nexport type TableCellVerticalAlignOperation =\n /**\n * Align current content table cell at the top\n */\n | 'alignCellTop'\n\n /**\n * Align current table cell at the middle\n */\n | 'alignCellMiddle'\n\n /**\n * Align current table cell at the bottom\n */\n | 'alignCellBottom';\n\n/**\n * Operations used by editTable() API\n */\nexport type TableOperation =\n | TableVerticalInsertOperation\n | TableHorizontalInsertOperation\n | TableDeleteOperation\n | TableVerticalMergeOperation\n | TableHorizontalMergeOperation\n | TableCellMergeOperation\n | TableSplitOperation\n | TableAlignOperation\n | TableCellHorizontalAlignOperation\n | TableCellVerticalAlignOperation;\n"]}
|