autumnnote 2.6.0 → 2.7.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 +34 -1
- package/dist/autumnnote.cjs +33 -33
- package/dist/autumnnote.core.es.js +680 -568
- package/dist/autumnnote.core.es.js.map +1 -1
- package/dist/autumnnote.es.js +856 -712
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.min.js +33 -33
- package/dist/autumnnote.umd.js +33 -33
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/js/core/func.js +10 -4
- package/types/index.d.ts +50 -1
package/README.md
CHANGED
|
@@ -160,6 +160,28 @@ Found a vulnerability? Please follow [SECURITY.md](SECURITY.md) rather than open
|
|
|
160
160
|
### Server-side rendering
|
|
161
161
|
The package is safe to `import` in a Node/SSR context — no module reads `document`, `window` or `navigator` at import time, so the React and Vue wrappers work under Next.js and Nuxt. Editors are only created when you call `create()` in the browser.
|
|
162
162
|
|
|
163
|
+
### Optional external assets
|
|
164
|
+
The editor itself ships zero runtime dependencies, but two features fetch a file from a CDN the first time they are needed:
|
|
165
|
+
|
|
166
|
+
| Feature | Asset | Turn it off with | Point it elsewhere with |
|
|
167
|
+
|---|---|---|---|
|
|
168
|
+
| Code-block highlighting | Prism core, theme, and one grammar per language used | `codeHighlight: false` | `codeHighlightCDN` |
|
|
169
|
+
| Icon picker | Font Awesome stylesheet, only when the page has none | `fontAwesomeAutoInject: false` | `fontAwesomeCDN` |
|
|
170
|
+
|
|
171
|
+
Injected `<link>`/`<script>` elements carry `crossorigin="anonymous"` and `referrerpolicy="no-referrer"`, and a `cspNonce` if you supply one. Nothing is fetched when the host page already provides Prism or Font Awesome.
|
|
172
|
+
|
|
173
|
+
**`Tracking Prevention blocked access to storage for …` in the console.** This is Microsoft Edge, not the editor. Edge's Tracking Prevention denies storage access (cookies, `localStorage`) to subresources loaded from domains on its tracking-protection list, and logs one line per attempt. `cdn.jsdelivr.net` is on that list; the default `cdnjs.cloudflare.com` is not. The asset still downloads and Prism still highlights — Prism never touches storage — so this is console noise rather than a failure. To silence it, either leave `codeHighlightCDN` at its default or self-host:
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
AutumnNote.create('#editor', {
|
|
177
|
+
// Serve prism.min.js, themes/ and components/ from your own origin.
|
|
178
|
+
// A trailing slash is fine — it is normalised before the paths are appended.
|
|
179
|
+
codeHighlightCDN: '/vendor/prism',
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Self-hosting also removes the third-party request entirely, which is usually what a strict CSP wants anyway. Alternatively, load Prism yourself before calling `create()` — the editor detects `window.Prism` and injects nothing.
|
|
184
|
+
|
|
163
185
|
---
|
|
164
186
|
|
|
165
187
|
## Installation
|
|
@@ -592,11 +614,15 @@ See the [full Plugin API docs →](https://autumn.konexforge.com/docs.html#plugi
|
|
|
592
614
|
| `direction` | `string` | `'ltr'` | Text direction: `'ltr'` or `'rtl'`. |
|
|
593
615
|
| `autoSave` | `boolean` | `false` | Persist content to `localStorage` on every change. |
|
|
594
616
|
| `autoSaveKey` | `string` | `'autumnnote-autosave'` | `localStorage` key used when `autoSave` is enabled. |
|
|
617
|
+
| `autoSaveDelay` | `number` | `400` | Debounce in ms between the last change and the auto-save write. |
|
|
595
618
|
| `maxChars` | `number` | `0` | Maximum character count. `0` = unlimited. Shows warning in statusbar. |
|
|
596
619
|
| `maxWords` | `number` | `0` | Maximum word count. `0` = unlimited. Shows warning in statusbar. |
|
|
597
620
|
| `tableHeaderRow` | `boolean` | `false` | Insert a `<thead>` header row when creating new tables. |
|
|
598
621
|
| `codeHighlight` | `boolean` | `true` | Auto-load Prism.js for syntax highlighting inside `<pre><code>` blocks. |
|
|
599
|
-
| `codeHighlightCDN` | `string` | cdnjs Prism 1.29.0 | Base
|
|
622
|
+
| `codeHighlightCDN` | `string` | cdnjs Prism 1.29.0 | Base URL for Prism assets; override to self-host. A trailing slash is normalised away. See [Optional external assets](#optional-external-assets). |
|
|
623
|
+
| `cspNonce` | `string` | `''` | CSP nonce applied to dynamically injected Prism and Font Awesome assets. |
|
|
624
|
+
| `externalAssetCrossOrigin` | `string` | `'anonymous'` | `crossorigin` value for optional external assets; set `''` to omit it. |
|
|
625
|
+
| `externalAssetReferrerPolicy` | `string` | `'no-referrer'` | Referrer policy for optional external assets; set `''` to omit it. |
|
|
600
626
|
| `colorSwatches` | `string[]` | `[]` | Custom brand colour swatches prepended to the colour picker palette. |
|
|
601
627
|
| `focusColor` | `string` | `null` | Custom focus ring colour (any valid CSS colour). Overrides the default blue. |
|
|
602
628
|
| `lang` | `string \| object` | `'en'` | UI display language. `'en'` is built in; other codes must be registered first — see [Languages](#languages). Pass a partial locale object for custom overrides. |
|
|
@@ -609,6 +635,12 @@ See the [full Plugin API docs →](https://autumn.konexforge.com/docs.html#plugi
|
|
|
609
635
|
| `maxPasteSize` | `number` | `5242880` | Maximum paste payload size in bytes (default 5 MB). Pastes larger than this are silently dropped. |
|
|
610
636
|
| `minImageSize` | `number` | `20` | Minimum image dimension in px during resize (width and height). |
|
|
611
637
|
| `mention` | `object` | `null` | @mention configuration object. Set `mention.onSearch` to activate. See [Mentions](#mentions). |
|
|
638
|
+
| `contextMenu` | `object` | `null` | Right-click menu override. `contextMenu.items` replaces the built-in list; see `ContextMenuItem` in the type definitions. |
|
|
639
|
+
| `slashCommands` | `object[]` | `[]` | Extra entries appended to the `/` command palette. |
|
|
640
|
+
| `historyMaxBytes` | `number` | `10485760` | Combined character budget for the undo/redo snapshot stack (default 10 MB). The oldest snapshots are dropped past it. |
|
|
641
|
+
| `blockIds` | `boolean` | `false` | Add stable `data-an-block-id` attributes to top-level blocks, so an external adapter can address them. |
|
|
642
|
+
| `documentAdapters` | `object` | `{}` | Import/export adapters keyed by format name. |
|
|
643
|
+
| `collaborationAdapter` | `object` | `null` | Bridge notified of local HTML changes. |
|
|
612
644
|
| `onChange` | `Function` | `null` | `(html: string) => void` — called on every content change. |
|
|
613
645
|
| `onFocus` | `Function` | `null` | `(context) => void` — called when the editor gains focus. |
|
|
614
646
|
| `onBlur` | `Function` | `null` | `(context) => void` — called when the editor loses focus. |
|
|
@@ -787,6 +819,7 @@ src/
|
|
|
787
819
|
│ │ ├── key.js Keyboard key constants
|
|
788
820
|
│ │ ├── lists.js Array helpers
|
|
789
821
|
│ │ ├── env.js Browser/platform detection (lazy — SSR-safe)
|
|
822
|
+
│ │ ├── count.js Word/character counting shared by the statusbar and the limits
|
|
790
823
|
│ │ ├── detectLang.js Code-block language detection for Prism highlighting
|
|
791
824
|
│ │ ├── markdown.js Bidirectional HTML ↔ Markdown conversion (with GFM checklists)
|
|
792
825
|
│ │ └── sanitise.js DOM-based HTML and URL sanitiser (string or nodes)
|