@jackuait/blok 0.23.3 → 0.23.5

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.
Files changed (34) hide show
  1. package/README.md +3 -3
  2. package/dist/blok.cjs +1 -1
  3. package/dist/blok.iife.js +14 -14
  4. package/dist/blok.mjs +2 -2
  5. package/dist/blok.umd.js +6 -6
  6. package/dist/chunks/{blok-J3Lfa_bK.cjs → blok-DixLFA0K.cjs} +5 -5
  7. package/dist/chunks/{blok-1H9roBGf.mjs → blok-TvOrZOjF.mjs} +2195 -2170
  8. package/dist/chunks/{constants-BZUc1kAY.cjs → constants-Bze_TXgc.cjs} +1 -1
  9. package/dist/chunks/{constants-BJ79cqMa.mjs → constants-DpIX_GOn.mjs} +2 -1
  10. package/dist/chunks/{tools-OHDv2C7w.cjs → tools-CRAPWuhj.cjs} +1 -1
  11. package/dist/chunks/{tools-ByOjWADT.mjs → tools-DBb88o-I.mjs} +1 -1
  12. package/dist/full.cjs +1 -1
  13. package/dist/full.mjs +3 -3
  14. package/dist/react.cjs +1 -1
  15. package/dist/react.mjs +42 -31
  16. package/dist/tools.cjs +1 -1
  17. package/dist/tools.mjs +2 -2
  18. package/package.json +1 -1
  19. package/src/components/block/index.ts +3 -2
  20. package/src/components/block/tunes-manager.ts +7 -2
  21. package/src/components/constants/data-attributes.ts +4 -0
  22. package/src/components/modules/modificationsObserver.ts +40 -2
  23. package/src/components/modules/paste/handlers/html-handler.ts +14 -1
  24. package/src/components/modules/paste/index.ts +1 -1
  25. package/src/components/modules/renderer.ts +32 -4
  26. package/src/components/modules/toolbar/blockSettings.ts +15 -2
  27. package/src/components/utils/apply-link-config.ts +40 -0
  28. package/src/react/BlokEditor.tsx +10 -2
  29. package/src/react/config-keys.ts +3 -0
  30. package/src/react/types.ts +4 -0
  31. package/src/react/useBlok.ts +45 -6
  32. package/types/block-tunes/block-tune.d.ts +21 -1
  33. package/types/configs/blok-config.d.ts +62 -5
  34. package/types/index.d.ts +1 -1
package/README.md CHANGED
@@ -62,11 +62,11 @@ new Blok({
62
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
63
 
64
64
  ```tsx
65
- const ref = useRef<Blok | null>(null);
66
- <BlokEditor ref={ref} tools={tools} data={initialData} theme={theme} onReady={(editor) => {/* editor ready */}} />;
65
+ const [data, setData] = useState(initialData);
66
+ <BlokEditor tools={tools} data={data} onSave={setData} theme={theme} />;
67
67
  ```
68
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.
69
+ `data` + `onSave` make `<BlokEditor>` a true **controlled component**. `data` is reactive: passing new content re-renders the editor in place (deep-equal–deduped, so identical content never clobbers the caret). `onSave` is the output half: it fires debounced — with the full serialized `OutputData` on every content change, so you no longer poll `ref.current.save()` by hand. Wiring `onSave={setData}` is safe and caret-stable: the adapter records the editor's own emitted output as the content baseline, so echoing it back deep-equal–dedupes to a no-op (no re-render) while genuine external `data` changes still render. (You can still forward a ref and call `ref.current.render(newData)` for ad-hoc reloads, or use the lower-level `onChange(api, event)` for mutation events.)
70
70
 
71
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
72
 
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-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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./chunks/blok-DixLFA0K.cjs`),t=require(`./chunks/constants-Bze_TXgc.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;