texditor 2.0.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/LICENSE.md +9 -0
- package/README.md +232 -0
- package/dist/core/base/base-model.d.ts +160 -0
- package/dist/core/base/base-model.d.ts.map +1 -0
- package/dist/core/base/event-manager.d.ts +20 -0
- package/dist/core/base/event-manager.d.ts.map +1 -0
- package/dist/core/base/index.d.ts +3 -0
- package/dist/core/base/index.d.ts.map +1 -0
- package/dist/core/base.d.ts +2 -0
- package/dist/core/base.mjs +1 -0
- package/dist/core/block-manager.d.ts +91 -0
- package/dist/core/block-manager.d.ts.map +1 -0
- package/dist/core/commands.d.ts +73 -0
- package/dist/core/commands.d.ts.map +1 -0
- package/dist/core/config.d.ts +11 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/events.d.ts +121 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/extensions.d.ts +23 -0
- package/dist/core/extensions.d.ts.map +1 -0
- package/dist/core/history-manager.d.ts +76 -0
- package/dist/core/history-manager.d.ts.map +1 -0
- package/dist/core/i18n.d.ts +29 -0
- package/dist/core/i18n.d.ts.map +1 -0
- package/dist/core/models/action-model.d.ts +54 -0
- package/dist/core/models/action-model.d.ts.map +1 -0
- package/dist/core/models/block-model.d.ts +396 -0
- package/dist/core/models/block-model.d.ts.map +1 -0
- package/dist/core/models/extension-model.d.ts +25 -0
- package/dist/core/models/extension-model.d.ts.map +1 -0
- package/dist/core/models/file-action-model.d.ts +20 -0
- package/dist/core/models/file-action-model.d.ts.map +1 -0
- package/dist/core/models/index.d.ts +7 -0
- package/dist/core/models/index.d.ts.map +1 -0
- package/dist/core/models/tool-model.d.ts +69 -0
- package/dist/core/models/tool-model.d.ts.map +1 -0
- package/dist/core/models.d.ts +2 -0
- package/dist/core/models.mjs +6 -0
- package/dist/core/security/sanitizer.d.ts +65 -0
- package/dist/core/security/sanitizer.d.ts.map +1 -0
- package/dist/core/selection-api.d.ts +52 -0
- package/dist/core/selection-api.d.ts.map +1 -0
- package/dist/core/tools.d.ts +27 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/ui/slider.d.ts +50 -0
- package/dist/core/ui/slider.d.ts.map +1 -0
- package/dist/core/ui/toasts.d.ts +23 -0
- package/dist/core/ui/toasts.d.ts.map +1 -0
- package/dist/core/ui/virtual-selection.d.ts +171 -0
- package/dist/core/ui/virtual-selection.d.ts.map +1 -0
- package/dist/entities/actions/convert-action.d.ts +9 -0
- package/dist/entities/actions/convert-action.d.ts.map +1 -0
- package/dist/entities/actions/create-action.d.ts +8 -0
- package/dist/entities/actions/create-action.d.ts.map +1 -0
- package/dist/entities/actions/delete-action.d.ts +8 -0
- package/dist/entities/actions/delete-action.d.ts.map +1 -0
- package/dist/entities/actions/index.d.ts +7 -0
- package/dist/entities/actions/index.d.ts.map +1 -0
- package/dist/entities/actions/move-down-action.d.ts +9 -0
- package/dist/entities/actions/move-down-action.d.ts.map +1 -0
- package/dist/entities/actions/move-up-action.d.ts +9 -0
- package/dist/entities/actions/move-up-action.d.ts.map +1 -0
- package/dist/entities/actions.d.ts +2 -0
- package/dist/entities/actions.mjs +6 -0
- package/dist/entities/blocks/code/index.d.ts +48 -0
- package/dist/entities/blocks/code/index.d.ts.map +1 -0
- package/dist/entities/blocks/code/languages.d.ts +4 -0
- package/dist/entities/blocks/code/languages.d.ts.map +1 -0
- package/dist/entities/blocks/files/actions/DeleteFileAction.d.ts +7 -0
- package/dist/entities/blocks/files/actions/DeleteFileAction.d.ts.map +1 -0
- package/dist/entities/blocks/files/actions/DownloadFileAction.d.ts +12 -0
- package/dist/entities/blocks/files/actions/DownloadFileAction.d.ts.map +1 -0
- package/dist/entities/blocks/files/actions/EditFileAction.d.ts +32 -0
- package/dist/entities/blocks/files/actions/EditFileAction.d.ts.map +1 -0
- package/dist/entities/blocks/files/actions/MoveLeftFileAction.d.ts +8 -0
- package/dist/entities/blocks/files/actions/MoveLeftFileAction.d.ts.map +1 -0
- package/dist/entities/blocks/files/actions/MoveRightFileAction.d.ts +8 -0
- package/dist/entities/blocks/files/actions/MoveRightFileAction.d.ts.map +1 -0
- package/dist/entities/blocks/files/index.d.ts +185 -0
- package/dist/entities/blocks/files/index.d.ts.map +1 -0
- package/dist/entities/blocks/gallery/index.d.ts +60 -0
- package/dist/entities/blocks/gallery/index.d.ts.map +1 -0
- package/dist/entities/blocks/header/H1.d.ts +4 -0
- package/dist/entities/blocks/header/H1.d.ts.map +1 -0
- package/dist/entities/blocks/header/H2.d.ts +6 -0
- package/dist/entities/blocks/header/H2.d.ts.map +1 -0
- package/dist/entities/blocks/header/H3.d.ts +6 -0
- package/dist/entities/blocks/header/H3.d.ts.map +1 -0
- package/dist/entities/blocks/header/H4.d.ts +6 -0
- package/dist/entities/blocks/header/H4.d.ts.map +1 -0
- package/dist/entities/blocks/header/H5.d.ts +6 -0
- package/dist/entities/blocks/header/H5.d.ts.map +1 -0
- package/dist/entities/blocks/header/H6.d.ts +6 -0
- package/dist/entities/blocks/header/H6.d.ts.map +1 -0
- package/dist/entities/blocks/header/index.d.ts +6 -0
- package/dist/entities/blocks/header/index.d.ts.map +1 -0
- package/dist/entities/blocks/index.d.ts +14 -0
- package/dist/entities/blocks/index.d.ts.map +1 -0
- package/dist/entities/blocks/list/index.d.ts +6 -0
- package/dist/entities/blocks/list/index.d.ts.map +1 -0
- package/dist/entities/blocks/list/ol.d.ts +6 -0
- package/dist/entities/blocks/list/ol.d.ts.map +1 -0
- package/dist/entities/blocks/paragraph/index.d.ts +6 -0
- package/dist/entities/blocks/paragraph/index.d.ts.map +1 -0
- package/dist/entities/blocks.d.ts +2 -0
- package/dist/entities/blocks.mjs +13 -0
- package/dist/entities/extensions/delete-selected.d.ts +9 -0
- package/dist/entities/extensions/delete-selected.d.ts.map +1 -0
- package/dist/entities/extensions/index.d.ts +5 -0
- package/dist/entities/extensions/index.d.ts.map +1 -0
- package/dist/entities/extensions/redo.d.ts +8 -0
- package/dist/entities/extensions/redo.d.ts.map +1 -0
- package/dist/entities/extensions/undo.d.ts +8 -0
- package/dist/entities/extensions/undo.d.ts.map +1 -0
- package/dist/entities/extensions.d.ts +2 -0
- package/dist/entities/extensions.mjs +4 -0
- package/dist/entities/tools/bold.d.ts +6 -0
- package/dist/entities/tools/bold.d.ts.map +1 -0
- package/dist/entities/tools/clear-formatting.d.ts +7 -0
- package/dist/entities/tools/clear-formatting.d.ts.map +1 -0
- package/dist/entities/tools/index.d.ts +10 -0
- package/dist/entities/tools/index.d.ts.map +1 -0
- package/dist/entities/tools/inline-code.d.ts +6 -0
- package/dist/entities/tools/inline-code.d.ts.map +1 -0
- package/dist/entities/tools/italic.d.ts +6 -0
- package/dist/entities/tools/italic.d.ts.map +1 -0
- package/dist/entities/tools/link.d.ts +35 -0
- package/dist/entities/tools/link.d.ts.map +1 -0
- package/dist/entities/tools/marker.d.ts +6 -0
- package/dist/entities/tools/marker.d.ts.map +1 -0
- package/dist/entities/tools/subscript.d.ts +6 -0
- package/dist/entities/tools/subscript.d.ts.map +1 -0
- package/dist/entities/tools/superscript.d.ts +6 -0
- package/dist/entities/tools/superscript.d.ts.map +1 -0
- package/dist/entities/tools.d.ts +2 -0
- package/dist/entities/tools.mjs +9 -0
- package/dist/icons/index.d.ts +42 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/locales/en.d.ts +66 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/index.d.ts +4 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/ru.d.ts +66 -0
- package/dist/locales/ru.d.ts.map +1 -0
- package/dist/locales.d.ts +2 -0
- package/dist/locales.mjs +3 -0
- package/dist/main.d.ts +6 -0
- package/dist/node_modules/snappykit/dist/snappykit.mjs +440 -0
- package/dist/node_modules/sortum/dist/sortum.mjs +588 -0
- package/dist/src/core/base/base-model.mjs +184 -0
- package/dist/src/core/base/event-manager.mjs +31 -0
- package/dist/src/core/block-manager.mjs +499 -0
- package/dist/src/core/commands.mjs +311 -0
- package/dist/src/core/config.mjs +12 -0
- package/dist/src/core/events.mjs +369 -0
- package/dist/src/core/extensions.mjs +48 -0
- package/dist/src/core/history-manager.mjs +107 -0
- package/dist/src/core/i18n.mjs +25 -0
- package/dist/src/core/models/action-model.mjs +72 -0
- package/dist/src/core/models/block-model.mjs +619 -0
- package/dist/src/core/models/extension-model.mjs +28 -0
- package/dist/src/core/models/file-action-model.mjs +24 -0
- package/dist/src/core/models/tool-model.mjs +80 -0
- package/dist/src/core/security/sanitizer.mjs +130 -0
- package/dist/src/core/selection-api.mjs +202 -0
- package/dist/src/core/tools.mjs +88 -0
- package/dist/src/core/ui/slider.mjs +81 -0
- package/dist/src/core/ui/toasts.mjs +55 -0
- package/dist/src/core/ui/virtual-selection.mjs +205 -0
- package/dist/src/entities/actions/convert-action.mjs +43 -0
- package/dist/src/entities/actions/create-action.mjs +39 -0
- package/dist/src/entities/actions/delete-action.mjs +19 -0
- package/dist/src/entities/actions/move-down-action.mjs +22 -0
- package/dist/src/entities/actions/move-up-action.mjs +22 -0
- package/dist/src/entities/blocks/code/index.mjs +144 -0
- package/dist/src/entities/blocks/code/languages.mjs +54 -0
- package/dist/src/entities/blocks/files/actions/DeleteFileAction.mjs +21 -0
- package/dist/src/entities/blocks/files/actions/DownloadFileAction.mjs +44 -0
- package/dist/src/entities/blocks/files/actions/EditFileAction.mjs +111 -0
- package/dist/src/entities/blocks/files/actions/MoveLeftFileAction.mjs +24 -0
- package/dist/src/entities/blocks/files/actions/MoveRightFileAction.mjs +24 -0
- package/dist/src/entities/blocks/files/index.mjs +424 -0
- package/dist/src/entities/blocks/gallery/index.mjs +141 -0
- package/dist/src/entities/blocks/header/H1.mjs +5 -0
- package/dist/src/entities/blocks/header/H2.mjs +16 -0
- package/dist/src/entities/blocks/header/H3.mjs +16 -0
- package/dist/src/entities/blocks/header/H4.mjs +16 -0
- package/dist/src/entities/blocks/header/H5.mjs +16 -0
- package/dist/src/entities/blocks/header/H6.mjs +16 -0
- package/dist/src/entities/blocks/header/index.mjs +46 -0
- package/dist/src/entities/blocks/list/index.mjs +51 -0
- package/dist/src/entities/blocks/list/ol.mjs +16 -0
- package/dist/src/entities/blocks/paragraph/index.mjs +46 -0
- package/dist/src/entities/extensions/delete-selected.mjs +27 -0
- package/dist/src/entities/extensions/redo.mjs +22 -0
- package/dist/src/entities/extensions/undo.mjs +22 -0
- package/dist/src/entities/tools/bold.mjs +16 -0
- package/dist/src/entities/tools/clear-formatting.mjs +20 -0
- package/dist/src/entities/tools/inline-code.mjs +19 -0
- package/dist/src/entities/tools/italic.mjs +16 -0
- package/dist/src/entities/tools/link.mjs +89 -0
- package/dist/src/entities/tools/marker.mjs +17 -0
- package/dist/src/entities/tools/subscript.mjs +17 -0
- package/dist/src/entities/tools/superscript.mjs +18 -0
- package/dist/src/icons/index.mjs +4 -0
- package/dist/src/locales/en.mjs +68 -0
- package/dist/src/locales/ru.mjs +68 -0
- package/dist/src/store/currentStore.mjs +8 -0
- package/dist/src/store/mainStore.mjs +4 -0
- package/dist/src/utils/ajax.mjs +35 -0
- package/dist/src/utils/common.mjs +26 -0
- package/dist/src/utils/icon.mjs +12 -0
- package/dist/src/utils/sanitizer.mjs +20 -0
- package/dist/src/views/extensions.mjs +18 -0
- package/dist/src/views/main.mjs +19 -0
- package/dist/src/views/tools.mjs +9 -0
- package/dist/store/currentStore.d.ts +15 -0
- package/dist/store/currentStore.d.ts.map +1 -0
- package/dist/store/mainStore.d.ts +14 -0
- package/dist/store/mainStore.d.ts.map +1 -0
- package/dist/styles/animations.css +1 -0
- package/dist/styles/core/ui/selection.css +1 -0
- package/dist/styles/core/ui/slider.css +1 -0
- package/dist/styles/entities/blocks/code.css +1 -0
- package/dist/styles/entities/blocks/files.css +1 -0
- package/dist/styles/entities/blocks/gallery.css +1 -0
- package/dist/styles/entities/blocks/list.css +1 -0
- package/dist/styles/entities/blocks/paragraph.css +1 -0
- package/dist/styles/entities/tools/inline-code.css +1 -0
- package/dist/styles/entities/tools/link.css +1 -0
- package/dist/styles/texditor.css +1 -0
- package/dist/styles/theme.css +42 -0
- package/dist/texditor.d.ts +68 -0
- package/dist/texditor.d.ts.map +1 -0
- package/dist/texditor.mjs +138 -0
- package/dist/types/core/base/base-model.d.ts +212 -0
- package/dist/types/core/base/base-model.d.ts.map +1 -0
- package/dist/types/core/base/event-manager.d.ts +42 -0
- package/dist/types/core/base/event-manager.d.ts.map +1 -0
- package/dist/types/core/base/index.d.ts +3 -0
- package/dist/types/core/base/index.d.ts.map +1 -0
- package/dist/types/core/block-manager.d.ts +223 -0
- package/dist/types/core/block-manager.d.ts.map +1 -0
- package/dist/types/core/commands.d.ts +93 -0
- package/dist/types/core/commands.d.ts.map +1 -0
- package/dist/types/core/config.d.ts +86 -0
- package/dist/types/core/config.d.ts.map +1 -0
- package/dist/types/core/events.d.ts +58 -0
- package/dist/types/core/events.d.ts.map +1 -0
- package/dist/types/core/extensions.d.ts +19 -0
- package/dist/types/core/extensions.d.ts.map +1 -0
- package/dist/types/core/history-manager.d.ts +72 -0
- package/dist/types/core/history-manager.d.ts.map +1 -0
- package/dist/types/core/http/index.d.ts +2 -0
- package/dist/types/core/http/index.d.ts.map +1 -0
- package/dist/types/core/http/response.d.ts +6 -0
- package/dist/types/core/http/response.d.ts.map +1 -0
- package/dist/types/core/i18n.d.ts +40 -0
- package/dist/types/core/i18n.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +15 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/models/action-model.d.ts +46 -0
- package/dist/types/core/models/action-model.d.ts.map +1 -0
- package/dist/types/core/models/block-model.d.ts +404 -0
- package/dist/types/core/models/block-model.d.ts.map +1 -0
- package/dist/types/core/models/extension-model.d.ts +41 -0
- package/dist/types/core/models/extension-model.d.ts.map +1 -0
- package/dist/types/core/models/file-action-model.d.ts +36 -0
- package/dist/types/core/models/file-action-model.d.ts.map +1 -0
- package/dist/types/core/models/index.d.ts +7 -0
- package/dist/types/core/models/index.d.ts.map +1 -0
- package/dist/types/core/models/tool-model.d.ts +54 -0
- package/dist/types/core/models/tool-model.d.ts.map +1 -0
- package/dist/types/core/sanitizer.d.ts +27 -0
- package/dist/types/core/sanitizer.d.ts.map +1 -0
- package/dist/types/core/selection-api.d.ts +116 -0
- package/dist/types/core/selection-api.d.ts.map +1 -0
- package/dist/types/core/tools.d.ts +35 -0
- package/dist/types/core/tools.d.ts.map +1 -0
- package/dist/types/core/ui/index.d.ts +4 -0
- package/dist/types/core/ui/index.d.ts.map +1 -0
- package/dist/types/core/ui/slider.d.ts +45 -0
- package/dist/types/core/ui/slider.d.ts.map +1 -0
- package/dist/types/core/ui/toasts.d.ts +58 -0
- package/dist/types/core/ui/toasts.d.ts.map +1 -0
- package/dist/types/core/ui/virtual-selection.d.ts +83 -0
- package/dist/types/core/ui/virtual-selection.d.ts.map +1 -0
- package/dist/types/entities/blocks/code.d.ts +4 -0
- package/dist/types/entities/blocks/code.d.ts.map +1 -0
- package/dist/types/entities/blocks/files.d.ts +170 -0
- package/dist/types/entities/blocks/files.d.ts.map +1 -0
- package/dist/types/entities/blocks/gallery.d.ts +40 -0
- package/dist/types/entities/blocks/gallery.d.ts.map +1 -0
- package/dist/types/entities/blocks/header.d.ts +4 -0
- package/dist/types/entities/blocks/header.d.ts.map +1 -0
- package/dist/types/entities/blocks/index.d.ts +7 -0
- package/dist/types/entities/blocks/index.d.ts.map +1 -0
- package/dist/types/entities/blocks/list.d.ts +4 -0
- package/dist/types/entities/blocks/list.d.ts.map +1 -0
- package/dist/types/entities/blocks/paragraph.d.ts +4 -0
- package/dist/types/entities/blocks/paragraph.d.ts.map +1 -0
- package/dist/types/entities/index.d.ts +2 -0
- package/dist/types/entities/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/texditor.d.ts +66 -0
- package/dist/types/texditor.d.ts.map +1 -0
- package/dist/types/utils/ajax.d.ts +31 -0
- package/dist/types/utils/ajax.d.ts.map +1 -0
- package/dist/types/utils/icon.d.ts +10 -0
- package/dist/types/utils/icon.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/utils/ajax.d.ts +9 -0
- package/dist/utils/ajax.d.ts.map +1 -0
- package/dist/utils/common.d.ts +28 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/icon.d.ts +12 -0
- package/dist/utils/icon.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/sanitizer.d.ts +8 -0
- package/dist/utils/sanitizer.d.ts.map +1 -0
- package/dist/views/extensions.d.ts +3 -0
- package/dist/views/extensions.d.ts.map +1 -0
- package/dist/views/main.d.ts +3 -0
- package/dist/views/main.d.ts.map +1 -0
- package/dist/views/tools.d.ts +2 -0
- package/dist/views/tools.d.ts.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { ModelConstructor, BaseModel, BaseModelConfig, BaseElement, SanitizerConfig, TexditorEventBase, Toasts } from '../..';
|
|
2
|
+
/**
|
|
3
|
+
* Block model constructor type
|
|
4
|
+
* Specialized constructor that creates ActionModel instances
|
|
5
|
+
* with ActionModelConfig
|
|
6
|
+
*/
|
|
7
|
+
export type BlockModelConstructor = ModelConstructor<BlockModel, BlockModelConfig>;
|
|
8
|
+
export interface BlockElement extends BaseElement {
|
|
9
|
+
baseModel: BlockModel;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Block model schema for registration
|
|
13
|
+
* @property constructor - Constructor reference
|
|
14
|
+
* @property model - Model instance
|
|
15
|
+
*/
|
|
16
|
+
export interface BlockModelSchema {
|
|
17
|
+
constructor: BlockModelConstructor;
|
|
18
|
+
model: BlockModel;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Block model configuration interface
|
|
22
|
+
* @property autoMerge - Automatically merge with adjacent blocks
|
|
23
|
+
* @property icon - Block icon
|
|
24
|
+
* @property autoParse - Automatically parse content
|
|
25
|
+
* @property groupCode - Block group categorization
|
|
26
|
+
* @property contentClassName - Name of the CSS class of the content node
|
|
27
|
+
* @property backspaceRemove - Remove block on backspace
|
|
28
|
+
* @property visibleTools - Show tools for block
|
|
29
|
+
* @property availableTools - Available tools list
|
|
30
|
+
* @property editable - Content is editable
|
|
31
|
+
* @property editableItems - Individual items are editable
|
|
32
|
+
* @property singleItem - Block supports single item only
|
|
33
|
+
* @property enterCreate - Enter key creates new block
|
|
34
|
+
* @property raw - Treat content as raw text
|
|
35
|
+
* @property sanitizer - Enable HTML sanitization
|
|
36
|
+
* @property sanitizerConfig - Sanitizer configuration
|
|
37
|
+
* @property tagName - HTML tag of the block
|
|
38
|
+
* @property itemTagName - HTML tag of the list item
|
|
39
|
+
* @property itemName - Item type
|
|
40
|
+
* @property itemRelatedNames - Related item names
|
|
41
|
+
* @property itemClassName - Item CSS class
|
|
42
|
+
* @property itemBodyClassName - Item body CSS class
|
|
43
|
+
* @property maxItems - Maximum number of elements
|
|
44
|
+
* @property sortableItems - Enable item sorting
|
|
45
|
+
* @property dragZoneClassName - Name of the drag zone class
|
|
46
|
+
* @property relatedNames - Related block names
|
|
47
|
+
* @property emptyDetect - Enable empty detection
|
|
48
|
+
* @property customSave - Use custom save logic
|
|
49
|
+
* @property normalize - Enable content normalization
|
|
50
|
+
* @property placeholder - Placeholder text
|
|
51
|
+
* @property convertible - Block can be converted
|
|
52
|
+
* @property toastTimeout - Timeout duration in milliseconds
|
|
53
|
+
* @property toastsClassName - The CSS class name for the toasts element
|
|
54
|
+
*/
|
|
55
|
+
export interface BlockModelConfig extends BaseModelConfig {
|
|
56
|
+
autoMerge: boolean;
|
|
57
|
+
autoParse: boolean;
|
|
58
|
+
groupCode?: string;
|
|
59
|
+
backspaceRemove: boolean;
|
|
60
|
+
visibleTools: boolean;
|
|
61
|
+
availableTools: string[];
|
|
62
|
+
editable: boolean;
|
|
63
|
+
editableItems: boolean;
|
|
64
|
+
singleItem: boolean;
|
|
65
|
+
enterCreate: boolean;
|
|
66
|
+
raw: boolean;
|
|
67
|
+
sanitizer: boolean;
|
|
68
|
+
sanitizerConfig: Record<string, unknown>;
|
|
69
|
+
tagName: string;
|
|
70
|
+
itemTagName: string;
|
|
71
|
+
itemName: string;
|
|
72
|
+
itemRelatedNames: string[];
|
|
73
|
+
itemClassName: string;
|
|
74
|
+
itemBodyClassName: string;
|
|
75
|
+
maxItems: number;
|
|
76
|
+
sortableItems: boolean;
|
|
77
|
+
dragZoneClassName: string;
|
|
78
|
+
relatedNames: string[];
|
|
79
|
+
emptyDetect: boolean;
|
|
80
|
+
customSave: boolean;
|
|
81
|
+
normalize: boolean;
|
|
82
|
+
placeholder?: string;
|
|
83
|
+
convertible: boolean;
|
|
84
|
+
contentClassName: string;
|
|
85
|
+
toastTimeout: number;
|
|
86
|
+
toastsClassName: string;
|
|
87
|
+
[key: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Block model behavior interface
|
|
91
|
+
* Defines all public methods for block manipulation
|
|
92
|
+
*/
|
|
93
|
+
export interface BlockModel extends BaseModel<BlockElement> {
|
|
94
|
+
/**
|
|
95
|
+
* Trigger model change event
|
|
96
|
+
* @param name - Event name
|
|
97
|
+
* @param params - Event parameters
|
|
98
|
+
* @param globalParams - Global event parameters
|
|
99
|
+
*/
|
|
100
|
+
change(name: string, params?: TexditorEventBase, globalParams?: TexditorEventBase): void;
|
|
101
|
+
/**
|
|
102
|
+
* Check if Enter creates new block
|
|
103
|
+
* @returns True if Enter creates block
|
|
104
|
+
*/
|
|
105
|
+
isEnterCreate(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Check if auto-merge enabled
|
|
108
|
+
* @returns True if auto-merge enabled
|
|
109
|
+
*/
|
|
110
|
+
isAutoMerge(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Check if auto-parse enabled
|
|
113
|
+
* @returns True if auto-parse enabled
|
|
114
|
+
*/
|
|
115
|
+
isAutoParse(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Get related block names
|
|
118
|
+
* @returns Array of related names
|
|
119
|
+
*/
|
|
120
|
+
getRelatedNames(): string[];
|
|
121
|
+
/**
|
|
122
|
+
* Gets an array of all supported type names
|
|
123
|
+
* @returns Array of supported type names (includes main type and related types)
|
|
124
|
+
*/
|
|
125
|
+
getSupportedNames(): string[];
|
|
126
|
+
/**
|
|
127
|
+
* Gets the block placeholder text
|
|
128
|
+
* @returns Placeholder text (empty string if not set)
|
|
129
|
+
*/
|
|
130
|
+
getPlaceholder(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Gets the CSS class name for the content element
|
|
133
|
+
* @returns The CSS class name as a string
|
|
134
|
+
*/
|
|
135
|
+
getContentClassName(): string;
|
|
136
|
+
/**
|
|
137
|
+
* Get content DOM node
|
|
138
|
+
* @returns Content node
|
|
139
|
+
*/
|
|
140
|
+
getContentElement(): HTMLElement;
|
|
141
|
+
/**
|
|
142
|
+
* Get the name of the block element
|
|
143
|
+
* @returns Tag name
|
|
144
|
+
*/
|
|
145
|
+
getTagName(): string;
|
|
146
|
+
/**
|
|
147
|
+
* Get group code
|
|
148
|
+
* @returns Group code string
|
|
149
|
+
*/
|
|
150
|
+
getGroupCode(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Get item tag name
|
|
153
|
+
* @returns Item tag name
|
|
154
|
+
*/
|
|
155
|
+
getItemTagName(): string;
|
|
156
|
+
/**
|
|
157
|
+
* Get item body CSS class
|
|
158
|
+
* @returns Item body class name
|
|
159
|
+
*/
|
|
160
|
+
getItemBodyClassName(): string;
|
|
161
|
+
/**
|
|
162
|
+
* Get item CSS class
|
|
163
|
+
* @returns Item class name
|
|
164
|
+
*/
|
|
165
|
+
getItemClassName(): string;
|
|
166
|
+
/**
|
|
167
|
+
* Get item type
|
|
168
|
+
* @returns Item type
|
|
169
|
+
*/
|
|
170
|
+
getItemName(): string;
|
|
171
|
+
/**
|
|
172
|
+
* Get maximum allowed items count
|
|
173
|
+
* @returns Maximum items number
|
|
174
|
+
*/
|
|
175
|
+
getMaxItems(): number;
|
|
176
|
+
/**
|
|
177
|
+
* Get related item names
|
|
178
|
+
* @returns Related item names array
|
|
179
|
+
*/
|
|
180
|
+
getItemRelatedNames(): string[];
|
|
181
|
+
/**
|
|
182
|
+
* Gets an array of all supported item type names
|
|
183
|
+
* @returns Array of supported type names (includes main item type and related types)
|
|
184
|
+
*/
|
|
185
|
+
getItemSupportedNames(): string[];
|
|
186
|
+
/**
|
|
187
|
+
* Check if items are sortable
|
|
188
|
+
* @returns True if sortable
|
|
189
|
+
*/
|
|
190
|
+
isSortableItems(): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Get the name of the drag zone class
|
|
193
|
+
* @returns Name of the drag zone class
|
|
194
|
+
*/
|
|
195
|
+
getDragZoneClassName(): string;
|
|
196
|
+
/**
|
|
197
|
+
* Get item index
|
|
198
|
+
* @param itemElement - Item element
|
|
199
|
+
* @returns Item index
|
|
200
|
+
*/
|
|
201
|
+
getItemIndex(itemElement?: HTMLElement): number;
|
|
202
|
+
/**
|
|
203
|
+
* Show block actions menu
|
|
204
|
+
*/
|
|
205
|
+
showActions(): void;
|
|
206
|
+
/**
|
|
207
|
+
* Hide block actions menu
|
|
208
|
+
*/
|
|
209
|
+
hideActions(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Create new item
|
|
212
|
+
* @param content - Item content
|
|
213
|
+
* @param index - Insert position
|
|
214
|
+
* @param skipEvents - Skip events
|
|
215
|
+
* @returns True if created
|
|
216
|
+
*/
|
|
217
|
+
createItem(content?: string | unknown, index?: number, skipEvents?: boolean): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Remove item
|
|
220
|
+
* @param index - Item index
|
|
221
|
+
* @returns True if removed
|
|
222
|
+
*/
|
|
223
|
+
removeItem(index?: number): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Get item by index
|
|
226
|
+
* @param index - Item index
|
|
227
|
+
* @returns Item element or null
|
|
228
|
+
*/
|
|
229
|
+
getItem(index: number): HTMLElement | null;
|
|
230
|
+
/**
|
|
231
|
+
* Get all items
|
|
232
|
+
* @returns Array of items
|
|
233
|
+
*/
|
|
234
|
+
getItems(): HTMLElement[];
|
|
235
|
+
/**
|
|
236
|
+
* Get item body by index
|
|
237
|
+
* @param index - Item index
|
|
238
|
+
* @returns Item body or null
|
|
239
|
+
*/
|
|
240
|
+
getItemBody(index: number): HTMLElement | null;
|
|
241
|
+
/**
|
|
242
|
+
* Move item to new position
|
|
243
|
+
* @param index - Item index
|
|
244
|
+
* @param targetIndex - Target item index
|
|
245
|
+
* @param skipEvents - Skip events
|
|
246
|
+
*/
|
|
247
|
+
moveItem(index: number, targetIndex: number, skipEvents?: boolean): void;
|
|
248
|
+
/**
|
|
249
|
+
* Get number of items
|
|
250
|
+
* @returns Item count
|
|
251
|
+
*/
|
|
252
|
+
getItemsLength(): number;
|
|
253
|
+
/** Checks if a new item can be added without exceeding the maximum limit.
|
|
254
|
+
* @returns `true` if allowed, `false` if limit reached
|
|
255
|
+
*/
|
|
256
|
+
canCreateItem(): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Check if block is empty
|
|
259
|
+
* @returns True if empty
|
|
260
|
+
*/
|
|
261
|
+
isEmpty(): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Check if specific item is empty
|
|
264
|
+
* @param index - Item index
|
|
265
|
+
* @returns True if empty
|
|
266
|
+
*/
|
|
267
|
+
isEmptyItem(index: number): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Check if empty detection enabled
|
|
270
|
+
* @returns True if enabled
|
|
271
|
+
*/
|
|
272
|
+
isEmptyDetect(): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Check if backspace removes block
|
|
275
|
+
* @returns True if enabled
|
|
276
|
+
*/
|
|
277
|
+
isBackspaceRemove(): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Check if content is editable
|
|
280
|
+
* @returns True if editable
|
|
281
|
+
*/
|
|
282
|
+
isEditable(): boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Check if items are editable
|
|
285
|
+
* @returns True if editable
|
|
286
|
+
*/
|
|
287
|
+
isEditableItems(): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Check if content is raw
|
|
290
|
+
* @returns True if raw
|
|
291
|
+
*/
|
|
292
|
+
isRaw(): boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Check if normalization enabled
|
|
295
|
+
* @returns True if enabled
|
|
296
|
+
*/
|
|
297
|
+
isNormalize(): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Check if single item only
|
|
300
|
+
* @returns True if single item
|
|
301
|
+
*/
|
|
302
|
+
isSingleItem(): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Check if convertible
|
|
305
|
+
* @returns True if convertible
|
|
306
|
+
*/
|
|
307
|
+
isConvertible(): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Check if custom save enabled
|
|
310
|
+
* @returns True if custom save
|
|
311
|
+
*/
|
|
312
|
+
isCustomSave(): boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Check if tools enabled
|
|
315
|
+
* @returns True if tools enabled
|
|
316
|
+
*/
|
|
317
|
+
isVisibleTools(): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Get available tools
|
|
320
|
+
* @returns Array of tool names
|
|
321
|
+
*/
|
|
322
|
+
getAvailableTools(): string[];
|
|
323
|
+
/**
|
|
324
|
+
* Checks if the sanitizer is enabled
|
|
325
|
+
* @returns True if the sanitizer is enabled
|
|
326
|
+
*/
|
|
327
|
+
isSanitizer(): boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Sanitize block content
|
|
330
|
+
*/
|
|
331
|
+
sanitize(): void;
|
|
332
|
+
/**
|
|
333
|
+
* Get content to normalize
|
|
334
|
+
* @returns Content node(s)
|
|
335
|
+
*/
|
|
336
|
+
toNormalize(): BlockElement | HTMLElement | HTMLElement[] | null;
|
|
337
|
+
/**
|
|
338
|
+
* Get content to sanitize
|
|
339
|
+
* @returns Content node(s)
|
|
340
|
+
*/
|
|
341
|
+
toSanitize(): BlockElement | HTMLElement | HTMLElement[] | null;
|
|
342
|
+
/**
|
|
343
|
+
* Gets the sanitizer configuration for block content
|
|
344
|
+
* @returns Sanitizer configuration object, or empty object if not set
|
|
345
|
+
*/
|
|
346
|
+
getSanitizerConfig(): SanitizerConfig;
|
|
347
|
+
/**
|
|
348
|
+
* Gets the CSS class name for the toasts element
|
|
349
|
+
* @returns The CSS class name as a string
|
|
350
|
+
*/
|
|
351
|
+
getToastsClassName(): string;
|
|
352
|
+
/**
|
|
353
|
+
* Gets the auto-hide timeout for toast messages in milliseconds
|
|
354
|
+
* @returns Timeout duration in milliseconds
|
|
355
|
+
*/
|
|
356
|
+
getToastTimeout(): number;
|
|
357
|
+
/**
|
|
358
|
+
* Gets the Toasts service instance
|
|
359
|
+
* @returns {Toasts} The Toasts service
|
|
360
|
+
*/
|
|
361
|
+
toasts(): Toasts;
|
|
362
|
+
/**
|
|
363
|
+
* Set up global configuration
|
|
364
|
+
* @param config - Configuration object
|
|
365
|
+
* @returns BlockModel class
|
|
366
|
+
*/
|
|
367
|
+
setup?(config: Partial<BlockModelConfig>): BlockModelConstructor;
|
|
368
|
+
}
|
|
369
|
+
/** Data of a block: plain text, array of strings, or child blocks. */
|
|
370
|
+
export type BlockSchemaData = string | string[] | BlockChildSchema[];
|
|
371
|
+
/** HTML attributes as key-value pairs for a block. */
|
|
372
|
+
export type BlockSchemaAttr = Record<string, string>;
|
|
373
|
+
/** Full block model with type, data, attributes, and metadata. */
|
|
374
|
+
export interface BlockSchema {
|
|
375
|
+
type: string;
|
|
376
|
+
data: BlockSchemaData;
|
|
377
|
+
attr?: BlockSchemaAttr;
|
|
378
|
+
lang?: string;
|
|
379
|
+
caption?: string;
|
|
380
|
+
layout?: string;
|
|
381
|
+
style?: string;
|
|
382
|
+
[key: string]: unknown;
|
|
383
|
+
}
|
|
384
|
+
/** Child block element */
|
|
385
|
+
export interface BlockChildSchema {
|
|
386
|
+
type: string;
|
|
387
|
+
data: BlockSchemaData | [];
|
|
388
|
+
attr?: BlockSchemaAttr;
|
|
389
|
+
url?: string;
|
|
390
|
+
desc?: string;
|
|
391
|
+
caption?: string;
|
|
392
|
+
size?: number;
|
|
393
|
+
[key: string]: unknown;
|
|
394
|
+
}
|
|
395
|
+
/** Simplified model for creating a block – type is provided by context, only data is required. */
|
|
396
|
+
export interface BlockCreateSchema extends Omit<BlockSchema, 'type'> {
|
|
397
|
+
data: string | BlockCreateItemSchema[] | unknown[];
|
|
398
|
+
}
|
|
399
|
+
/** Simplified child item model for creation – only type and string data required. */
|
|
400
|
+
export interface BlockCreateItemSchema extends Omit<BlockChildSchema, 'data'> {
|
|
401
|
+
type: string;
|
|
402
|
+
data: string;
|
|
403
|
+
}
|
|
404
|
+
//# sourceMappingURL=block-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-model.d.ts","sourceRoot":"","sources":["../../../../src/types/core/models/block-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AAEnF,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,SAAS,EAAE,UAAU,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,qBAAqB,CAAC;IACnC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC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;AAED,kGAAkG;AAClG,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IAClE,IAAI,EAAE,MAAM,GAAG,qBAAqB,EAAE,GAAG,OAAO,EAAE,CAAC;CACpD;AAED,qFAAqF;AACrF,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseModelConfig, BaseModel, BaseElement, ModelConstructor } from '../..';
|
|
2
|
+
/**
|
|
3
|
+
* Extension model constructor type
|
|
4
|
+
* Specialized constructor that creates ExtensionModel instances
|
|
5
|
+
* with ExtensionModelConfig
|
|
6
|
+
*/
|
|
7
|
+
export type ExtensionModelConstructor = ModelConstructor<ExtensionModel, ExtensionModelConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* Extension DOM node interface
|
|
10
|
+
* Extends HTMLElement with extension model reference
|
|
11
|
+
*/
|
|
12
|
+
export interface ExtensionElement extends BaseElement {
|
|
13
|
+
/** Reference to the extension model instance */
|
|
14
|
+
baseModel: ExtensionModel;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Extension model configuration interface
|
|
18
|
+
* @property toggleActive - Whether extension toggles active state on click
|
|
19
|
+
* @property groupName - Group name for categorization
|
|
20
|
+
*/
|
|
21
|
+
export interface ExtensionModelConfig extends BaseModelConfig {
|
|
22
|
+
toggleActive: boolean;
|
|
23
|
+
groupName: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Extension model behavior interface
|
|
27
|
+
* Defines all public methods for extension manipulation
|
|
28
|
+
*/
|
|
29
|
+
export interface ExtensionModel extends BaseModel<ExtensionElement> {
|
|
30
|
+
/**
|
|
31
|
+
* Get group name for categorization
|
|
32
|
+
* @returns Group name string
|
|
33
|
+
*/
|
|
34
|
+
getGroupName(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Check if extension toggles active state on click
|
|
37
|
+
* @returns True if toggle active is enabled
|
|
38
|
+
*/
|
|
39
|
+
isToggleActive(): boolean;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=extension-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-model.d.ts","sourceRoot":"","sources":["../../../../src/types/core/models/extension-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEzF;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC;AAE/F;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,gDAAgD;IAChD,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACjE;;;OAGG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC;CAC3B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseModelConfig, BaseModel, BaseElement, BlockElement, FileItemElement, ModelConstructor } from '../..';
|
|
2
|
+
/**
|
|
3
|
+
* Block model constructor type
|
|
4
|
+
* Specialized constructor that creates ActionModel instances
|
|
5
|
+
* with ActionModelConfig
|
|
6
|
+
*/
|
|
7
|
+
export type FileActionModelConstructor = ModelConstructor<FileActionModel, FileActionModelConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* File action DOM node interface
|
|
10
|
+
* Extends HTMLElement with action model reference
|
|
11
|
+
*/
|
|
12
|
+
export interface FileActionElement extends BaseElement {
|
|
13
|
+
/** Reference to the action model instance */
|
|
14
|
+
baseModel: FileActionModel;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* File action model configuration interface
|
|
18
|
+
* @property menu - Whether action shows a menu on click
|
|
19
|
+
* @property confirm - Whether action requires confirmation before execution
|
|
20
|
+
*/
|
|
21
|
+
export interface FileActionModelConfig extends BaseModelConfig {
|
|
22
|
+
actions: FileActionModel[];
|
|
23
|
+
}
|
|
24
|
+
export interface FileActionModel extends BaseModel<FileActionElement> {
|
|
25
|
+
/**
|
|
26
|
+
* Returns the parent block node associated with this action.
|
|
27
|
+
* @returns The parent block node or null if not set.
|
|
28
|
+
*/
|
|
29
|
+
getBlockElement(): BlockElement | null;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the file item element.
|
|
32
|
+
* @returns The file item element or null if not set.
|
|
33
|
+
*/
|
|
34
|
+
getItemElement(): FileItemElement | null;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=file-action-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-action-model.d.ts","sourceRoot":"","sources":["../../../../src/types/core/models/file-action-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExH;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;AAElG;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,6CAA6C;IAC7C,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACnE;;;OAGG;IACH,eAAe,IAAI,YAAY,GAAG,IAAI,CAAC;IAEvC;;;OAGG;IACH,cAAc,IAAI,eAAe,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/core/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BaseModelConfig, BaseElement, ModelConstructor, BlockElement } from '../..';
|
|
2
|
+
import { BaseModel } from '../base/base-model';
|
|
3
|
+
/**
|
|
4
|
+
* Tool model constructor type
|
|
5
|
+
* Specialized constructor that creates ToolModel instances
|
|
6
|
+
* with ToolModelConfig
|
|
7
|
+
*/
|
|
8
|
+
export type ToolModelConstructor = ModelConstructor<ToolModel, ToolModelConfig>;
|
|
9
|
+
export interface ToolElement extends BaseElement {
|
|
10
|
+
baseModel: ToolModel;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tool model configuration interface
|
|
14
|
+
* @property tagName - Tool HTML tag name for formatting
|
|
15
|
+
* @property override - Overriding tag
|
|
16
|
+
*/
|
|
17
|
+
export interface ToolModelConfig extends BaseModelConfig {
|
|
18
|
+
tagName: string;
|
|
19
|
+
override: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Tool model behavior interface
|
|
23
|
+
* Defines all public methods for tool manipulation
|
|
24
|
+
*/
|
|
25
|
+
export interface ToolModel extends BaseModel<ToolElement> {
|
|
26
|
+
/**
|
|
27
|
+
* Get tool tag name
|
|
28
|
+
* @returns Tag name string
|
|
29
|
+
*/
|
|
30
|
+
getTagName(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get the parent block node associated with this action
|
|
33
|
+
* @returns The parent block node or null if not set
|
|
34
|
+
*/
|
|
35
|
+
getBlockElement(): BlockElement | null;
|
|
36
|
+
/**
|
|
37
|
+
* Apply format to selected content
|
|
38
|
+
*/
|
|
39
|
+
format(onlyRemove?: boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Force create format on selected content (without toggling)
|
|
42
|
+
*/
|
|
43
|
+
forcedFormat(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Remove format from selected content
|
|
46
|
+
*/
|
|
47
|
+
removeFormat(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Overriding tag
|
|
50
|
+
* @returns boolean
|
|
51
|
+
*/
|
|
52
|
+
isOverride(): boolean;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=tool-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-model.d.ts","sourceRoot":"","sources":["../../../../src/types/core/models/tool-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAEhF,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,SAAS,CAAC,WAAW,CAAC;IACvD;;;OAGG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;OAGG;IACH,eAAe,IAAI,YAAY,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;OAEG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface SanitizerConfig {
|
|
2
|
+
elements?: string[];
|
|
3
|
+
attributes?: Record<string, string[]>;
|
|
4
|
+
allowComments?: boolean;
|
|
5
|
+
protocols?: Record<string, Record<string, string[]>>;
|
|
6
|
+
addAttributes?: Record<string, Record<string, string>>;
|
|
7
|
+
dom?: Document;
|
|
8
|
+
removeContents?: string[] | boolean;
|
|
9
|
+
transformers?: Array<(context: TransformerContext) => TransformerOutput | null>;
|
|
10
|
+
removeAllContents?: boolean;
|
|
11
|
+
removeElementContents?: object;
|
|
12
|
+
}
|
|
13
|
+
export interface TransformerContext {
|
|
14
|
+
allowedElements: Record<string, boolean>;
|
|
15
|
+
config: SanitizerConfig;
|
|
16
|
+
node: Node;
|
|
17
|
+
nodeName: string;
|
|
18
|
+
whitelistNodes: Node[];
|
|
19
|
+
dom: Document;
|
|
20
|
+
}
|
|
21
|
+
export interface TransformerOutput {
|
|
22
|
+
whitelist?: boolean;
|
|
23
|
+
attrWhitelist?: string[];
|
|
24
|
+
node?: Node;
|
|
25
|
+
whitelistNodes?: Node[];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=sanitizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizer.d.ts","sourceRoot":"","sources":["../../../src/types/core/sanitizer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,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