@novaprose/core 0.5.2 → 0.6.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.
Files changed (56) hide show
  1. package/README.md +51 -17
  2. package/THIRD_PARTY_NOTICES.md +50 -0
  3. package/dist/{advlist-FH3K3AAQ.js → advlist-K2U3VPH2.js} +3 -3
  4. package/dist/{autolink-IDJWAL2V.js → autolink-XWDTLY37.js} +2 -2
  5. package/dist/{autoresize-4ZEPQCHP.js → autoresize-UB3GOA6D.js} +2 -2
  6. package/dist/{autosave-WODRZ7L6.js → autosave-MWNRUNU3.js} +6 -3
  7. package/dist/autosave-MWNRUNU3.js.map +1 -0
  8. package/dist/{charmap-LWA7TL3K.js → charmap-ADLYOIB3.js} +6 -3
  9. package/dist/charmap-ADLYOIB3.js.map +1 -0
  10. package/dist/{chunk-PHRON5PL.js → chunk-435CRWKA.js} +70 -155
  11. package/dist/chunk-435CRWKA.js.map +1 -0
  12. package/dist/{chunk-2A3IYKPE.js → chunk-46RIM5KP.js} +934 -32
  13. package/dist/chunk-46RIM5KP.js.map +1 -0
  14. package/dist/{chunk-YZPJQB3I.js → chunk-7ON7PR5R.js} +106 -25
  15. package/dist/chunk-7ON7PR5R.js.map +1 -0
  16. package/dist/{chunk-6GWG2BLC.js → chunk-HPLT3XRZ.js} +1 -1
  17. package/dist/chunk-HPLT3XRZ.js.map +1 -0
  18. package/dist/chunk-NPKAIW34.js +239 -0
  19. package/dist/chunk-NPKAIW34.js.map +1 -0
  20. package/dist/{directionality-N62ZB7CF.js → directionality-XOHJFSL6.js} +7 -4
  21. package/dist/directionality-XOHJFSL6.js.map +1 -0
  22. package/dist/{emoticons-WQ3K4J6G.js → emoticons-TP4N4ZGY.js} +6 -3
  23. package/dist/emoticons-TP4N4ZGY.js.map +1 -0
  24. package/dist/index.cjs +1660 -308
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +334 -81
  27. package/dist/index.d.ts +334 -81
  28. package/dist/index.js +223 -34
  29. package/dist/index.js.map +1 -1
  30. package/dist/{insertdatetime-2RZ3UUQE.js → insertdatetime-T4SEMQWP.js} +6 -3
  31. package/dist/insertdatetime-T4SEMQWP.js.map +1 -0
  32. package/dist/{nonbreaking-L6GNDHVO.js → nonbreaking-HG5HV6AL.js} +6 -3
  33. package/dist/nonbreaking-HG5HV6AL.js.map +1 -0
  34. package/dist/{quickbars-TIRY3RH4.js → quickbars-4NU4SIPL.js} +7 -5
  35. package/dist/{quickbars-TIRY3RH4.js.map → quickbars-4NU4SIPL.js.map} +1 -1
  36. package/dist/{revisionhistory-GDTOULKS.js → revisionhistory-3YQPLPLM.js} +9 -6
  37. package/dist/revisionhistory-3YQPLPLM.js.map +1 -0
  38. package/dist/{visualblocks-V4CQ4XMF.js → visualblocks-RTAYJOGR.js} +6 -3
  39. package/dist/visualblocks-RTAYJOGR.js.map +1 -0
  40. package/package.json +3 -2
  41. package/src/style.css +106 -0
  42. package/dist/autosave-WODRZ7L6.js.map +0 -1
  43. package/dist/charmap-LWA7TL3K.js.map +0 -1
  44. package/dist/chunk-2A3IYKPE.js.map +0 -1
  45. package/dist/chunk-6GWG2BLC.js.map +0 -1
  46. package/dist/chunk-PHRON5PL.js.map +0 -1
  47. package/dist/chunk-YZPJQB3I.js.map +0 -1
  48. package/dist/directionality-N62ZB7CF.js.map +0 -1
  49. package/dist/emoticons-WQ3K4J6G.js.map +0 -1
  50. package/dist/insertdatetime-2RZ3UUQE.js.map +0 -1
  51. package/dist/nonbreaking-L6GNDHVO.js.map +0 -1
  52. package/dist/revisionhistory-GDTOULKS.js.map +0 -1
  53. package/dist/visualblocks-V4CQ4XMF.js.map +0 -1
  54. /package/dist/{advlist-FH3K3AAQ.js.map → advlist-K2U3VPH2.js.map} +0 -0
  55. /package/dist/{autolink-IDJWAL2V.js.map → autolink-XWDTLY37.js.map} +0 -0
  56. /package/dist/{autoresize-4ZEPQCHP.js.map → autoresize-UB3GOA6D.js.map} +0 -0
package/README.md CHANGED
@@ -58,23 +58,30 @@ Svelte, Astro and server-rendered pages, with a CDN build).
58
58
 
59
59
  ## Options
60
60
 
61
- | Option | Description |
62
- | ---------------------------------------------------- | -------------------------------------------------------------------------------- |
63
- | `element` | container to mount into (required) |
64
- | `content` | initial HTML string or document JSON |
65
- | `toolbar` | string (`'bold italic \| link'`), array of groups, or `false` |
66
- | `toolbarMode` | `'sliding'` (default) or `'wrap'` |
67
- | `mode` | `'classic'`, `'inline'` (toolbar on focus) or `'distraction-free'` (quick bars) |
68
- | `menubar`, `menu` | File · Edit · View · Insert · Format · Table · Help menus, customizable |
69
- | `statusbar` | word count and path; `false` to hide |
70
- | `placeholder`, `editable`, `language` | placeholder text, read-only mode, UI language (`en`, `ru` or your own) |
71
- | `uploadImage` | `(file, progress) => Promise<url>` |
72
- | `fontFamilies`, `fontSizes`, `lineHeights`, `colors` | lists for the corresponding pickers |
73
- | `plugins`, `pluginOptions` | plugin objects or names of built-in lazy plugins (`insertdatetime`, `quickbars`) |
74
- | `validElements`, `invalidElements`, `validStyles` | restrict content, like TinyMCE `valid_elements` / `invalid_elements` |
75
- | `pastePreprocess`, `pastePostprocess`, `pasteAsText` | paste hooks and plain-text mode |
76
- | `setup`, `onChange` | access the instance before first render; change callback |
77
- | `prosemirrorPlugins` | raw ProseMirror plugins for advanced use |
61
+ | Option | Description |
62
+ | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63
+ | `element` | container to mount into (required) |
64
+ | `content` | initial HTML string or document JSON |
65
+ | `toolbar` | string (`'bold italic \| link'`), array of groups, or `false` |
66
+ | `toolbarMode` | `'sliding'` (default) or `'wrap'` |
67
+ | `mode` | `'classic'`, `'inline'` (toolbar on focus) or `'distraction-free'` (quick bars) |
68
+ | `menubar`, `menu` | File · Edit · View · Insert · Format · Table · Help menus, customizable |
69
+ | `statusbar` | word count and path; `false` to hide |
70
+ | `placeholder`, `editable`, `language` | placeholder text, read-only mode, UI language (`en`, `ru` or your own) |
71
+ | `disabled` | disabled like a form field: no editing, skipped by Tab, dimmed UI |
72
+ | `resize` | resize handle in the status bar: `true` (height) or `'both'`; mouse, touch and arrow keys |
73
+ | `blockFormats` | items and order of the block menu: `[{ label: 'Subheading', block: 'h3' }]` |
74
+ | `contentStyle`, `contentCss` | styles for the text only (like TinyMCE `content_style` / `content_css`): scoped to this editor, `body` means the text area, `@import` and relative `url()` work, no `unsafe-inline` needed under CSP |
75
+ | `formats`, `styleFormats`, `validClasses` | named formats and the Formats menu (`styles` toolbar button), like TinyMCE `formats` / `style_formats`; classes from formats are kept in HTML, other classes only if listed in `validClasses` (`true` keeps all) |
76
+ | `tableClassList`, `tableCellClassList` | table and cell styles to pick in the properties dialogs: `[{ title: 'Bordered', value: 'grid' }]`; the class is kept in HTML |
77
+ | `uploadImage` | `(file, progress) => Promise<url>` |
78
+ | `filePicker`, `filePickerTypes` | your file manager behind a Browse button in the link, image and video dialogs: `({ type, value }) => Promise<{ url, text?, title?, alt? } | null>` |
79
+ | `fontFamilies`, `fontSizes`, `lineHeights`, `colors` | lists for the corresponding pickers |
80
+ | `plugins`, `pluginOptions` | plugin objects or names of built-in lazy plugins (`insertdatetime`, `quickbars`) |
81
+ | `validElements`, `invalidElements`, `validStyles` | restrict content, like TinyMCE `valid_elements` / `invalid_elements` |
82
+ | `pastePreprocess`, `pastePostprocess`, `pasteAsText` | paste hooks and plain-text mode |
83
+ | `setup`, `onChange` | access the instance before first render; change callback |
84
+ | `prosemirrorPlugins` | raw ProseMirror plugins for advanced use |
78
85
 
79
86
  ## API
80
87
 
@@ -84,16 +91,43 @@ editor.getJSON();
84
91
  editor.getText();
85
92
  editor.isEmpty();
86
93
  editor.setContent(html, { addToHistory: false });
94
+ editor.insertContent('<p>Inserted</p>'); // at the cursor; a table never overwrites table cells
87
95
  editor.exec('bold');
88
96
  editor.can('undo');
89
97
  editor.isActive('h2');
90
98
  editor.setEditable(false);
99
+ editor.setDisabled(true);
91
100
  editor.focus();
92
101
  editor.on('change' | 'selectionChange' | 'focus' | 'blur' | 'editableChange' | 'destroy', handler);
93
102
  editor.ui.registry.addButton('signature', { text: 'Sign', onAction: (e) => e.exec('bold') });
94
103
  editor.destroy();
95
104
  ```
96
105
 
106
+ ### Formats
107
+
108
+ ```ts
109
+ const editor = createEditor({
110
+ element,
111
+ toolbar: 'undo redo | styles | bold italic',
112
+ formats: {
113
+ note: { block: 'p', classes: 'note' },
114
+ marker: { inline: 'span', classes: 'marker' },
115
+ imageLeft: { selector: 'img', classes: 'float-left' },
116
+ },
117
+ styleFormats: [
118
+ { title: 'Note', format: 'note' },
119
+ { title: 'Text', items: [{ title: 'Marker', format: 'marker' }] },
120
+ ],
121
+ contentStyle: '.note { border-left: 3px solid #0969da; padding-left: 12px }',
122
+ });
123
+
124
+ editor.formatter.apply('note'); // also remove, toggle, match, canApply, register
125
+ ```
126
+
127
+ A format is a `block` (`p`, `h1`…`h6`, `blockquote`, `pre`), an `inline` (`span`, `strong`, `em`,
128
+ `code`…) or a `selector` for existing elements (`'p,h1'`, `'img'`), with `classes` and `styles`
129
+ (`color`, `background-color`, `font-family`, `font-size` for text; `text-align`, `line-height` for blocks).
130
+
97
131
  Command names (`bold`, `italic`, `h1`…`h6`, `bulletList`, `alignCenter`, `undo`…) are part of the
98
132
  public API and stay stable across minor versions.
99
133
 
@@ -0,0 +1,50 @@
1
+ # Third-party notices
2
+
3
+ NovaProse includes icons from [Lucide](https://lucide.dev) (some derived from Feather), used under the licenses below.
4
+
5
+ ```text
6
+ ISC License
7
+
8
+ Copyright (c) 2026 Lucide Icons and Contributors
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted, provided that the above
12
+ copyright notice and this permission notice appear in all copies.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
+
22
+ ---
23
+
24
+ The following Lucide icons are derived from the Feather project:
25
+
26
+ airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
27
+
28
+ The MIT License (MIT) (for the icons listed above)
29
+
30
+ Copyright (c) 2013-present Cole Bemis
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining a copy
33
+ of this software and associated documentation files (the "Software"), to deal
34
+ in the Software without restriction, including without limitation the rights
35
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ copies of the Software, and to permit persons to whom the Software is
37
+ furnished to do so, subject to the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be included in all
40
+ copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
+ SOFTWARE.
49
+
50
+ ```
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BULLET_STYLES,
3
3
  ORDERED_STYLES
4
- } from "./chunk-YZPJQB3I.js";
4
+ } from "./chunk-7ON7PR5R.js";
5
5
  import {
6
6
  pickLabels
7
7
  } from "./chunk-6RJENZXT.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-GHEFKKRC.js";
12
12
  import {
13
13
  definePlugin
14
- } from "./chunk-6GWG2BLC.js";
14
+ } from "./chunk-HPLT3XRZ.js";
15
15
 
16
16
  // src/plugins/advlist.ts
17
17
  var LABELS = {
@@ -104,4 +104,4 @@ var advlist_default = definePlugin({
104
104
  export {
105
105
  advlist_default as default
106
106
  };
107
- //# sourceMappingURL=advlist-FH3K3AAQ.js.map
107
+ //# sourceMappingURL=advlist-K2U3VPH2.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-GHEFKKRC.js";
5
5
  import {
6
6
  definePlugin
7
- } from "./chunk-6GWG2BLC.js";
7
+ } from "./chunk-HPLT3XRZ.js";
8
8
 
9
9
  // src/plugins/autolink.ts
10
10
  import { InputRule, inputRules } from "prosemirror-inputrules";
@@ -86,4 +86,4 @@ var autolink_default = definePlugin({
86
86
  export {
87
87
  autolink_default as default
88
88
  };
89
- //# sourceMappingURL=autolink-IDJWAL2V.js.map
89
+ //# sourceMappingURL=autolink-XWDTLY37.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  definePlugin
3
- } from "./chunk-6GWG2BLC.js";
3
+ } from "./chunk-HPLT3XRZ.js";
4
4
 
5
5
  // src/plugins/autoresize.ts
6
6
  var autoresize_default = definePlugin({
@@ -23,4 +23,4 @@ var autoresize_default = definePlugin({
23
23
  export {
24
24
  autoresize_default as default
25
25
  };
26
- //# sourceMappingURL=autoresize-4ZEPQCHP.js.map
26
+ //# sourceMappingURL=autoresize-UB3GOA6D.js.map
@@ -2,12 +2,15 @@ import {
2
2
  pickLabels
3
3
  } from "./chunk-6RJENZXT.js";
4
4
  import "./chunk-HZRIBOPW.js";
5
+ import {
6
+ icons
7
+ } from "./chunk-NPKAIW34.js";
5
8
  import {
6
9
  definePlugin
7
- } from "./chunk-6GWG2BLC.js";
10
+ } from "./chunk-HPLT3XRZ.js";
8
11
 
9
12
  // src/plugins/autosave.ts
10
- var ICON = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l3 2"/></svg>';
13
+ var ICON = icons.save;
11
14
  var LABELS = {
12
15
  en: {
13
16
  restore: "Restore last draft",
@@ -96,4 +99,4 @@ var autosave_default = definePlugin({
96
99
  export {
97
100
  autosave_default as default
98
101
  };
99
- //# sourceMappingURL=autosave-WODRZ7L6.js.map
102
+ //# sourceMappingURL=autosave-MWNRUNU3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/autosave.ts"],"sourcesContent":["import { icons } from '../ui/icons';\nimport { definePlugin } from '../plugins';\nimport { pickLabels } from './shared';\n\n/**\n * Плагин autosave: черновик в localStorage браузера, чтобы текст не пропал при закрытой вкладке,\n * перезагрузке или сбое. Если при открытии найден черновик, отличный от текущего содержимого,\n * появляется уведомление, а кнопка «Восстановить черновик» (restoredraft) становится активной.\n *\n * `plugins: ['autosave']`, настройки — `pluginOptions.autosave`:\n * - key — ключ хранилища (по умолчанию адрес страницы + id элемента);\n * - delay — задержка сохранения после изменения, мс (1000);\n * - retention — сколько хранить черновик, минут (7 дней).\n */\n\nexport interface AutosaveOptions {\n key?: string;\n delay?: number;\n retention?: number;\n}\n\ninterface Draft {\n html: string;\n time: number;\n}\n\nconst ICON = icons.save;\n\nconst LABELS = {\n en: {\n restore: 'Restore last draft',\n found: 'An unsaved draft was found. Use “Restore last draft” to bring it back.',\n restored: 'Draft restored',\n },\n ru: {\n restore: 'Восстановить черновик',\n found: 'Найден несохранённый черновик. Его можно вернуть кнопкой «Восстановить черновик».',\n restored: 'Черновик восстановлен',\n },\n};\n\nfunction storage(): Storage | null {\n try {\n return typeof localStorage === 'undefined' ? null : localStorage;\n } catch {\n // Доступ к localStorage запрещён (приватный режим, политика браузера) — работаем без черновиков.\n return null;\n }\n}\n\nexport default definePlugin({\n name: 'autosave',\n toolbar: 'restoredraft',\n setup(editor) {\n const options = (editor.options.pluginOptions?.autosave ?? {}) as AutosaveOptions;\n const labels = pickLabels(editor, LABELS);\n const store = storage();\n const key =\n options.key ??\n `novaprose-draft:${typeof location === 'undefined' ? '' : location.pathname}:${editor.options.element.id || 'editor'}`;\n const delay = options.delay ?? 1000;\n const retentionMs = (options.retention ?? 7 * 24 * 60) * 60_000;\n\n const read = (): Draft | null => {\n try {\n const draft = JSON.parse(store?.getItem(key) ?? 'null') as Draft | null;\n if (!draft || typeof draft.html !== 'string' || Date.now() - draft.time > retentionMs)\n return null;\n return draft;\n } catch {\n return null;\n }\n };\n\n // Черновик с прошлого раза запоминаем до первого сохранения нового.\n let pending = read();\n if (pending && pending.html === editor.getHTML()) pending = null;\n if (pending) editor.ui.notify({ text: labels.found, timeout: 8000 });\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n const save = () => {\n timer = undefined;\n try {\n if (editor.isEmpty()) store?.removeItem(key);\n else store?.setItem(key, JSON.stringify({ html: editor.getHTML(), time: Date.now() }));\n } catch {\n // Хранилище переполнено — не мешаем работе.\n }\n };\n const off = editor.on('change', () => {\n // Первое изменение после открытия — старый черновик больше не восстанавливаем поверх.\n pending = null;\n clearTimeout(timer);\n timer = setTimeout(save, delay);\n });\n\n const restore = () => {\n const draft = pending ?? read();\n if (!draft) return;\n editor.setContent(draft.html);\n pending = null;\n editor.ui.notify({ text: labels.restored });\n editor.focus();\n };\n const spec = {\n icon: ICON,\n tooltip: labels.restore,\n isEnabled: () => editor.isEditable() && pending !== null,\n onAction: restore,\n };\n editor.ui.registry.addButton('restoredraft', spec);\n editor.ui.registry.addMenuItem('restoredraft', {\n text: labels.restore,\n icon: ICON,\n onAction: restore,\n });\n\n return () => {\n off();\n // Изменения последней секунды не теряем.\n if (timer !== undefined) {\n clearTimeout(timer);\n save();\n }\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAM,OAAO,MAAM;AAEnB,IAAM,SAAS;AAAA,EACb,IAAI;AAAA,IACF,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,IAAI;AAAA,IACF,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACF;AAEA,SAAS,UAA0B;AACjC,MAAI;AACF,WAAO,OAAO,iBAAiB,cAAc,OAAO;AAAA,EACtD,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,mBAAQ,aAAa;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM,QAAQ;AACZ,UAAM,UAAW,OAAO,QAAQ,eAAe,YAAY,CAAC;AAC5D,UAAM,SAAS,WAAW,QAAQ,MAAM;AACxC,UAAM,QAAQ,QAAQ;AACtB,UAAM,MACJ,QAAQ,OACR,mBAAmB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B,WAAW,MAAM,OAAO,WAAW,KAAK,YAAY;AAAA,MACpD,UAAU;AAAA,IACZ;AACA,WAAO,GAAG,SAAS,UAAU,gBAAgB,IAAI;AACjD,WAAO,GAAG,SAAS,YAAY,gBAAgB;AAAA,MAC7C,MAAM,OAAO;AAAA,MACb,MAAM;AAAA,MACN,UAAU;AAAA,IACZ,CAAC;AAED,WAAO,MAAM;AACX,UAAI;AAEJ,UAAI,UAAU,QAAW;AACvB,qBAAa,KAAK;AAClB,aAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -5,12 +5,15 @@ import {
5
5
  symbolPanel
6
6
  } from "./chunk-6RJENZXT.js";
7
7
  import "./chunk-HZRIBOPW.js";
8
+ import {
9
+ icons
10
+ } from "./chunk-NPKAIW34.js";
8
11
  import {
9
12
  definePlugin
10
- } from "./chunk-6GWG2BLC.js";
13
+ } from "./chunk-HPLT3XRZ.js";
11
14
 
12
15
  // src/plugins/charmap.ts
13
- var ICON = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 20h4v-3a7 7 0 1 1 6 0v3h4"/></svg>';
16
+ var ICON = icons.charmap;
14
17
  var LABELS = {
15
18
  en: {
16
19
  title: "Special character",
@@ -194,4 +197,4 @@ var charmap_default = definePlugin({
194
197
  export {
195
198
  charmap_default as default
196
199
  };
197
- //# sourceMappingURL=charmap-LWA7TL3K.js.map
200
+ //# sourceMappingURL=charmap-ADLYOIB3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/charmap.ts"],"sourcesContent":["import { icons } from '../ui/icons';\nimport { definePlugin } from '../plugins';\nimport { insertText, openSymbolDialog, pickLabels, symbolPanel, type SymbolGroup } from './shared';\n\n/** Плагин charmap: таблица специальных символов с поиском. `plugins: ['charmap']`. */\n\nconst ICON = icons.charmap;\n\nconst LABELS = {\n en: {\n title: 'Special character',\n search: 'Search characters',\n empty: 'Nothing found',\n groups: ['Currency', 'Typography', 'Math', 'Arrows', 'Latin', 'Greek'],\n },\n ru: {\n title: 'Специальный символ',\n search: 'Поиск символа',\n empty: 'Ничего не найдено',\n groups: ['Валюты', 'Типографика', 'Математика', 'Стрелки', 'Латиница', 'Греческие'],\n },\n};\n\n// Названия — английские: по ним работает поиск на любом языке интерфейса.\nconst SYMBOLS: (readonly (readonly [string, string])[])[] = [\n [\n ['€', 'euro'],\n ['£', 'pound'],\n ['¥', 'yen'],\n ['₽', 'ruble'],\n ['$', 'dollar'],\n ['¢', 'cent'],\n ['₴', 'hryvnia'],\n ['₸', 'tenge'],\n ['₹', 'rupee'],\n ['₩', 'won'],\n ['₺', 'lira'],\n ['₿', 'bitcoin'],\n ],\n [\n ['—', 'em dash'],\n ['–', 'en dash'],\n ['…', 'ellipsis'],\n ['«', 'left guillemet'],\n ['»', 'right guillemet'],\n ['„', 'low double quote'],\n ['“', 'left double quote'],\n ['”', 'right double quote'],\n ['‘', 'left single quote'],\n ['’', 'right single quote apostrophe'],\n ['•', 'bullet'],\n ['·', 'middle dot'],\n ['§', 'section'],\n ['¶', 'paragraph pilcrow'],\n ['†', 'dagger'],\n ['‡', 'double dagger'],\n ['©', 'copyright'],\n ['®', 'registered'],\n ['™', 'trademark'],\n ['°', 'degree'],\n ['№', 'numero number'],\n ['‰', 'per mille'],\n ['′', 'prime minutes'],\n ['″', 'double prime seconds'],\n ['¡', 'inverted exclamation'],\n ['¿', 'inverted question'],\n ],\n [\n ['±', 'plus minus'],\n ['×', 'multiply times'],\n ['÷', 'divide'],\n ['≠', 'not equal'],\n ['≈', 'approximately'],\n ['≤', 'less or equal'],\n ['≥', 'greater or equal'],\n ['∞', 'infinity'],\n ['√', 'square root'],\n ['∑', 'sum sigma'],\n ['∏', 'product'],\n ['∫', 'integral'],\n ['∂', 'partial'],\n ['∆', 'increment delta'],\n ['∈', 'element of'],\n ['∉', 'not element of'],\n ['∩', 'intersection'],\n ['∪', 'union'],\n ['⊂', 'subset'],\n ['∀', 'for all'],\n ['∃', 'exists'],\n ['¬', 'not'],\n ['∧', 'and'],\n ['∨', 'or'],\n ['½', 'one half'],\n ['⅓', 'one third'],\n ['¼', 'one quarter'],\n ['¾', 'three quarters'],\n ['²', 'superscript two squared'],\n ['³', 'superscript three cubed'],\n ['µ', 'micro'],\n ['‰', 'per mille'],\n ],\n [\n ['←', 'left arrow'],\n ['→', 'right arrow'],\n ['↑', 'up arrow'],\n ['↓', 'down arrow'],\n ['↔', 'left right arrow'],\n ['↕', 'up down arrow'],\n ['⇐', 'left double arrow'],\n ['⇒', 'right double arrow implies'],\n ['⇔', 'left right double arrow iff'],\n ['↩', 'return arrow'],\n ['↗', 'north east arrow'],\n ['↘', 'south east arrow'],\n ],\n [\n ['à', 'a grave'],\n ['á', 'a acute'],\n ['â', 'a circumflex'],\n ['ä', 'a umlaut'],\n ['å', 'a ring'],\n ['æ', 'ae ligature'],\n ['ç', 'c cedilla'],\n ['é', 'e acute'],\n ['è', 'e grave'],\n ['ê', 'e circumflex'],\n ['ë', 'e umlaut'],\n ['í', 'i acute'],\n ['ï', 'i umlaut'],\n ['ñ', 'n tilde'],\n ['ó', 'o acute'],\n ['ô', 'o circumflex'],\n ['ö', 'o umlaut'],\n ['ø', 'o slash'],\n ['œ', 'oe ligature'],\n ['ß', 'sharp s eszett'],\n ['ú', 'u acute'],\n ['ü', 'u umlaut'],\n ['ý', 'y acute'],\n ['ł', 'l stroke'],\n ['š', 's caron'],\n ['ž', 'z caron'],\n ],\n [\n ['α', 'alpha'],\n ['β', 'beta'],\n ['γ', 'gamma'],\n ['δ', 'delta'],\n ['ε', 'epsilon'],\n ['θ', 'theta'],\n ['λ', 'lambda'],\n ['μ', 'mu'],\n ['π', 'pi'],\n ['σ', 'sigma'],\n ['φ', 'phi'],\n ['ω', 'omega'],\n ['Δ', 'capital delta'],\n ['Σ', 'capital sigma'],\n ['Ω', 'capital omega ohm'],\n ],\n];\n\nexport default definePlugin({\n name: 'charmap',\n toolbar: 'charmap',\n setup(editor) {\n const labels = pickLabels(editor, LABELS);\n const groups: SymbolGroup[] = SYMBOLS.map((items, i) => ({ title: labels.groups[i]!, items }));\n const panel = (close: () => void) =>\n symbolPanel({\n groups,\n searchLabel: labels.search,\n emptyText: labels.empty,\n className: 'nova-charmap',\n onPick: (symbol) => {\n close();\n insertText(editor, symbol);\n },\n });\n\n editor.ui.registry.addPanelButton('charmap', {\n icon: ICON,\n tooltip: labels.title,\n isEnabled: (e) => e.isEditable(),\n render: (_e, close) => panel(close),\n });\n editor.ui.registry.addMenuItem('charmap', {\n text: labels.title,\n icon: ICON,\n onAction: () => openSymbolDialog(editor, labels.title, panel),\n });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAMA,IAAM,OAAO,MAAM;AAEnB,IAAM,SAAS;AAAA,EACb,IAAI;AAAA,IACF,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ,CAAC,YAAY,cAAc,QAAQ,UAAU,SAAS,OAAO;AAAA,EACvE;AAAA,EACA,IAAI;AAAA,IACF,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ,CAAC,wCAAU,sEAAe,gEAAc,8CAAW,oDAAY,wDAAW;AAAA,EACpF;AACF;AAGA,IAAM,UAAsD;AAAA,EAC1D;AAAA,IACE,CAAC,UAAK,MAAM;AAAA,IACZ,CAAC,QAAK,OAAO;AAAA,IACb,CAAC,QAAK,KAAK;AAAA,IACX,CAAC,UAAK,OAAO;AAAA,IACb,CAAC,KAAK,QAAQ;AAAA,IACd,CAAC,QAAK,MAAM;AAAA,IACZ,CAAC,UAAK,SAAS;AAAA,IACf,CAAC,UAAK,OAAO;AAAA,IACb,CAAC,UAAK,OAAO;AAAA,IACb,CAAC,UAAK,KAAK;AAAA,IACX,CAAC,UAAK,MAAM;AAAA,IACZ,CAAC,UAAK,SAAS;AAAA,EACjB;AAAA,EACA;AAAA,IACE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AAM,QAAQ,CAAC,UACb,YAAY;AAAA,MACV;AAAA,MACA,aAAa,OAAO;AAAA,MACpB,WAAW,OAAO;AAAA,MAClB,WAAW;AAAA,MACX,QAAQ,CAAC,WAAW;AAClB,cAAM;AACN,mBAAW,QAAQ,MAAM;AAAA,MAC3B;AAAA,IACF,CAAC;AAEH,WAAO,GAAG,SAAS,eAAe,WAAW;AAAA,MAC3C,MAAM;AAAA,MACN,SAAS,OAAO;AAAA,MAChB,WAAW,CAAC,MAAM,EAAE,WAAW;AAAA,MAC/B,QAAQ,CAAC,IAAI,UAAU,MAAM,KAAK;AAAA,IACpC,CAAC;AACD,WAAO,GAAG,SAAS,YAAY,WAAW;AAAA,MACxC,MAAM,OAAO;AAAA,MACb,MAAM;AAAA,MACN,UAAU,MAAM,iBAAiB,QAAQ,OAAO,OAAO,KAAK;AAAA,IAC9D,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
@@ -1,13 +1,17 @@
1
1
  import {
2
+ classAttr,
2
3
  cssValue,
3
4
  schema
4
- } from "./chunk-YZPJQB3I.js";
5
+ } from "./chunk-7ON7PR5R.js";
5
6
  import {
6
7
  FOCUSABLE,
7
8
  h,
8
9
  icon,
9
10
  uniqueId
10
11
  } from "./chunk-HZRIBOPW.js";
12
+ import {
13
+ icons
14
+ } from "./chunk-NPKAIW34.js";
11
15
  import {
12
16
  getLinkAt,
13
17
  insertImage,
@@ -18,153 +22,40 @@ import {
18
22
  nodesOf
19
23
  } from "./chunk-GHEFKKRC.js";
20
24
 
21
- // src/ui/icons.ts
22
- var svg = (body) => `<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${body}</svg>`;
23
- var icons = {
24
- undo: svg('<path d="M9 14 4 9l5-5"/><path d="M4 9h11a5 5 0 0 1 0 10h-3"/>'),
25
- redo: svg('<path d="m15 14 5-5-5-5"/><path d="M20 9H9a5 5 0 0 0 0 10h3"/>'),
26
- bold: svg('<path d="M7 5h6a3.5 3.5 0 0 1 0 7H7z"/><path d="M7 12h7a3.5 3.5 0 0 1 0 7H7z"/>'),
27
- italic: svg('<path d="M14 5h-4M14 19h-4M14 5l-4 14"/>'),
28
- underline: svg('<path d="M7 4v6a5 5 0 0 0 10 0V4"/><path d="M5 20h14"/>'),
29
- strike: svg(
30
- '<path d="M4 12h16"/><path d="M16 7a4 3 0 0 0-4-2c-2.5 0-4 1.3-4 3"/><path d="M8 17a4 3 0 0 0 4 2c2.5 0 4-1.3 4-3"/>'
31
- ),
32
- code: svg('<path d="m9 8-4 4 4 4"/><path d="m15 8 4 4-4 4"/>'),
33
- subscript: svg(
34
- '<path d="m4 6 8 9M12 6l-8 9"/><path d="M20 20h-4c0-1.5 4-2 4-4a1.5 1.5 0 0 0-3-.5"/>'
35
- ),
36
- superscript: svg(
37
- '<path d="m4 9 8 9M12 9l-8 9"/><path d="M20 10h-4c0-1.5 4-2 4-4a1.5 1.5 0 0 0-3-.5"/>'
38
- ),
39
- bulletList: svg(
40
- '<circle cx="5" cy="7" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="5" cy="17" r="1"/><path d="M9 7h11M9 12h11M9 17h11"/>'
41
- ),
42
- orderedList: svg(
43
- '<path d="M4 5h1v4M4 9h2"/><path d="M4 14h2l-2 3h2"/><path d="M10 7h10M10 12h10M10 17h10"/>'
44
- ),
45
- indent: svg('<path d="M4 6h16M10 12h10M4 18h16"/><path d="m4 10 3 2-3 2"/>'),
46
- outdent: svg('<path d="M4 6h16M10 12h10M4 18h16"/><path d="m7 10-3 2 3 2"/>'),
47
- blockquote: svg(
48
- '<path d="M6 17c-1.5 0-2.5-1-2.5-3 0-3 2-6 5-7"/><path d="M15 17c-1.5 0-2.5-1-2.5-3 0-3 2-6 5-7"/><circle cx="6" cy="14" r="2.5"/><circle cx="15" cy="14" r="2.5"/>'
49
- ),
50
- codeBlock: svg(
51
- '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="m9 10-2 2 2 2M15 10l2 2-2 2"/>'
52
- ),
53
- alignLeft: svg('<path d="M4 6h16M4 10h10M4 14h16M4 18h10"/>'),
54
- alignCenter: svg('<path d="M4 6h16M7 10h10M4 14h16M7 18h10"/>'),
55
- alignRight: svg('<path d="M4 6h16M10 10h10M4 14h16M10 18h10"/>'),
56
- alignJustify: svg('<path d="M4 6h16M4 10h16M4 14h16M4 18h16"/>'),
57
- horizontalRule: svg('<path d="M4 12h16"/><path d="M8 7h8M8 17h8" opacity=".4"/>'),
58
- link: svg(
59
- '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>'
60
- ),
61
- unlink: svg(
62
- '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/><path d="M3 3l18 18"/>'
63
- ),
64
- image: svg(
65
- '<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="m21 16-5-5-9 9"/>'
66
- ),
67
- clearFormatting: svg('<path d="M6 5h12M12 5l-3 14"/><path d="m15 15 5 5M20 15l-5 5"/>'),
68
- // «T²» — меню дополнительного форматирования
69
- formatMore: svg(
70
- '<path d="M3 7h10M8 7v12"/><path d="M21 11h-4c0-1.5 4-2 4-4a1.5 1.5 0 0 0-3-.5"/>'
71
- ),
72
- // Картинка: обтекание слева / по центру / справа — прямоугольник + строки текста
73
- imageLeft: svg(
74
- '<rect x="3" y="5" width="8" height="8" rx="1"/><path d="M14 6h7M14 10h7M3 17h18M3 20h12"/>'
75
- ),
76
- imageCenter: svg('<rect x="7" y="4" width="10" height="9" rx="1"/><path d="M3 17h18M6 20h12"/>'),
77
- imageRight: svg(
78
- '<rect x="13" y="5" width="8" height="8" rx="1"/><path d="M3 6h7M3 10h7M3 17h18M9 20h12"/>'
79
- ),
80
- resize: svg('<path d="M15 3h6v6M9 21H3v-6"/><path d="m21 3-7 7M3 21l7-7"/>'),
81
- altText: svg(
82
- '<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M7 15l2.5-6 2.5 6M7.8 13h3.4M15 9v6h3"/>'
83
- ),
84
- trash: svg('<path d="M4 7h16M10 11v6M14 11v6"/><path d="M6 7l1 13h10l1-13M9 7V4h6v3"/>'),
85
- paragraph: svg('<path d="M13 4v16M17 4v16M19 4H9.5a4.5 4.5 0 0 0 0 9H13"/>'),
86
- h1: svg('<path d="M4 6v12M12 6v12M4 12h8"/><path d="m16 9 3-2v11"/>'),
87
- h2: svg(
88
- '<path d="M4 6v12M12 6v12M4 12h8"/><path d="M16 9.5a2.5 2.5 0 1 1 5 .5c0 1.5-5 4-5 8h5"/>'
89
- ),
90
- h3: svg('<path d="M4 6v12M12 6v12M4 12h8"/><path d="M16 7.5h4.5l-2.5 3.5a3 3 0 1 1-2.5 5"/>'),
91
- // Планшет буфера обмена с буквой T — «вставить как текст»
92
- pasteText: svg(
93
- '<rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 4V3h6v1M9 10h6M12 10v7"/>'
94
- ),
95
- // ---------- таблицы ----------
96
- table: svg(
97
- '<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M3 10h18M3 15h18M9 4v16M15 4v16"/>'
98
- ),
99
- rowBefore: svg('<rect x="3" y="12" width="18" height="8" rx="1"/><path d="M12 3v6M9 6h6"/>'),
100
- rowAfter: svg('<rect x="3" y="4" width="18" height="8" rx="1"/><path d="M12 15v6M9 18h6"/>'),
101
- rowDelete: svg(
102
- '<rect x="3" y="8" width="18" height="8" rx="1"/><path d="m10 10 4 4M14 10l-4 4"/>'
103
- ),
104
- colBefore: svg('<rect x="12" y="3" width="8" height="18" rx="1"/><path d="M3 12h6M6 9v6"/>'),
105
- colAfter: svg('<rect x="4" y="3" width="8" height="18" rx="1"/><path d="M15 12h6M18 9v6"/>'),
106
- colDelete: svg(
107
- '<rect x="8" y="3" width="8" height="18" rx="1"/><path d="m10 10 4 4M14 10l-4 4"/>'
108
- ),
109
- merge: svg(
110
- '<rect x="3" y="5" width="18" height="14" rx="1"/><path d="M6 12h4M14 12h4M8 10l2 2-2 2M16 10l-2 2 2 2"/>'
111
- ),
112
- split: svg(
113
- '<rect x="3" y="5" width="18" height="14" rx="1"/><path d="M12 5v14M5 12h4M15 12h4M7 10l-2 2 2 2M17 10l2 2-2 2"/>'
114
- ),
115
- rowHeader: svg(
116
- '<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M3 9.5h18"/><path d="M4 5h16v4H4z" fill="currentColor" opacity=".35" stroke="none"/>'
117
- ),
118
- colHeader: svg(
119
- '<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M9.5 4v16"/><path d="M4 5h5v14H4z" fill="currentColor" opacity=".35" stroke="none"/>'
120
- ),
121
- sort: svg('<path d="M7 4v16M4 17l3 3 3-3"/><path d="M14 6h7M14 11h5M14 16h3"/>'),
122
- tableProps: svg(
123
- '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M9 10v10"/><path d="M15 15h3"/>'
124
- ),
125
- cellProps: svg(
126
- '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M9 4v16"/><rect x="11" y="12" width="8" height="6" rx="1"/>'
127
- ),
128
- tableDelete: svg(
129
- '<rect x="3" y="4" width="13" height="12" rx="1"/><path d="M3 10h13M9.5 4v12"/><path d="m17 15 4 4M21 15l-4 4"/>'
130
- ),
131
- chevronUp: svg('<path d="m7 14 5-5 5 5"/>'),
132
- search: svg('<circle cx="11" cy="11" r="6.5"/><path d="m20 20-4.2-4.2"/>'),
133
- fullscreen: svg('<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/>'),
134
- fullscreenExit: svg('<path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/>'),
135
- preview: svg(
136
- '<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>'
137
- ),
138
- sourceCode: svg('<path d="m8 7-5 5 5 5M16 7l5 5-5 5M14 4l-4 16"/>'),
139
- help: svg(
140
- '<circle cx="12" cy="12" r="9"/><path d="M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.6"/><circle cx="12" cy="17" r=".6" fill="currentColor"/>'
141
- ),
142
- print: svg(
143
- '<path d="M7 9V3h10v6"/><rect x="3" y="9" width="18" height="8" rx="2"/><path d="M7 14h10v7H7z"/>'
144
- ),
145
- check: svg('<path d="m5 12 5 5 9-10"/>'),
146
- close: svg('<path d="M6 6l12 12M18 6 6 18"/>'),
147
- chevronDown: svg('<path d="m7 10 5 5 5-5"/>'),
148
- more: svg(
149
- '<circle cx="5" cy="12" r="1.2" fill="currentColor"/><circle cx="12" cy="12" r="1.2" fill="currentColor"/><circle cx="19" cy="12" r="1.2" fill="currentColor"/>'
150
- ),
151
- // Буква «A» — цвет полоски под ней задаётся через currentColor у .nova-color-bar
152
- textColor: svg('<path d="m6 16 6-12 6 12"/><path d="M8.5 11h7"/>'),
153
- highlight: svg('<path d="m14 4 6 6-8 8H6v-6z"/><path d="m11 7 6 6"/>'),
154
- lineHeight: svg(
155
- '<path d="M11 6h10M11 12h10M11 18h10"/><path d="m3 8 3-3 3 3M3 16l3 3 3-3M6 5v14"/>'
156
- ),
157
- upload: svg(
158
- '<path d="M12 16V4"/><path d="m7 9 5-5 5 5"/><path d="M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3"/>'
159
- ),
160
- externalLink: svg(
161
- '<path d="M14 4h6v6"/><path d="M20 4 10 14"/><path d="M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>'
162
- ),
163
- copy: svg(
164
- '<rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3"/>'
165
- ),
166
- edit: svg('<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="m13 7 4 4"/>')
167
- };
25
+ // src/ui/file-picker.ts
26
+ function attachFilePicker(editor, field, type, onPick) {
27
+ const { filePicker: picker, filePickerTypes: types } = editor.options;
28
+ if (!picker || types && !types.includes(type)) return;
29
+ const { input } = field;
30
+ const button = h(
31
+ "button",
32
+ {
33
+ type: "button",
34
+ className: "nova-btn nova-input-action",
35
+ "aria-label": editor.ui.t("dialog.browse"),
36
+ title: editor.ui.t("dialog.browse")
37
+ },
38
+ icon(icons.browse)
39
+ );
40
+ const group = h("div", { className: "nova-input-group" });
41
+ input.replaceWith(group);
42
+ group.append(input, button);
43
+ button.addEventListener("click", async () => {
44
+ button.disabled = true;
45
+ try {
46
+ const result = await picker({ type, value: input.value });
47
+ if (!result?.url) return;
48
+ input.value = result.url;
49
+ input.removeAttribute("aria-invalid");
50
+ onPick?.(result);
51
+ } catch (error) {
52
+ console.error("[nova] filePicker failed:", error);
53
+ } finally {
54
+ button.disabled = false;
55
+ if (input.isConnected) input.focus();
56
+ }
57
+ });
58
+ }
168
59
 
169
60
  // src/image.ts
170
61
  import {
@@ -494,6 +385,9 @@ function openImageDialog(editor) {
494
385
  );
495
386
  const url = textField({ label: t("image.url"), type: "url", placeholder: "https://" });
496
387
  const alt = textField({ label: t("image.alt"), hint: t("image.altHint") });
388
+ attachFilePicker(editor, url, "image", (picked) => {
389
+ if (picked.alt) alt.input.value = picked.alt;
390
+ });
497
391
  const body = h(
498
392
  "div",
499
393
  { className: "nova-form" },
@@ -660,6 +554,10 @@ function openLinkDialog(editor) {
660
554
  const text = textField({ label: t("link.text"), value: selectedText });
661
555
  const title = textField({ label: t("link.tooltip"), value: existing?.title ?? "" });
662
556
  const newTab = checkboxField(t("link.newTab"), existing?.target === "_blank");
557
+ attachFilePicker(editor, url, "file", (picked) => {
558
+ if (picked.text && !text.input.value.trim()) text.input.value = picked.text;
559
+ if (picked.title) title.input.value = picked.title;
560
+ });
663
561
  const body = h(
664
562
  "div",
665
563
  { className: "nova-form" },
@@ -761,7 +659,9 @@ var nextCellOrNewRow = (state, dispatch, view) => {
761
659
  };
762
660
  function tablePlugins() {
763
661
  return [
764
- columnResizing({ cellMinWidth: 48, View: NovaTableView }),
662
+ // defaultCellMinWidth — минимум для столбцов без заданной ширины (по умолчанию 100px:
663
+ // таблица из 5+ столбцов раньше времени вылезала за край узкого редактора).
664
+ columnResizing({ cellMinWidth: 48, defaultCellMinWidth: 48, View: NovaTableView }),
765
665
  tableEditing(),
766
666
  keymap({
767
667
  Tab: nextCellOrNewRow,
@@ -943,18 +843,31 @@ var NovaTableView = class extends TableView {
943
843
  const align = node.attrs.align;
944
844
  this.table.style.marginLeft = align ? "auto" : "";
945
845
  this.table.style.marginRight = align === "center" ? "auto" : "";
846
+ const cls = classAttr(node.attrs.class).class;
847
+ if (cls) this.table.setAttribute("class", cls);
848
+ else this.table.removeAttribute("class");
946
849
  }
947
850
  };
948
851
  function getTableProps(state) {
949
852
  const found = findTable(state.selection.$from);
950
- return found ? { width: found.node.attrs.width ?? null, align: found.node.attrs.align ?? null } : null;
853
+ return found ? {
854
+ width: found.node.attrs.width ?? null,
855
+ align: found.node.attrs.align ?? null,
856
+ class: found.node.attrs.class ?? null
857
+ } : null;
951
858
  }
952
859
  function setTableProps(props) {
953
860
  return (state, dispatch) => {
954
861
  const found = findTable(state.selection.$from);
955
862
  if (!found) return false;
956
863
  if (props.width !== null && !cssValue.length(props.width)) return false;
957
- dispatch?.(state.tr.setNodeMarkup(found.pos, void 0, { ...found.node.attrs, ...props }));
864
+ const attrs = {
865
+ ...found.node.attrs,
866
+ width: props.width,
867
+ align: props.align
868
+ };
869
+ if (props.class !== void 0) attrs.class = classAttr(props.class).class ?? null;
870
+ dispatch?.(state.tr.setNodeMarkup(found.pos, void 0, attrs));
958
871
  return true;
959
872
  };
960
873
  }
@@ -982,7 +895,8 @@ function getCellProps(state) {
982
895
  return {
983
896
  valign: cell.node.attrs.valign ?? null,
984
897
  header: cell.node.type === state.schema.nodes.table_header,
985
- width: widths?.[0] ?? null
898
+ width: widths?.[0] ?? null,
899
+ class: cell.node.attrs.class ?? null
986
900
  };
987
901
  }
988
902
  function setCellProps(props) {
@@ -997,7 +911,8 @@ function setCellProps(props) {
997
911
  const type = props.header === void 0 ? node.type : props.header ? nodes.table_header : nodes.table_cell;
998
912
  const attrs = {
999
913
  ...node.attrs,
1000
- ...props.valign !== void 0 ? { valign: props.valign } : {}
914
+ ...props.valign !== void 0 ? { valign: props.valign } : {},
915
+ ...props.class !== void 0 ? { class: classAttr(props.class).class ?? null } : {}
1001
916
  };
1002
917
  tr.setNodeMarkup(pos, type, attrs);
1003
918
  }
@@ -1032,10 +947,10 @@ function setCellProps(props) {
1032
947
  }
1033
948
 
1034
949
  export {
1035
- icons,
1036
950
  openDialog,
1037
951
  textField,
1038
952
  selectField,
953
+ attachFilePicker,
1039
954
  isSupportedImage,
1040
955
  uploadImages,
1041
956
  embeddedImageUploadPlugin,
@@ -1065,4 +980,4 @@ export {
1065
980
  getCellProps,
1066
981
  setCellProps
1067
982
  };
1068
- //# sourceMappingURL=chunk-PHRON5PL.js.map
983
+ //# sourceMappingURL=chunk-435CRWKA.js.map