autumnnote 1.8.2 → 1.8.3

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.
@@ -0,0 +1,4 @@
1
+ User-agent: *
2
+ Allow: /
3
+
4
+ Sitemap: https://autumn.konexforge.com/sitemap.xml
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ <url>
4
+ <loc>https://autumn.konexforge.com/</loc>
5
+ <changefreq>monthly</changefreq>
6
+ <priority>1.0</priority>
7
+ </url>
8
+ <url>
9
+ <loc>https://autumn.konexforge.com/docs.html</loc>
10
+ <changefreq>monthly</changefreq>
11
+ <priority>0.9</priority>
12
+ </url>
13
+ <url>
14
+ <loc>https://autumn.konexforge.com/playground.html</loc>
15
+ <changefreq>monthly</changefreq>
16
+ <priority>0.7</priority>
17
+ </url>
18
+ </urlset>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autumnnote",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "WYSIWYG rich-text editor built with vanilla JavaScript — zero dependencies, no jQuery. Dark mode, @mention, markdown shortcuts, bubble toolbar. React and Vue 3 wrappers included.",
5
5
  "main": "dist/autumnnote.umd.js",
6
6
  "module": "dist/autumnnote.es.js",
@@ -9,10 +9,12 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": "./dist/autumnnote.es.js",
12
- "require": "./dist/autumnnote.umd.js"
12
+ "require": "./dist/autumnnote.umd.js",
13
+ "types": "./types/index.d.ts"
13
14
  },
14
15
  "./dist/autumnnote.css": "./dist/autumnnote.css"
15
16
  },
17
+ "sideEffects": ["./dist/autumnnote.css", "**/*.css"],
16
18
  "files": [
17
19
  "dist",
18
20
  "src",
@@ -100,6 +102,9 @@
100
102
  "vite": "^8.0.3",
101
103
  "vitest": "^4.1.2"
102
104
  },
105
+ "engines": {
106
+ "node": ">=18.0.0"
107
+ },
103
108
  "browserslist": [
104
109
  "last 2 versions",
105
110
  "not dead",
package/src/js/index.js CHANGED
@@ -144,7 +144,7 @@ const AutumnNote = {
144
144
  buttons,
145
145
 
146
146
  /** Library version */
147
- version: '1.8.2',
147
+ version: '1.8.3',
148
148
  };
149
149
 
150
150
  // ---------------------------------------------------------------------------
@@ -381,7 +381,7 @@ export class Clipboard {
381
381
  const MAX_DIM = 1920;
382
382
  const QUALITY = 0.85;
383
383
 
384
- return new Promise((resolve) => {
384
+ return new Promise((resolve, reject) => {
385
385
  const objectUrl = URL.createObjectURL(file);
386
386
  const img = new Image();
387
387
 
@@ -408,6 +408,7 @@ export class Clipboard {
408
408
  // embedding the original file without compression.
409
409
  const reader = new FileReader();
410
410
  reader.onload = (e) => resolve(/** @type {string} */ (e.target.result));
411
+ reader.onerror = () => reject(new Error('FileReader failed'));
411
412
  reader.readAsDataURL(file);
412
413
  return;
413
414
  }
@@ -423,6 +424,7 @@ export class Clipboard {
423
424
  // Fallback: embed original without compression
424
425
  const reader = new FileReader();
425
426
  reader.onload = (e) => resolve(/** @type {string} */ (e.target.result));
427
+ reader.onerror = () => reject(new Error('FileReader failed'));
426
428
  reader.readAsDataURL(file);
427
429
  };
428
430
 
@@ -77,7 +77,7 @@ const defaultItems = [
77
77
  navigator.clipboard.read().then((items) => {
78
78
  for (const item of items) {
79
79
  if (item.types.includes('text/html')) {
80
- item.getType('text/html').then((blob) => blob.text()).then((html) => doInsert(html, null));
80
+ item.getType('text/html').then((blob) => blob.text()).then((html) => doInsert(html, null)).catch(() => {});
81
81
  return;
82
82
  }
83
83
  }
@@ -48,6 +48,7 @@ function drawCropToCanvas(img, naturalRect, renderW, renderH) {
48
48
  canvas.width = Math.round(renderW);
49
49
  canvas.height = Math.round(renderH);
50
50
  const ctx = canvas.getContext('2d');
51
+ if (!ctx) { resolve(null); return; } // GPU memory limit — let _confirm() handle null
51
52
  try {
52
53
  ctx.drawImage(
53
54
  source,
@@ -153,7 +153,7 @@ export const defaultOptions = {
153
153
  // Accepts any valid CSS colour string, e.g. '#f97316', 'hsl(25,90%,55%)'.
154
154
  focusColor: null,
155
155
  // Display language for the editor UI.
156
- // Built-in values: 'en' (default), 'vi', 'ja', 'zh', 'fr'.
156
+ // Built-in values: 'en' (default), 'vi', 'ja', 'zh', 'fr', 'de', 'es', 'ko'.
157
157
  // Pass a partial or full locale object to override individual strings.
158
158
  lang: 'en',
159
159
 
@@ -168,6 +168,12 @@ export const defaultOptions = {
168
168
  // e.g. "## " at line start → <h2>, "**bold**" → <strong>
169
169
  markdownShortcuts: true,
170
170
 
171
+ // Maximum paste size in bytes (default 5 MB). Pastes larger than this are silently dropped.
172
+ maxPasteSize: 5 * 1024 * 1024,
173
+ // Minimum image dimension in px during resize (width and height). Prevents images from being
174
+ // resized below this value.
175
+ minImageSize: 20,
176
+
171
177
  // Bubble toolbar: show a mini floating toolbar above text selections.
172
178
  bubbleToolbar: false,
173
179
  bubbleToolbarItems: ['bold', 'italic', 'underline', 'link', 'foreColor', 'hiliteColor', 'removeFormat'],
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * AutumnNote – TypeScript declarations
3
- * @version 1.8.2
3
+ * @version 1.8.3
4
4
  */
5
5
 
6
6
  // ---------------------------------------------------------------------------
@@ -104,6 +104,8 @@ export interface AsnOptions {
104
104
  onPaste?: (data: { text: string; html: string | null }) => void;
105
105
  /** Additional color swatches shown at the top of the color picker. */
106
106
  colorSwatches?: string[];
107
+ /** Custom focus ring colour — overrides the default blue. Accepts any valid CSS colour string, e.g. '#f97316'. */
108
+ focusColor?: string | null;
107
109
  /**
108
110
  * Display language for the editor UI.
109
111
  * Built-in: 'en' (default) | 'vi' | 'ja' | 'zh' | 'fr' | 'de' | 'es' | 'ko'.
@@ -134,7 +136,7 @@ export interface AsnOptions {
134
136
  /** Show a mini floating toolbar above the text selection. Default: false. */
135
137
  bubbleToolbar?: boolean;
136
138
  /** Button names shown in the bubble toolbar. */
137
- bubbleToolbarItems?: Array<'bold' | 'italic' | 'underline' | 'strikethrough' | 'link' | 'foreColor' | 'removeFormat' | 'inlineCode'>;
139
+ bubbleToolbarItems?: Array<'bold' | 'italic' | 'underline' | 'strikethrough' | 'link' | 'foreColor' | 'hiliteColor' | 'removeFormat' | 'inlineCode'>;
138
140
 
139
141
  // ---- @mention (#5) --------------------------------------------------------
140
142