noteloom 0.1.1 → 0.1.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/README.md CHANGED
@@ -112,6 +112,38 @@ No wrapper `<div>` is added unless you pass one of these props, so existing usag
112
112
 
113
113
  `examples/basic/src/style.css` shows the extra page-level chrome (fonts, page width, the demo's own toolbar buttons) a host app typically adds around the editor — none of that is part of the default theme itself.
114
114
 
115
+ **Customize individual blocks**, not just the root, via `getBlockClassName`:
116
+
117
+ ```jsx
118
+ <EditorProvider
119
+ store={store}
120
+ registry={registry}
121
+ getBlockClassName={(block) => (block.type === 'callout' ? 'my-callout' : undefined)}
122
+ >
123
+ ```
124
+
125
+ Whatever string you return is appended onto that block's own root element's class list (`be-paragraph my-callout`, alongside the fixed base class) — `block` is the real block object (`type`, `id`, `props`), so you can target a type, a specific id, or a prop value (e.g. every red callout) as precisely as you like.
126
+
127
+ ## Exporting the document (JSON / HTML / plain text)
128
+
129
+ ```js
130
+ import { exportDocumentJSON, exportDocumentHTML, exportDocumentText } from 'noteloom';
131
+
132
+ exportDocumentJSON(store); // { rootId, blocks, runs } — feed straight back into `new EditorStore(...)`
133
+ exportDocumentHTML(store, registry, inlineRegistry);
134
+ exportDocumentText(store, registry, inlineRegistry);
135
+ ```
136
+
137
+ Or mount the ready-made button + modal instead of wiring your own UI:
138
+
139
+ ```jsx
140
+ import { DocumentExportButton } from 'noteloom';
141
+
142
+ <DocumentExportButton label="View source" />
143
+ ```
144
+
145
+ It opens a modal with JSON/HTML/Text tabs (reading live from the store every time it opens) and a Copy button — useful for debugging, or as a starting point for a real "export" feature.
146
+
115
147
  ## Built-in block types
116
148
 
117
149
  `paragraph`, `heading` (h1–h3), `listItem` (bulleted, numbered, and to-do — with Notion-style Tab/Shift+Tab nesting and Enter conventions), `table` (with row/column insert/delete), `layout` (multi-column), `divider`.