docblocks-react-ui 0.5.0 → 0.6.1
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 +22 -0
- package/README.md +43 -32
- package/dist/{Editor-BBbAwxWT.mjs → Editor-DcQTuUsM.mjs} +13617 -13396
- package/dist/{constants-BaAj3jDA.mjs → constants-2VXoyPmd.mjs} +76 -43
- package/dist/{index-DtVBbaEs.d.mts → index-DyPFy2m5.d.mts} +40 -75
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/mermaid/index.mjs +2 -2
- package/dist/pdf/index.d.mts +2 -2
- package/dist/pdf/index.mjs +253 -60
- package/dist/styles.css +9 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 47a8334: Remove column drag, resize, menu, and add-column affordances from database grids in view and published modes.
|
|
8
|
+
- 2fd97ce: Block every database cell write in view and published modes, including direct boolean toggles.
|
|
9
|
+
|
|
10
|
+
## 0.6.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 8b0f589: Add a zoom bar to the PDF preview's fullscreen mode: a separate pill to the left of the page controls with the zoom in/out buttons (over the fitted scale, 25%-400% bounds), the scale indicator, the fit-width and the fit-height buttons (the page's width/height fills the viewport's width/height, the overflow scrolls). The fullscreen mode pages with the left/right arrow keys, locks the body's scroll while open (the wheel over the overlay no longer scrolls the page behind), and stands a fixed-width page indicator (a digit count change no longer shifts the page buttons). The preview chrome stands no text selection (the page indicator and the controls are not document content), so selecting the page numbers can no longer flag the block or pull up the format toolbar.
|
|
15
|
+
- 7f26c1a: Localize the empty-block command palette placeholder for Russian locales while preserving consumer overrides.
|
|
16
|
+
- 8f6a3d6: - Add first-class file blocks with consumer-owned file ids, live rename subscriptions, reader downloads, and PDF previews.
|
|
17
|
+
- Replace URL-based blob resolution with Blob+metadata stores and remove the legacy `blobResolver` prop.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 16e10af: Fix attachment insertion and deletion gestures: replace phrase-only slash blocks, keep removal and the trailing paragraph in one undo step, and seat the caret on a surviving text block.
|
|
22
|
+
- Updated dependencies [8f6a3d6]
|
|
23
|
+
- docblocks-core@0.3.0
|
|
24
|
+
|
|
3
25
|
## 0.5.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ a bare `tsc`-only setup needs a one-line `declare module "*.css"` shim.
|
|
|
86
86
|
Everything the editor needs from the consumer is injected as an
|
|
87
87
|
`EditorProvider` prop; every prop except `doc` is optional. The only
|
|
88
88
|
built-in default is the blob store (a shared in-memory stand — the
|
|
89
|
-
uploads
|
|
89
|
+
uploads stay in memory for the JS session, cleared on reload); the
|
|
90
90
|
other props degrade gracefully over their absence (the external-form
|
|
91
91
|
database block stands the not-connected placeholder and the `/database`
|
|
92
92
|
slash command is hidden without a bridge; the `sync-embed` block stands
|
|
@@ -99,14 +99,13 @@ mention catalog). The full props list:
|
|
|
99
99
|
| `provider?` | A core `SyncProvider` for the wire + presence. Without it the editor is a single-client document (local edits stand, nothing syncs). |
|
|
100
100
|
| `blockRenderers?` | Per-type renderer overrides (see below). |
|
|
101
101
|
| `blobStore?` | The blob bridge for image / pdf / file blocks (see below). |
|
|
102
|
-
| `blobResolver?` | Legacy view-only resolver (key → src string). Wrapped as a store: no upload, subtype `image`. Prefer `blobStore`. |
|
|
103
102
|
| `databaseBridge?` | The table operations behind external-form database blocks (see below). |
|
|
104
103
|
| `syncEmbedResolver?` | `(ref) => Doc \| null` — resolves a `sync-embed` block's ref to the master doc (see below). |
|
|
105
104
|
| `embedSandbox?` | `(src) => string \| null` — the embed iframe's `sandbox` policy. The default grants the same-origin (the embedded app's own storage / cookies stand, so the real apps boot); `null` stands no sandbox (a fully trusted embed). The opaque-origin restriction stands over this policy. |
|
|
106
|
-
| `pdfPreview?` | A first-page preview component for
|
|
105
|
+
| `pdfPreview?` | A first-page preview component for PDF file blocks (and legacy PDF image blocks). |
|
|
107
106
|
| `mentionProvider?` | The `@` mention picker's search catalog (see below). |
|
|
108
107
|
| `rootBlockId?` | Render the entry list of this block instead of the document root (the subtree view). Must not change after mount. |
|
|
109
|
-
| `commandPalettePlaceholder?` | The empty-block hint
|
|
108
|
+
| `commandPalettePlaceholder?` | The empty-block hint override; the default is localized (en/ru). |
|
|
110
109
|
| `accessLevel?` | The consumer's user access level (default `editor`): `viewer` forces the `published` mode (the current state is never rendered to a reader). |
|
|
111
110
|
| `mode?` | The document mode (default `edit`): `view` is a read-only live document; `published` renders the `publishedDoc` snapshot read-only. |
|
|
112
111
|
| `publishedDoc?` | The published snapshot (a hydrated core `Doc`; must not change after mount — remount over `key` for a new snapshot). The consumer owns the publish action and the snapshot storage. |
|
|
@@ -316,33 +315,45 @@ anonymous plaintext selection over the room — the 0.2.0 behavior).
|
|
|
316
315
|
|
|
317
316
|
### Blobs
|
|
318
317
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
File-backed blocks hold only consumer-owned ids: `file.attrs.fileId` for
|
|
319
|
+
attachments and PDFs, and `image.attrs.src` for inline images. Bytes, names,
|
|
320
|
+
and MIME types never enter the document. `BlobStore` is the only bridge
|
|
321
|
+
between those ids and the stored objects:
|
|
322
322
|
|
|
323
323
|
```ts
|
|
324
|
+
interface BlobMeta {
|
|
325
|
+
name: string;
|
|
326
|
+
mimeType: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
324
329
|
interface BlobStore {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
remove?(key: string): Promise<void>; // optional gc
|
|
330
|
+
get(fileId: string): Promise<{ blob: Blob; meta: BlobMeta }>;
|
|
331
|
+
upload(file: File): Promise<string>;
|
|
332
|
+
rename(fileId: string, name: string): Promise<BlobMeta>;
|
|
333
|
+
subscribe(fileId: string, onChange: () => void): () => void;
|
|
334
|
+
remove?(fileId: string): Promise<void>;
|
|
331
335
|
}
|
|
332
336
|
```
|
|
333
337
|
|
|
334
|
-
- `
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
338
|
+
- `get` rejects an unknown id; the block renders a placeholder while loading
|
|
339
|
+
or when the id is unavailable. The library creates an object URL for the
|
|
340
|
+
returned blob and revokes it on replacement or unmount.
|
|
341
|
+
- The file picker accepts arbitrary files. New `image/*` uploads create an
|
|
342
|
+
`image` block; other MIME types, including `application/pdf`, create a
|
|
343
|
+
`file` block. PDF files render through `pdfPreview` or the sandboxed native
|
|
344
|
+
iframe; other files render a card with file and download icons.
|
|
345
|
+
- `meta.name` is the authoritative display and suggested download name.
|
|
346
|
+
Editors rename through `rename(fileId, name)`; the document JSON does not
|
|
347
|
+
change and document undo/redo does not revert storage renames. The store
|
|
348
|
+
notifies `subscribe` listeners after rename or replacement, so every open
|
|
349
|
+
view reloads the current blob and metadata. A rejection keeps the previous
|
|
350
|
+
name and displays an inline error. Read-only modes hide rename and keep
|
|
351
|
+
download available.
|
|
352
|
+
- Consumers can also update S3 `Content-Disposition` in `rename` when direct
|
|
353
|
+
storage URLs outside the library must carry the same filename.
|
|
354
|
+
- Without `blobStore`, the editor uses a shared in-memory store, cleared on
|
|
355
|
+
page reload. `createMemoryBlobStore` is exported for consumers that want the
|
|
356
|
+
same behavior in their own store composition.
|
|
346
357
|
|
|
347
358
|
### Database
|
|
348
359
|
|
|
@@ -518,8 +529,8 @@ const blockRenderers: BlockRendererMap = {
|
|
|
518
529
|
|
|
519
530
|
### PDF preview
|
|
520
531
|
|
|
521
|
-
`pdfPreview` is a component that renders a
|
|
522
|
-
|
|
532
|
+
`pdfPreview` is a component that renders a PDF file block's bytes as a
|
|
533
|
+
client-side first-page preview. The `./pdf` subpath
|
|
523
534
|
provides one over `pdfjs-dist` (a required peer):
|
|
524
535
|
|
|
525
536
|
```tsx
|
|
@@ -530,11 +541,11 @@ import { PdfFirstPage } from "docblocks-react-ui/pdf";
|
|
|
530
541
|
</EditorProvider>;
|
|
531
542
|
```
|
|
532
543
|
|
|
533
|
-
The renderer receives `{ id, url, name }
|
|
534
|
-
|
|
535
|
-
`data-block-id={id}
|
|
536
|
-
|
|
537
|
-
native iframe viewer; a failed preview render falls back to it, so the
|
|
544
|
+
The renderer receives `{ id, blockType, url, name }`: the block id, `file` for
|
|
545
|
+
new PDF blocks or `image` for legacy ones, the library-owned object URL, and
|
|
546
|
+
the store's authoritative name. It stamps `data-block-id={id}` and
|
|
547
|
+
`data-block-type={blockType}` on its root. Without the prop a PDF block stands
|
|
548
|
+
the native iframe viewer; a failed preview render falls back to it, so the
|
|
538
549
|
document always stays viewable.
|
|
539
550
|
|
|
540
551
|
### Mentions
|