@mdaemon/html-editor-react 1.0.4 → 1.0.5
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/index.d.ts +167 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,168 @@
|
|
|
1
|
+
import { EditorConfig } from '@mdaemon/html-editor';
|
|
2
|
+
import { EditorEvents } from '@mdaemon/html-editor';
|
|
3
|
+
import { fontNames } from '@mdaemon/html-editor';
|
|
4
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
5
|
+
import { HTMLEditor } from '@mdaemon/html-editor';
|
|
6
|
+
import { RefAttributes } from 'react';
|
|
7
|
+
import { setGetFileSrc } from '@mdaemon/html-editor';
|
|
8
|
+
import { setTranslate } from '@mdaemon/html-editor';
|
|
9
|
+
import { Template } from '@mdaemon/html-editor';
|
|
10
|
+
import { ToolbarButtonAPI } from '@mdaemon/html-editor';
|
|
11
|
+
import { ToolbarButtonSpec } from '@mdaemon/html-editor';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* MDHTMLEditor React Component
|
|
15
|
+
*/
|
|
16
|
+
declare const Editor: ForwardRefExoticComponent<EditorProps & RefAttributes<EditorRef>>;
|
|
17
|
+
export { Editor }
|
|
18
|
+
export { Editor as MDEditor }
|
|
19
|
+
|
|
20
|
+
export { EditorConfig }
|
|
21
|
+
|
|
22
|
+
export { EditorEvents }
|
|
23
|
+
|
|
24
|
+
export declare interface EditorProps {
|
|
25
|
+
/**
|
|
26
|
+
* Editor configuration - TinyMCE compatible
|
|
27
|
+
*/
|
|
28
|
+
config: EditorConfig;
|
|
29
|
+
/**
|
|
30
|
+
* Initial HTML content (also known as 'body' for TinyMCE compat)
|
|
31
|
+
*/
|
|
32
|
+
body?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Initial HTML content (alias for body)
|
|
35
|
+
*/
|
|
36
|
+
initialValue?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Name attribute for the hidden textarea
|
|
39
|
+
*/
|
|
40
|
+
name?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Called when content is modified
|
|
43
|
+
*/
|
|
44
|
+
onDirty?: (dirty: boolean) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Called on content change (debounced)
|
|
47
|
+
*/
|
|
48
|
+
onChange?: (content: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Called when editor is fully initialized
|
|
51
|
+
*/
|
|
52
|
+
onInit?: (editor: HTMLEditor) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Called when editor receives focus
|
|
55
|
+
*/
|
|
56
|
+
onFocus?: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Called when editor loses focus
|
|
59
|
+
*/
|
|
60
|
+
onBlur?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Translation function
|
|
63
|
+
*/
|
|
64
|
+
translate?: (key: string) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Function to resolve file paths (like TinyMCE's tinymceScriptSrc path)
|
|
67
|
+
*/
|
|
68
|
+
getFileSrc?: (path: string) => string;
|
|
69
|
+
/**
|
|
70
|
+
* Disable the editor
|
|
71
|
+
*/
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare interface EditorRef {
|
|
76
|
+
/**
|
|
77
|
+
* Get the underlying HTMLEditor instance
|
|
78
|
+
*/
|
|
79
|
+
getEditor: () => HTMLEditor | null;
|
|
80
|
+
/**
|
|
81
|
+
* Get the editor content as HTML
|
|
82
|
+
*/
|
|
83
|
+
getContent: () => string;
|
|
84
|
+
/**
|
|
85
|
+
* Set the editor content
|
|
86
|
+
*/
|
|
87
|
+
setContent: (html: string) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Insert content at cursor position
|
|
90
|
+
*/
|
|
91
|
+
insertContent: (html: string) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Focus the editor
|
|
94
|
+
*/
|
|
95
|
+
focus: () => void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { fontNames }
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get content from the global editor instance
|
|
102
|
+
* Note: Only works with single editor on the page
|
|
103
|
+
*/
|
|
104
|
+
export declare function getEditorContent(): string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Set content on the global editor instance
|
|
108
|
+
* Note: Only works with single editor on the page
|
|
109
|
+
*/
|
|
110
|
+
export declare function setEditorContent(html: string): void;
|
|
111
|
+
|
|
112
|
+
export { setGetFileSrc }
|
|
113
|
+
|
|
114
|
+
export { setTranslate }
|
|
115
|
+
|
|
116
|
+
export { Template }
|
|
117
|
+
|
|
118
|
+
export { ToolbarButtonAPI }
|
|
119
|
+
|
|
120
|
+
export { ToolbarButtonSpec }
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Hook for programmatic editor control
|
|
124
|
+
*/
|
|
125
|
+
export declare function useEditor(options?: UseEditorOptions): UseEditorReturn;
|
|
126
|
+
|
|
127
|
+
export declare interface UseEditorOptions {
|
|
128
|
+
config?: EditorConfig;
|
|
129
|
+
content?: string;
|
|
130
|
+
onUpdate?: (html: string) => void;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export declare interface UseEditorReturn {
|
|
134
|
+
/**
|
|
135
|
+
* The editor instance
|
|
136
|
+
*/
|
|
137
|
+
editor: HTMLEditor | null;
|
|
138
|
+
/**
|
|
139
|
+
* Ref to attach to the container element
|
|
140
|
+
*/
|
|
141
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the editor is ready
|
|
144
|
+
*/
|
|
145
|
+
ready: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Get the current HTML content
|
|
148
|
+
*/
|
|
149
|
+
getContent: () => string;
|
|
150
|
+
/**
|
|
151
|
+
* Set the HTML content
|
|
152
|
+
*/
|
|
153
|
+
setContent: (html: string) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Insert HTML at cursor
|
|
156
|
+
*/
|
|
157
|
+
insertContent: (html: string) => void;
|
|
158
|
+
/**
|
|
159
|
+
* Focus the editor
|
|
160
|
+
*/
|
|
161
|
+
focus: () => void;
|
|
162
|
+
/**
|
|
163
|
+
* Check if editor is dirty
|
|
164
|
+
*/
|
|
165
|
+
isDirty: () => boolean;
|
|
166
|
+
}
|
|
167
|
+
|
|
1
168
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdaemon/html-editor-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "React wrapper for MDHTMLEditor",
|
|
5
5
|
"homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor-react",
|
|
6
6
|
"repository": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"types": "dist/index.d.ts",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
18
19
|
"import": "./dist/index.mjs",
|
|
19
|
-
"require": "./dist/index.js"
|
|
20
|
-
"types": "./dist/index.d.ts"
|
|
20
|
+
"require": "./dist/index.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|