autumnnote 1.16.0 → 2.1.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 +31 -2
- package/dist/autumnnote.cjs +20 -20
- package/dist/autumnnote.css +1 -1
- package/dist/autumnnote.es.js +1521 -6319
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.min.js +20 -20
- package/dist/autumnnote.umd.js +20 -20
- package/dist/autumnnote.umd.js.map +1 -1
- package/dist/emoji-data-BDQX5kh-.js +2331 -0
- package/dist/emoji-data-BDQX5kh-.js.map +1 -0
- package/package.json +6 -2
- package/src/js/Context.js +68 -8
- package/src/js/core/env.js +23 -10
- package/src/js/core/sanitise.js +81 -8
- package/src/js/i18n/all.js +27 -0
- package/src/js/i18n/index.js +45 -19
- package/src/js/index.js +12 -2
- package/src/js/index.umd.js +5 -0
- package/src/js/module/BaseMediaTooltip.js +142 -0
- package/src/js/module/BaseResizer.js +322 -0
- package/src/js/module/EmojiDialog.js +41 -494
- package/src/js/module/ImageResizer.js +23 -241
- package/src/js/module/ImageTooltip.js +16 -111
- package/src/js/module/TableTooltip.js +91 -220
- package/src/js/module/Toolbar.js +107 -2
- package/src/js/module/VideoResizer.js +38 -239
- package/src/js/module/VideoTooltip.js +27 -114
- package/src/js/module/emoji-data.js +496 -0
- package/src/js/module/table-grid.js +102 -0
- package/src/js/module/table-icons.js +33 -0
- package/src/styles/autumnnote.scss +11 -0
- package/types/i18n/all.d.ts +14 -0
- package/types/i18n/de.d.ts +4 -0
- package/types/i18n/en.d.ts +4 -0
- package/types/i18n/es.d.ts +4 -0
- package/types/i18n/fr.d.ts +4 -0
- package/types/i18n/ja.d.ts +4 -0
- package/types/i18n/ko.d.ts +4 -0
- package/types/i18n/vi.d.ts +4 -0
- package/types/i18n/zh.d.ts +4 -0
- package/types/index.d.ts +30 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* table-icons.js - Inline SVG glyphs for the table tooltip's action bar.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of TableTooltip.js because the markup is ~9 KB of static data that
|
|
5
|
+
* obscures the module's actual logic; nothing here has behaviour.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const ICONS = {
|
|
9
|
+
rowAbove: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="12" x2="21" y2="12"/><path d="M12 3v7"/><path d="M9 7l3-4 3 4"/></svg>`,
|
|
10
|
+
rowBelow: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="12" x2="21" y2="12"/><path d="M12 12v7"/><path d="M9 17l3 4 3-4"/></svg>`,
|
|
11
|
+
deleteRow: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="15" y1="15" x2="21" y2="21"/><line x1="21" y1="15" x2="15" y2="21"/></svg>`,
|
|
12
|
+
colLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="12" y1="3" x2="12" y2="21"/><path d="M3 12h7"/><path d="M7 8l-4 4 4 4"/></svg>`,
|
|
13
|
+
colRight: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="12" y1="3" x2="12" y2="21"/><path d="M12 12h9"/><path d="M17 8l4 4-4 4"/></svg>`,
|
|
14
|
+
deleteCol: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="12" y1="3" x2="12" y2="21"/><line x1="15" y1="6" x2="21" y2="12"/><line x1="21" y1="6" x2="15" y2="12"/></svg>`,
|
|
15
|
+
mergeCells: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="8" height="10" rx="1"/><rect x="14" y="7" width="8" height="10" rx="1"/><path d="M10 12h4"/><path d="M12 10l2 2-2 2"/></svg>`,
|
|
16
|
+
unmergeCells: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="5" width="20" height="14" rx="1"/><line x1="12" y1="5" x2="12" y2="19" stroke-dasharray="2.5 2"/><line x1="2" y1="12" x2="22" y2="12" stroke-dasharray="2.5 2"/><path d="M9 9 L6 12 L9 15"/><path d="M15 9 L18 12 L15 15"/></svg>`,
|
|
17
|
+
colWidth: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="7" y1="4" x2="7" y2="20"/><line x1="17" y1="4" x2="17" y2="20"/><line x1="7" y1="12" x2="17" y2="12"/><path d="M10 9l-3 3 3 3"/><path d="M14 9l3 3-3 3"/></svg>`,
|
|
18
|
+
rowHeight: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="7" x2="20" y2="7"/><line x1="4" y1="17" x2="20" y2="17"/><line x1="12" y1="7" x2="12" y2="17"/><path d="M9 10l3-3 3 3"/><path d="M9 14l3 3 3-3"/></svg>`,
|
|
19
|
+
tableBorder: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6" stroke-width="1"/><line x1="3" y1="13" x2="21" y2="13" stroke-width="2"/><line x1="3" y1="20" x2="21" y2="20" stroke-width="3"/></svg>`,
|
|
20
|
+
deleteTable: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/><line x1="16" y1="16" x2="22" y2="22" stroke="#ef4444"/><line x1="22" y1="16" x2="16" y2="22" stroke="#ef4444"/></svg>`,
|
|
21
|
+
selectCells: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z" fill="currentColor" opacity="0.15"/><path d="M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z"/></svg>`,
|
|
22
|
+
cellShade: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20"/><path d="m5 14 5-5"/><path d="M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z"/></svg>`,
|
|
23
|
+
borderColor: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="14" rx="1"/><line x1="3" y1="10" x2="21" y2="10" stroke-width="1.5"/><line x1="12" y1="3" x2="12" y2="17" stroke-width="1.5"/><path d="M3 21h18" stroke-width="3"/></svg>`,
|
|
24
|
+
alignLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="15" y1="12" x2="3" y2="12"/><line x1="17" y1="18" x2="3" y2="18"/></svg>`,
|
|
25
|
+
alignCenter: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="17" y1="12" x2="7" y2="12"/><line x1="19" y1="18" x2="5" y2="18"/></svg>`,
|
|
26
|
+
alignRight: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="9" y2="12"/><line x1="21" y1="18" x2="7" y2="18"/></svg>`,
|
|
27
|
+
alignJustify: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="3" y2="12"/><line x1="21" y1="18" x2="3" y2="18"/></svg>`,
|
|
28
|
+
headerRow: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><rect x="3" y="3" width="18" height="8" rx="1" fill="currentColor" opacity="0.2"/><line x1="3" y1="11" x2="21" y2="11"/><line x1="3" y1="16" x2="21" y2="16"/><line x1="9" y1="11" x2="9" y2="21"/><line x1="15" y1="11" x2="15" y2="21"/></svg>`,
|
|
29
|
+
sortAsc: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="6" x2="11" y2="6"/><line x1="4" y1="12" x2="11" y2="12"/><line x1="4" y1="18" x2="13" y2="18"/><path d="M15 9l3-3 3 3"/><line x1="18" y1="6" x2="18" y2="18"/></svg>`,
|
|
30
|
+
sortDesc: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="6" x2="13" y2="6"/><line x1="4" y1="12" x2="11" y2="12"/><line x1="4" y1="18" x2="11" y2="18"/><path d="M15 15l3 3 3-3"/><line x1="18" y1="6" x2="18" y2="18"/></svg>`,
|
|
31
|
+
exportCSV: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`,
|
|
32
|
+
cellPadding: `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="1"/><rect x="7" y="7" width="10" height="10" rx="0.5" stroke-dasharray="2 1.5"/></svg>`,
|
|
33
|
+
};
|
|
@@ -1390,6 +1390,17 @@
|
|
|
1390
1390
|
border-radius: 1px;
|
|
1391
1391
|
box-sizing: border-box;
|
|
1392
1392
|
pointer-events: all;
|
|
1393
|
+
// Required for the pointerdown drag to survive on touch: without it the
|
|
1394
|
+
// browser claims the gesture as a scroll and fires pointercancel.
|
|
1395
|
+
touch-action: none;
|
|
1396
|
+
|
|
1397
|
+
// 8px is below the ~44px recommended touch target, so widen the hit area
|
|
1398
|
+
// with a transparent ::before rather than by enlarging the visible dot.
|
|
1399
|
+
&::before {
|
|
1400
|
+
content: '';
|
|
1401
|
+
position: absolute;
|
|
1402
|
+
inset: -10px;
|
|
1403
|
+
}
|
|
1393
1404
|
}
|
|
1394
1405
|
|
|
1395
1406
|
// Corners
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AsnLocale } from '../index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Registers every bundled locale as a side effect of importing this module.
|
|
5
|
+
* Pulls all locales into the bundle — prefer importing individual locales
|
|
6
|
+
* from `autumnnote/i18n/<code>`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const vi: Partial<AsnLocale>;
|
|
9
|
+
export declare const ja: Partial<AsnLocale>;
|
|
10
|
+
export declare const zh: Partial<AsnLocale>;
|
|
11
|
+
export declare const fr: Partial<AsnLocale>;
|
|
12
|
+
export declare const de: Partial<AsnLocale>;
|
|
13
|
+
export declare const es: Partial<AsnLocale>;
|
|
14
|
+
export declare const ko: Partial<AsnLocale>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AutumnNote – TypeScript declarations
|
|
3
|
-
* @version
|
|
3
|
+
* @version 2.0.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
@@ -154,8 +154,13 @@ export interface AsnOptions {
|
|
|
154
154
|
focusColor?: string | null;
|
|
155
155
|
/**
|
|
156
156
|
* Display language for the editor UI.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
157
|
+
*
|
|
158
|
+
* `'en'` is built in. Other codes must be registered first — the ESM bundle
|
|
159
|
+
* ships English only, so import the locale from `autumnnote/i18n/<code>` and
|
|
160
|
+
* pass it to {@link registerLocale}. The UMD/CDN build pre-registers all
|
|
161
|
+
* eight ('en', 'vi', 'ja', 'zh', 'fr', 'de', 'es', 'ko').
|
|
162
|
+
*
|
|
163
|
+
* A partial locale object works inline without registering anything.
|
|
159
164
|
*/
|
|
160
165
|
lang?: string | Partial<AsnLocale>;
|
|
161
166
|
|
|
@@ -399,9 +404,24 @@ export interface AsnLocale {
|
|
|
399
404
|
};
|
|
400
405
|
}
|
|
401
406
|
|
|
402
|
-
/**
|
|
407
|
+
/**
|
|
408
|
+
* Registry of locales selectable by code. The ESM bundle ships `'en'` only;
|
|
409
|
+
* register others with {@link registerLocale}. The UMD/CDN build pre-registers
|
|
410
|
+
* all eight ('en', 'vi', 'ja', 'zh', 'fr', 'de', 'es', 'ko').
|
|
411
|
+
*/
|
|
403
412
|
export declare const locales: Record<string, AsnLocale>;
|
|
404
413
|
|
|
414
|
+
/**
|
|
415
|
+
* Registers a locale so `lang: '<code>'` can select it.
|
|
416
|
+
*
|
|
417
|
+
* ```ts
|
|
418
|
+
* import AutumnNote from 'autumnnote';
|
|
419
|
+
* import { vi } from 'autumnnote/i18n/vi';
|
|
420
|
+
* AutumnNote.registerLocale('vi', vi);
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
export declare function registerLocale(code: string, locale: Partial<AsnLocale>): void;
|
|
424
|
+
|
|
405
425
|
/**
|
|
406
426
|
* Resolves a lang value to a full AsnLocale.
|
|
407
427
|
* - string key → looks up locales registry, deep-merges with 'en' fallback.
|
|
@@ -713,6 +733,12 @@ export interface AutumnNoteStatic {
|
|
|
713
733
|
registerButton(btnDef: ToolbarItemDef): this;
|
|
714
734
|
registerSlashCommand(command: SlashCommand): this;
|
|
715
735
|
|
|
736
|
+
/**
|
|
737
|
+
* Registers a locale so `lang: '<code>'` can select it. Only English ships
|
|
738
|
+
* in the ESM bundle; import others from `autumnnote/i18n/<code>`.
|
|
739
|
+
*/
|
|
740
|
+
registerLocale(code: string, locale: Partial<AsnLocale>): this;
|
|
741
|
+
|
|
716
742
|
/**
|
|
717
743
|
* All pre-built button definitions in a single namespace.
|
|
718
744
|
* Use in UMD / CJS builds where named imports are unavailable:
|