Placeholder
In this example, we will demonstrate how to use the CreativeEditor SDK's CreativeEngine to manage placeholder behavior and controls through the block API.
Setup#
This example uses the headless CreativeEngine. See the Setup article for a detailed guide.
To get started right away, you can also access the block
API within a running CE.SDK instance via cesdk.engine.block
.
Check out the APIs Overview to see that illustrated in more detail.
Placeholder Behavior and Controls#
supportsPlaceholderBehavior(id: DesignBlockId): boolean
Checks whether the block supports placeholder behavior.
block
: The block to query.- Returns True, if the block supports placeholder behavior.
setPlaceholderBehaviorEnabled(id: DesignBlockId, enabled: boolean): void
Enable or disable the placeholder behavior for a block.
id
: The block whose placeholder behavior should be enabled or disabled.enabled
: Whether the placeholder behavior should be enabled or disabled.
isPlaceholderBehaviorEnabled(id: DesignBlockId): boolean
Query whether the placeholder behavior for a block is enabled.
id
: The block whose placeholder behavior state should be queried.- Returns the enabled state of the placeholder behavior.
setPlaceholderEnabled(id: DesignBlockId, enabled: boolean): void
Enable or disable the placeholder function for a block.
id
: The block whose placeholder function should be enabled or disabled.enabled
: Whether the function should be enabled or disabled.
isPlaceholderEnabled(id: DesignBlockId): boolean
Query whether the placeholder function for a block is enabled.
id
: The block whose placeholder function state should be queried.- Returns the enabled state of the placeholder function.
supportsPlaceholderControls(id: DesignBlockId): boolean
Checks whether the block supports placeholder controls.
block
: The block to query.- Returns True, if the block supports placeholder controls.
setPlaceholderControlsOverlayEnabled(id: DesignBlockId, enabled: boolean): void
Enable or disable the visibility of the placeholder overlay pattern for a block.
block
: The block whose placeholder overlay should be enabled or disabled.enabled
: Whether the placeholder overlay should be shown or not.- Returns An empty result on success, an error otherwise.
isPlaceholderControlsOverlayEnabled(id: DesignBlockId): boolean
Query whether the placeholder overlay pattern for a block is shown.
block
: The block whose placeholder overlay visibility state should be queried.- Returns An error if the block was invalid, otherwise the visibility state of the block's placeholder overlay pattern.