@lakamark/modulo-editor 0.2.0-alpha.1
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 +21 -0
- package/README.md +73 -0
- package/dist/modulo-editor.js +1018 -0
- package/dist/modulo-editor.js.map +1 -0
- package/dist/modulo-editor.umd.cjs +5 -0
- package/dist/modulo-editor.umd.cjs.map +1 -0
- package/dist/types/commands/builtin/BoldCommand.d.ts +9 -0
- package/dist/types/commands/builtin/BoldCommand.d.ts.map +1 -0
- package/dist/types/commands/builtin/HeadingCommand.d.ts +8 -0
- package/dist/types/commands/builtin/HeadingCommand.d.ts.map +1 -0
- package/dist/types/commands/builtin/ItalicCommand.d.ts +6 -0
- package/dist/types/commands/builtin/ItalicCommand.d.ts.map +1 -0
- package/dist/types/commands/builtin/index.d.ts +11 -0
- package/dist/types/commands/builtin/index.d.ts.map +1 -0
- package/dist/types/commands/contracts/EditorCommand.d.ts +18 -0
- package/dist/types/commands/contracts/EditorCommand.d.ts.map +1 -0
- package/dist/types/commands/contracts/EditorCommandContext.d.ts +15 -0
- package/dist/types/commands/contracts/EditorCommandContext.d.ts.map +1 -0
- package/dist/types/commands/contracts/EditorInput.d.ts +14 -0
- package/dist/types/commands/contracts/EditorInput.d.ts.map +1 -0
- package/dist/types/commands/contracts/index.d.ts +4 -0
- package/dist/types/commands/contracts/index.d.ts.map +1 -0
- package/dist/types/commands/index.d.ts +5 -0
- package/dist/types/commands/index.d.ts.map +1 -0
- package/dist/types/commands/registry/EditorCommandRegistry.d.ts +28 -0
- package/dist/types/commands/registry/EditorCommandRegistry.d.ts.map +1 -0
- package/dist/types/commands/registry/EditorCommandsApi.d.ts +14 -0
- package/dist/types/commands/registry/EditorCommandsApi.d.ts.map +1 -0
- package/dist/types/commands/registry/RegistryEditorCommandsApi.d.ts +20 -0
- package/dist/types/commands/registry/RegistryEditorCommandsApi.d.ts.map +1 -0
- package/dist/types/commands/registry/index.d.ts +4 -0
- package/dist/types/commands/registry/index.d.ts.map +1 -0
- package/dist/types/commands/setup/assertCustomCommandsAreValid.d.ts +12 -0
- package/dist/types/commands/setup/assertCustomCommandsAreValid.d.ts.map +1 -0
- package/dist/types/commands/setup/builtin-command-names.d.ts +16 -0
- package/dist/types/commands/setup/builtin-command-names.d.ts.map +1 -0
- package/dist/types/commands/setup/index.d.ts +6 -0
- package/dist/types/commands/setup/index.d.ts.map +1 -0
- package/dist/types/commands/setup/resolveBuiltinCommands.d.ts +4 -0
- package/dist/types/commands/setup/resolveBuiltinCommands.d.ts.map +1 -0
- package/dist/types/commands/setup/setupEditorCommands.d.ts +30 -0
- package/dist/types/commands/setup/setupEditorCommands.d.ts.map +1 -0
- package/dist/types/core/Builder/DefaultModuloEditorBuilder.d.ts +117 -0
- package/dist/types/core/Builder/DefaultModuloEditorBuilder.d.ts.map +1 -0
- package/dist/types/core/Builder/index.d.ts +2 -0
- package/dist/types/core/Builder/index.d.ts.map +1 -0
- package/dist/types/core/DefaultEditorDocument.d.ts +11 -0
- package/dist/types/core/DefaultEditorDocument.d.ts.map +1 -0
- package/dist/types/core/ModuloEditor.d.ts +93 -0
- package/dist/types/core/ModuloEditor.d.ts.map +1 -0
- package/dist/types/core/contracts/EditorDocument.d.ts +16 -0
- package/dist/types/core/contracts/EditorDocument.d.ts.map +1 -0
- package/dist/types/core/contracts/ModuloEditorBuilder.d.ts +23 -0
- package/dist/types/core/contracts/ModuloEditorBuilder.d.ts.map +1 -0
- package/dist/types/core/contracts/ModuloEditorOptions.d.ts +52 -0
- package/dist/types/core/contracts/ModuloEditorOptions.d.ts.map +1 -0
- package/dist/types/core/contracts/index.d.ts +4 -0
- package/dist/types/core/contracts/index.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +6 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/dom/DefaultEditorDomResolver.d.ts +42 -0
- package/dist/types/dom/DefaultEditorDomResolver.d.ts.map +1 -0
- package/dist/types/dom/contracts/EditorDomResolver.d.ts +20 -0
- package/dist/types/dom/contracts/EditorDomResolver.d.ts.map +1 -0
- package/dist/types/dom/contracts/EditorDomSlots.d.ts +62 -0
- package/dist/types/dom/contracts/EditorDomSlots.d.ts.map +1 -0
- package/dist/types/dom/contracts/index.d.ts +3 -0
- package/dist/types/dom/contracts/index.d.ts.map +1 -0
- package/dist/types/dom/index.d.ts +2 -0
- package/dist/types/dom/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/EditorInputAdapter.d.ts +17 -0
- package/dist/types/input/EditorInputAdapter.d.ts.map +1 -0
- package/dist/types/input/EditorInputState.d.ts +6 -0
- package/dist/types/input/EditorInputState.d.ts.map +1 -0
- package/dist/types/input/TextareaInputAdapter.d.ts +18 -0
- package/dist/types/input/TextareaInputAdapter.d.ts.map +1 -0
- package/dist/types/input/index.d.ts +4 -0
- package/dist/types/input/index.d.ts.map +1 -0
- package/dist/types/markdown/config/ConfigurableHtmlSanitizer.d.ts +23 -0
- package/dist/types/markdown/config/ConfigurableHtmlSanitizer.d.ts.map +1 -0
- package/dist/types/markdown/config/DefaultHtmlSanitizerConfig.d.ts +6 -0
- package/dist/types/markdown/config/DefaultHtmlSanitizerConfig.d.ts.map +1 -0
- package/dist/types/markdown/config/HtmlSanitizerConfig.d.ts +14 -0
- package/dist/types/markdown/config/HtmlSanitizerConfig.d.ts.map +1 -0
- package/dist/types/markdown/config/index.d.ts +4 -0
- package/dist/types/markdown/config/index.d.ts.map +1 -0
- package/dist/types/markdown/contracts/HtmlSanitizer.d.ts +15 -0
- package/dist/types/markdown/contracts/HtmlSanitizer.d.ts.map +1 -0
- package/dist/types/markdown/contracts/MarkdownParser.d.ts +12 -0
- package/dist/types/markdown/contracts/MarkdownParser.d.ts.map +1 -0
- package/dist/types/markdown/contracts/MarkdownProcessor.d.ts +12 -0
- package/dist/types/markdown/contracts/MarkdownProcessor.d.ts.map +1 -0
- package/dist/types/markdown/contracts/index.d.ts +4 -0
- package/dist/types/markdown/contracts/index.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +6 -0
- package/dist/types/markdown/index.d.ts.map +1 -0
- package/dist/types/markdown/parser/DefaultMarkdownProcessor.d.ts +18 -0
- package/dist/types/markdown/parser/DefaultMarkdownProcessor.d.ts.map +1 -0
- package/dist/types/markdown/parser/PlainTextMarkdownParser.d.ts +11 -0
- package/dist/types/markdown/parser/PlainTextMarkdownParser.d.ts.map +1 -0
- package/dist/types/markdown/parser/index.d.ts +3 -0
- package/dist/types/markdown/parser/index.d.ts.map +1 -0
- package/dist/types/markdown/sanitizers/DomPurifyHtmlSanitizer.d.ts +27 -0
- package/dist/types/markdown/sanitizers/DomPurifyHtmlSanitizer.d.ts.map +1 -0
- package/dist/types/markdown/sanitizers/NoopHtmlSanitizer.d.ts +11 -0
- package/dist/types/markdown/sanitizers/NoopHtmlSanitizer.d.ts.map +1 -0
- package/dist/types/markdown/sanitizers/index.d.ts +3 -0
- package/dist/types/markdown/sanitizers/index.d.ts.map +1 -0
- package/dist/types/output/EditorOutputAdapter.d.ts +25 -0
- package/dist/types/output/EditorOutputAdapter.d.ts.map +1 -0
- package/dist/types/output/HtmlPreviewAdapter.d.ts +20 -0
- package/dist/types/output/HtmlPreviewAdapter.d.ts.map +1 -0
- package/dist/types/output/index.d.ts +3 -0
- package/dist/types/output/index.d.ts.map +1 -0
- package/dist/types/plugins/contracts/EditorPlugin.d.ts +19 -0
- package/dist/types/plugins/contracts/EditorPlugin.d.ts.map +1 -0
- package/dist/types/plugins/contracts/EditorPluginApi.d.ts +11 -0
- package/dist/types/plugins/contracts/EditorPluginApi.d.ts.map +1 -0
- package/dist/types/plugins/contracts/index.d.ts +3 -0
- package/dist/types/plugins/contracts/index.d.ts.map +1 -0
- package/dist/types/plugins/index.d.ts +3 -0
- package/dist/types/plugins/index.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/base/CommandButtonPlugin.d.ts +31 -0
- package/dist/types/plugins/toolbar/base/CommandButtonPlugin.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/base/CommandButtonPluginOptions.d.ts +23 -0
- package/dist/types/plugins/toolbar/base/CommandButtonPluginOptions.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/base/index.d.ts +3 -0
- package/dist/types/plugins/toolbar/base/index.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/buttons/BoldToolbarPlugin.d.ts +8 -0
- package/dist/types/plugins/toolbar/buttons/BoldToolbarPlugin.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/buttons/HeadingToolbarPlugin.d.ts +5 -0
- package/dist/types/plugins/toolbar/buttons/HeadingToolbarPlugin.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/buttons/ItalicToolbarPlugin.d.ts +5 -0
- package/dist/types/plugins/toolbar/buttons/ItalicToolbarPlugin.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/buttons/index.d.ts +4 -0
- package/dist/types/plugins/toolbar/buttons/index.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/createDefaultToolbarPlugins.d.ts +6 -0
- package/dist/types/plugins/toolbar/createDefaultToolbarPlugins.d.ts.map +1 -0
- package/dist/types/plugins/toolbar/index.d.ts +4 -0
- package/dist/types/plugins/toolbar/index.d.ts.map +1 -0
- package/dist/types/textarea/HiddenTextareaBridge.d.ts +12 -0
- package/dist/types/textarea/HiddenTextareaBridge.d.ts.map +1 -0
- package/dist/types/textarea/TextareaBridge.d.ts +24 -0
- package/dist/types/textarea/TextareaBridge.d.ts.map +1 -0
- package/dist/types/textarea/index.d.ts +3 -0
- package/dist/types/textarea/index.d.ts.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of builtin command names reserved by the editor core.
|
|
3
|
+
*
|
|
4
|
+
* These names cannot be overridden by user-defined commands,
|
|
5
|
+
* even if the builtin command is not enabled.
|
|
6
|
+
*/
|
|
7
|
+
export declare const BUILTIN_COMMAND_NAMES: readonly ["bold", "italic", "heading"];
|
|
8
|
+
/**
|
|
9
|
+
* Type representing a builtin command name.
|
|
10
|
+
*/
|
|
11
|
+
export type BuiltinCommandName = typeof BUILTIN_COMMAND_NAMES[number];
|
|
12
|
+
/**
|
|
13
|
+
* Checks whether a command name is reserved by the editor core.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isBuiltinCommandName(name: string): name is BuiltinCommandName;
|
|
16
|
+
//# sourceMappingURL=builtin-command-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-command-names.d.ts","sourceRoot":"","sources":["../../../../src/commands/setup/builtin-command-names.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,wCAIxB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAEtE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,kBAAkB,CAE7E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { assertCustomCommandsAreValid } from "./assertCustomCommandsAreValid";
|
|
2
|
+
export { resolveBuiltinCommands } from "./resolveBuiltinCommands";
|
|
3
|
+
export { isBuiltinCommandName, BUILTIN_COMMAND_NAMES } from "./builtin-command-names";
|
|
4
|
+
export type { BuiltinCommandName } from "./builtin-command-names";
|
|
5
|
+
export type { SetupEditorCommandsOptions } from "./setupEditorCommands";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/setup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BuiltinCommandName } from "./builtin-command-names";
|
|
2
|
+
import type { EditorCommand } from "../contracts";
|
|
3
|
+
export declare function resolveBuiltinCommands(option: boolean | readonly BuiltinCommandName[] | undefined): readonly EditorCommand[];
|
|
4
|
+
//# sourceMappingURL=resolveBuiltinCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBuiltinCommands.d.ts","sourceRoot":"","sources":["../../../../src/commands/setup/resolveBuiltinCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAGhD,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,OAAO,GAAG,SAAS,kBAAkB,EAAE,GAAG,SAAS,GAC5D,SAAS,aAAa,EAAE,CAgB1B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BuiltinCommandName } from "./builtin-command-names";
|
|
2
|
+
import type { EditorCommand } from "../contracts";
|
|
3
|
+
import { EditorCommandRegistry } from "../registry";
|
|
4
|
+
/**
|
|
5
|
+
* Options used to configure editor commands.
|
|
6
|
+
*/
|
|
7
|
+
export interface SetupEditorCommandsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Controls which builtin commands are enabled.
|
|
10
|
+
*
|
|
11
|
+
* - true / undefined → enable all builtin commands
|
|
12
|
+
* - false → disable all builtin commands
|
|
13
|
+
* - string[] → enable only specified builtin commands
|
|
14
|
+
*/
|
|
15
|
+
readonly builtinCommands?: boolean | readonly BuiltinCommandName[];
|
|
16
|
+
/**
|
|
17
|
+
* Custom commands provided by the user.
|
|
18
|
+
*/
|
|
19
|
+
readonly commands?: readonly EditorCommand[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Registers builtin and custom commands into the registry.
|
|
23
|
+
*
|
|
24
|
+
* This function:
|
|
25
|
+
* - resolves builtin commands
|
|
26
|
+
* - validates custom commands
|
|
27
|
+
* - registers commands in the correct order
|
|
28
|
+
*/
|
|
29
|
+
export declare function setupEditorCommands(registry: EditorCommandRegistry, options: SetupEditorCommandsOptions): void;
|
|
30
|
+
//# sourceMappingURL=setupEditorCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupEditorCommands.d.ts","sourceRoot":"","sources":["../../../../src/commands/setup/setupEditorCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAIlD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,kBAAkB,EAAE,CAAC;IAEnE;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,0BAA0B,GACpC,IAAI,CA+BN"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ModuloEditor } from "../ModuloEditor";
|
|
2
|
+
import type { EditorPlugin } from "../../plugins";
|
|
3
|
+
import type { ModuloEditorBuilder } from "../contracts";
|
|
4
|
+
/**
|
|
5
|
+
* Default fluent builder implementation for ModuloEditor.
|
|
6
|
+
*
|
|
7
|
+
* This builder provides a high-level API for common editor setups.
|
|
8
|
+
* It creates a fully configured editor instance using the default
|
|
9
|
+
* DOM resolver, adapters, Markdown processor, sanitizer, textarea bridge,
|
|
10
|
+
* and default toolbar plugins.
|
|
11
|
+
*
|
|
12
|
+
* For advanced and fully manual setups, the `ModuloEditor` constructor
|
|
13
|
+
* can still be used directly.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const editor = ModuloEditor
|
|
18
|
+
* .create('[data-mo-editor]')
|
|
19
|
+
* .init();
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const editor = ModuloEditor
|
|
25
|
+
* .create('[data-mo-editor]')
|
|
26
|
+
* .withoutPlugins()
|
|
27
|
+
* .init();
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const editor = ModuloEditor
|
|
33
|
+
* .create('[data-mo-editor]')
|
|
34
|
+
* .use(new BoldToolbarPlugin(), new ItalicToolbarPlugin())
|
|
35
|
+
* .init();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class DefaultModuloEditorBuilder implements ModuloEditorBuilder {
|
|
39
|
+
/**
|
|
40
|
+
* Optional custom plugins explicitly configured by the user.
|
|
41
|
+
*
|
|
42
|
+
* - `undefined` means: use default toolbar plugins
|
|
43
|
+
* - `false` means: disable all plugins
|
|
44
|
+
* - `EditorPlugin[]` means: use the provided plugin list
|
|
45
|
+
*/
|
|
46
|
+
private plugins;
|
|
47
|
+
/**
|
|
48
|
+
* Root editor selector or HTMLElement used to initialize the editor.
|
|
49
|
+
*/
|
|
50
|
+
private readonly root;
|
|
51
|
+
/**
|
|
52
|
+
* Indicates whether the builder has already been initialized.
|
|
53
|
+
*
|
|
54
|
+
* Used to prevent multiple init() calls and configuration changes
|
|
55
|
+
* after initialization.
|
|
56
|
+
*/
|
|
57
|
+
private initialized;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new builder bound to the provided root selector or element.
|
|
60
|
+
*
|
|
61
|
+
* @param root CSS selector or root HTMLElement used to resolve the editor DOM.
|
|
62
|
+
*/
|
|
63
|
+
constructor(root: string | HTMLElement);
|
|
64
|
+
/**
|
|
65
|
+
* Replaces the default plugin list with the provided plugins.
|
|
66
|
+
*
|
|
67
|
+
* Calling this method disables the automatic default toolbar plugin setup
|
|
68
|
+
* and uses only the plugins passed here.
|
|
69
|
+
*
|
|
70
|
+
* @param plugins Plugins to mount on the editor instance.
|
|
71
|
+
*
|
|
72
|
+
* @returns The current builder instance.
|
|
73
|
+
*
|
|
74
|
+
* @throws Error When called after init().
|
|
75
|
+
*/
|
|
76
|
+
use(...plugins: EditorPlugin[]): this;
|
|
77
|
+
/**
|
|
78
|
+
* Disables all plugins for the editor instance.
|
|
79
|
+
*
|
|
80
|
+
* @returns The current builder instance.
|
|
81
|
+
*
|
|
82
|
+
* @throws Error When called after init().
|
|
83
|
+
*/
|
|
84
|
+
withoutPlugins(): this;
|
|
85
|
+
/**
|
|
86
|
+
* Builds and initializes a new ModuloEditor instance.
|
|
87
|
+
*
|
|
88
|
+
* This method resolves the root element, creates all default editor
|
|
89
|
+
* dependencies, mounts the configured plugin list, initializes the editor,
|
|
90
|
+
* and returns the initialized instance.
|
|
91
|
+
*
|
|
92
|
+
* @returns The initialized editor instance.
|
|
93
|
+
*
|
|
94
|
+
* @throws Error When the configured root selector does not match any element.
|
|
95
|
+
*/
|
|
96
|
+
init(): ModuloEditor;
|
|
97
|
+
/**
|
|
98
|
+
* Resolves the configured root into a concrete HTMLElement.
|
|
99
|
+
*
|
|
100
|
+
* When a selector string is provided, the element is queried from the DOM.
|
|
101
|
+
* When an HTMLElement is provided directly, it is returned as-is.
|
|
102
|
+
*
|
|
103
|
+
* @param root CSS selector or root HTMLElement.
|
|
104
|
+
*
|
|
105
|
+
* @returns The resolved root HTMLElement.
|
|
106
|
+
*
|
|
107
|
+
* @throws Error When the selector does not match any HTMLElement.
|
|
108
|
+
*/
|
|
109
|
+
private resolveRoot;
|
|
110
|
+
/**
|
|
111
|
+
* Ensures the builder has not been initialized yet.
|
|
112
|
+
*
|
|
113
|
+
* @throws Error When a configuration method is called after init().
|
|
114
|
+
*/
|
|
115
|
+
private assertNotInitialized;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=DefaultModuloEditorBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultModuloEditorBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/Builder/DefaultModuloEditorBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAclD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IAClE;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,CAAqC;IAEpD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuB;IAE5C;;;;;OAKG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;OAIG;gBACgB,IAAI,EAAE,MAAM,GAAG,WAAW;IAI7C;;;;;;;;;;;OAWG;IACI,GAAG,CAAC,GAAG,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI;IAQ5C;;;;;;OAMG;IACI,cAAc,IAAI,IAAI;IAQ7B;;;;;;;;;;OAUG;IACI,IAAI,IAAI,YAAY;IAgC3B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;IAcnB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;CAO/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/Builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditorDocument } from "./contracts";
|
|
2
|
+
/**
|
|
3
|
+
* Default implementation of EditorDocument.
|
|
4
|
+
*/
|
|
5
|
+
export declare class DefaultEditorDocument implements EditorDocument {
|
|
6
|
+
private content;
|
|
7
|
+
constructor(content?: string);
|
|
8
|
+
getRawContent(): string;
|
|
9
|
+
setRawContent(content: string): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=DefaultEditorDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultEditorDocument.d.ts","sourceRoot":"","sources":["../../../src/core/DefaultEditorDocument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,cAAc;IACxD,OAAO,CAAC,OAAO,CAAS;gBAEL,OAAO,GAAE,MAAW;IAIhC,aAAa,IAAI,MAAM;IAIvB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG9C"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ModuloEditorBuilder, ModuloEditorOptions } from "./contracts";
|
|
2
|
+
/**
|
|
3
|
+
* Main editor orchestrator.
|
|
4
|
+
*
|
|
5
|
+
* ModuloEditor connects:
|
|
6
|
+
*
|
|
7
|
+
* - EditorDocument → source of truth
|
|
8
|
+
* - EditorInputAdapter → editing layer
|
|
9
|
+
* - MarkdownProcessor → transforms content to HTML
|
|
10
|
+
* - EditorOutputAdapter → preview renderer
|
|
11
|
+
* - EditorCommandsApi → command execution
|
|
12
|
+
* - EditorPlugin → UI extensions
|
|
13
|
+
*
|
|
14
|
+
* Responsibilities:
|
|
15
|
+
*
|
|
16
|
+
* - initialize editor state
|
|
17
|
+
* - synchronize input → document → preview
|
|
18
|
+
* - execute commands
|
|
19
|
+
* - mount plugins
|
|
20
|
+
* - manage lifecycle (init / destroy)
|
|
21
|
+
*/
|
|
22
|
+
export declare class ModuloEditor {
|
|
23
|
+
private readonly document;
|
|
24
|
+
private readonly input;
|
|
25
|
+
private readonly output;
|
|
26
|
+
private readonly markdown;
|
|
27
|
+
private readonly plugins;
|
|
28
|
+
private readonly commands;
|
|
29
|
+
private readonly root;
|
|
30
|
+
private readonly domResolver;
|
|
31
|
+
private readonly textareaBridge?;
|
|
32
|
+
private unsubscribeInputChange?;
|
|
33
|
+
private initialized;
|
|
34
|
+
private slots;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new ModuloEditor instance.
|
|
37
|
+
*
|
|
38
|
+
* Commands and plugins are registered but not initialized
|
|
39
|
+
* until `init()` is called.
|
|
40
|
+
*/
|
|
41
|
+
constructor({ document, input, output, markdown, commands, plugins, builtinCommands, root, domResolver, textareaBridge, }: ModuloEditorOptions);
|
|
42
|
+
static create(root: string | HTMLElement): ModuloEditorBuilder;
|
|
43
|
+
/**
|
|
44
|
+
* Initializes the editor.
|
|
45
|
+
*
|
|
46
|
+
* - hydrates input from document
|
|
47
|
+
* - renders initial preview
|
|
48
|
+
* - subscribes to input changes
|
|
49
|
+
* - mounts plugins
|
|
50
|
+
*/
|
|
51
|
+
init(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Destroys the editor.
|
|
54
|
+
*
|
|
55
|
+
* - unsubscribes input listeners
|
|
56
|
+
* - destroys plugins
|
|
57
|
+
* - destroys adapters
|
|
58
|
+
*/
|
|
59
|
+
destroy(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the editor value and synchronizes all layers.
|
|
62
|
+
*/
|
|
63
|
+
setValue(value: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the current editor raw value.
|
|
66
|
+
*/
|
|
67
|
+
getValue(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Executes a registered command and synchronizes editor state.
|
|
70
|
+
*/
|
|
71
|
+
executeCommand(name: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Focuses the editor input.
|
|
74
|
+
*/
|
|
75
|
+
focus(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Handles input changes by synchronizing the document and preview.
|
|
78
|
+
*/
|
|
79
|
+
private handleInputChange;
|
|
80
|
+
/**
|
|
81
|
+
* Synchronizes document and preview from the current input value.
|
|
82
|
+
*/
|
|
83
|
+
private syncFromInput;
|
|
84
|
+
/**
|
|
85
|
+
* Creates the current command execution context.
|
|
86
|
+
*/
|
|
87
|
+
private createCommandContext;
|
|
88
|
+
/**
|
|
89
|
+
* Creates the API exposed to plugins.
|
|
90
|
+
*/
|
|
91
|
+
private createPluginApi;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=ModuloEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuloEditor.d.ts","sourceRoot":"","sources":["../../../src/core/ModuloEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,aAAa,CAAC;AAuBrB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAwC;IAExE,OAAO,CAAC,sBAAsB,CAAC,CAAa;IAC5C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAkB;IAE/B;;;;;OAKG;gBAEC,EACI,QAAsC,EACtC,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAa,EACb,OAAY,EACZ,eAAsB,EACtB,IAAI,EACJ,WAAW,EACX,cAAc,GACjB,EAAE,mBAAmB;WAuBZ,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,mBAAmB;IAIrE;;;;;;;OAOG;IACI,IAAI,IAAI,IAAI;IA6BnB;;;;;;OAMG;IACI,OAAO,IAAI,IAAI;IAoBtB;;OAEG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQpC;;OAEG;IACI,QAAQ,IAAI,MAAM;IAIzB;;OAEG;IACI,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IASzC;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;OAEG;IACH,OAAO,CAAC,eAAe;CAS1B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the editor document state.
|
|
3
|
+
*
|
|
4
|
+
* This is the single source of truth for the editor content.
|
|
5
|
+
*/
|
|
6
|
+
export interface EditorDocument {
|
|
7
|
+
/**
|
|
8
|
+
* Return the raw Markdown content.
|
|
9
|
+
*/
|
|
10
|
+
getRawContent(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Updates the raw Markdown content.
|
|
13
|
+
*/
|
|
14
|
+
setRawContent(content: string): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=EditorDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorDocument.d.ts","sourceRoot":"","sources":["../../../../src/core/contracts/EditorDocument.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EditorPlugin } from "../../plugins";
|
|
2
|
+
import type { ModuloEditor } from "../ModuloEditor";
|
|
3
|
+
/**
|
|
4
|
+
* Fluent builder used to configure and create a ModuloEditor instance.
|
|
5
|
+
*
|
|
6
|
+
* This builder provides a higher-level API for common editor setups while
|
|
7
|
+
* keeping the low-level `ModuloEditor` constructor available for advanced use cases.
|
|
8
|
+
*/
|
|
9
|
+
export interface ModuloEditorBuilder {
|
|
10
|
+
/**
|
|
11
|
+
* Replaces the default plugin list with the provided plugins.
|
|
12
|
+
*/
|
|
13
|
+
use(...plugins: EditorPlugin[]): this;
|
|
14
|
+
/**
|
|
15
|
+
* Disables all default plugins.
|
|
16
|
+
*/
|
|
17
|
+
withoutPlugins(): this;
|
|
18
|
+
/**
|
|
19
|
+
* Builds and initializes the editor instance.
|
|
20
|
+
*/
|
|
21
|
+
init(): ModuloEditor;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ModuloEditorBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuloEditorBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/contracts/ModuloEditorBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,GAAG,CAAC,GAAG,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB;;OAEG;IACH,IAAI,IAAI,YAAY,CAAC;CACxB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { EditorDocument } from "./EditorDocument";
|
|
2
|
+
import type { EditorInputAdapter } from "../../input";
|
|
3
|
+
import type { EditorOutputAdapter } from "../../output";
|
|
4
|
+
import type { MarkdownProcessor } from "../../markdown";
|
|
5
|
+
import type { EditorPlugin } from "../../plugins";
|
|
6
|
+
import type { EditorDomResolver } from "../../dom/contracts";
|
|
7
|
+
import type { TextareaBridge } from "../../textarea";
|
|
8
|
+
import type { BuiltinCommandName, EditorCommand } from "../../commands";
|
|
9
|
+
/**
|
|
10
|
+
* Options used to configure a ModuloEditor instance.
|
|
11
|
+
*/
|
|
12
|
+
export interface ModuloEditorOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Optional document used as the initial source of truth.
|
|
15
|
+
*/
|
|
16
|
+
readonly document?: EditorDocument;
|
|
17
|
+
/**
|
|
18
|
+
* Input adapter responsible for editor interactions.
|
|
19
|
+
*/
|
|
20
|
+
readonly input: EditorInputAdapter;
|
|
21
|
+
/**
|
|
22
|
+
* Output adapter responsible for preview rendering.
|
|
23
|
+
*/
|
|
24
|
+
readonly output: EditorOutputAdapter;
|
|
25
|
+
/**
|
|
26
|
+
* Markdown processor used to transform raw content into HTML.
|
|
27
|
+
*/
|
|
28
|
+
readonly markdown: MarkdownProcessor;
|
|
29
|
+
/**
|
|
30
|
+
* Custom commands provided by the user.
|
|
31
|
+
*/
|
|
32
|
+
readonly commands?: readonly EditorCommand[];
|
|
33
|
+
/**
|
|
34
|
+
* Plugins mounted into the editor lifecycle.
|
|
35
|
+
*/
|
|
36
|
+
readonly plugins?: readonly EditorPlugin[];
|
|
37
|
+
/**
|
|
38
|
+
* Controls which builtin commands are enabled.
|
|
39
|
+
*
|
|
40
|
+
* - true / undefined → enable all builtin commands
|
|
41
|
+
* - false → disable all builtin commands
|
|
42
|
+
* - string[] → enable only specified builtin commands
|
|
43
|
+
*/
|
|
44
|
+
readonly builtinCommands?: boolean | readonly BuiltinCommandName[];
|
|
45
|
+
readonly root: HTMLElement;
|
|
46
|
+
readonly domResolver?: EditorDomResolver;
|
|
47
|
+
/**
|
|
48
|
+
* Optional bridge used to synchronize a hidden textarea.
|
|
49
|
+
*/
|
|
50
|
+
readonly textareaBridge?: TextareaBridge;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ModuloEditorOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuloEditorOptions.d.ts","sourceRoot":"","sources":["../../../../src/core/contracts/ModuloEditorOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EACR,kBAAkB,EAClB,aAAa,EAChB,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAE7C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAE3C;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,kBAAkB,EAAE,CAAC;IAEnE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/contracts/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ModuloEditor } from "./ModuloEditor";
|
|
2
|
+
export type { ModuloEditorOptions } from "./contracts/ModuloEditorOptions";
|
|
3
|
+
export type { EditorDocument } from "./contracts/EditorDocument";
|
|
4
|
+
export { DefaultEditorDocument } from "./DefaultEditorDocument";
|
|
5
|
+
export type { ModuloEditorBuilder } from "./contracts";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { EditorDomResolver, EditorDomSlots } from "./contracts";
|
|
2
|
+
/**
|
|
3
|
+
* Default implementation of EditorDomResolver.
|
|
4
|
+
*
|
|
5
|
+
* This resolver expects the following data attributes:
|
|
6
|
+
*
|
|
7
|
+
* Required:
|
|
8
|
+
* - data-mo-editor-input
|
|
9
|
+
* - data-mo-editor-preview
|
|
10
|
+
* - data-mo-editor-textarea
|
|
11
|
+
*
|
|
12
|
+
* Optional:
|
|
13
|
+
* - data-mo-editor-header
|
|
14
|
+
* - data-mo-editor-toolbar
|
|
15
|
+
* - data-mo-editor-body
|
|
16
|
+
* - data-mo-editor-footer
|
|
17
|
+
* - data-mo-editor-status
|
|
18
|
+
*
|
|
19
|
+
* Example structure:
|
|
20
|
+
*
|
|
21
|
+
* <div data-mo-editor>
|
|
22
|
+
* <div data-mo-editor-header></div>
|
|
23
|
+
* <div data-mo-editor-toolbar></div>
|
|
24
|
+
* <div data-mo-editor-input></div>
|
|
25
|
+
* <div data-mo-editor-preview></div>
|
|
26
|
+
* <textarea data-mo-editor-textarea></textarea>
|
|
27
|
+
* </div>
|
|
28
|
+
*/
|
|
29
|
+
export declare class DefaultEditorDomResolver implements EditorDomResolver {
|
|
30
|
+
/**
|
|
31
|
+
* Resolves DOM slots from the provided root element.
|
|
32
|
+
*/
|
|
33
|
+
resolve(root: HTMLElement): EditorDomSlots;
|
|
34
|
+
/**
|
|
35
|
+
* Finds a DOM element using the data-mo-editor-* convention.
|
|
36
|
+
*
|
|
37
|
+
* @param root - Root element
|
|
38
|
+
* @param attributeName - Slot name
|
|
39
|
+
*/
|
|
40
|
+
private getDataAttribute;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=DefaultEditorDomResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultEditorDomResolver.d.ts","sourceRoot":"","sources":["../../../src/dom/DefaultEditorDomResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,iBAAiB,EACjB,cAAc,EACjB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,wBAAyB,YAAW,iBAAiB;IAE9D;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc;IAmCjD;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;CAS3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EditorDomSlots } from "./EditorDomSlots";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves editor DOM slots from a root element.
|
|
4
|
+
*
|
|
5
|
+
* Implementations are responsible for locating the required
|
|
6
|
+
* editor containers using data attributes.
|
|
7
|
+
*
|
|
8
|
+
* This abstraction allows users to provide custom HTML
|
|
9
|
+
* structures while keeping the editor core decoupled from DOM.
|
|
10
|
+
*/
|
|
11
|
+
export interface EditorDomResolver {
|
|
12
|
+
/**
|
|
13
|
+
* Resolves all editor DOM slots from the given root element.
|
|
14
|
+
*
|
|
15
|
+
* @param root - Root editor element
|
|
16
|
+
* @throws Error if required slots are missing
|
|
17
|
+
*/
|
|
18
|
+
resolve(root: HTMLElement): EditorDomSlots;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=EditorDomResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorDomResolver.d.ts","sourceRoot":"","sources":["../../../../src/dom/contracts/EditorDomResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,CAAC;CAC9C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved DOM slots used by the editor.
|
|
3
|
+
*
|
|
4
|
+
* These slots are extracted from the root element using
|
|
5
|
+
* data attributes (data-mo-editor-*).
|
|
6
|
+
*
|
|
7
|
+
* Some slots are optional and may not exist depending on the
|
|
8
|
+
* provided HTML structure.
|
|
9
|
+
*
|
|
10
|
+
* Required slots:
|
|
11
|
+
* - input
|
|
12
|
+
* - preview
|
|
13
|
+
* - textarea
|
|
14
|
+
*
|
|
15
|
+
* Optional slots:
|
|
16
|
+
* - header
|
|
17
|
+
* - toolbar
|
|
18
|
+
* - body
|
|
19
|
+
* - footer
|
|
20
|
+
* - status
|
|
21
|
+
*/
|
|
22
|
+
export interface EditorDomSlots {
|
|
23
|
+
/**
|
|
24
|
+
* Root editor element.
|
|
25
|
+
*/
|
|
26
|
+
readonly root: HTMLElement;
|
|
27
|
+
/**
|
|
28
|
+
* Optional header container.
|
|
29
|
+
*/
|
|
30
|
+
readonly header: HTMLElement | null;
|
|
31
|
+
/**
|
|
32
|
+
* Optional toolbar container.
|
|
33
|
+
*/
|
|
34
|
+
readonly toolbar: HTMLElement | null;
|
|
35
|
+
/**
|
|
36
|
+
* Optional body container.
|
|
37
|
+
*/
|
|
38
|
+
readonly body: HTMLElement | null;
|
|
39
|
+
/**
|
|
40
|
+
* Editor input container.
|
|
41
|
+
* This is where the EditorInputAdapter will mount.
|
|
42
|
+
*/
|
|
43
|
+
readonly input: HTMLElement;
|
|
44
|
+
/**
|
|
45
|
+
* Preview container.
|
|
46
|
+
* This is where the EditorOutputAdapter will render HTML.
|
|
47
|
+
*/
|
|
48
|
+
readonly preview: HTMLElement;
|
|
49
|
+
/**
|
|
50
|
+
* Optional footer container.
|
|
51
|
+
*/
|
|
52
|
+
readonly footer: HTMLElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Optional status container.
|
|
55
|
+
*/
|
|
56
|
+
readonly status: HTMLElement | null;
|
|
57
|
+
/**
|
|
58
|
+
* Hidden textarea used for form submission.
|
|
59
|
+
*/
|
|
60
|
+
readonly textarea: HTMLTextAreaElement;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=EditorDomSlots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorDomSlots.d.ts","sourceRoot":"","sources":["../../../../src/dom/contracts/EditorDomSlots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dom/contracts/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ModuloEditor } from './core';
|
|
2
|
+
export type { ModuloEditorOptions } from './core';
|
|
3
|
+
export type { EditorCommand, EditorCommandContext, EditorCommandsApi, } from "./commands";
|
|
4
|
+
export type { EditorPlugin, EditorPluginApi, } from "./plugins";
|
|
5
|
+
export type { MarkdownParser, MarkdownProcessor, HtmlSanitizer, } from "./markdown";
|
|
6
|
+
export { DefaultMarkdownProcessor, } from "./markdown";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAC;AAGhD,YAAY,EACR,aAAa,EACb,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACR,YAAY,EACZ,eAAe,GAClB,MAAM,WAAW,CAAC;AAGnB,YAAY,EACR,cAAc,EACd,iBAAiB,EACjB,aAAa,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACH,wBAAwB,GAC3B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EditorInput } from "../commands";
|
|
2
|
+
/**
|
|
3
|
+
* Adapter responsible for handling editor input.
|
|
4
|
+
*
|
|
5
|
+
* This abstraction allows different input implementations
|
|
6
|
+
* like textarea, contenteditable, or CodeMirror.
|
|
7
|
+
*/
|
|
8
|
+
export interface EditorInputAdapter extends EditorInput {
|
|
9
|
+
/**
|
|
10
|
+
* Mounts the input inside the given container.
|
|
11
|
+
*
|
|
12
|
+
* @param element - Input container
|
|
13
|
+
* @param initialValue - Initial content
|
|
14
|
+
*/
|
|
15
|
+
mount(element: HTMLElement, initialValue: string): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=EditorInputAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorInputAdapter.d.ts","sourceRoot":"","sources":["../../../src/input/EditorInputAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3D"}
|