autumnnote 1.7.0 → 1.8.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/README.md +15 -3
- package/dist/autumnnote.css +24 -1
- package/dist/autumnnote.es.js +509 -134
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +587 -195
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/js/Context.js +26 -1
- package/src/js/core/markdown.js +32 -6
- package/src/js/editing/Style.js +288 -159
- package/src/js/editing/Table.js +10 -2
- package/src/js/editing/Typing.js +21 -4
- package/src/js/i18n/de.js +17 -0
- package/src/js/i18n/en.js +8 -0
- package/src/js/i18n/es.js +17 -0
- package/src/js/i18n/fr.js +18 -1
- package/src/js/i18n/ja.js +17 -0
- package/src/js/i18n/ko.js +17 -0
- package/src/js/i18n/vi.js +15 -0
- package/src/js/i18n/zh.js +17 -0
- package/src/js/index.js +5 -2
- package/src/js/module/Buttons.js +49 -0
- package/src/js/module/Clipboard.js +13 -1
- package/src/js/module/FindReplace.js +24 -5
- package/src/js/module/ImageDialog.js +1 -0
- package/src/js/module/ImageResizer.js +8 -7
- package/src/js/module/Mention.js +13 -2
- package/src/js/module/TableTooltip.js +21 -0
- package/src/styles/autumnnote.scss +23 -3
- package/types/index.d.ts +84 -3
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AutumnNote – TypeScript declarations
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.8.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
@@ -106,7 +106,7 @@ export interface AsnOptions {
|
|
|
106
106
|
colorSwatches?: string[];
|
|
107
107
|
/**
|
|
108
108
|
* Display language for the editor UI.
|
|
109
|
-
* Built-in: 'en' (default) | 'vi' | 'ja' | 'zh' | 'fr'.
|
|
109
|
+
* Built-in: 'en' (default) | 'vi' | 'ja' | 'zh' | 'fr' | 'de' | 'es' | 'ko'.
|
|
110
110
|
* Pass a partial locale object to override individual strings.
|
|
111
111
|
*/
|
|
112
112
|
lang?: string | Partial<AsnLocale>;
|
|
@@ -119,6 +119,10 @@ export interface AsnOptions {
|
|
|
119
119
|
autoSaveRestoreTimeout?: number;
|
|
120
120
|
/** Callback fired after the user chooses to restore a draft. */
|
|
121
121
|
onAutoSaveRestore?: (html: string, context: Context) => void;
|
|
122
|
+
/** Maximum paste size in MB before paste is silently dropped (0 = unlimited). Default: 5. */
|
|
123
|
+
maxPasteSize?: number;
|
|
124
|
+
/** Minimum image dimension in px during resize (width and height). Default: 20. */
|
|
125
|
+
minImageSize?: number;
|
|
122
126
|
|
|
123
127
|
// ---- Markdown input shortcuts (#3) ----------------------------------------
|
|
124
128
|
|
|
@@ -165,6 +169,8 @@ export interface MentionOptions {
|
|
|
165
169
|
* - Promise: `async onSearch(query) { return items; }`
|
|
166
170
|
*/
|
|
167
171
|
onSearch: (query: string, callback: (items: MentionItem[]) => void) => void | Promise<MentionItem[]>;
|
|
172
|
+
/** Called when onSearch rejects with an error (Promise style only). */
|
|
173
|
+
onError?: (error: unknown) => void;
|
|
168
174
|
/** Optional. Return custom HTML string for the inserted chip, or null to use the default. */
|
|
169
175
|
onInsert?: (item: MentionItem) => string | null;
|
|
170
176
|
/** CSS class added to the inserted mention chip. Default: 'an-mention'. */
|
|
@@ -309,9 +315,15 @@ export interface AsnLocale {
|
|
|
309
315
|
imageFormat: (type: string) => string;
|
|
310
316
|
imageSize: (maxMb: number) => string;
|
|
311
317
|
};
|
|
318
|
+
autoSaveRestore: {
|
|
319
|
+
found: string;
|
|
320
|
+
foundAt: string;
|
|
321
|
+
restore: string;
|
|
322
|
+
discard: string;
|
|
323
|
+
};
|
|
312
324
|
}
|
|
313
325
|
|
|
314
|
-
/** Registry of all built-in locales (keys: 'en', 'vi', 'ja', 'zh', 'fr'). */
|
|
326
|
+
/** Registry of all built-in locales (keys: 'en', 'vi', 'ja', 'zh', 'fr', 'de', 'es', 'ko'). */
|
|
315
327
|
export declare const locales: Record<string, AsnLocale>;
|
|
316
328
|
|
|
317
329
|
/**
|
|
@@ -423,6 +435,18 @@ export declare class Context {
|
|
|
423
435
|
/** Downloads the editor content as a Markdown file. */
|
|
424
436
|
downloadMarkdown(filename?: string): void;
|
|
425
437
|
|
|
438
|
+
/** Moves keyboard focus into the editable area. */
|
|
439
|
+
focus(): void;
|
|
440
|
+
|
|
441
|
+
/** Removes keyboard focus from the editable area. */
|
|
442
|
+
blur(): void;
|
|
443
|
+
|
|
444
|
+
/** Returns true when the editor is currently in fullscreen mode. */
|
|
445
|
+
isFullscreen(): boolean;
|
|
446
|
+
|
|
447
|
+
/** Opens a print dialog with the editor content. */
|
|
448
|
+
print(title?: string): void;
|
|
449
|
+
|
|
426
450
|
/** Enables or disables (read-only) mode on this instance. */
|
|
427
451
|
setDisabled(disabled: boolean): void;
|
|
428
452
|
|
|
@@ -494,6 +518,56 @@ export declare const foreColorBtn: ColorPickerDef;
|
|
|
494
518
|
export declare const backColorBtn: ColorPickerDef;
|
|
495
519
|
export declare const defaultToolbar: Array<Array<ToolbarItemDef>>;
|
|
496
520
|
|
|
521
|
+
/**
|
|
522
|
+
* All pre-built button definitions grouped in a single namespace object.
|
|
523
|
+
* Use this to access individual buttons in UMD / CJS environments where
|
|
524
|
+
* named imports are not available: `AutumnNote.buttons.boldBtn`.
|
|
525
|
+
*/
|
|
526
|
+
export interface ButtonsNamespace {
|
|
527
|
+
boldBtn: ButtonDef;
|
|
528
|
+
italicBtn: ButtonDef;
|
|
529
|
+
underlineBtn: ButtonDef;
|
|
530
|
+
strikeBtn: ButtonDef;
|
|
531
|
+
superscriptBtn: ButtonDef;
|
|
532
|
+
subscriptBtn: ButtonDef;
|
|
533
|
+
alignLeftBtn: ButtonDef;
|
|
534
|
+
alignCenterBtn: ButtonDef;
|
|
535
|
+
alignRightBtn: ButtonDef;
|
|
536
|
+
alignJustifyBtn: ButtonDef;
|
|
537
|
+
ulBtn: ButtonDef;
|
|
538
|
+
olBtn: ButtonDef;
|
|
539
|
+
indentBtn: ButtonDef;
|
|
540
|
+
outdentBtn: ButtonDef;
|
|
541
|
+
undoBtn: ButtonDef;
|
|
542
|
+
redoBtn: ButtonDef;
|
|
543
|
+
hrBtn: ButtonDef;
|
|
544
|
+
linkBtn: ButtonDef;
|
|
545
|
+
imageBtn: ButtonDef;
|
|
546
|
+
videoBtn: ButtonDef;
|
|
547
|
+
emojiBtn: ButtonDef;
|
|
548
|
+
iconBtn: ButtonDef;
|
|
549
|
+
tableBtn: GridButtonDef;
|
|
550
|
+
fontSizeBtn: DropdownDef;
|
|
551
|
+
removeFormatBtn: ButtonDef;
|
|
552
|
+
directionBtn: ButtonDef;
|
|
553
|
+
fontFamilyBtn: DropdownDef;
|
|
554
|
+
paragraphStyleBtn: DropdownDef;
|
|
555
|
+
lineHeightBtn: DropdownDef;
|
|
556
|
+
codeviewBtn: ButtonDef;
|
|
557
|
+
fullscreenBtn: ButtonDef;
|
|
558
|
+
shortcutsBtn: ButtonDef;
|
|
559
|
+
findBtn: ButtonDef;
|
|
560
|
+
findReplaceBtn: ButtonDef;
|
|
561
|
+
inlineCodeBtn: ButtonDef;
|
|
562
|
+
checklistBtn: ButtonDef;
|
|
563
|
+
printBtn: ButtonDef;
|
|
564
|
+
foreColorBtn: ColorPickerDef;
|
|
565
|
+
backColorBtn: ColorPickerDef;
|
|
566
|
+
defaultToolbar: Array<Array<ToolbarItemDef>>;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export declare const buttons: ButtonsNamespace;
|
|
570
|
+
|
|
497
571
|
// ---------------------------------------------------------------------------
|
|
498
572
|
// Main AutumnNote API
|
|
499
573
|
// ---------------------------------------------------------------------------
|
|
@@ -543,6 +617,13 @@ export interface AutumnNoteStatic {
|
|
|
543
617
|
*/
|
|
544
618
|
registerButton(btnDef: ToolbarItemDef): this;
|
|
545
619
|
|
|
620
|
+
/**
|
|
621
|
+
* All pre-built button definitions in a single namespace.
|
|
622
|
+
* Use in UMD / CJS builds where named imports are unavailable:
|
|
623
|
+
* `AutumnNote.buttons.boldBtn`, `AutumnNote.buttons.defaultToolbar`, etc.
|
|
624
|
+
*/
|
|
625
|
+
readonly buttons: ButtonsNamespace;
|
|
626
|
+
|
|
546
627
|
/** Library version string. */
|
|
547
628
|
readonly version: string;
|
|
548
629
|
}
|