autumnnote 1.6.6 → 1.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 +11 -5
- package/dist/autumnnote.css +164 -0
- package/dist/autumnnote.es.js +426 -31
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +426 -31
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/js/Context.js +37 -1
- package/src/js/editing/History.js +10 -0
- package/src/js/i18n/de.js +7 -0
- package/src/js/i18n/en.js +14 -0
- package/src/js/i18n/es.js +7 -0
- package/src/js/i18n/fr.js +7 -0
- package/src/js/i18n/ja.js +7 -0
- package/src/js/i18n/ko.js +7 -0
- package/src/js/i18n/vi.js +7 -0
- package/src/js/i18n/zh.js +7 -0
- package/src/js/index.js +1 -1
- package/src/js/module/BaseDialog.js +7 -0
- package/src/js/module/CodeTooltip.js +23 -0
- package/src/js/module/Editor.js +8 -0
- package/src/js/module/FindReplace.js +31 -6
- package/src/js/module/Mention.js +6 -2
- package/src/js/module/Statusbar.js +3 -3
- package/src/js/module/TableTooltip.js +287 -2
- package/src/js/renderer.js +5 -2
- package/src/styles/autumnnote.scss +181 -0
- package/types/index.d.ts +18 -4
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ A **zero-dependency WYSIWYG rich-text editor** built with vanilla JavaScript (ES
|
|
|
67
67
|
- **FA Icon picker** — FontAwesome 6 Free Solid icons across 8 categories; keyword search; configurable style, size, and colour; inserts as `<i>` element; auto-injects FA CDN if not on the page
|
|
68
68
|
|
|
69
69
|
### Search
|
|
70
|
-
- **Find and Replace** — `Ctrl+F` to find, `Ctrl+H` for find-and-replace; compact non-blocking floating panel (top-right); TreeWalker text matching; `<mark>` highlighting; case-sensitive `Aa` toggle; icon-button Prev/Next navigation (↑ ↓); single and replace-all modes
|
|
70
|
+
- **Find and Replace** — `Ctrl+F` to find, `Ctrl+H` for find-and-replace; compact non-blocking floating panel (top-right); TreeWalker text matching; `<mark>` highlighting; case-sensitive `Aa` toggle; **regex mode** (`.*` toggle); icon-button Prev/Next navigation (↑ ↓); single and replace-all modes
|
|
71
71
|
- **Auto language detection** — when selected text is formatted as a code block the editor automatically analyses the content and applies Prism.js syntax highlighting; 20 languages detected: JavaScript, TypeScript, Python, HTML, CSS, SCSS, JSON, SQL, Bash, Java, C#, PHP, Ruby, Go, Rust, C++, C, Kotlin, Swift, XML
|
|
72
72
|
|
|
73
73
|
### Inline tooltips
|
|
@@ -78,8 +78,8 @@ Floating toolbars appear automatically when the user clicks on an editable eleme
|
|
|
78
78
|
| **Link** | Open in new tab, Edit (reopens dialog), Unlink |
|
|
79
79
|
| **Image** | Edit alt/URL (reopens dialog), Crop, Delete |
|
|
80
80
|
| **Video** | Edit (reopens dialog), Delete |
|
|
81
|
-
| **Table cell** | Row above/below, Delete row, Column left/right, Delete column, Merge cells, Unmerge cells, Cell selection mode, Column width, Row height, Border width, **Cell background colour**, Delete table |
|
|
82
|
-
| **Code block** | Copy code, Language selector (20 languages + SCSS), Delete block |
|
|
81
|
+
| **Table cell** | Row above/below, Delete row, Column left/right, Delete column, Merge cells, Unmerge cells, Cell selection mode, Column width, Row height, Border width/color, **Cell background colour**, **Cell padding**, **Sort ↑↓**, **Export CSV**, **Toggle header row**, Delete table |
|
|
82
|
+
| **Code block** | Copy code, Language selector (20 languages + SCSS), **Line numbers toggle**, Delete block |
|
|
83
83
|
|
|
84
84
|
### Context menu
|
|
85
85
|
Right-click inside the editor opens a context menu with: **Undo**, **Redo**, **Cut**, **Copy**, **Paste**, **Bold**, **Italic**, **Underline**, **Copy Format**, **Paste Format**, **Remove Format**, and a **colour palette** for quick text/highlight colour changes.
|
|
@@ -93,7 +93,7 @@ Right-click inside the editor opens a context menu with: **Undo**, **Redo**, **C
|
|
|
93
93
|
### UI
|
|
94
94
|
- **Toolbar** — fully configurable button groups; overflow strategy: `wrap` (default) or `scroll`; on viewports ≤ 640 px the toolbar automatically switches to a single horizontally-scrollable row regardless of the `toolbarOverflow` setting; FontAwesome icons with built-in SVG fallback
|
|
95
95
|
- **Sticky toolbar** — `stickyToolbar: true` pins the toolbar to the viewport top; configurable offset for fixed nav bars
|
|
96
|
-
- **Dark / light theme** — `theme: 'dark'` or `
|
|
96
|
+
- **Dark / light / auto theme** — `theme: 'dark'`, `'light'` (default), or `'auto'` (follows OS `prefers-color-scheme`); full SCSS variable coverage; dark styles propagate to all floating elements (dialogs, tooltips, colour pickers)
|
|
97
97
|
- **Draggable dialogs** — all dialogs (Link, Image, Video, Emoji, Icon, Find & Replace) can be repositioned by dragging their title bar; position is clamped to the viewport
|
|
98
98
|
- **Image resizer** — drag handle on selected image to resize proportionally
|
|
99
99
|
- **Video resizer** — drag handle on selected video embed to resize
|
|
@@ -116,7 +116,7 @@ Right-click inside the editor opens a context menu with: **Undo**, **Redo**, **C
|
|
|
116
116
|
- **Plugin API** — first-class plugin system: `AutumnNote.use(plugin)`, `context.getPlugin(name)`, global button registry (`registerButton`), per-instance installation, `AsnPlugin<T>` TypeScript interface
|
|
117
117
|
- **Tree-shakeable** — ES module build; all core utilities individually exported
|
|
118
118
|
- **TypeScript definitions** — bundled `types/index.d.ts` with full JSDoc coverage
|
|
119
|
-
- **@mention autocomplete** — type `@` (or any custom trigger) to open a floating dropdown backed by a user-supplied `onSearch` function; inserts a non-editable mention chip; customisable chip HTML via `onInsert`
|
|
119
|
+
- **@mention autocomplete** — type `@` (or any custom trigger) to open a floating dropdown backed by a user-supplied `onSearch` function (callback or `async`/Promise); inserts a non-editable mention chip; customisable chip HTML via `onInsert`
|
|
120
120
|
|
|
121
121
|
### Security
|
|
122
122
|
- All HTML (pasted content, `setHTML()`, or code-view output) passes through a DOM-based sanitiser that strips `<script>`, `<object>`, `<embed>`, and all `on*` event handler attributes
|
|
@@ -407,6 +407,12 @@ See the [full Plugin API docs →](https://cmm-cmm.github.io/Autumn-Note/docs.ht
|
|
|
407
407
|
| `editor.setHTML(html)` | Sets HTML content (sanitised). `<iframe>` elements are preserved. |
|
|
408
408
|
| `editor.getText()` | Returns plain text with no markup. |
|
|
409
409
|
| `editor.clear()` | Clears all content, resets to an empty `<p>`. |
|
|
410
|
+
| `editor.clearHistory()` | Resets the undo/redo stack. |
|
|
411
|
+
| `editor.getUndoCount()` | Returns the number of available undo steps. |
|
|
412
|
+
| `editor.getRedoCount()` | Returns the number of available redo steps. |
|
|
413
|
+
| `editor.getWordCount()` | Returns the current word count. |
|
|
414
|
+
| `editor.getCharCount()` | Returns the current character count. |
|
|
415
|
+
| `editor.getTableOfContents()` | Returns an array of `{ level, text, element }` heading objects. |
|
|
410
416
|
| `editor.setDisabled(bool)` | Disables (`true`) or re-enables (`false`) the editor and toolbar. |
|
|
411
417
|
| `editor.destroy()` | Removes the editor, disposes all modules, and restores the original element. |
|
|
412
418
|
| `editor.on(event, fn)` | Subscribes to an editor event. Returns an unsubscribe function. |
|
package/dist/autumnnote.css
CHANGED
|
@@ -67,6 +67,11 @@
|
|
|
67
67
|
border-bottom: 1px solid #d1d5db;
|
|
68
68
|
user-select: none;
|
|
69
69
|
border-radius: 6px 6px 0 0;
|
|
70
|
+
overflow-x: auto;
|
|
71
|
+
scrollbar-width: none;
|
|
72
|
+
}
|
|
73
|
+
.an-toolbar::-webkit-scrollbar {
|
|
74
|
+
display: none;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
.an-btn-group {
|
|
@@ -404,6 +409,22 @@
|
|
|
404
409
|
color: inherit;
|
|
405
410
|
padding: 0;
|
|
406
411
|
}
|
|
412
|
+
.an-editable .an-code-line-numbers {
|
|
413
|
+
position: relative;
|
|
414
|
+
padding-left: 3.5em !important;
|
|
415
|
+
}
|
|
416
|
+
.an-editable .an-code-line-numbers::before {
|
|
417
|
+
content: "";
|
|
418
|
+
position: absolute;
|
|
419
|
+
left: 0;
|
|
420
|
+
top: 0;
|
|
421
|
+
bottom: 0;
|
|
422
|
+
width: 3em;
|
|
423
|
+
background: rgba(0, 0, 0, 0.04);
|
|
424
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
425
|
+
pointer-events: none;
|
|
426
|
+
z-index: 0;
|
|
427
|
+
}
|
|
407
428
|
.an-editable a {
|
|
408
429
|
color: #3b82f6;
|
|
409
430
|
}
|
|
@@ -1769,6 +1790,10 @@
|
|
|
1769
1790
|
background: #313244;
|
|
1770
1791
|
color: #cdd6f4;
|
|
1771
1792
|
}
|
|
1793
|
+
.an-theme-dark .an-editable .an-code-line-numbers::before {
|
|
1794
|
+
background: rgba(255, 255, 255, 0.05);
|
|
1795
|
+
border-right-color: rgba(255, 255, 255, 0.1);
|
|
1796
|
+
}
|
|
1772
1797
|
.an-theme-dark .an-editable hr {
|
|
1773
1798
|
border-color: #3f3f5f;
|
|
1774
1799
|
}
|
|
@@ -2125,6 +2150,145 @@
|
|
|
2125
2150
|
color: #6c7086;
|
|
2126
2151
|
}
|
|
2127
2152
|
|
|
2153
|
+
@media (prefers-color-scheme: dark) {
|
|
2154
|
+
.an-theme-auto {
|
|
2155
|
+
border-color: #3f3f5f;
|
|
2156
|
+
background: #1e1e2e;
|
|
2157
|
+
color: #cdd6f4;
|
|
2158
|
+
}
|
|
2159
|
+
.an-theme-auto.an-focused {
|
|
2160
|
+
border-color: #89b4fa;
|
|
2161
|
+
box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.2);
|
|
2162
|
+
}
|
|
2163
|
+
.an-theme-auto .an-toolbar {
|
|
2164
|
+
background: #181825;
|
|
2165
|
+
border-color: #3f3f5f;
|
|
2166
|
+
}
|
|
2167
|
+
.an-theme-auto .an-btn {
|
|
2168
|
+
color: #cdd6f4;
|
|
2169
|
+
}
|
|
2170
|
+
.an-theme-auto .an-btn:hover {
|
|
2171
|
+
background: #2a2a3e;
|
|
2172
|
+
border-color: #3f3f5f;
|
|
2173
|
+
color: #cdd6f4;
|
|
2174
|
+
}
|
|
2175
|
+
.an-theme-auto .an-btn:hover svg {
|
|
2176
|
+
stroke: #cdd6f4;
|
|
2177
|
+
}
|
|
2178
|
+
.an-theme-auto .an-btn.active {
|
|
2179
|
+
background: #1a3a5c;
|
|
2180
|
+
border-color: #89b4fa;
|
|
2181
|
+
color: #89b4fa;
|
|
2182
|
+
}
|
|
2183
|
+
.an-theme-auto .an-btn.active svg {
|
|
2184
|
+
stroke: #89b4fa;
|
|
2185
|
+
}
|
|
2186
|
+
.an-theme-auto .an-btn.an-btn-primary {
|
|
2187
|
+
background: #3b5bdb;
|
|
2188
|
+
border-color: #3b5bdb;
|
|
2189
|
+
color: #fff;
|
|
2190
|
+
}
|
|
2191
|
+
.an-theme-auto .an-select {
|
|
2192
|
+
background-color: #1e1e2e;
|
|
2193
|
+
border-color: #3f3f5f;
|
|
2194
|
+
color: #cdd6f4;
|
|
2195
|
+
}
|
|
2196
|
+
.an-theme-auto .an-select:hover, .an-theme-auto .an-select:focus {
|
|
2197
|
+
border-color: #89b4fa;
|
|
2198
|
+
}
|
|
2199
|
+
.an-theme-auto .an-editable {
|
|
2200
|
+
background: #1e1e2e;
|
|
2201
|
+
color: #cdd6f4;
|
|
2202
|
+
}
|
|
2203
|
+
.an-theme-auto .an-editable a {
|
|
2204
|
+
color: #89b4fa;
|
|
2205
|
+
}
|
|
2206
|
+
.an-theme-auto .an-editable blockquote {
|
|
2207
|
+
border-color: #3f3f5f;
|
|
2208
|
+
color: #a6adc8;
|
|
2209
|
+
}
|
|
2210
|
+
.an-theme-auto .an-editable pre:not([class*=language-]),
|
|
2211
|
+
.an-theme-auto .an-editable code:not([class*=language-]) {
|
|
2212
|
+
background: #313244;
|
|
2213
|
+
color: #cdd6f4;
|
|
2214
|
+
}
|
|
2215
|
+
.an-theme-auto .an-editable hr {
|
|
2216
|
+
border-color: #3f3f5f;
|
|
2217
|
+
}
|
|
2218
|
+
.an-theme-auto .an-editable table td, .an-theme-auto .an-editable table th, .an-theme-auto .an-editable .an-table td, .an-theme-auto .an-editable .an-table th {
|
|
2219
|
+
border-color: #3f3f5f;
|
|
2220
|
+
}
|
|
2221
|
+
.an-theme-auto .an-editable table th, .an-theme-auto .an-editable .an-table th {
|
|
2222
|
+
background: #313244;
|
|
2223
|
+
}
|
|
2224
|
+
.an-theme-auto .an-editable.an-placeholder::before {
|
|
2225
|
+
color: #6c7086;
|
|
2226
|
+
}
|
|
2227
|
+
.an-theme-auto .an-editable figcaption.an-figcaption {
|
|
2228
|
+
color: #6c7086;
|
|
2229
|
+
}
|
|
2230
|
+
.an-theme-auto .an-statusbar {
|
|
2231
|
+
background: #181825;
|
|
2232
|
+
border-color: #3f3f5f;
|
|
2233
|
+
color: #6c7086;
|
|
2234
|
+
}
|
|
2235
|
+
.an-theme-auto .an-link-tooltip,
|
|
2236
|
+
.an-theme-auto .an-contextmenu {
|
|
2237
|
+
background: #24273a;
|
|
2238
|
+
border-color: #3f3f5f;
|
|
2239
|
+
color: #cdd6f4;
|
|
2240
|
+
}
|
|
2241
|
+
.an-theme-auto .an-link-tooltip-url {
|
|
2242
|
+
color: #89b4fa;
|
|
2243
|
+
}
|
|
2244
|
+
.an-theme-auto .an-link-tooltip-btn {
|
|
2245
|
+
color: #a6adc8;
|
|
2246
|
+
}
|
|
2247
|
+
.an-theme-auto .an-link-tooltip-btn:hover {
|
|
2248
|
+
background: #2a2a3e;
|
|
2249
|
+
color: #cdd6f4;
|
|
2250
|
+
}
|
|
2251
|
+
.an-theme-auto .an-dialog-overlay {
|
|
2252
|
+
background: rgba(0, 0, 0, 0.65);
|
|
2253
|
+
}
|
|
2254
|
+
.an-theme-auto .an-dialog-box {
|
|
2255
|
+
background: #24273a;
|
|
2256
|
+
color: #cdd6f4;
|
|
2257
|
+
border: 1px solid #3f3f5f;
|
|
2258
|
+
}
|
|
2259
|
+
.an-theme-auto .an-dialog-title {
|
|
2260
|
+
color: #cdd6f4;
|
|
2261
|
+
}
|
|
2262
|
+
.an-theme-auto .an-input {
|
|
2263
|
+
background: #313244;
|
|
2264
|
+
border-color: #3f3f5f;
|
|
2265
|
+
color: #cdd6f4;
|
|
2266
|
+
}
|
|
2267
|
+
.an-theme-auto .an-input:focus {
|
|
2268
|
+
border-color: #89b4fa;
|
|
2269
|
+
box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.15);
|
|
2270
|
+
}
|
|
2271
|
+
.an-theme-auto .an-color-popup,
|
|
2272
|
+
.an-theme-auto .an-table-picker-popup,
|
|
2273
|
+
.an-theme-auto .an-size-popover,
|
|
2274
|
+
.an-theme-auto .an-cell-shade-popover {
|
|
2275
|
+
background: #24273a;
|
|
2276
|
+
border-color: #3f3f5f;
|
|
2277
|
+
color: #cdd6f4;
|
|
2278
|
+
}
|
|
2279
|
+
.an-theme-auto .an-context-color-swatch {
|
|
2280
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
2281
|
+
}
|
|
2282
|
+
.an-theme-auto .an-context-color-swatch:hover {
|
|
2283
|
+
border-color: rgba(255, 255, 255, 0.5);
|
|
2284
|
+
}
|
|
2285
|
+
.an-theme-auto .an-label {
|
|
2286
|
+
color: #cdd6f4;
|
|
2287
|
+
}
|
|
2288
|
+
.an-theme-auto .an-editable ul.an-checklist li:has(input[type=checkbox]:checked) {
|
|
2289
|
+
color: #6c7086;
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2128
2292
|
@media print {
|
|
2129
2293
|
.an-container {
|
|
2130
2294
|
border: none;
|