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.
- package/README.md +11 -5
- package/dist/autumnnote.es.js +11 -3
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +11 -11
- package/dist/autumnnote.umd.js.map +1 -1
- package/dist/robots.txt +4 -0
- package/dist/sitemap.xml +18 -0
- package/package.json +7 -2
- package/src/js/index.js +1 -1
- package/src/js/module/Clipboard.js +3 -1
- package/src/js/module/ContextMenu.js +1 -1
- package/src/js/module/ImageCropOverlay.js +1 -0
- package/src/js/settings.js +7 -1
- package/types/index.d.ts +4 -2
package/README.md
CHANGED
|
@@ -177,6 +177,9 @@ Official React and Vue 3 wrappers are available as separate packages in this mon
|
|
|
177
177
|
|
|
178
178
|
```bash
|
|
179
179
|
npm install autumnnote autumnnote-react
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```js
|
|
180
183
|
import 'autumnnote/dist/autumnnote.css';
|
|
181
184
|
```
|
|
182
185
|
|
|
@@ -206,6 +209,9 @@ The `ref` is forwarded to the underlying `Context` instance via `useImperativeHa
|
|
|
206
209
|
|
|
207
210
|
```bash
|
|
208
211
|
npm install autumnnote autumnnote-vue
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```js
|
|
209
215
|
import 'autumnnote/dist/autumnnote.css';
|
|
210
216
|
```
|
|
211
217
|
|
|
@@ -260,7 +266,6 @@ const editor = AutumnNote.create('#my-editor', {
|
|
|
260
266
|
```js
|
|
261
267
|
const editor = AutumnNote.create('#my-editor', {
|
|
262
268
|
useBootstrap: true,
|
|
263
|
-
bootstrapVersion: 5,
|
|
264
269
|
toolbarButtonClass: 'btn btn-sm btn-light',
|
|
265
270
|
});
|
|
266
271
|
```
|
|
@@ -296,7 +301,7 @@ const editor = AutumnNote.create('#my-editor', {
|
|
|
296
301
|
fd.append('file', files[0]);
|
|
297
302
|
fetch('/api/upload', { method: 'POST', body: fd })
|
|
298
303
|
.then(r => r.json())
|
|
299
|
-
.then(({ url }) => editor.insertImage
|
|
304
|
+
.then(({ url }) => editor.invoke('editor.insertImage', url, files[0].name));
|
|
300
305
|
},
|
|
301
306
|
});
|
|
302
307
|
```
|
|
@@ -462,7 +467,6 @@ See the [full Plugin API docs →](https://autumn.konexforge.com/docs.html#plugi
|
|
|
462
467
|
| `toolbar` | `Array[]` | all buttons | Toolbar layout. See [Toolbar Customisation](#toolbar-customisation). |
|
|
463
468
|
| `toolbarOverflow` | `string` | `'wrap'` | Toolbar overflow strategy: `'wrap'` or `'scroll'`. |
|
|
464
469
|
| `useBootstrap` | `boolean` | `false` | Apply Bootstrap CSS classes to toolbar buttons. |
|
|
465
|
-
| `bootstrapVersion` | `number` | `5` | Bootstrap major version (`4` or `5`). |
|
|
466
470
|
| `toolbarButtonClass` | `string` | `'btn btn-sm btn-light'` | CSS classes for toolbar buttons when `useBootstrap` is `true`. |
|
|
467
471
|
| `useFontAwesome` | `boolean` | `true` | Use FA icons when FontAwesome is detected on the page. |
|
|
468
472
|
| `fontAwesomeClass` | `string` | `'fas'` | FA prefix: `'fas'` for FA 5, `'fa-solid'` for FA 6. |
|
|
@@ -479,7 +483,7 @@ See the [full Plugin API docs →](https://autumn.konexforge.com/docs.html#plugi
|
|
|
479
483
|
| `fontFamilies` | `string[]` | 10 fonts | Font families available in the font-family dropdown. |
|
|
480
484
|
| `stickyToolbar` | `boolean` | `false` | Pin the toolbar to the viewport top when the page is scrolled. |
|
|
481
485
|
| `stickyToolbarOffset` | `number` | `0` | Top offset in pixels for the sticky toolbar (e.g. height of a fixed nav bar). |
|
|
482
|
-
| `theme` | `string` | `'light'` | Colour theme: `'light'` or `'
|
|
486
|
+
| `theme` | `string` | `'light'` | Colour theme: `'light'`, `'dark'`, or `'auto'` (follows system preference). |
|
|
483
487
|
| `readOnly` | `boolean` | `false` | Start the editor in non-editable (read-only) mode with toolbar hidden. |
|
|
484
488
|
| `spellcheck` | `boolean` | `true` | Enable browser spellcheck in the editable area. |
|
|
485
489
|
| `direction` | `string` | `'ltr'` | Text direction: `'ltr'` or `'rtl'`. |
|
|
@@ -495,10 +499,12 @@ See the [full Plugin API docs →](https://autumn.konexforge.com/docs.html#plugi
|
|
|
495
499
|
| `lang` | `string \| object` | `'en'` | UI display language. Built-in codes: `'en'`, `'vi'`, `'ja'`, `'zh'`, `'fr'`, `'de'`, `'es'`, `'ko'`. Pass a partial locale object for custom overrides. |
|
|
496
500
|
| `markdownShortcuts` | `boolean` | `true` | Convert Markdown-style syntax typed in the editor to HTML in real time (block and inline rules). |
|
|
497
501
|
| `bubbleToolbar` | `boolean` | `false` | Show a mini floating toolbar above the text selection for quick formatting. |
|
|
498
|
-
| `bubbleToolbarItems` | `string[]` | `['bold','italic','underline','link','foreColor','removeFormat']` | Buttons shown in the bubble toolbar. Available names: `'bold'`, `'italic'`, `'underline'`, `'strikethrough'`, `'link'`, `'foreColor'`, `'removeFormat'`, `'inlineCode'`. |
|
|
502
|
+
| `bubbleToolbarItems` | `string[]` | `['bold','italic','underline','link','foreColor','hiliteColor','removeFormat']` | Buttons shown in the bubble toolbar. Available names: `'bold'`, `'italic'`, `'underline'`, `'strikethrough'`, `'link'`, `'foreColor'`, `'hiliteColor'`, `'removeFormat'`, `'inlineCode'`. |
|
|
499
503
|
| `autoSaveRestore` | `boolean` | `false` | When `autoSave` is also `true`, show a restore banner on load if a draft exists. |
|
|
500
504
|
| `autoSaveRestoreTimeout` | `number` | `7` | Max draft age in days before it is auto-discarded. `0` = no expiry. |
|
|
501
505
|
| `onAutoSaveRestore` | `Function` | `null` | `(html, context) => void` — called after the user restores a draft. |
|
|
506
|
+
| `maxPasteSize` | `number` | `5242880` | Maximum paste payload size in bytes (default 5 MB). Pastes larger than this are silently dropped. |
|
|
507
|
+
| `minImageSize` | `number` | `20` | Minimum image dimension in px during resize (width and height). |
|
|
502
508
|
| `mention` | `object` | `null` | @mention configuration object. Set `mention.onSearch` to activate. See [Mentions](#mentions). |
|
|
503
509
|
| `onChange` | `Function` | `null` | `(html: string) => void` — called on every content change. |
|
|
504
510
|
| `onFocus` | `Function` | `null` | `(context) => void` — called when the editor gains focus. |
|
package/dist/autumnnote.es.js
CHANGED
|
@@ -1724,6 +1724,8 @@ var defaultOptions = {
|
|
|
1724
1724
|
autoSaveRestoreTimeout: 7,
|
|
1725
1725
|
onAutoSaveRestore: null,
|
|
1726
1726
|
markdownShortcuts: true,
|
|
1727
|
+
maxPasteSize: 5 * 1024 * 1024,
|
|
1728
|
+
minImageSize: 20,
|
|
1727
1729
|
bubbleToolbar: false,
|
|
1728
1730
|
bubbleToolbarItems: [
|
|
1729
1731
|
"bold",
|
|
@@ -7427,7 +7429,7 @@ var Clipboard = class {
|
|
|
7427
7429
|
_compressImage(file) {
|
|
7428
7430
|
const MAX_DIM = 1920;
|
|
7429
7431
|
const QUALITY = .85;
|
|
7430
|
-
return new Promise((resolve) => {
|
|
7432
|
+
return new Promise((resolve, reject) => {
|
|
7431
7433
|
const objectUrl = URL.createObjectURL(file);
|
|
7432
7434
|
const img = new Image();
|
|
7433
7435
|
img.onload = () => {
|
|
@@ -7447,6 +7449,7 @@ var Clipboard = class {
|
|
|
7447
7449
|
if (!ctx) {
|
|
7448
7450
|
const reader = new FileReader();
|
|
7449
7451
|
reader.onload = (e) => resolve(e.target.result);
|
|
7452
|
+
reader.onerror = () => reject(/* @__PURE__ */ new Error("FileReader failed"));
|
|
7450
7453
|
reader.readAsDataURL(file);
|
|
7451
7454
|
return;
|
|
7452
7455
|
}
|
|
@@ -7458,6 +7461,7 @@ var Clipboard = class {
|
|
|
7458
7461
|
URL.revokeObjectURL(objectUrl);
|
|
7459
7462
|
const reader = new FileReader();
|
|
7460
7463
|
reader.onload = (e) => resolve(e.target.result);
|
|
7464
|
+
reader.onerror = () => reject(/* @__PURE__ */ new Error("FileReader failed"));
|
|
7461
7465
|
reader.readAsDataURL(file);
|
|
7462
7466
|
};
|
|
7463
7467
|
img.src = objectUrl;
|
|
@@ -14179,7 +14183,7 @@ var defaultItems = [
|
|
|
14179
14183
|
};
|
|
14180
14184
|
if (typeof navigator.clipboard.read === "function") navigator.clipboard.read().then((items) => {
|
|
14181
14185
|
for (const item of items) if (item.types.includes("text/html")) {
|
|
14182
|
-
item.getType("text/html").then((blob) => blob.text()).then((html) => doInsert(html, null));
|
|
14186
|
+
item.getType("text/html").then((blob) => blob.text()).then((html) => doInsert(html, null)).catch(() => {});
|
|
14183
14187
|
return;
|
|
14184
14188
|
}
|
|
14185
14189
|
navigator.clipboard.readText().then((text) => doInsert(null, text)).catch(() => {});
|
|
@@ -15304,6 +15308,10 @@ function drawCropToCanvas(img, naturalRect, renderW, renderH) {
|
|
|
15304
15308
|
canvas.width = Math.round(renderW);
|
|
15305
15309
|
canvas.height = Math.round(renderH);
|
|
15306
15310
|
const ctx = canvas.getContext("2d");
|
|
15311
|
+
if (!ctx) {
|
|
15312
|
+
resolve(null);
|
|
15313
|
+
return;
|
|
15314
|
+
}
|
|
15307
15315
|
try {
|
|
15308
15316
|
ctx.drawImage(source, naturalRect.x, naturalRect.y, naturalRect.width, naturalRect.height, 0, 0, canvas.width, canvas.height);
|
|
15309
15317
|
ctx.getImageData(0, 0, 1, 1);
|
|
@@ -17492,7 +17500,7 @@ var AutumnNote = {
|
|
|
17492
17500
|
/** All pre-built button definitions — accessible in every module format including UMD/CJS. */
|
|
17493
17501
|
buttons,
|
|
17494
17502
|
/** Library version */
|
|
17495
|
-
version: "1.8.
|
|
17503
|
+
version: "1.8.3"
|
|
17496
17504
|
};
|
|
17497
17505
|
/**
|
|
17498
17506
|
* @param {string|Element|NodeList|Element[]} selector
|