craft-neo icon indicating copy to clipboard operation
craft-neo copied to clipboard

[FR] Outline view

Open leevigraham opened this issue 2 years ago • 3 comments

Description

Still fleshing this idea out but some kind of outline view could be very cool.

Webflow has a content navigator:

Screen Shot 2022-05-04 at 8 50 45 am

Combine this with a double click -> slide out editor for each block this could be a powerful editing experience.

leevigraham avatar May 03 '22 22:05 leevigraham

@ttempleton I was going to have a crack as this as a plugin first.

I see there are some events on the field for addBlock and removeBlock but nothing like blocksChanged or some kind of event that covers other updates like dragging.

I was thinking if there was some kind of catch all change event then I could parse the tree and create the outline.

Then I started thinking about the idea of keeping an internal tree structure inside the input.js. Is there anything like that… I can see there's a blocks property.

leevigraham avatar May 13 '22 06:05 leevigraham

The _blocks property is just an array of all the blocks in the field. I've made some changes today, for the next release, that would allow you to call an input's getBlocks(1) to get all top level blocks, then call the blocks' getChildren(), etc. to traverse the block structure, if that helps. Otherwise, happy to add anything you need.

ttempleton avatar May 16 '22 12:05 ttempleton

Also just added an updateBlockOrder event, and will have a look at a general 'any change to the field' event later today.

ttempleton avatar May 17 '22 01:05 ttempleton