Input fields in Chunk Input

I am using the Chunk input type and my chunk contains an input field, however, while editing the Resource the input field refreshes every time I enter something. Is the refresh necessary? Is there a way to turn it off?

On the chunk fields’ properties, you can set a custom preview content. That disables the dynamic preview refreshing when you make a change.

The refresh is debounced every 300ms (meaning it’ll only refresh every 300ms), but I suppose if you’re a fast typer that’s still going to get annoying… will log an issue to increase that (or make it configurable).

Maybe I’m going about it completely wrong, but I’m trying to include <input type="color" value=""> into a Repeater using the Chunk type containing that input to allow the user to pick a background color when making each section. It’s that input that refreshes every 300ms making it difficult to successfully choose a color… but after thinking it through I’m not even sure my method would work, even without the refresh.

Has anyone built a color picker input type?

Just to make sure I understand your reasoning - you’re trying to use the chunk preview for editing?

As the name indicates, the preview is for seeing the result of the output, i.e. your chunk and associated properties. Not to provide input.

For input, you’d need to build a custom input type that hooks into ContentBlocks the right way. After that you can use it as a standalone field or as part of a repeater to compose a single block. See: https://docs.modmore.com/en/ContentBlocks/v1.x/Custom_Inputs/Developing_Custom_Inputs.html

Interestingly nobody has built a color input yet, at least not that I’m aware off. Most people likely use a dropdown to allow users to select a class that corresponds with their CSS, rather than directly inputting colors. Would be a useful addition though for sure, and not very complex to build if you’re happy with the default input[type=color] behavior across browsers, which is pretty good.

Yes. I was totally going about it the wrong way with the chunk preview thing.

I’ll look into the custom inputs. The dropdown method won’t work in my specific use, the client will need to be able to select ANY color.

Thanks