@atom-forge/brickee 0.0.0-stage → 0.0.2
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 +42 -0
- package/LICENSE +21 -0
- package/README-AI.md +286 -0
- package/README.md +41 -2
- package/dist/Editor.svelte +1956 -0
- package/dist/Editor.svelte.d.ts +19 -0
- package/dist/LinkPrompt.svelte +42 -0
- package/dist/LinkPrompt.svelte.d.ts +8 -0
- package/dist/PluginHost.svelte +41 -0
- package/dist/PluginHost.svelte.d.ts +13 -0
- package/dist/Preview.svelte +182 -0
- package/dist/Preview.svelte.d.ts +32 -0
- package/dist/PropsBar.svelte +405 -0
- package/dist/PropsBar.svelte.d.ts +17 -0
- package/dist/code.d.ts +12 -0
- package/dist/code.js +15 -0
- package/dist/dom.d.ts +29 -0
- package/dist/dom.js +224 -0
- package/dist/i18n.d.ts +7 -0
- package/dist/i18n.js +18 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +16 -0
- package/dist/kit/Empty.svelte +24 -0
- package/dist/kit/Empty.svelte.d.ts +8 -0
- package/dist/kit/Frame.svelte +76 -0
- package/dist/kit/Frame.svelte.d.ts +15 -0
- package/dist/kit/util.d.ts +13 -0
- package/dist/kit/util.js +28 -0
- package/dist/locales/hu.d.ts +2 -0
- package/dist/locales/hu.js +142 -0
- package/dist/markdown.d.ts +23 -0
- package/dist/markdown.js +219 -0
- package/dist/model.d.ts +21 -0
- package/dist/model.js +45 -0
- package/dist/palette.d.ts +19 -0
- package/dist/palette.js +23 -0
- package/dist/plugins/Gap.svelte +28 -0
- package/dist/plugins/Gap.svelte.d.ts +15 -0
- package/dist/plugins/GapPreview.svelte +17 -0
- package/dist/plugins/GapPreview.svelte.d.ts +5 -0
- package/dist/plugins/Map.svelte +47 -0
- package/dist/plugins/Map.svelte.d.ts +12 -0
- package/dist/plugins/MapPreview.svelte +26 -0
- package/dist/plugins/MapPreview.svelte.d.ts +5 -0
- package/dist/plugins/Table.svelte +537 -0
- package/dist/plugins/Table.svelte.d.ts +28 -0
- package/dist/plugins/TablePreview.svelte +62 -0
- package/dist/plugins/TablePreview.svelte.d.ts +5 -0
- package/dist/plugins/YouTube.svelte +52 -0
- package/dist/plugins/YouTube.svelte.d.ts +8 -0
- package/dist/plugins/YouTubePreview.svelte +76 -0
- package/dist/plugins/YouTubePreview.svelte.d.ts +5 -0
- package/dist/plugins/index.d.ts +20 -0
- package/dist/plugins/index.js +105 -0
- package/dist/plugins/util.d.ts +3 -0
- package/dist/plugins/util.js +8 -0
- package/dist/schema.d.ts +11 -0
- package/dist/schema.js +25 -0
- package/dist/scroll.d.ts +18 -0
- package/dist/scroll.js +57 -0
- package/dist/types.d.ts +132 -0
- package/dist/types.js +43 -0
- package/dist/view.d.ts +6 -0
- package/dist/view.js +11 -0
- package/docs/en/bundled-plugins.md +99 -0
- package/docs/en/documents-and-markdown.md +114 -0
- package/docs/en/editor-and-preview.md +139 -0
- package/docs/en/getting-started.md +85 -0
- package/docs/en/host-contexts.md +169 -0
- package/docs/en/index.md +38 -0
- package/docs/en/recipes-and-pitfalls.md +123 -0
- package/docs/en/server-side.md +95 -0
- package/docs/en/upgrading.md +71 -0
- package/docs/en/writing-plugins.md +405 -0
- package/docs/hu/bundled-plugins.md +99 -0
- package/docs/hu/documents-and-markdown.md +114 -0
- package/docs/hu/editor-and-preview.md +139 -0
- package/docs/hu/getting-started.md +85 -0
- package/docs/hu/host-contexts.md +169 -0
- package/docs/hu/index.md +38 -0
- package/docs/hu/recipes-and-pitfalls.md +123 -0
- package/docs/hu/server-side.md +95 -0
- package/docs/hu/upgrading.md +71 -0
- package/docs/hu/writing-plugins.md +405 -0
- package/package.json +114 -5
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Recipes and pitfalls
|
|
2
|
+
|
|
3
|
+
[← Previous](server-side.md) · [Contents](index.md) · [Next →](upgrading.md)
|
|
4
|
+
|
|
5
|
+
## One place for the block setup
|
|
6
|
+
|
|
7
|
+
Keep the plugins, palettes and messages of an application in one module, and wrap the editor in a component of your own. Pages then use the wrapper and never repeat the setup.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
// lib/blocks.ts
|
|
11
|
+
import type { BlockPlugin, Messages } from '@atom-forge/brickee';
|
|
12
|
+
import * as base from '@atom-forge/brickee/plugins';
|
|
13
|
+
import { hu } from '@atom-forge/brickee/locales/hu';
|
|
14
|
+
import SiteYouTube from './SiteYouTube.svelte';
|
|
15
|
+
import { photo } from './photo';
|
|
16
|
+
import { button } from './button';
|
|
17
|
+
|
|
18
|
+
const withPreview = (plugin: BlockPlugin, preview: BlockPlugin['preview']): BlockPlugin => ({ ...plugin, preview });
|
|
19
|
+
|
|
20
|
+
export const plugins: BlockPlugin[] = [
|
|
21
|
+
withPreview(base.youtube, SiteYouTube),
|
|
22
|
+
base.table,
|
|
23
|
+
base.map,
|
|
24
|
+
base.gap,
|
|
25
|
+
photo,
|
|
26
|
+
button
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
/** The full palette, for editors of the site's own pages. */
|
|
30
|
+
export const PAGE_PALETTE = ['md:p', 'md:h2', 'md:h3', 'md:ul', 'md:ol', 'md:quote', 'md:hr', ...plugins.map((p) => p.type)];
|
|
31
|
+
|
|
32
|
+
/** A smaller one, for user comments. */
|
|
33
|
+
export const COMMENT_PALETTE = ['md:p', 'md:ul', 'md:ol', 'md:quote', 'photo'];
|
|
34
|
+
|
|
35
|
+
export const messages: Messages = { ...hu, Button: 'Gomb', 'A link as a button': 'Egy link gombként' };
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```svelte
|
|
39
|
+
<!-- lib/BlockEditor.svelte -->
|
|
40
|
+
<script lang="ts">
|
|
41
|
+
import { Editor, provideView, type StoredBlock } from '@atom-forge/brickee';
|
|
42
|
+
import { messages, PAGE_PALETTE, plugins } from './blocks';
|
|
43
|
+
|
|
44
|
+
let {
|
|
45
|
+
value = $bindable(),
|
|
46
|
+
palette = PAGE_PALETTE,
|
|
47
|
+
view
|
|
48
|
+
}: { value: StoredBlock[]; palette?: string[]; view?: string } = $props();
|
|
49
|
+
|
|
50
|
+
provideView(() => view);
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<Editor bind:value {plugins} {palette} {messages} />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Render the published page with `<Preview blocks={doc} {plugins} {messages} />` and the same `plugins`, so a block looks the same in the editor's preview and on the site.
|
|
57
|
+
|
|
58
|
+
## Copying the whole document as markdown
|
|
59
|
+
|
|
60
|
+
Copying selected blocks already puts markdown on the clipboard. For a "Copy as markdown" button for the whole document:
|
|
61
|
+
|
|
62
|
+
```svelte
|
|
63
|
+
<script lang="ts">
|
|
64
|
+
import { fromStored, toMarkdown, type StoredBlock } from '@atom-forge/brickee';
|
|
65
|
+
import { plugins } from './blocks';
|
|
66
|
+
|
|
67
|
+
let { doc }: { doc: StoredBlock[] } = $props();
|
|
68
|
+
|
|
69
|
+
// Runs in a click handler, so the browser-only toMarkdown is safe here.
|
|
70
|
+
const copy = () => navigator.clipboard.writeText(toMarkdown(doc.map(fromStored), { plugins }));
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<button type="button" onclick={copy}>Copy as markdown</button>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Starting a document from markdown
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { fromMarkdown, toStored, type StoredBlock } from '@atom-forge/brickee';
|
|
80
|
+
|
|
81
|
+
// In the browser: toStored reads the inline HTML through the DOM.
|
|
82
|
+
export const fromText = (text: string): StoredBlock[] => fromMarkdown(text).map(toStored);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Remember that every non-empty line becomes its own block.
|
|
86
|
+
|
|
87
|
+
## Developing against a local copy
|
|
88
|
+
|
|
89
|
+
When you link a local checkout of the package into an application (`bun link`), the linked folder brings its own `node_modules`. Make Vite use the application's single copy of the shared packages, otherwise Svelte contexts — the popup manager, the theme — are not found across the two copies:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
// vite.config.ts of the application
|
|
93
|
+
export default defineConfig({
|
|
94
|
+
plugins: [sveltekit()],
|
|
95
|
+
resolve: {
|
|
96
|
+
dedupe: ['svelte', '@atom-forge/ui', '@lucide/svelte', 'zod']
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The application reads the package's built `dist/`, so rebuild the package after each change.
|
|
102
|
+
|
|
103
|
+
## Pitfalls
|
|
104
|
+
|
|
105
|
+
| Symptom | Cause | Fix |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| Block fields and popups look unstyled | The `@atom-forge/ui` theme CSS or its Tailwind `@source` is missing | Set up `@atom-forge/ui` as its documentation describes and render the app beneath its `Root`. |
|
|
108
|
+
| Block handles stick out on the left | The handles are drawn left of the editor's box | Give the element around the editor about 22 px of left padding. |
|
|
109
|
+
| Popups do not open, or "context not found" errors with a linked package | Two copies of `svelte` or `@atom-forge/ui` | Add them to Vite's `resolve.dedupe`. |
|
|
110
|
+
| A plugin block shows "Unknown block" | Its plugin is missing from `plugins` | Pass the same plugins to every editor and preview of a document type. |
|
|
111
|
+
| A block is missing from `Preview` | Its plugin has no `preview` | Give the plugin a `preview` (the bundled ones have a default), or render the block with your own renderer. |
|
|
112
|
+
| A plugin block is missing from the site | The preview got other `plugins` | Use the same plugin list for the editor and the preview. |
|
|
113
|
+
| An image block renders nothing | Its preview rejects the stored address, or the app's own lookup does not know the stored id | Store addresses the preview accepts (`http(s)` or site-relative); resolve ids from the same data in the editor and on the site. |
|
|
114
|
+
| A box cannot be put inside another box | Nested editors go one level deep | Design containers to hold content blocks, not other containers. |
|
|
115
|
+
| A block is not offered inside a container | Its `accepts` or the host `palette` leaves it out | Add the palette id to `accepts` (or use `'md:*'` for every built-in). |
|
|
116
|
+
| A unique block appears twice | The schema does not enforce `unique` | Check it on the server if your application relies on it. |
|
|
117
|
+
| Gated content visible to everyone | `gate` only marks the blocks | Cut the document on the server before rendering. |
|
|
118
|
+
| `document is not defined` | `toMarkdown` or `toStored` ran during SSR | Call them in the browser only. |
|
|
119
|
+
| A colour or link from props breaks the page | Props are user input | Use `safeColor`, check links, never use `{@html}` with props. |
|
|
120
|
+
| Overridden plugin loses its blocks | Its `type` was changed | Keep `type` when spreading a plugin. |
|
|
121
|
+
| `bind:blocks` error in a custom view | `props` or `blocks` not declared bindable | Declare both with `$bindable()`. |
|
|
122
|
+
| The value is never an empty array | The editor shows (and writes) one empty paragraph for an empty document | Treat a document with only empty paragraphs as empty, for example with `blocksToPlainText(doc).trim() === ''`. |
|
|
123
|
+
| The preview does not follow the editor's scrolling | The actions are not on the boxes that scroll | Put `use:sync.source` / `use:sync.target` on the `overflow` boxes themselves. |
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# On the server
|
|
2
|
+
|
|
3
|
+
[← Previous](host-contexts.md) · [Contents](index.md) · [Next →](recipes-and-pitfalls.md)
|
|
4
|
+
|
|
5
|
+
A stored document is JSON sent by the browser, so the server must check it before saving. Two entry points have no Svelte dependency and are meant for server code:
|
|
6
|
+
|
|
7
|
+
- `@atom-forge/brickee/model` — `StoredBlock`, `MD`, `MAX_INDENT`, `MAX_DEPTH`, `isMd`, `acceptsId`, `inlineToPlainText`, `blocksToPlainText`;
|
|
8
|
+
- `@atom-forge/brickee/schema` — `blocksSchema` and `blocksSchemaFor`, built with `zod` (an optional peer dependency: install it to use this entry point).
|
|
9
|
+
|
|
10
|
+
## Validating a document
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
// content.server.ts
|
|
14
|
+
import { blocksSchemaFor } from '@atom-forge/brickee/schema';
|
|
15
|
+
import { plugins } from '$lib/blocks';
|
|
16
|
+
|
|
17
|
+
const contentSchema = blocksSchemaFor(plugins);
|
|
18
|
+
|
|
19
|
+
export function parseContent(input: unknown) {
|
|
20
|
+
const result = contentSchema.safeParse(input);
|
|
21
|
+
if (!result.success) throw new Error('Invalid content');
|
|
22
|
+
return result.data; // StoredBlock[]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`blocksSchema` checks the shape of any document; `blocksSchemaFor(plugins)` adds the containers' `accepts` lists. It needs only `type` and `accepts` of each plugin, so a server that does not want to import the plugin components can pass those alone:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
const contentSchema = blocksSchemaFor([
|
|
30
|
+
{ type: 'note', accepts: ['md:*', 'youtube'] },
|
|
31
|
+
{ type: 'youtube' }
|
|
32
|
+
]);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
What the schema checks:
|
|
36
|
+
|
|
37
|
+
| Rule | Limit |
|
|
38
|
+
|---|---|
|
|
39
|
+
| Block keys | `type`, `indent`, `text`, `props`, `blocks` only (strict objects). |
|
|
40
|
+
| `type` | `^[a-z][a-z0-9:-]{0,39}$` |
|
|
41
|
+
| `indent` | An integer, 0–6. |
|
|
42
|
+
| `text` | At most 100 000 characters. |
|
|
43
|
+
| `props` | Keys up to 60 characters, JSON values. |
|
|
44
|
+
| `blocks` | At most 500 nested blocks per container, one level deep only. |
|
|
45
|
+
| Document | At most 2000 top-level blocks and 1 000 000 characters as JSON. |
|
|
46
|
+
| `accepts` (`blocksSchemaFor`) | Every nested block is one its container takes. |
|
|
47
|
+
|
|
48
|
+
What it does **not** check: whether a type is known, whether a unique block appears once, and what the props contain. Add your own refinements for the rules your application relies on — for example, to reject unknown block types:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import type { StoredBlock } from '@atom-forge/brickee/model';
|
|
52
|
+
import { blocksSchemaFor } from '@atom-forge/brickee/schema';
|
|
53
|
+
import { plugins } from '$lib/blocks';
|
|
54
|
+
|
|
55
|
+
const BUILT_IN = ['md:p', 'md:h1', 'md:h2', 'md:h3', 'md:h4', 'md:h5', 'md:h6', 'md:ul', 'md:ol', 'md:todo', 'md:quote', 'md:code', 'md:hr'];
|
|
56
|
+
const known = new Set([...BUILT_IN, ...plugins.map((p) => p.type)]);
|
|
57
|
+
const allKnown = (list: StoredBlock[]): boolean => list.every((b) => known.has(b.type) && allKnown(b.blocks ?? []));
|
|
58
|
+
|
|
59
|
+
export const contentSchema = blocksSchemaFor(plugins).refine(allKnown, 'Unknown block type.');
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> **Shape, not safety**
|
|
63
|
+
>
|
|
64
|
+
> The schema keeps documents well-formed and bounded; it does not make props safe to render. The renderers escape every text and keep links to safe schemes, and each plugin preview must sanitize its own props (see [Writing plugins](writing-plugins.md)).
|
|
65
|
+
|
|
66
|
+
## Plain text
|
|
67
|
+
|
|
68
|
+
`blocksToPlainText(blocks)` collects every text of a document in order, separated by blank lines: block texts with their marks and link targets removed, string props that contain whitespace (titles, captions — not ids or colours), table rows, and nested blocks. Use it for search indexes, leads and meta descriptions. `inlineToPlainText(md)` does the same for a single inline markdown string.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { blocksToPlainText, type StoredBlock } from '@atom-forge/brickee/model';
|
|
72
|
+
|
|
73
|
+
export const description = (doc: StoredBlock[]) => blocksToPlainText(doc).slice(0, 160);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Rendering
|
|
77
|
+
|
|
78
|
+
`Preview` is an ordinary Svelte component and can be server-rendered; the core renderer and the bundled previews use no browser APIs. Only the markdown export path (`toMarkdown`, `toStored`) needs the browser.
|
|
79
|
+
|
|
80
|
+
## Gated content
|
|
81
|
+
|
|
82
|
+
A gate block (a plugin with `gate: true`, such as a supporters-only divider) only makes the preview mark the blocks after it. To keep the gated part from readers who may not see it, cut the document on the server before it reaches the page:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import type { StoredBlock } from '@atom-forge/brickee/model';
|
|
86
|
+
|
|
87
|
+
/** The document up to and including the first gate block, for readers without access. */
|
|
88
|
+
export function publicPart(doc: StoredBlock[], gateTypes: string[], canRead: boolean): StoredBlock[] {
|
|
89
|
+
if (canRead) return doc;
|
|
90
|
+
const at = doc.findIndex((b) => gateTypes.includes(b.type));
|
|
91
|
+
return at < 0 ? doc : doc.slice(0, at + 1);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Call it with your gate plugin types (for example `['paywall']`) and the reader's access. Readers without access see the content up to the gate block and its teaser; readers with access get the whole document, and the preview marks the gated part for them.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Upgrading
|
|
2
|
+
|
|
3
|
+
[← Previous](recipes-and-pitfalls.md) · [Contents](index.md)
|
|
4
|
+
|
|
5
|
+
This chapter lists the changes that may require action when you move to a newer version of `@atom-forge/brickee`. Each section covers one version step, newest first, and each change ends with a **What to do:** paragraph.
|
|
6
|
+
|
|
7
|
+
Changes that need no action from you — new exports, fixes, documentation updates — are listed only in the changelog (`CHANGELOG.md`, shipped with the package).
|
|
8
|
+
|
|
9
|
+
## From 0.0.1 to 0.0.2
|
|
10
|
+
|
|
11
|
+
### Images and media are no longer part of the package
|
|
12
|
+
|
|
13
|
+
The package has no notion of images any more. Whether a block stores an image's URL or an id, how the user picks the image, and how the stored value becomes an address are decided by the application's own image plugin (see [Images](writing-plugins.md#images)).
|
|
14
|
+
|
|
15
|
+
| Removed | Was |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `kind: 'image'`, `kind: 'images'` | Field kinds that stored the id (or ids) of a picked media item, with the built-in image picker popup |
|
|
18
|
+
| `media` prop of `Editor` and `Preview` | The images blocks could pick from and refer to |
|
|
19
|
+
| `provideMedia`, `useMedia`, `findMedia`, `MediaItem` | The media context, its lookup and its type |
|
|
20
|
+
| `media` option of `toMarkdown` | `toMarkdown(blocks, { plugins, media })` is now `toMarkdown(blocks, { plugins })` |
|
|
21
|
+
| `ctx.media` in a plugin's `markdown(props, ctx)` | `MarkdownContext` is now `{ inner }` |
|
|
22
|
+
|
|
23
|
+
`PropField['kind']` is now `'text' | 'textarea' | 'color' | 'select' | 'slider'`. Stored documents are unaffected: a block's props keep whatever they stored, ids included.
|
|
24
|
+
|
|
25
|
+
**What to do:** in your image plugins, replace each `image` or `images` field with your own picking — a button in the plugin's view that opens your media dialog or an upload and writes the result into `props`, or a plain `text` field for a URL — and keep the prop keys, so stored documents still load. Remove the `media` prop from your editors and previews, and the `media` option from your `toMarkdown` calls. Where a view, a preview or a `markdown` form turned an id into an address with `useMedia`, `findMedia` or `ctx.media`, look it up in your application's own data instead: a module of your app, or a Svelte context of your own provided above the editor and the preview (`markdown` runs outside components, so it needs module data). Define a `MediaItem`-like type in your app if you still need one.
|
|
26
|
+
|
|
27
|
+
## From the `block-editor` workspace package to 0.0.1
|
|
28
|
+
|
|
29
|
+
This section is only for applications that used the editor before it became this package.
|
|
30
|
+
|
|
31
|
+
The editor started as `block-editor`, a workspace package inside an application. It moved here as `@atom-forge/brickee` with the same stored form, so saved documents need no conversion. The import specifiers changed, the plugin kit moved from the plugins entry point into the core, and the site-specific plugins stayed with the application.
|
|
32
|
+
|
|
33
|
+
### Package name and entry points
|
|
34
|
+
|
|
35
|
+
| Before | After |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `block-editor` | `@atom-forge/brickee` |
|
|
38
|
+
| `block-editor/plugins` | `@atom-forge/brickee/plugins` |
|
|
39
|
+
| `block-editor/locales/hu` | `@atom-forge/brickee/locales/hu` |
|
|
40
|
+
|
|
41
|
+
**What to do:** replace the dependency (`"block-editor": "workspace:*"` → `"@atom-forge/brickee"`) and rename the imports. Install `@atom-forge/ui` and `@lucide/svelte` as dependencies of the application if they are not already, and `zod` if you use the schema.
|
|
42
|
+
|
|
43
|
+
### The kit lives in the core
|
|
44
|
+
|
|
45
|
+
`Frame`, `Empty` and the plugin helpers are exported from the core entry point. `safeColor`, `viewValues`, `baseValue` and `lines` are no longer exported from the plugins entry point.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// Before
|
|
49
|
+
import { safeColor, viewValues } from 'block-editor/plugins';
|
|
50
|
+
|
|
51
|
+
// After
|
|
52
|
+
import { safeColor, viewValues } from '@atom-forge/brickee';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**What to do:** import `Frame`, `Empty`, `safeColor`, `viewValues`, `baseValue`, `lines`, `mdText`, `mdJoin` and `mdQuote` from `@atom-forge/brickee`. The helpers of the bundled plugins that remain (`youtubeId`, `mapSrc`, `gapLines`, `tableHeads`…) stay in `@atom-forge/brickee/plugins`.
|
|
56
|
+
|
|
57
|
+
### Site-specific plugins are no longer in the package
|
|
58
|
+
|
|
59
|
+
The package now bundles only four general-purpose plugins: `table`, `youtube`, `map` and `gap` (`PLUGINS` holds these four). The other plugins of `block-editor/plugins` and their helpers were application-specific and are not part of `@atom-forge/brickee`:
|
|
60
|
+
|
|
61
|
+
| Removed | Kind |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `richBox`, `feature`, `sideBox`, `callout`, `spoiler`, `faq`, `imageText` | container plugins |
|
|
64
|
+
| `image`, `gallery`, `tweet`, `form`, `banner`, `locked` | plugins |
|
|
65
|
+
| `CALLOUTS`, `calloutTone`, `CalloutTone`, `questions`, `formEmbed`, `formHeight` | their helpers |
|
|
66
|
+
| `postId`, `userName`, `RATIO_MIN`, `RATIO_MAX`, `ratioPercent`, `ratio` | helpers of the former `plugins/util` |
|
|
67
|
+
| `ImageProps`, `GalleryProps`, `CalloutProps` and the other props types of these plugins | types |
|
|
68
|
+
|
|
69
|
+
The stored form is unchanged: documents that contain these block types stay valid, as long as the application still passes plugins with the same `type` values to the editor and the preview.
|
|
70
|
+
|
|
71
|
+
**What to do:** if the application uses any of these plugins, keep its own copy of them (their views, previews and helpers) in the application, written against the core kit, and add them to its plugin list with the same `type`. Import the four remaining plugins and their helpers from `@atom-forge/brickee/plugins` as before. Add the UI text of the copied plugins to your `messages`: `@atom-forge/brickee/locales/hu` no longer contains it.
|