@jackuait/blok 0.22.0 → 0.23.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/README.md +12 -1
- package/dist/blok.cjs +1 -1
- package/dist/blok.iife.js +5 -5
- package/dist/blok.mjs +2 -2
- package/dist/blok.umd.js +5 -5
- package/dist/chunks/{blok-S6c68iVJ.mjs → blok-BPeM6wKv.mjs} +33 -1
- package/dist/chunks/{blok-Blnd71Ww.cjs → blok-Ci1zCOUg.cjs} +4 -4
- package/dist/chunks/{constants-BIqDMhRj.cjs → constants-Bkncy0y5.cjs} +1 -1
- package/dist/chunks/{constants-BvxJIgSQ.mjs → constants-DR3sya6U.mjs} +1 -1
- package/dist/chunks/{tools-B89FUeNz.mjs → tools-B72rczVw.mjs} +4 -1
- package/dist/chunks/{tools-DTjC0C5o.cjs → tools-DlOZpcVU.cjs} +1 -1
- package/dist/full.cjs +1 -1
- package/dist/full.mjs +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +69 -42
- package/dist/tools.cjs +1 -1
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/blok.ts +43 -0
- package/src/components/block/index.ts +13 -0
- package/src/components/modules/blockManager/blockManager.ts +19 -0
- package/src/components/tools/base.ts +9 -0
- package/src/react/BlokEditor.tsx +88 -0
- package/src/react/config-keys.ts +51 -0
- package/src/react/index.ts +2 -0
- package/src/react/types.ts +14 -3
- package/src/react/useBlok.ts +27 -0
- package/src/tools/paragraph/index.ts +20 -0
- package/types/api/index.d.ts +1 -0
- package/types/api/placeholder.d.ts +18 -0
- package/types/index.d.ts +5 -0
- package/types/react.d.ts +40 -3
package/README.md
CHANGED
|
@@ -59,7 +59,18 @@ new Blok({
|
|
|
59
59
|
|
|
60
60
|
### Other entry points
|
|
61
61
|
|
|
62
|
-
- `@jackuait/blok/react` —
|
|
62
|
+
- `@jackuait/blok/react` — React 18/19 adapter. The recommended entry point is `<BlokEditor>`, an all-in-one component that forwards a ref to the live `Blok` instance:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
const ref = useRef<Blok | null>(null);
|
|
66
|
+
<BlokEditor ref={ref} tools={tools} data={initialData} theme={theme} onReady={(editor) => {/* editor ready */}} />;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`data` is the **initial content only** — the editor owns the document after mount. Read content via `onChange` or `ref.current.save()`; replace it via `ref.current.render(newData)`; passing a new `data` reference does not reload content.
|
|
70
|
+
|
|
71
|
+
Reactive props (`readOnly`, `theme`, `width`, `autofocus`) sync without remounting. When structural config like `tools` needs to change, pass a `deps` array — the editor is destroyed and recreated whenever any dep value changes.
|
|
72
|
+
|
|
73
|
+
For advanced control (e.g., rendering outside a single container), use `useBlok` + `BlokContent` directly.
|
|
63
74
|
- `@jackuait/blok/markdown` — `markdownToBlocks(md)` to import Markdown (GFM, with optional math) as Blok data.
|
|
64
75
|
- `@jackuait/blok/locales` — locale data, if you'd rather load it yourself.
|
|
65
76
|
|
package/dist/blok.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./chunks/blok-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./chunks/blok-Ci1zCOUg.cjs`),t=require(`./chunks/constants-Bkncy0y5.cjs`);exports.Blok=e.t,exports.EditorJS=e.t,exports.default=e.t,exports.DATA_ATTR=t.ja,exports.version=e.n,exports.wrapLegacyInlineTool=e.r;
|