@doxi/react 0.11.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/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/DoxivaEditor.d.ts +20 -0
- package/dist/DoxivaEditor.d.ts.map +1 -0
- package/dist/DoxivaEditor.js +448 -0
- package/dist/DoxivaEditor.js.map +1 -0
- package/dist/Editor.d.ts +21 -0
- package/dist/Editor.d.ts.map +1 -0
- package/dist/Editor.js +49 -0
- package/dist/Editor.js.map +1 -0
- package/dist/HeaderFooterPopover.d.ts +49 -0
- package/dist/HeaderFooterPopover.d.ts.map +1 -0
- package/dist/HeaderFooterPopover.js +139 -0
- package/dist/HeaderFooterPopover.js.map +1 -0
- package/dist/ImagePopover.d.ts +23 -0
- package/dist/ImagePopover.d.ts.map +1 -0
- package/dist/ImagePopover.js +59 -0
- package/dist/ImagePopover.js.map +1 -0
- package/dist/LinkPopover.d.ts +25 -0
- package/dist/LinkPopover.d.ts.map +1 -0
- package/dist/LinkPopover.js +67 -0
- package/dist/LinkPopover.js.map +1 -0
- package/dist/PageSettingsPopover.d.ts +33 -0
- package/dist/PageSettingsPopover.d.ts.map +1 -0
- package/dist/PageSettingsPopover.js +48 -0
- package/dist/PageSettingsPopover.js.map +1 -0
- package/dist/TablePicker.d.ts +27 -0
- package/dist/TablePicker.d.ts.map +1 -0
- package/dist/TablePicker.js +38 -0
- package/dist/TablePicker.js.map +1 -0
- package/dist/Toolbar.d.ts +103 -0
- package/dist/Toolbar.d.ts.map +1 -0
- package/dist/Toolbar.js +161 -0
- package/dist/Toolbar.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/toolbar-builders/alignment.d.ts +4 -0
- package/dist/toolbar-builders/alignment.d.ts.map +1 -0
- package/dist/toolbar-builders/alignment.js +56 -0
- package/dist/toolbar-builders/alignment.js.map +1 -0
- package/dist/toolbar-builders/blocks.d.ts +4 -0
- package/dist/toolbar-builders/blocks.d.ts.map +1 -0
- package/dist/toolbar-builders/blocks.js +39 -0
- package/dist/toolbar-builders/blocks.js.map +1 -0
- package/dist/toolbar-builders/font-size.d.ts +4 -0
- package/dist/toolbar-builders/font-size.d.ts.map +1 -0
- package/dist/toolbar-builders/font-size.js +41 -0
- package/dist/toolbar-builders/font-size.js.map +1 -0
- package/dist/toolbar-builders/headings.d.ts +4 -0
- package/dist/toolbar-builders/headings.d.ts.map +1 -0
- package/dist/toolbar-builders/headings.js +18 -0
- package/dist/toolbar-builders/headings.js.map +1 -0
- package/dist/toolbar-builders/history.d.ts +3 -0
- package/dist/toolbar-builders/history.d.ts.map +1 -0
- package/dist/toolbar-builders/history.js +13 -0
- package/dist/toolbar-builders/history.js.map +1 -0
- package/dist/toolbar-builders/images.d.ts +4 -0
- package/dist/toolbar-builders/images.d.ts.map +1 -0
- package/dist/toolbar-builders/images.js +8 -0
- package/dist/toolbar-builders/images.js.map +1 -0
- package/dist/toolbar-builders/line-height.d.ts +4 -0
- package/dist/toolbar-builders/line-height.d.ts.map +1 -0
- package/dist/toolbar-builders/line-height.js +46 -0
- package/dist/toolbar-builders/line-height.js.map +1 -0
- package/dist/toolbar-builders/links.d.ts +4 -0
- package/dist/toolbar-builders/links.d.ts.map +1 -0
- package/dist/toolbar-builders/links.js +19 -0
- package/dist/toolbar-builders/links.js.map +1 -0
- package/dist/toolbar-builders/lists.d.ts +4 -0
- package/dist/toolbar-builders/lists.d.ts.map +1 -0
- package/dist/toolbar-builders/lists.js +38 -0
- package/dist/toolbar-builders/lists.js.map +1 -0
- package/dist/toolbar-builders/marks.d.ts +4 -0
- package/dist/toolbar-builders/marks.d.ts.map +1 -0
- package/dist/toolbar-builders/marks.js +41 -0
- package/dist/toolbar-builders/marks.js.map +1 -0
- package/dist/toolbar-builders/system.d.ts +12 -0
- package/dist/toolbar-builders/system.d.ts.map +1 -0
- package/dist/toolbar-builders/system.js +28 -0
- package/dist/toolbar-builders/system.js.map +1 -0
- package/dist/toolbar-builders/tables.d.ts +4 -0
- package/dist/toolbar-builders/tables.d.ts.map +1 -0
- package/dist/toolbar-builders/tables.js +235 -0
- package/dist/toolbar-builders/tables.js.map +1 -0
- package/dist/toolbar-builders/typography.d.ts +4 -0
- package/dist/toolbar-builders/typography.d.ts.map +1 -0
- package/dist/toolbar-builders/typography.js +123 -0
- package/dist/toolbar-builders/typography.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/dist/useDoxivaEditor.d.ts +10 -0
- package/dist/useDoxivaEditor.d.ts.map +1 -0
- package/dist/useDoxivaEditor.js +30 -0
- package/dist/useDoxivaEditor.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mahbub Hasan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @doxi/react
|
|
2
|
+
|
|
3
|
+
React adapter for [`@doxi/core`](../core). Ships a thin `<Editor>` wrapper around the underlying `EditorView`, plus a `useDoxivaEditor` hook for imperative access.
|
|
4
|
+
|
|
5
|
+
> **Status:** v0.10.x preview. Public API may evolve until v1.0.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @doxi/react @doxi/core react react-dom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer-deps: `react` ≥ 18 (works under 19), `@doxi/core`. Zero runtime deps beyond the peers.
|
|
14
|
+
|
|
15
|
+
## Quickstart
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Editor, useDoxivaEditor } from '@doxi/react'
|
|
19
|
+
import { defaultRenderer, defaultSchema, historyPlugin } from '@doxi/core'
|
|
20
|
+
import '@doxi/core/styles/base.css'
|
|
21
|
+
import '@doxi/core/styles/light.css'
|
|
22
|
+
|
|
23
|
+
export function App() {
|
|
24
|
+
const editor = useDoxivaEditor({
|
|
25
|
+
schema: defaultSchema,
|
|
26
|
+
plugins: [historyPlugin().plugin],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Editor
|
|
31
|
+
editor={editor}
|
|
32
|
+
renderer={defaultRenderer}
|
|
33
|
+
ariaLabel="Document editor"
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Imperative access
|
|
40
|
+
|
|
41
|
+
`useDoxivaEditor` returns a handle exposing the live `EditorView`:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
const editor = useDoxivaEditor({ schema: defaultSchema })
|
|
45
|
+
// editor.view → underlying @doxi/core EditorView
|
|
46
|
+
// editor.dispatch(tr) → dispatch a transaction
|
|
47
|
+
// editor.replaceState(newState) → swap the whole state (e.g. after DOCX import)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Toolbar
|
|
51
|
+
|
|
52
|
+
`@doxi/react` ships a default toolbar; consumers can compose their own from the per-group builders (`buildHistory`, `buildHeadings`, `buildLists`, `buildMarks`, `buildLinks`, `buildAlignment`, `buildBlocks`, …). See the [example app](../example-react) for a full reference setup.
|
|
53
|
+
|
|
54
|
+
## Accessibility
|
|
55
|
+
|
|
56
|
+
`<Editor>` exposes an `ariaLabel` prop (default `"Document editor"`) applied to the contenteditable surface alongside `role="textbox"` and `aria-multiline="true"`. Localize for non-English UIs.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type EditorView } from '@doxi/core';
|
|
2
|
+
import { type DoxivaEditorProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Imperative handle exposed via `ref` for hosts that need to reach the
|
|
5
|
+
* underlying EditorView (e.g., to wire dev-only debug helpers in example
|
|
6
|
+
* apps). The shape is intentionally minimal in v0.11 — a stable API ships
|
|
7
|
+
* in v0.12.
|
|
8
|
+
*/
|
|
9
|
+
export interface DoxivaEditorHandle {
|
|
10
|
+
readonly view: EditorView | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The bundled Doxiva editor — a single React component that internally
|
|
14
|
+
* orchestrates the toolbar, popovers, keymap, print bridge, DOCX import/
|
|
15
|
+
* export, and page chrome. Hosts pass `features` to disable parts of the UX
|
|
16
|
+
* and `theme` to switch palettes. The low-level `<Editor>`, `<Toolbar>`,
|
|
17
|
+
* `useDoxivaEditor` primitives remain exported for power users.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DoxivaEditor: import("react").ForwardRefExoticComponent<DoxivaEditorProps & import("react").RefAttributes<DoxivaEditorHandle>>;
|
|
20
|
+
//# sourceMappingURL=DoxivaEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DoxivaEditor.d.ts","sourceRoot":"","sources":["../src/DoxivaEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAaL,KAAK,UAAU,EAEhB,MAAM,YAAY,CAAA;AA4BnB,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,YAAY,CAAA;AAqCnB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;CACjC;AA8ED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,kHA6bvB,CAED"}
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { defaultKeymapBindings, defaultRenderer, defaultSchema, EditorState, historyPlugin, insertPageBreak, installClipboardHandlers, installInputPipeline, keymap, printDocument, TextSelection, } from '@doxi/core';
|
|
3
|
+
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, forwardRef, } from 'react';
|
|
4
|
+
import { Editor } from './Editor.js';
|
|
5
|
+
import { useDoxivaEditor } from './useDoxivaEditor.js';
|
|
6
|
+
import { Toolbar, defaultToolbarActions, TOOLBAR_SEPARATOR, } from './Toolbar.js';
|
|
7
|
+
import { LinkPopover } from './LinkPopover.js';
|
|
8
|
+
import { TablePicker } from './TablePicker.js';
|
|
9
|
+
import { ImagePopover } from './ImagePopover.js';
|
|
10
|
+
import { HeaderFooterPopover } from './HeaderFooterPopover.js';
|
|
11
|
+
import { PageSettingsPopover } from './PageSettingsPopover.js';
|
|
12
|
+
import { DEFAULT_FEATURES, } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Pixel dimensions for the page-size presets. Letter / A4 mirror the values
|
|
15
|
+
* the @doxi/core layout engine uses for its built-in named sizes.
|
|
16
|
+
*/
|
|
17
|
+
const SIZE_PX = {
|
|
18
|
+
letter: { w: 816, h: 1056 },
|
|
19
|
+
a4: { w: 794, h: 1123 },
|
|
20
|
+
legal: { w: 816, h: 1344 },
|
|
21
|
+
a5: { w: 559, h: 794 },
|
|
22
|
+
};
|
|
23
|
+
const MARGIN_PX = { normal: 96, narrow: 48, wide: 144 };
|
|
24
|
+
const DEFAULT_PAGE_CHROME = {
|
|
25
|
+
headerEnabled: true,
|
|
26
|
+
footerEnabled: true,
|
|
27
|
+
headerHeightPx: 24,
|
|
28
|
+
footerHeightPx: 24,
|
|
29
|
+
};
|
|
30
|
+
// Inline SVG markup, drawn inside the toolbar's shared 24×24 viewBox.
|
|
31
|
+
const ICON_NEW_PAGE = '<rect x="4" y="3" width="13" height="18" rx="2" />' +
|
|
32
|
+
'<path d="M7 10h7M7 14h7M7 18h4" />' +
|
|
33
|
+
'<circle cx="19" cy="6" r="3" />' +
|
|
34
|
+
'<path d="M19 4.5v3M17.5 6h3" />';
|
|
35
|
+
const ICON_HEADER_FOOTER = '<rect x="4" y="3" width="16" height="18" rx="2" />' +
|
|
36
|
+
'<path d="M4 7h16M4 17h16" />' +
|
|
37
|
+
'<path d="M8 11h8M8 14h6" />';
|
|
38
|
+
const ICON_PAGE_SETTINGS = '<rect x="4" y="3" width="13" height="18" rx="2" />' +
|
|
39
|
+
'<path d="M7 8h7M7 12h7M7 16h4" />' +
|
|
40
|
+
'<circle cx="19" cy="19" r="2.2" />';
|
|
41
|
+
/**
|
|
42
|
+
* Filter the default toolbar actions by feature flags. Removes-only — never
|
|
43
|
+
* reorders. After filtering, consecutive `separator` items (and leading /
|
|
44
|
+
* trailing separators) are collapsed so a removed group doesn't leave a
|
|
45
|
+
* double divider.
|
|
46
|
+
*/
|
|
47
|
+
function filterByFeatures(actions, features) {
|
|
48
|
+
const kept = actions.filter((item) => {
|
|
49
|
+
const t = item.type;
|
|
50
|
+
if (t === 'separator')
|
|
51
|
+
return true;
|
|
52
|
+
if (t === 'select') {
|
|
53
|
+
const id = item.id;
|
|
54
|
+
if (id === 'font-size')
|
|
55
|
+
return features.fontSize;
|
|
56
|
+
if (id === 'font-family')
|
|
57
|
+
return features.fontFamily;
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (t === 'palette') {
|
|
61
|
+
const id = item.id;
|
|
62
|
+
if (id === 'color')
|
|
63
|
+
return features.color;
|
|
64
|
+
if (id === 'cell-bg')
|
|
65
|
+
return features.tables;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (t === 'popover') {
|
|
69
|
+
const id = item.id;
|
|
70
|
+
if (id === 'link')
|
|
71
|
+
return features.links;
|
|
72
|
+
if (id === 'table')
|
|
73
|
+
return features.tables;
|
|
74
|
+
if (id === 'image')
|
|
75
|
+
return features.images;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const id = item.id;
|
|
79
|
+
if (id === 'undo' || id === 'redo')
|
|
80
|
+
return features.history;
|
|
81
|
+
if (id === 'body' || id === 'h1' || id === 'h2' || id === 'h3')
|
|
82
|
+
return features.headings;
|
|
83
|
+
if (id === 'bold' || id === 'italic' || id === 'underline')
|
|
84
|
+
return features.marks;
|
|
85
|
+
if (id === 'align-left' ||
|
|
86
|
+
id === 'align-center' ||
|
|
87
|
+
id === 'align-right' ||
|
|
88
|
+
id === 'align-justify')
|
|
89
|
+
return features.alignment;
|
|
90
|
+
if (id === 'line-1' || id === 'line-1-5' || id === 'line-2')
|
|
91
|
+
return features.lineHeight;
|
|
92
|
+
if (id === 'list-bullet' || id === 'list-numbered')
|
|
93
|
+
return features.lists;
|
|
94
|
+
if (id === 'blockquote' || id === 'hr')
|
|
95
|
+
return features.blocks;
|
|
96
|
+
if (id === 'table-header-row')
|
|
97
|
+
return features.tables;
|
|
98
|
+
if (id === 'print')
|
|
99
|
+
return features.print;
|
|
100
|
+
return true;
|
|
101
|
+
});
|
|
102
|
+
return dedupeSeparators(kept);
|
|
103
|
+
}
|
|
104
|
+
function dedupeSeparators(items) {
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const item of items) {
|
|
107
|
+
const isSep = item.type === 'separator';
|
|
108
|
+
if (isSep) {
|
|
109
|
+
// Skip leading and consecutive separators.
|
|
110
|
+
if (out.length === 0)
|
|
111
|
+
continue;
|
|
112
|
+
const prev = out[out.length - 1];
|
|
113
|
+
if (prev.type === 'separator')
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
out.push(item);
|
|
117
|
+
}
|
|
118
|
+
// Strip trailing separators.
|
|
119
|
+
while (out.length > 0 && out[out.length - 1].type === 'separator') {
|
|
120
|
+
out.pop();
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
function buildDefaultDoc() {
|
|
125
|
+
return defaultSchema.node('doc', null, [defaultSchema.node('paragraph', null)]);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The bundled Doxiva editor — a single React component that internally
|
|
129
|
+
* orchestrates the toolbar, popovers, keymap, print bridge, DOCX import/
|
|
130
|
+
* export, and page chrome. Hosts pass `features` to disable parts of the UX
|
|
131
|
+
* and `theme` to switch palettes. The low-level `<Editor>`, `<Toolbar>`,
|
|
132
|
+
* `useDoxivaEditor` primitives remain exported for power users.
|
|
133
|
+
*/
|
|
134
|
+
export const DoxivaEditor = forwardRef(function DoxivaEditor(props, ref) {
|
|
135
|
+
const features = useMemo(() => ({ ...DEFAULT_FEATURES, ...(props.features ?? {}) }), [props.features]);
|
|
136
|
+
const theme = props.theme ?? 'light';
|
|
137
|
+
const paginated = props.paginated !== false;
|
|
138
|
+
// Initial doc only ever read once — like the example app, subsequent
|
|
139
|
+
// changes to `initialDoc` are ignored (the editor's state is mutated via
|
|
140
|
+
// dispatch). Track G of v0.8 added `replaceState` for wholesale swaps.
|
|
141
|
+
const initialDoc = useMemo(() => props.initialDoc ?? buildDefaultDoc(),
|
|
142
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
143
|
+
[]);
|
|
144
|
+
const history = useMemo(() => historyPlugin(), []);
|
|
145
|
+
const editor = useDoxivaEditor({
|
|
146
|
+
schema: defaultSchema,
|
|
147
|
+
plugins: [history.plugin],
|
|
148
|
+
doc: initialDoc,
|
|
149
|
+
selection: new TextSelection(1, 1),
|
|
150
|
+
});
|
|
151
|
+
// Page settings + remount key (changing the page config requires a full
|
|
152
|
+
// EditorView remount — the layout engine reads `paginated` at mount).
|
|
153
|
+
const [pageSettings, setPageSettings] = useState({
|
|
154
|
+
size: props.defaultPageSize ?? 'letter',
|
|
155
|
+
orientation: 'portrait',
|
|
156
|
+
margins: 'normal',
|
|
157
|
+
});
|
|
158
|
+
const [editorKey, setEditorKey] = useState(0);
|
|
159
|
+
const paginatedConfig = useMemo(() => {
|
|
160
|
+
if (!paginated)
|
|
161
|
+
return undefined;
|
|
162
|
+
const base = SIZE_PX[pageSettings.size];
|
|
163
|
+
const { w, h } = pageSettings.orientation === 'landscape' ? { w: base.h, h: base.w } : base;
|
|
164
|
+
const m = MARGIN_PX[pageSettings.margins];
|
|
165
|
+
return {
|
|
166
|
+
size: { widthPx: w, heightPx: h },
|
|
167
|
+
margins: { topPx: m, rightPx: m, bottomPx: m, leftPx: m },
|
|
168
|
+
};
|
|
169
|
+
}, [paginated, pageSettings]);
|
|
170
|
+
const updatePageSettings = useCallback((next) => {
|
|
171
|
+
setPageSettings(next);
|
|
172
|
+
setEditorKey((k) => k + 1);
|
|
173
|
+
}, []);
|
|
174
|
+
// Header/footer chrome — pure CSS, not part of the doc.
|
|
175
|
+
const [chrome, setChrome] = useState(DEFAULT_PAGE_CHROME);
|
|
176
|
+
// Import warnings (rendered in the default panel unless onImportWarnings
|
|
177
|
+
// is explicitly `null`).
|
|
178
|
+
const [importWarnings, setImportWarnings] = useState([]);
|
|
179
|
+
// EditorView reference — set by onMount and consumed by export / print /
|
|
180
|
+
// keymap callbacks. `viewVersion` bumps so disabled-state of the top-row
|
|
181
|
+
// buttons re-renders after mount/unmount.
|
|
182
|
+
const viewRef = useRef(null);
|
|
183
|
+
const [viewVersion, setViewVersion] = useState(0);
|
|
184
|
+
useImperativeHandle(ref, () => ({ get view() { return viewRef.current; } }), []);
|
|
185
|
+
// Build the toolbar action list — feature-filtered + tail items added.
|
|
186
|
+
const actions = useMemo(() => {
|
|
187
|
+
const filtered = filterByFeatures(defaultToolbarActions(defaultSchema, features.history ? history : undefined), features);
|
|
188
|
+
const tail = [];
|
|
189
|
+
if (features.newPage) {
|
|
190
|
+
tail.push({
|
|
191
|
+
id: 'new-page',
|
|
192
|
+
label: 'Add new page (Ctrl+Enter)',
|
|
193
|
+
icon: ICON_NEW_PAGE,
|
|
194
|
+
command: (state, dispatch) => {
|
|
195
|
+
const pbType = state.schema.nodes.page_break;
|
|
196
|
+
if (!pbType)
|
|
197
|
+
return false;
|
|
198
|
+
return insertPageBreak(pbType)(state, dispatch);
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (features.headerFooter) {
|
|
203
|
+
tail.push({
|
|
204
|
+
type: 'popover',
|
|
205
|
+
id: 'headerFooter',
|
|
206
|
+
label: 'Header and footer',
|
|
207
|
+
icon: ICON_HEADER_FOOTER,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (features.pageSettings) {
|
|
211
|
+
tail.push({
|
|
212
|
+
type: 'popover',
|
|
213
|
+
id: 'pageSettings',
|
|
214
|
+
label: 'Page settings',
|
|
215
|
+
icon: ICON_PAGE_SETTINGS,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (tail.length === 0)
|
|
219
|
+
return filtered;
|
|
220
|
+
return dedupeSeparators([...filtered, TOOLBAR_SEPARATOR, ...tail]);
|
|
221
|
+
}, [features, history]);
|
|
222
|
+
// Build the popover map. The headerFooter / pageSettings entries close
|
|
223
|
+
// over the bundled component's state so the popovers can read/write the
|
|
224
|
+
// current chrome and page-settings values via simple prop callbacks.
|
|
225
|
+
const popovers = useMemo(() => {
|
|
226
|
+
const map = {};
|
|
227
|
+
if (features.links)
|
|
228
|
+
map.link = LinkPopover;
|
|
229
|
+
if (features.tables)
|
|
230
|
+
map.table = TablePicker;
|
|
231
|
+
if (features.images)
|
|
232
|
+
map.image = ImagePopover;
|
|
233
|
+
if (features.headerFooter) {
|
|
234
|
+
const HF = (popProps) => (_jsx(HeaderFooterPopover, { state: popProps.state, dispatch: popProps.dispatch, close: popProps.close, chrome: chrome, onChromeChange: setChrome }));
|
|
235
|
+
HF.displayName = 'BundledHeaderFooterPopover';
|
|
236
|
+
map.headerFooter = HF;
|
|
237
|
+
}
|
|
238
|
+
if (features.pageSettings) {
|
|
239
|
+
const PS = (popProps) => (_jsx(PageSettingsPopover, { state: popProps.state, dispatch: popProps.dispatch, close: popProps.close, current: pageSettings, onChange: updatePageSettings }));
|
|
240
|
+
PS.displayName = 'BundledPageSettingsPopover';
|
|
241
|
+
map.pageSettings = PS;
|
|
242
|
+
}
|
|
243
|
+
return map;
|
|
244
|
+
}, [features, chrome, pageSettings, updatePageSettings]);
|
|
245
|
+
// Keymap handler. Rebuilt when the feature set or history handle changes.
|
|
246
|
+
const handler = useMemo(() => keymap({
|
|
247
|
+
...defaultKeymapBindings(defaultSchema),
|
|
248
|
+
...(features.history
|
|
249
|
+
? {
|
|
250
|
+
'Mod-z': history.commands.undo,
|
|
251
|
+
'Mod-Shift-z': history.commands.redo,
|
|
252
|
+
'Mod-y': history.commands.redo,
|
|
253
|
+
}
|
|
254
|
+
: {}),
|
|
255
|
+
...(features.links
|
|
256
|
+
? {
|
|
257
|
+
'Mod-k': () => {
|
|
258
|
+
if (typeof document === 'undefined')
|
|
259
|
+
return false;
|
|
260
|
+
const btn = document.querySelector('[data-testid="btn-link"]');
|
|
261
|
+
if (!btn)
|
|
262
|
+
return false;
|
|
263
|
+
btn.click();
|
|
264
|
+
return true;
|
|
265
|
+
},
|
|
266
|
+
}
|
|
267
|
+
: {}),
|
|
268
|
+
...(features.newPage
|
|
269
|
+
? {
|
|
270
|
+
'Mod-Enter': (state, dispatch) => {
|
|
271
|
+
const pbType = state.schema.nodes.page_break;
|
|
272
|
+
if (!pbType)
|
|
273
|
+
return false;
|
|
274
|
+
return insertPageBreak(pbType)(state, dispatch);
|
|
275
|
+
},
|
|
276
|
+
}
|
|
277
|
+
: {}),
|
|
278
|
+
...(features.print
|
|
279
|
+
? {
|
|
280
|
+
'Mod-p': () => {
|
|
281
|
+
const v = viewRef.current;
|
|
282
|
+
if (!v)
|
|
283
|
+
return false;
|
|
284
|
+
void printDocument(v);
|
|
285
|
+
return true;
|
|
286
|
+
},
|
|
287
|
+
}
|
|
288
|
+
: {}),
|
|
289
|
+
}), [features, history]);
|
|
290
|
+
const onMount = useCallback((view) => {
|
|
291
|
+
viewRef.current = view;
|
|
292
|
+
setViewVersion((v) => v + 1);
|
|
293
|
+
const uninstallInput = installInputPipeline(view, {
|
|
294
|
+
keymap: (event, state, dispatch) => handler(event, state, dispatch),
|
|
295
|
+
});
|
|
296
|
+
const uninstallClipboard = installClipboardHandlers(view);
|
|
297
|
+
const onPrint = () => {
|
|
298
|
+
const v = viewRef.current;
|
|
299
|
+
if (v)
|
|
300
|
+
void printDocument(v);
|
|
301
|
+
};
|
|
302
|
+
if (typeof document !== 'undefined') {
|
|
303
|
+
document.addEventListener('doxiva:print', onPrint);
|
|
304
|
+
}
|
|
305
|
+
return () => {
|
|
306
|
+
if (typeof document !== 'undefined') {
|
|
307
|
+
document.removeEventListener('doxiva:print', onPrint);
|
|
308
|
+
}
|
|
309
|
+
uninstallInput();
|
|
310
|
+
uninstallClipboard();
|
|
311
|
+
viewRef.current = null;
|
|
312
|
+
setViewVersion((v) => v + 1);
|
|
313
|
+
};
|
|
314
|
+
}, [handler]);
|
|
315
|
+
// Fire host change callbacks. We skip the first render so the host doesn't
|
|
316
|
+
// see an initial spurious notification — the doc/state at mount time was
|
|
317
|
+
// supplied BY the host (initialDoc), so re-emitting it is noise.
|
|
318
|
+
const onChange = props.onChange;
|
|
319
|
+
const onStateChange = props.onStateChange;
|
|
320
|
+
const firedFirstChange = useRef(false);
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
if (!firedFirstChange.current) {
|
|
323
|
+
firedFirstChange.current = true;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (onChange)
|
|
327
|
+
onChange(editor.state.doc);
|
|
328
|
+
}, [editor.state.doc, onChange]);
|
|
329
|
+
const firedFirstState = useRef(false);
|
|
330
|
+
useEffect(() => {
|
|
331
|
+
if (!firedFirstState.current) {
|
|
332
|
+
firedFirstState.current = true;
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (onStateChange)
|
|
336
|
+
onStateChange(editor.state);
|
|
337
|
+
}, [editor.state, onStateChange]);
|
|
338
|
+
// Theme: 'auto' follows prefers-color-scheme + listens for changes.
|
|
339
|
+
const [resolvedTheme, setResolvedTheme] = useState(() => {
|
|
340
|
+
if (theme === 'auto') {
|
|
341
|
+
if (typeof window === 'undefined')
|
|
342
|
+
return 'light';
|
|
343
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
344
|
+
}
|
|
345
|
+
return theme;
|
|
346
|
+
});
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
if (theme !== 'auto') {
|
|
349
|
+
setResolvedTheme(theme);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (typeof window === 'undefined')
|
|
353
|
+
return;
|
|
354
|
+
const mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
355
|
+
const onChangeMedia = (e) => {
|
|
356
|
+
setResolvedTheme(e.matches ? 'dark' : 'light');
|
|
357
|
+
};
|
|
358
|
+
setResolvedTheme(mq.matches ? 'dark' : 'light');
|
|
359
|
+
mq.addEventListener('change', onChangeMedia);
|
|
360
|
+
return () => mq.removeEventListener('change', onChangeMedia);
|
|
361
|
+
}, [theme]);
|
|
362
|
+
// Top-row button handlers.
|
|
363
|
+
const onPrintClick = useCallback(() => {
|
|
364
|
+
const v = viewRef.current;
|
|
365
|
+
if (v)
|
|
366
|
+
void printDocument(v);
|
|
367
|
+
}, []);
|
|
368
|
+
const onDownloadPdfClick = useCallback(() => {
|
|
369
|
+
const v = viewRef.current;
|
|
370
|
+
if (!v)
|
|
371
|
+
return;
|
|
372
|
+
const prev = typeof document !== 'undefined' ? document.title : '';
|
|
373
|
+
if (typeof document !== 'undefined')
|
|
374
|
+
document.title = 'doxiva-document';
|
|
375
|
+
void printDocument(v).finally(() => {
|
|
376
|
+
if (typeof document !== 'undefined')
|
|
377
|
+
document.title = prev;
|
|
378
|
+
});
|
|
379
|
+
}, []);
|
|
380
|
+
const onExportDocxClick = useCallback(async () => {
|
|
381
|
+
const v = viewRef.current;
|
|
382
|
+
if (!v)
|
|
383
|
+
return;
|
|
384
|
+
const { exportDocx } = await import('@doxi/docx');
|
|
385
|
+
const bytes = exportDocx(v.state.doc);
|
|
386
|
+
const blob = new Blob([bytes], {
|
|
387
|
+
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
388
|
+
});
|
|
389
|
+
const url = URL.createObjectURL(blob);
|
|
390
|
+
const a = document.createElement('a');
|
|
391
|
+
a.href = url;
|
|
392
|
+
a.download = 'doxiva-document.docx';
|
|
393
|
+
document.body.appendChild(a);
|
|
394
|
+
a.click();
|
|
395
|
+
document.body.removeChild(a);
|
|
396
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
397
|
+
}, []);
|
|
398
|
+
const fileInputRef = useRef(null);
|
|
399
|
+
const onImportClick = useCallback(() => {
|
|
400
|
+
fileInputRef.current?.click();
|
|
401
|
+
}, []);
|
|
402
|
+
const onImportFile = useCallback(async (e) => {
|
|
403
|
+
const file = e.target.files?.[0];
|
|
404
|
+
e.target.value = '';
|
|
405
|
+
if (!file)
|
|
406
|
+
return;
|
|
407
|
+
const { importDocx } = await import('@doxi/docx');
|
|
408
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
409
|
+
const { doc, warnings } = await importDocx(bytes);
|
|
410
|
+
setImportWarnings(warnings);
|
|
411
|
+
if (props.onImportWarnings && props.onImportWarnings !== null) {
|
|
412
|
+
props.onImportWarnings(warnings);
|
|
413
|
+
}
|
|
414
|
+
editor.replaceState(EditorState.create({
|
|
415
|
+
schema: defaultSchema,
|
|
416
|
+
doc,
|
|
417
|
+
selection: new TextSelection(1, 1),
|
|
418
|
+
plugins: [history.plugin],
|
|
419
|
+
}));
|
|
420
|
+
}, [editor, history, props.onImportWarnings]);
|
|
421
|
+
const shellClass = 'dx-doxiva-shell ' +
|
|
422
|
+
(resolvedTheme === 'dark' ? 'dx-theme-dark ' : 'dx-theme-light ') +
|
|
423
|
+
(chrome.headerEnabled ? '' : 'no-header ') +
|
|
424
|
+
(chrome.footerEnabled ? '' : 'no-footer ');
|
|
425
|
+
const ariaLabel = props.ariaLabel ?? 'Document editor';
|
|
426
|
+
const showWarningsPanel = importWarnings.length > 0 && props.onImportWarnings !== null;
|
|
427
|
+
const shellStyle = {
|
|
428
|
+
['--dx-header-height']: `${chrome.headerHeightPx}px`,
|
|
429
|
+
['--dx-footer-height']: `${chrome.footerHeightPx}px`,
|
|
430
|
+
};
|
|
431
|
+
const showTopRow = features.print ||
|
|
432
|
+
features.downloadPdf ||
|
|
433
|
+
features.exportDocx ||
|
|
434
|
+
features.importDocx;
|
|
435
|
+
const viewReady = viewVersion > 0 && viewRef.current != null;
|
|
436
|
+
return (_jsxs("div", { className: shellClass.trim(), "data-doxiva-version": "0.11.0", "data-testid": "doxiva-shell", style: shellStyle, children: [showTopRow && (_jsxs("div", { className: "dx-doxiva-toprow", "data-testid": "doxiva-toprow", children: [features.print && (_jsx("button", { type: "button", "data-testid": "btn-print-top", onClick: onPrintClick, disabled: !viewReady, children: "Print" })), features.downloadPdf && (_jsx("button", { type: "button", "data-testid": "btn-download-pdf", onClick: onDownloadPdfClick, disabled: !viewReady, children: "Download PDF" })), features.exportDocx && (_jsx("button", { type: "button", "data-testid": "btn-export-docx", onClick: () => { void onExportDocxClick(); }, disabled: !viewReady, children: "Export DOCX" })), features.importDocx && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", "data-testid": "btn-import-docx", onClick: onImportClick, children: "Import DOCX" }), _jsx("input", { ref: fileInputRef, type: "file", accept: ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", "data-testid": "import-file-input", style: {
|
|
437
|
+
position: 'absolute',
|
|
438
|
+
width: 1,
|
|
439
|
+
height: 1,
|
|
440
|
+
opacity: 0,
|
|
441
|
+
pointerEvents: 'none',
|
|
442
|
+
}, onChange: (e) => { void onImportFile(e); } })] }))] })), _jsx(Toolbar, { editor: editor, actions: actions, popovers: popovers }), _jsx("section", { className: "dx-doxiva-editor-wrap", "data-testid": "editor-wrap", children: _jsx(Editor, { editor: editor, renderer: defaultRenderer, ...(paginatedConfig ? { paginated: paginatedConfig } : {}), editable: props.editable !== false, ariaLabel: ariaLabel, onMount: onMount }, editorKey) }), showWarningsPanel && (_jsxs("div", { className: "dx-doxiva-import-warnings", "data-testid": "import-warnings", children: [_jsxs("strong", { children: [importWarnings.length, " warning", importWarnings.length === 1 ? '' : 's', ":"] }), _jsxs("ul", { children: [importWarnings.slice(0, 5).map((w, i) => {
|
|
443
|
+
const entry = w;
|
|
444
|
+
return (_jsxs("li", { children: [entry.code ?? 'WARNING', ": ", entry.message ?? ''] }, i));
|
|
445
|
+
}), importWarnings.length > 5 && (_jsxs("li", { children: ["\u2026 and ", importWarnings.length - 5, " more"] }))] })] }))] }));
|
|
446
|
+
});
|
|
447
|
+
DoxivaEditor.displayName = 'DoxivaEditor';
|
|
448
|
+
//# sourceMappingURL=DoxivaEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DoxivaEditor.js","sourceRoot":"","sources":["../src/DoxivaEditor.tsx"],"names":[],"m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CACpB,eAAK,SAAS,EAAC,2BAA2B,iBAAa,iBAAiB,aACtE,6BACG,cAAc,CAAC,MAAM,cAAU,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAC/D,EACT,yBACG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gCACvC,MAAM,KAAK,GAAG,CAAwC,CAAA;gCACtD,OAAO,CACL,yBACG,KAAK,CAAC,IAAI,IAAI,SAAS,QAAI,KAAK,CAAC,OAAO,IAAI,EAAE,KADxC,CAAC,CAEL,CACN,CAAA;4BACH,CAAC,CAAC,EACD,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,CAC5B,wCAAW,cAAc,CAAC,MAAM,GAAG,CAAC,aAAW,CAChD,IACE,IACD,CACP,IACG,CACP,CAAA;AACH,CAAC,CAAC,CAED;AAAC,YAAyC,CAAC,WAAW,GAAG,cAAc,CAAA"}
|
package/dist/Editor.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EditorView, type PageConfig, type Renderer } from '@doxi/core';
|
|
2
|
+
import type { EditorHandle } from './types.js';
|
|
3
|
+
export interface EditorProps {
|
|
4
|
+
readonly editor: EditorHandle;
|
|
5
|
+
readonly renderer: Renderer;
|
|
6
|
+
readonly editable?: boolean;
|
|
7
|
+
readonly paginated?: PageConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Accessible name applied to the editor's contenteditable surface as
|
|
10
|
+
* `aria-label`. Defaults to "Document editor".
|
|
11
|
+
*/
|
|
12
|
+
readonly ariaLabel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Called once the EditorView is mounted. May return a cleanup function
|
|
15
|
+
* (called on unmount). Use this to install the input pipeline, clipboard
|
|
16
|
+
* handlers, mutation observer, etc.
|
|
17
|
+
*/
|
|
18
|
+
readonly onMount?: (view: EditorView) => void | (() => void);
|
|
19
|
+
}
|
|
20
|
+
export declare function Editor(props: EditorProps): JSX.Element;
|
|
21
|
+
//# sourceMappingURL=Editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAA;IAC/B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAA;CAC7D;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA4CtD"}
|