@morfira-dev/wysiwyg-core 1.5.2 → 1.6.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/dist/chunk-X5IUYCDN.js +2 -0
- package/dist/chunk-X5IUYCDN.js.map +7 -0
- package/dist/chunk-YFIJ4ED5.js +2 -0
- package/dist/chunk-YFIJ4ED5.js.map +7 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/internal-types.d.ts +18 -0
- package/dist/commands/types.d.ts +25 -0
- package/dist/document/index.d.ts +3 -2
- package/dist/document/internal-types.d.ts +2 -0
- package/dist/document/security.d.ts +1 -0
- package/dist/editor/html-snapshots.d.ts +1 -1
- package/dist/editor/types.d.ts +11 -0
- package/dist/events/types.d.ts +2 -0
- package/dist/formatting/index.d.ts +2 -1
- package/dist/formatting/links.d.ts +2 -1
- package/dist/formatting/local-inline.d.ts +2 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/localization/index.d.ts +7 -0
- package/dist/localization/messages.d.ts +11 -0
- package/dist/localization/types.d.ts +8 -0
- package/dist/private-editor-messages.js +2 -0
- package/dist/private-editor-messages.js.map +7 -0
- package/dist/private-toolbar-messages.js +2 -0
- package/dist/private-toolbar-messages.js.map +7 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/internal-types.d.ts +9 -0
- package/dist/schema/types.d.ts +32 -0
- package/dist/ui/toolbar/index.d.ts +1 -1
- package/dist/ui/toolbar/messages.d.ts +32 -0
- package/dist/ui/toolbar/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EditorLocale, EditorTranslations, LocaleDictionaries } from './types.js';
|
|
2
|
+
export type { EditorLocale, EditorTranslations, LocaleDictionaries, EditorTranslationKey } from './types.js';
|
|
3
|
+
export { editorMessages } from './messages.js';
|
|
4
|
+
/** Copy and validate before changing UI state or mounting DOM. */
|
|
5
|
+
export declare const createLocale: (locale: string, translations?: EditorTranslations) => EditorLocale;
|
|
6
|
+
/** Resolve feature-owned copy without pulling optional feature dictionaries into core. */
|
|
7
|
+
export declare const localize: (state: EditorLocale, key: string, dictionaries: LocaleDictionaries) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Core-only copy. Optional UI and plugins own their dictionaries. */
|
|
2
|
+
export declare const editorMessages: Readonly<{
|
|
3
|
+
en: Readonly<{
|
|
4
|
+
'editor.label': "Text editor";
|
|
5
|
+
'editor.placeholder': "Start writing…";
|
|
6
|
+
}>;
|
|
7
|
+
ru: Readonly<{
|
|
8
|
+
'editor.label': "Текстовый редактор";
|
|
9
|
+
'editor.placeholder': "Начните писать…";
|
|
10
|
+
}>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { editorMessages } from './messages.js';
|
|
2
|
+
export type EditorTranslations = Readonly<Record<string, string>>;
|
|
3
|
+
export interface EditorLocale {
|
|
4
|
+
readonly locale: string;
|
|
5
|
+
readonly translations: EditorTranslations;
|
|
6
|
+
}
|
|
7
|
+
export type LocaleDictionaries = Readonly<Record<string, EditorTranslations>>;
|
|
8
|
+
export type EditorTranslationKey = keyof typeof editorMessages.en;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocumentTag } from '../document/types.js';
|
|
2
|
+
export interface CompiledAttribute {
|
|
3
|
+
readonly required: boolean;
|
|
4
|
+
readonly read: (value: unknown) => string;
|
|
5
|
+
}
|
|
6
|
+
export interface CompiledSchemaNode {
|
|
7
|
+
readonly tag: DocumentTag;
|
|
8
|
+
readonly attributes: ReadonlyMap<string, CompiledAttribute>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DocumentTag, EditorDocument } from '../document/types.js';
|
|
2
|
+
export type SchemaAttributeSpec = {
|
|
3
|
+
readonly type: 'text';
|
|
4
|
+
readonly maxLength?: number;
|
|
5
|
+
readonly required?: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
readonly type: 'enum';
|
|
8
|
+
readonly values: readonly string[];
|
|
9
|
+
readonly required?: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
readonly type: 'integer';
|
|
12
|
+
readonly min: number;
|
|
13
|
+
readonly max: number;
|
|
14
|
+
readonly required?: boolean;
|
|
15
|
+
} | {
|
|
16
|
+
readonly type: 'url';
|
|
17
|
+
readonly required?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export interface SchemaNodeSpec {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly kind: 'block' | 'inline';
|
|
22
|
+
readonly tag: DocumentTag;
|
|
23
|
+
readonly attributes?: Readonly<Record<string, SchemaAttributeSpec>>;
|
|
24
|
+
}
|
|
25
|
+
/** A compiled immutable schema with safe HTML/JSON import and rendering boundaries. */
|
|
26
|
+
export interface DocumentSchema {
|
|
27
|
+
readonly parseHTML: (html: string) => EditorDocument;
|
|
28
|
+
readonly validateDocument: (input: unknown) => EditorDocument;
|
|
29
|
+
readonly renderDocument: (value: EditorDocument) => DocumentFragment;
|
|
30
|
+
readonly documentHTML: (value: EditorDocument) => string;
|
|
31
|
+
readonly sanitizeHTML: (html: string) => string;
|
|
32
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ToolbarAction, ToolbarOptions } from './types.js';
|
|
2
2
|
export type { ToolbarAction, ToolbarOptions } from './types.js';
|
|
3
3
|
import type { Editor } from '../../index.js';
|
|
4
|
-
export declare const createToolbar: (host: HTMLElement, editor: Editor,
|
|
4
|
+
export declare const createToolbar: (host: HTMLElement, editor: Editor, requestedActions?: ToolbarAction[], options?: ToolbarOptions) => () => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const toolbarMessages: Readonly<{
|
|
2
|
+
en: Readonly<{
|
|
3
|
+
'toolbar.label': "Formatting";
|
|
4
|
+
'toolbar.undo': "Undo";
|
|
5
|
+
'toolbar.redo': "Redo";
|
|
6
|
+
'toolbar.bold': "Bold";
|
|
7
|
+
'toolbar.italic': "Italic";
|
|
8
|
+
'toolbar.underline': "Underline";
|
|
9
|
+
'toolbar.header': "Heading";
|
|
10
|
+
'toolbar.bulletList': "Bulleted list";
|
|
11
|
+
'toolbar.orderedList': "Numbered list";
|
|
12
|
+
'toolbar.indent': "Increase indent";
|
|
13
|
+
'toolbar.outdent': "Decrease indent";
|
|
14
|
+
'toolbar.blockquote': "Block quote";
|
|
15
|
+
'toolbar.clear': "Clear formatting";
|
|
16
|
+
}>;
|
|
17
|
+
ru: Readonly<{
|
|
18
|
+
'toolbar.label': "Форматирование";
|
|
19
|
+
'toolbar.undo': "Отменить";
|
|
20
|
+
'toolbar.redo': "Повторить";
|
|
21
|
+
'toolbar.bold': "Полужирный";
|
|
22
|
+
'toolbar.italic': "Курсив";
|
|
23
|
+
'toolbar.underline': "Подчёркнутый";
|
|
24
|
+
'toolbar.header': "Заголовок";
|
|
25
|
+
'toolbar.bulletList': "Маркированный список";
|
|
26
|
+
'toolbar.orderedList': "Нумерованный список";
|
|
27
|
+
'toolbar.indent': "Увеличить отступ";
|
|
28
|
+
'toolbar.outdent': "Уменьшить отступ";
|
|
29
|
+
'toolbar.blockquote': "Цитата";
|
|
30
|
+
'toolbar.clear': "Очистить форматирование";
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Editor } from '../../editor/types.js';
|
|
2
|
+
import type { toolbarMessages } from './messages.js';
|
|
3
|
+
export type ToolbarTranslationKey = keyof typeof toolbarMessages.en;
|
|
2
4
|
export interface ToolbarAction {
|
|
3
5
|
label: string;
|
|
4
6
|
text: string;
|
|
@@ -7,6 +9,9 @@ export interface ToolbarAction {
|
|
|
7
9
|
run?: (editor: Editor) => void;
|
|
8
10
|
enabled?: (editor: Editor) => boolean;
|
|
9
11
|
}
|
|
12
|
+
export interface LocalizedToolbarAction extends ToolbarAction {
|
|
13
|
+
translationKey: ToolbarTranslationKey;
|
|
14
|
+
}
|
|
10
15
|
export interface ToolbarOptions {
|
|
11
16
|
label?: string;
|
|
12
17
|
}
|