@jackuait/blok 0.23.1 → 0.23.3
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 +3 -1
- package/dist/blok.cjs +1 -1
- package/dist/blok.iife.js +73 -73
- package/dist/blok.mjs +3 -3
- package/dist/blok.umd.js +53 -53
- package/dist/chunks/{blok-BPeM6wKv.mjs → blok-1H9roBGf.mjs} +2271 -2249
- package/dist/chunks/{blok-Ci1zCOUg.cjs → blok-J3Lfa_bK.cjs} +13 -13
- package/dist/chunks/{constants-DR3sya6U.mjs → constants-BJ79cqMa.mjs} +288 -284
- package/dist/chunks/constants-BZUc1kAY.cjs +606 -0
- package/dist/chunks/{tools-B72rczVw.mjs → tools-ByOjWADT.mjs} +420 -418
- package/dist/chunks/{tools-DlOZpcVU.cjs → tools-OHDv2C7w.cjs} +2 -2
- package/dist/full.cjs +1 -1
- package/dist/full.mjs +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +54 -33
- package/dist/tools.cjs +1 -1
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/blok.ts +12 -0
- package/src/components/block/tool-renderer.ts +2 -2
- package/src/components/blocks.ts +32 -10
- package/src/components/constants/test-ids.ts +17 -0
- package/src/components/constants.ts +5 -0
- package/src/components/events/BlockRendered.ts +9 -0
- package/src/components/events/BlocksRendered.ts +13 -0
- package/src/components/events/index.ts +8 -0
- package/src/components/inline-tools/inline-tool-link.ts +23 -9
- package/src/components/modules/api/events.ts +10 -10
- package/src/components/modules/api/index.ts +3 -0
- package/src/components/modules/api/tools.ts +3 -0
- package/src/components/modules/blockManager/blockManager.ts +1 -1
- package/src/components/modules/paste/index.ts +10 -1
- package/src/components/modules/renderer.ts +146 -131
- package/src/components/modules/toolbar/plus-button.ts +2 -1
- package/src/components/modules/toolbar/settings-toggler.ts +2 -2
- package/src/components/modules/tools.ts +18 -0
- package/src/components/tools/factory.ts +28 -1
- package/src/react/BlokEditor.tsx +17 -5
- package/src/react/config-keys.ts +2 -0
- package/src/react/deep-equal.ts +48 -0
- package/src/react/types.ts +2 -0
- package/src/react/useBlok.ts +37 -0
- package/types/api/events.d.ts +35 -5
- package/types/api/tools.d.ts +16 -1
- package/types/configs/blok-config.d.ts +37 -0
- package/types/events/editor-events.ts +41 -0
- package/types/index.d.ts +5 -1
- package/types/react.d.ts +13 -2
- package/dist/chunks/constants-Bkncy0y5.cjs +0 -606
package/README.md
CHANGED
|
@@ -68,7 +68,9 @@ new Blok({
|
|
|
68
68
|
|
|
69
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
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.
|
|
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. Keep each value inside `deps` referentially stable: pass primitives or `useMemo`-stable objects, since a dep value whose identity changes every render recreates the editor each time. (The individual values are compared, not the array wrapper, so a fresh `[a, b]` literal each render is fine when `a` and `b` are stable; omitting `deps` creates the editor once.)
|
|
72
|
+
|
|
73
|
+
Don't wrap `<BlokEditor>` in `styled()` or any HOC that reserves the `theme` prop — styled-components claims `theme` for its own `ThemeProvider`, so it never reaches the editor and theme sync silently breaks. Render `<BlokEditor>` directly and style it through `className`.
|
|
72
74
|
|
|
73
75
|
For advanced control (e.g., rendering outside a single container), use `useBlok` + `BlokContent` directly.
|
|
74
76
|
- `@jackuait/blok/markdown` — `markdownToBlocks(md)` to import Markdown (GFM, with optional math) as Blok data.
|
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-J3Lfa_bK.cjs`),t=require(`./chunks/constants-BZUc1kAY.cjs`);exports.BlockRendered=e.o,exports.BlocksRendered=e.a,exports.Blok=e.t,exports.EditorJS=e.t,exports.default=e.t,exports.DATA_ATTR=t.Ma,exports.TEST_ID=t.Fi,exports.version=e.n,exports.wrapLegacyInlineTool=e.r;
|