WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 15e0dfb

Browse files
djayclaude
andcommitted
Integrate hierarchical sidebar widgets and update docs
- Add ParentBlocksWidget and ChildBlocksWidget to View.jsx - Update README to use "empty block" terminology (matching Volto convention) - Add reference to Slate transforms architecture docs in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent aeb156f commit 15e0dfb

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Architecture Documentation
2+
3+
Read `docs/slate-transforms-architecture.md` for understanding how Slate transforms work between hydra.js and View.jsx (Enter key, formatting, paste, delete handling).
4+
15
# Running Playwright Tests
26

37
## Prerequisites

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,16 @@ For our slider example
515515
- but you can override this by setting a ```onHandleBlockSelection``` callback.
516516
517517
518-
Placeholders are special blocks rendered when a container is empty or if a new sub-block is added.
519-
- The default placeholder has the @type of 'Placeholder'
520-
- Render the Placeholder as taking up the space a typical sub-block might take up.
518+
Empty blocks are special blocks rendered when a container is empty or if a new sub-block is added.
519+
- The default empty block has the @type of 'empty' (matching Volto's convention)
520+
- Render the empty block as taking up the space a typical sub-block might take up.
521521
- this is important so containers are always able to be selected even when empty.
522-
- Hydra will automatically place an add button in the center of a Placeholder block.
523-
- After the user clicks "add" and selects a block, the Placeholder is replaced by new block.
524-
- if you'd like to customise the look of the placeholder you can use ```data-block-add="hidden"``` to prevent hide the default button
522+
- Hydra will automatically place an add button on the empty block.
523+
- After the user clicks "add" and selects a block, the empty block is replaced by the new block.
524+
- if you'd like to customise the look of the empty block you can use ```data-block-add="hidden"``` to hide the default button
525525
and instead add ```data-block-add="button"``` to another element you want to act as the add button.
526-
- or you can nominate another type be your placeholder, such as a SlateBlock (which has the builtin capability to replace itself)
527-
- if only one block type is allowed in a container then this is created instead of a Placeholder block.
526+
- or you can nominate another type be your empty block, such as a SlateBlock (which has the builtin capability to replace itself)
527+
- if only one block type is allowed in a container then this is created instead of an empty block.
528528
529529
530530
### Level 5: Enable Visual frontend editing of Text, Media and links ([TODO](https://github.com/collective/volto-hydra/issues/5))

packages/volto-hydra/src/components/Iframe/View.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ import OpenObjectBrowser from './OpenObjectBrowser';
5151
import SyncedSlateToolbar from '../Toolbar/SyncedSlateToolbar';
5252
import DropdownMenu from '../Toolbar/DropdownMenu';
5353
import { buildBlockPathMap, getBlockByPath, getContainerFieldConfig, insertBlockInContainer, deleteBlockFromContainer, mutateBlockInContainer, ensureEmptyBlockIfEmpty } from '../../utils/blockPath';
54+
import ChildBlocksWidget from '../Sidebar/ChildBlocksWidget';
55+
import ParentBlocksWidget from '../Sidebar/ParentBlocksWidget';
5456

5557
/**
5658
* NoPreview component for frontend-defined blocks.
@@ -1401,6 +1403,25 @@ const Iframe = (props) => {
14011403
onClose={() => setMenuDropdownOpen(false)}
14021404
/>
14031405
)}
1406+
1407+
{/* Hierarchical sidebar widgets */}
1408+
<ParentBlocksWidget
1409+
selectedBlock={selectedBlock}
1410+
formData={properties}
1411+
blockPathMap={iframeSyncState.blockPathMap}
1412+
onSelectBlock={onSelectBlock}
1413+
/>
1414+
<ChildBlocksWidget
1415+
selectedBlock={selectedBlock}
1416+
formData={properties}
1417+
blockPathMap={iframeSyncState.blockPathMap}
1418+
onSelectBlock={onSelectBlock}
1419+
onAddBlock={(parentBlockId, fieldName) => {
1420+
// TODO: Implement add block to container field
1421+
console.log('[VIEW] Add block requested:', { parentBlockId, fieldName });
1422+
setAddNewBlockOpened(true);
1423+
}}
1424+
/>
14041425
</div>
14051426
);
14061427
};

0 commit comments

Comments
 (0)