@folijs/react 0.4.0 → 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.
- package/CHANGELOG.md +61 -0
- package/README.md +4 -2
- package/dist/FoliCanvas.d.ts +8 -0
- package/dist/FoliCanvas.d.ts.map +1 -1
- package/dist/FoliCanvas.js +9 -4
- package/dist/FoliCanvas.js.map +1 -1
- package/dist/FoliEditor.d.ts.map +1 -1
- package/dist/FoliEditor.js +2 -1
- package/dist/FoliEditor.js.map +1 -1
- package/dist/FoliNavigation.d.ts +15 -0
- package/dist/FoliNavigation.d.ts.map +1 -0
- package/dist/FoliNavigation.js +491 -0
- package/dist/FoliNavigation.js.map +1 -0
- package/dist/FoliToolbar.d.ts +9 -2
- package/dist/FoliToolbar.d.ts.map +1 -1
- package/dist/FoliToolbar.js +1223 -13
- package/dist/FoliToolbar.js.map +1 -1
- package/dist/editor.d.ts +2 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +6 -0
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/FoliCanvas.tsx +26 -5
- package/src/FoliEditor.tsx +3 -0
- package/src/FoliNavigation.tsx +895 -0
- package/src/FoliToolbar.tsx +1900 -10
- package/src/editor.tsx +11 -0
- package/src/index.ts +1 -0
- package/styles.css +202 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# @folijs/react
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- cd343e4: Sections, headers and footers, notes, fields, content controls, find and replace, and PDF, as Word models them: imported, laid out on pages, edited there and written back to `.docx`.
|
|
8
|
+
- **Schema v5** (`@folijs/core`, ADR-0007): `stories` in the envelope (headers, footers, footnotes and endnotes, each a tree of blocks), `controls` (content controls' properties) and `settings` (even and odd headers, note options, `doNotUseHTMLParagraphAutoSpacing`); field markers (`fieldStart`, `fieldCode`, `fieldSeparator`, `fieldEnd`), content control markers (`controlStart`, `controlEnd`; a `controls` attribute on blocks, rows and cells), `noteReference` and `noteMark` nodes; sections gain `columns`, `pageNumbers`, note properties and a tracked setup change (`change`). `SCHEMA_VERSION` 5: v4 documents migrate on load (the version only: what was opaque stays so until the `.docx` is imported again).
|
|
9
|
+
- **Stories and undo** (`@folijs/core`): `editor.story(id)` gives an editor over a header, footer or note; its changes are `StoryStep`s of the body's history (one undo across the document), `EnvelopeStep` for the last section, settings and controls; accept and reject all reach every story.
|
|
10
|
+
- **Sections** (`@folijs/core`, `@folijs/view`, `@folijs/react`): columns (equal and set widths, the line between, column breaks), continuous, next-column and even and odd page sections with Word's blank page, balanced columns above a continuous break; `insertSectionBreak`, `removeSectionBreak`, `setSectionSetup`, `insertColumnBreak`, tracked as Word records them; a Section menu and Page setup dialog.
|
|
11
|
+
- **Headers and footers**: drawn in their margins on every page (first, even and default variants, linked to the previous section, a taller one pushing the text, page fields filled per page), edited in place (double click or the Header menu, Escape returns) with typing, formatting, pictures, tables, undo and tracking; `setDifferentFirstPage`, `setDifferentEvenPages`, `setStoryLinked`.
|
|
12
|
+
- **Footnotes and endnotes**: at their reference's page foot under a separator, continued on the next page, beneath the text or at the end of a section or the document; numbered in Word's formats with restarts (`noteNumbers`, never stored); `insertNote`, `setNoteProperties`, `convertNotes`; deleted with their reference, tracked, carried on the clipboard; edited in place (double click, Shift+Alt+N, the Notes menu and its options dialog).
|
|
13
|
+
- **Fields**: shown with their results, selected and deleted whole, codes hidden or shown (Alt+F9); `updateFields` (`PAGE`, `NUMPAGES`, `SECTIONPAGES`, `DATE`, `TIME`, `REF`, `PAGEREF`, `SEQ`, `TOC` from heading styles with their pages, `MERGEFIELD` from data; F9, Ctrl+A then F9, `view.updateFields`, `view.print()`) returning what it updated and what it left; `fieldsIn`, `insertField`, `insertPageNumber`, `insertDate`, `insertCrossReference`, `insertTableOfContents`; a Fields menu and cross-reference dialog.
|
|
14
|
+
- **Content controls**: plain and rich text, drop-down, combo box, date, check box, picture, repeating sections, with Word's locks, placeholders and what each kind holds; frames, titles, lists, a date picker and check boxes in the view (Alt+Down, Space); `insertControl`, `setControlValue` and `controlValues` (by id or tag), `setControlProperties`, `addRepeatingItem`; a Controls menu and properties dialog.
|
|
15
|
+
- **Navigation**: `findAll`, `replace`, `replaceAll` over the body and every story (match case, whole words, tracked while tracking, one undo step), `insertBookmark`, `renameBookmark`, `deleteBookmark`, `listBookmarks`, `goTo`, `documentOutline`; matches marked with the CSS Custom Highlight API; `FoliNavigation` (find, replace and go to panel, bookmarks dialog, outline), included in `FoliEditor`, with Word's keys (Ctrl+F, Ctrl+H, Ctrl+G, F3, Shift+F3, Ctrl+Shift+F5) and a Navigate menu.
|
|
16
|
+
- **DOCX** (`@folijs/docx`): headers, footers, footnotes and endnotes read and written as stories (unchanged ones byte for byte, new ones with their parts, relationships and content types), complex and simple fields, content controls at every level (properties patched into the kept `w:sdtPr`), sections' columns, page numbers and note properties, `word/settings.xml`'s even and odd headers and note options. Word reads Foli's sections, headers, notes, fields, controls and replacements back (`scripts/corpus/*-roundtrip.mjs`).
|
|
17
|
+
- **PDF** (`@folijs/pdf`, first released): `exportPdf(document, { page, resources, review, styles })` prints Foli's own pages with a headless Chromium page the app supplies (Playwright 1.42+; Puppeteer's page type fits): each section on its own sheet size, fields updated from the pages first, safe links and bookmark links as PDF links, headings as PDF bookmarks, a tagged PDF. The page loads nothing from the network (images and fonts as `data:` URLs only). Against Word's PDFs of the corpus it scores 0.954 over 24 pages.
|
|
18
|
+
- **Pages against Word**: all 158 paragraphs outside tables that the harness compares on Word's page; headers, footers and notes scored with the rest of the page (0.889 over 24 pages on screen).
|
|
19
|
+
|
|
20
|
+
0.5.0 cannot read documents saved by 0.6.0 (schema v5). Known limits are in [Known limitations](https://github.com/josep-audenis/foli/blob/main/docs/limitations.md) (content, finding and going places, print and PDF sections).
|
|
21
|
+
|
|
22
|
+
Changed behaviour (pre-1.0 minor):
|
|
23
|
+
- `.docx` headers, footers and notes import as `stories` (0.5.0 kept them as parts, never shown); note references, fields (`w:fldChar`, `w:instrText`, `w:fldSimple`) and content controls (`w:sdt`) that imported as `opaqueInline` or `opaqueBlock` now import as nodes. A v4 document's opaque content stays opaque until the `.docx` is imported again.
|
|
24
|
+
- Layout: between two paragraphs goes the larger of the first's space after and the second's space before, as in Word's PDFs (0.5.0 added them; they still add up with `w:doNotUseHTMLParagraphAutoSpacing`); a line is as tall as its runs and paragraph mark, not the paragraph style's font; a header or footer taller than its margin pushes the text. Pages break differently than in 0.5.0, closer to Word.
|
|
25
|
+
- `FoliEditor` includes `FoliNavigation` and takes Ctrl+F, Ctrl+H, Ctrl+G, F3, Shift+F3 and Ctrl+Shift+F5 while the focus is in the document or its panels (the browser's own find no longer opens there).
|
|
26
|
+
- `FoliToolbar` shows the Section, Header, Fields, Navigate, Notes and Controls menus.
|
|
27
|
+
- `view.print()` updates every field before printing; the print rules are shared with `exportPdf`.
|
|
28
|
+
- Backspace at a field's edge selects the field first, and a selection crossing a field's markers takes the whole field, as in Word; the caret steps over a field's code.
|
|
29
|
+
- `acceptAllChanges` and `rejectAllChanges` also settle the tracked changes in headers, footers and notes.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [cd343e4]
|
|
34
|
+
- @folijs/core@0.6.0
|
|
35
|
+
- @folijs/view@0.6.0
|
|
36
|
+
|
|
37
|
+
## 0.5.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- 18f838a: Tables and pictures as Word models them: imported, edited on pages and written back to `.docx`.
|
|
42
|
+
- **Schema v4** (`@folijs/core`, ADR-0006): `table`, `tableRow` and `tableCell` nodes with Word's table, row and cell properties (grid, merges, borders, shading, widths, header rows, `cantSplit`), table styles resolved as Word does (conditional formatting for first and last rows and columns, bands), `picture` nodes (inline or floating: `float` with Word's position and wrapping) and the envelope's `resources` (the pictures' images by key: content type, size, a URL or an opted-in `data:` URL; no base64 by default). `SCHEMA_VERSION` 4: v3 documents migrate on load.
|
|
43
|
+
- **Table editing** (`@folijs/core`, `@folijs/view`): cells isolate edits; typing, Enter, Backspace and Delete in cells; Tab and Shift+Tab between cells (Tab in the last cell adds a row); arrows across rows, pages and out of the table; `CellSelection` (drag, Shift+arrows) with copy, cut, paste and delete; commands `insertTable`, `insertRow`, `deleteRows`, `insertColumn`, `deleteColumns`, `deleteTable`, `mergeCells`, `splitCell`, `toggleHeaderRow`, `setTableStyle`, `setCellShading`, `setColumnWidth`; column borders dragged in the view. Rows inserted and deleted while tracking are tracked as Word records them.
|
|
44
|
+
- **Tables on pages** (`@folijs/view`): tables drawn from the model, rows flowed across pages (split at a line, header rows repeated, `cantSplit` kept whole); 277 of the corpus's 280 cell paragraphs on Word's page.
|
|
45
|
+
- **Pictures** (`@folijs/core`, `@folijs/view`): `insertPicture` (alt text required unless decorative, or `{ requireAlt: false }`: pasted and dropped files go in so and are marked), `setPictureSize`, `setPictureAlt`, `selectedPicture`; pictures drawn at their size, selected by a click, resized by a handle with their aspect ratio kept; image files pasted or dropped go through the app's `upload` hook (`EditorViewOptions.upload`, `view.insertFiles`), images shown through `EditorViewOptions.resource`; floating pictures laid out with the text around them (square, top and bottom, behind and in front of text), where Word places them in the corpus. `measureImageFile`, `textWidthEmu` and `EMU_PER_PX` are exported.
|
|
46
|
+
- **React** (`@folijs/react`): `FoliToolbar` gets a Table menu (insert table dialog, rows, columns, merge, split, header row, delete), a table style box, a cell shading menu and a Picture… dialog (insert from a file with alt text; edit a picture's alt text and size); `FoliEditor` and `FoliCanvas` take `upload` and `resource` props, `FoliToolbar` `upload`. Keyboard-usable and axe-clean in Chromium, Firefox and WebKit.
|
|
47
|
+
- **DOCX** (`@folijs/docx`): tables read into the model and written back (unchanged ones as written, changed ones child by child; tracked row changes); inline (`wp:inline`) and floating (`wp:anchor`) pictures read as picture nodes with their images as resources, written back byte for byte when unchanged, new images as media parts from `data:` URLs or `ExportOptions.resource`; `packageImages(pkg)` gives the view URLs for a package's images; `report.picturesWithoutAlt`. Word opens the corpus's tables and pictures exported unchanged and edited.
|
|
48
|
+
|
|
49
|
+
0.4.0 cannot read documents saved by 0.5.0 (schema v4). Known limits are in [Known limitations](https://github.com/josep-audenis/foli/blob/main/docs/limitations.md) (tables and pictures sections).
|
|
50
|
+
|
|
51
|
+
Changed behaviour (pre-1.0 minor):
|
|
52
|
+
- `.docx` tables and drawings that imported as `opaqueBlock` and `opaqueInline` now import as `table` and `picture` nodes; a v3 document's opaque tables stay opaque until the `.docx` is imported again.
|
|
53
|
+
- `exportDocx` needs the bytes of a picture added since import: a `data:` URL resource or `ExportOptions.resource(key, resource)`; without them it throws a `DocxError` (never drops the picture).
|
|
54
|
+
- The editor's pages are `position: relative; isolation: isolate; display: flow-root` (pictures behind and in front of text are positioned against them; a floating picture past the page's text makes the page taller).
|
|
55
|
+
- Inserting or deleting a table while tracking is recorded as tracked rows (0.4.0 did not make the edit), and `deleteComment` and `deleteAllComments` remove comments anchored in tables (0.4.0 kept them: tables were opaque).
|
|
56
|
+
- `FoliToolbar` shows the Table menu, table style box, cell shading menu and Picture… button.
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [18f838a]
|
|
61
|
+
- @folijs/core@0.5.0
|
|
62
|
+
- @folijs/view@0.5.0
|
|
63
|
+
|
|
3
64
|
## 0.4.0
|
|
4
65
|
|
|
5
66
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -37,8 +37,10 @@ export function App() {
|
|
|
37
37
|
Browser-only as written; for server rendering (Next.js) and saving on page close, see
|
|
38
38
|
[Getting started](https://github.com/josep-audenis/foli/blob/main/docs/getting-started.md).
|
|
39
39
|
|
|
40
|
-
`FoliEditor` shows the pages with
|
|
41
|
-
|
|
40
|
+
`FoliEditor` shows the pages with Word's toolbar (formatting, review, tables, pictures,
|
|
41
|
+
sections, headers and footers, fields, notes, content controls) and the find, replace and go to
|
|
42
|
+
panel (`FoliNavigation`). For your own layout: `useFoliEditor`, `FoliEditorProvider`,
|
|
43
|
+
`FoliCanvas`, `FoliToolbar`, `FoliComments`, `FoliNavigation`, `useCurrentEditor` and
|
|
42
44
|
`useEditorState(selector)`. React 18.2+ and 19; server rendering gives the editor's shell, the
|
|
43
45
|
document appears on hydration.
|
|
44
46
|
|
package/dist/FoliCanvas.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Editor } from "@folijs/core";
|
|
2
|
+
import { type EditorViewOptions } from "@folijs/view";
|
|
2
3
|
export interface FoliCanvasProps {
|
|
3
4
|
/** Default: the editor of the nearest `FoliEditorProvider`. */
|
|
4
5
|
editor?: Editor | undefined;
|
|
@@ -8,6 +9,13 @@ export interface FoliCanvasProps {
|
|
|
8
9
|
placeholder?: string | undefined;
|
|
9
10
|
/** Accessible name of the editable area (default "Document"). */
|
|
10
11
|
label?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Where pasted, dropped and inserted image files go: the URL the app stores the file at (or a
|
|
14
|
+
* `data:` URL, opting in). Without it, pictures are not pasted, dropped or inserted.
|
|
15
|
+
*/
|
|
16
|
+
upload?: EditorViewOptions["upload"] | undefined;
|
|
17
|
+
/** The URL to show a picture's image from (`packageImages` for a .docx package's images). */
|
|
18
|
+
resource?: EditorViewOptions["resource"] | undefined;
|
|
11
19
|
className?: string | undefined;
|
|
12
20
|
}
|
|
13
21
|
/** What a `ref` on `FoliCanvas` gives. */
|
package/dist/FoliCanvas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoliCanvas.d.ts","sourceRoot":"","sources":["../src/FoliCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FoliCanvas.d.ts","sourceRoot":"","sources":["../src/FoliCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIlE,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACjD,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,8GAsDrB,CAAC"}
|
package/dist/FoliCanvas.js
CHANGED
|
@@ -6,16 +6,21 @@ import { useEditorOrContext, useIsomorphicLayoutEffect } from "./editor.js";
|
|
|
6
6
|
* The editable document on real pages (size and margins from the document settings). The view
|
|
7
7
|
* owns the DOM inside it; React never renders children there.
|
|
8
8
|
*/
|
|
9
|
-
export const FoliCanvas = forwardRef(function FoliCanvas({ editor: given, readOnly = false, placeholder = "", label = "Document", className }, ref) {
|
|
9
|
+
export const FoliCanvas = forwardRef(function FoliCanvas({ editor: given, readOnly = false, placeholder = "", label = "Document", className, upload = null, resource = null, }, ref) {
|
|
10
10
|
const editor = useEditorOrContext(given, "FoliCanvas");
|
|
11
11
|
const contentRef = useRef(null);
|
|
12
12
|
const viewRef = useRef(null);
|
|
13
13
|
useImperativeHandle(ref, () => ({ focus: () => viewRef.current?.focus() }), []);
|
|
14
|
+
// The options at the moment the view is made: its first render already uses them (no web
|
|
15
|
+
// image fetched before the app's resolver is in place).
|
|
16
|
+
const options = { editable: !readOnly, placeholder, upload, resource };
|
|
17
|
+
const optionsRef = useRef(options);
|
|
18
|
+
optionsRef.current = options;
|
|
14
19
|
useIsomorphicLayoutEffect(() => {
|
|
15
20
|
const host = contentRef.current;
|
|
16
21
|
if (!host)
|
|
17
22
|
return;
|
|
18
|
-
const view = new EditorView(host, editor);
|
|
23
|
+
const view = new EditorView(host, editor, optionsRef.current);
|
|
19
24
|
viewRef.current = view;
|
|
20
25
|
return () => {
|
|
21
26
|
view.destroy();
|
|
@@ -25,8 +30,8 @@ export const FoliCanvas = forwardRef(function FoliCanvas({ editor: given, readOn
|
|
|
25
30
|
// Runs after the view is created (effects run in order): for a new view, and when the props change.
|
|
26
31
|
// biome-ignore lint/correctness/useExhaustiveDependencies: a new editor means a new view, which needs the options too.
|
|
27
32
|
useIsomorphicLayoutEffect(() => {
|
|
28
|
-
viewRef.current?.setOptions({ editable: !readOnly, placeholder });
|
|
29
|
-
}, [editor, readOnly, placeholder]);
|
|
33
|
+
viewRef.current?.setOptions({ editable: !readOnly, placeholder, upload, resource });
|
|
34
|
+
}, [editor, readOnly, placeholder, upload, resource]);
|
|
30
35
|
return (_jsx("div", { className: className ? `foli-canvas ${className}` : "foli-canvas", children: _jsx("div", { ref: contentRef, className: "foli-content", role: "textbox", "aria-multiline": "true", "aria-label": label, tabIndex: 0 }) }));
|
|
31
36
|
});
|
|
32
37
|
//# sourceMappingURL=FoliCanvas.js.map
|
package/dist/FoliCanvas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoliCanvas.js","sourceRoot":"","sources":["../src/FoliCanvas.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,U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E,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACxC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC;AAED,2FAA2F;AAC3F,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,8GA6ErB,CAAC"}
|
package/dist/FoliEditor.js
CHANGED
|
@@ -4,6 +4,7 @@ import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
|
4
4
|
import { FoliEditorProvider, useEditorState, useFoliEditor, useIsomorphicLayoutEffect, } from "./editor.js";
|
|
5
5
|
import { FoliCanvas } from "./FoliCanvas.js";
|
|
6
6
|
import { FoliComments } from "./FoliComments.js";
|
|
7
|
+
import { FoliNavigation } from "./FoliNavigation.js";
|
|
7
8
|
import { FoliToolbar } from "./FoliToolbar.js";
|
|
8
9
|
/**
|
|
9
10
|
* An editable document on real pages with a toolbar: creates its editor, provides it to
|
|
@@ -37,6 +38,6 @@ export const FoliEditor = forwardRef(function FoliEditor({ initialContent, plugi
|
|
|
37
38
|
},
|
|
38
39
|
});
|
|
39
40
|
}), [editor]);
|
|
40
|
-
return (_jsxs(FoliEditorProvider, { editor: editor, children: [toolbar && (_jsx(FoliToolbar, { editor: editor, disabled: canvas.readOnly, comments: comments !== false, onClickCommand: () => canvasRef.current?.focus() })), children, _jsxs("div", { className: "foli-editor-body", children: [_jsx(FoliCanvas, { ref: canvasRef, editor: editor, ...canvas }), comments !== false && (_jsx(FoliComments, { editor: editor, readOnly: canvas.readOnly, hidden: comments === "auto" && !hasComments }))] })] }));
|
|
41
|
+
return (_jsxs(FoliEditorProvider, { editor: editor, children: [toolbar && (_jsx(FoliToolbar, { editor: editor, disabled: canvas.readOnly, comments: comments !== false, upload: canvas.upload, onClickCommand: () => canvasRef.current?.focus() })), children, _jsxs("div", { className: "foli-editor-body", children: [_jsx(FoliNavigation, { editor: editor, readOnly: canvas.readOnly }), _jsx(FoliCanvas, { ref: canvasRef, editor: editor, ...canvas }), comments !== false && (_jsx(FoliComments, { editor: editor, readOnly: canvas.readOnly, hidden: comments === "auto" && !hasComments }))] })] }));
|
|
41
42
|
});
|
|
42
43
|
//# sourceMappingURL=FoliEditor.js.map
|
package/dist/FoliEditor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoliEditor.js","sourceRoot":"","sources":["../src/FoliEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAOL,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAkB,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAA+C,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqD/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAoC,SAAS,UAAU,CACzF,EACE,cAAc,EACd,OAAO,EACP,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,MAAM,EACjB,QAAQ,EACR,GAAG,MAAM,EACV,EACD,GAAG;IAEH,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;IAC5F,MAAM,WAAW,GAAG,cAAc,CAChC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAClE,EAAE,M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Q,CAAC;YAClB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,EACJ,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,CACL,MAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,aAC/B,OAAO,IAAI,CACV,KAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,QAAQ,EAAE,QAAQ,KAAK,KAAK,EAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,GAChD,CACH,EACA,QAAQ,EACT,eAAK,SAAS,EAAC,kBAAkB,aAC/B,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAI,EAC7D,KAAC,UAAU,IAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAM,MAAM,GAAI,EAEzD,QAAQ,KAAK,KAAK,IAAI,CACrB,KAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,MAAM,EAAE,QAAQ,KAAK,MAAM,IAAI,CAAC,WAAW,GAC3C,CACH,IACG,IACa,CACtB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Editor } from "@folijs/core";
|
|
2
|
+
export interface FoliNavigationProps {
|
|
3
|
+
/** Default: the editor of the nearest `FoliEditorProvider`. */
|
|
4
|
+
editor?: Editor | undefined;
|
|
5
|
+
/** No replacing, and no changing bookmarks. */
|
|
6
|
+
readOnly?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Word's navigation for an editor: the find and replace panel (Ctrl+F, Ctrl+H, with Go to on
|
|
10
|
+
* Ctrl+G; F3 and Shift+F3 go to the next and previous match), the bookmarks dialog (Ctrl+Shift+F5)
|
|
11
|
+
* and the outline. The keys are taken only while the focus is in the document or in these panels:
|
|
12
|
+
* elsewhere on the page Ctrl+F stays the browser's. The toolbar's Navigate menu opens them too.
|
|
13
|
+
*/
|
|
14
|
+
export declare function FoliNavigation({ editor: given, readOnly }: FoliNavigationProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=FoliNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FoliNavigation.d.ts","sourceRoot":"","sources":["../src/FoliNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,MAAM,EAoBZ,MAAM,cAAc,CAAC;AAmBtB,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AA8ED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,mBAAmB,+BAwHtF"}
|