autumnnote 2.6.0 → 2.7.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 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
@@ -596,7 +618,10 @@ See the [full Plugin API docs →](https://autumn.konexforge.com/docs.html#plugi
596
618
  | `maxWords` | `number` | `0` | Maximum word count. `0` = unlimited. Shows warning in statusbar. |
597
619
  | `tableHeaderRow` | `boolean` | `false` | Insert a `<thead>` header row when creating new tables. |
598
620
  | `codeHighlight` | `boolean` | `true` | Auto-load Prism.js for syntax highlighting inside `<pre><code>` blocks. |
599
- | `codeHighlightCDN` | `string` | cdnjs Prism 1.29.0 | Base CDN URL for Prism assets. |
621
+ | `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). |
622
+ | `cspNonce` | `string` | `''` | CSP nonce applied to dynamically injected Prism and Font Awesome assets. |
623
+ | `externalAssetCrossOrigin` | `string` | `'anonymous'` | `crossorigin` value for optional external assets; set `''` to omit it. |
624
+ | `externalAssetReferrerPolicy` | `string` | `'no-referrer'` | Referrer policy for optional external assets; set `''` to omit it. |
600
625
  | `colorSwatches` | `string[]` | `[]` | Custom brand colour swatches prepended to the colour picker palette. |
601
626
  | `focusColor` | `string` | `null` | Custom focus ring colour (any valid CSS colour). Overrides the default blue. |
602
627
  | `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. |
@@ -787,6 +812,7 @@ src/
787
812
  │ │ ├── key.js Keyboard key constants
788
813
  │ │ ├── lists.js Array helpers
789
814
  │ │ ├── env.js Browser/platform detection (lazy — SSR-safe)
815
+ │ │ ├── count.js Word/character counting shared by the statusbar and the limits
790
816
  │ │ ├── detectLang.js Code-block language detection for Prism highlighting
791
817
  │ │ ├── markdown.js Bidirectional HTML ↔ Markdown conversion (with GFM checklists)
792
818
  │ │ └── sanitise.js DOM-based HTML and URL sanitiser (string or nodes)