overtype 1.2.7 → 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/README.md +222 -34
- package/dist/overtype-webcomponent.esm.js +4763 -0
- package/dist/overtype-webcomponent.esm.js.map +7 -0
- package/dist/overtype-webcomponent.js +4785 -0
- package/dist/overtype-webcomponent.js.map +7 -0
- package/dist/overtype-webcomponent.min.js +991 -0
- package/dist/overtype.cjs +682 -389
- package/dist/overtype.cjs.map +4 -4
- package/dist/overtype.d.ts +57 -14
- package/dist/overtype.esm.js +679 -388
- package/dist/overtype.esm.js.map +4 -4
- package/dist/overtype.js +679 -388
- package/dist/overtype.js.map +4 -4
- package/dist/overtype.min.js +157 -125
- package/package.json +18 -4
- package/src/link-tooltip.js +48 -73
- package/src/overtype-webcomponent.js +676 -0
- package/src/overtype.d.ts +57 -14
- package/src/overtype.js +186 -59
- package/src/parser.js +120 -17
- package/src/styles.js +92 -30
- package/src/toolbar-buttons.js +163 -0
- package/src/toolbar.js +194 -249
- package/diagram.png +0 -0
package/dist/overtype.d.ts
CHANGED
|
@@ -41,6 +41,28 @@ export interface Stats {
|
|
|
41
41
|
column: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Toolbar button definition
|
|
46
|
+
*/
|
|
47
|
+
export interface ToolbarButton {
|
|
48
|
+
/** Unique button identifier */
|
|
49
|
+
name: string;
|
|
50
|
+
|
|
51
|
+
/** SVG icon markup (optional for separator) */
|
|
52
|
+
icon?: string;
|
|
53
|
+
|
|
54
|
+
/** Button tooltip text (optional for separator) */
|
|
55
|
+
title?: string;
|
|
56
|
+
|
|
57
|
+
/** Button action callback (optional for separator) */
|
|
58
|
+
action?: (context: {
|
|
59
|
+
editor: OverType;
|
|
60
|
+
getValue: () => string;
|
|
61
|
+
setValue: (value: string) => void;
|
|
62
|
+
event: MouseEvent;
|
|
63
|
+
}) => void | Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
export interface MobileOptions {
|
|
45
67
|
fontSize?: string;
|
|
46
68
|
padding?: string;
|
|
@@ -71,17 +93,11 @@ export interface Options {
|
|
|
71
93
|
// Features
|
|
72
94
|
showActiveLineRaw?: boolean;
|
|
73
95
|
showStats?: boolean;
|
|
74
|
-
toolbar?: boolean
|
|
75
|
-
|
|
76
|
-
name?: string;
|
|
77
|
-
icon?: string;
|
|
78
|
-
title?: string;
|
|
79
|
-
action?: string;
|
|
80
|
-
separator?: boolean;
|
|
81
|
-
}>;
|
|
82
|
-
};
|
|
96
|
+
toolbar?: boolean;
|
|
97
|
+
toolbarButtons?: ToolbarButton[]; // Custom toolbar button configuration
|
|
83
98
|
smartLists?: boolean; // v1.2.3+ Smart list continuation
|
|
84
99
|
statsFormatter?: (stats: Stats) => string;
|
|
100
|
+
codeHighlighter?: ((code: string, language: string) => string) | null; // Per-instance code highlighter
|
|
85
101
|
|
|
86
102
|
// Theme (deprecated in favor of global theme)
|
|
87
103
|
theme?: string | Theme;
|
|
@@ -96,7 +112,7 @@ export interface Options {
|
|
|
96
112
|
export interface OverTypeConstructor {
|
|
97
113
|
new(target: string | Element | NodeList | Element[], options?: Options): OverTypeInstance[];
|
|
98
114
|
// Static members
|
|
99
|
-
instances:
|
|
115
|
+
instances: any;
|
|
100
116
|
stylesInjected: boolean;
|
|
101
117
|
globalListenersInitialized: boolean;
|
|
102
118
|
instanceCount: number;
|
|
@@ -112,6 +128,7 @@ export interface OverTypeConstructor {
|
|
|
112
128
|
destroyAll(): void;
|
|
113
129
|
injectStyles(force?: boolean): void;
|
|
114
130
|
setTheme(theme: string | Theme, customColors?: Partial<Theme['colors']>): void;
|
|
131
|
+
setCodeHighlighter(highlighter: ((code: string, language: string) => string) | null): void;
|
|
115
132
|
initGlobalListeners(): void;
|
|
116
133
|
getTheme(name: string): Theme;
|
|
117
134
|
}
|
|
@@ -146,7 +163,8 @@ export interface OverTypeInstance {
|
|
|
146
163
|
isInitialized(): boolean;
|
|
147
164
|
reinit(options: Options): void;
|
|
148
165
|
showStats(show: boolean): void;
|
|
149
|
-
setTheme(theme: string | Theme):
|
|
166
|
+
setTheme(theme: string | Theme): this;
|
|
167
|
+
setCodeHighlighter(highlighter: ((code: string, language: string) => string) | null): void;
|
|
150
168
|
updatePreview(): void;
|
|
151
169
|
|
|
152
170
|
// HTML output methods
|
|
@@ -155,8 +173,9 @@ export interface OverTypeInstance {
|
|
|
155
173
|
getPreviewHTML(): string;
|
|
156
174
|
|
|
157
175
|
// View mode methods
|
|
158
|
-
|
|
159
|
-
|
|
176
|
+
showNormalEditMode(): this;
|
|
177
|
+
showPlainTextarea(): this;
|
|
178
|
+
showPreviewMode(): this;
|
|
160
179
|
}
|
|
161
180
|
|
|
162
181
|
// Declare the constructor as a constant with proper typing
|
|
@@ -166,4 +185,28 @@ declare const OverType: OverTypeConstructor;
|
|
|
166
185
|
export type OverType = OverTypeInstance;
|
|
167
186
|
|
|
168
187
|
// Module exports - default export is the constructor
|
|
169
|
-
export default OverType;
|
|
188
|
+
export default OverType;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Pre-defined toolbar buttons
|
|
192
|
+
*/
|
|
193
|
+
export const toolbarButtons: {
|
|
194
|
+
bold: ToolbarButton;
|
|
195
|
+
italic: ToolbarButton;
|
|
196
|
+
code: ToolbarButton;
|
|
197
|
+
separator: ToolbarButton;
|
|
198
|
+
link: ToolbarButton;
|
|
199
|
+
h1: ToolbarButton;
|
|
200
|
+
h2: ToolbarButton;
|
|
201
|
+
h3: ToolbarButton;
|
|
202
|
+
bulletList: ToolbarButton;
|
|
203
|
+
orderedList: ToolbarButton;
|
|
204
|
+
taskList: ToolbarButton;
|
|
205
|
+
quote: ToolbarButton;
|
|
206
|
+
viewMode: ToolbarButton;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Default toolbar button layout with separators
|
|
211
|
+
*/
|
|
212
|
+
export const defaultToolbarButtons: ToolbarButton[];
|