Enable Feature#
The following API allows to enable a custom or built-in feature (see the list of built-in features below):
enable(featureId: FeatureId | FeatureId[])This method enables one or more features using their default predicates. If you need custom predicate logic, use the set() method instead (see below).
Tip: FeatureId can be an arbitrary string, so you can use this mechanism to toggle your own custom features, as well.
Example: Enable Single Feature#
// Enable a feature with its default predicatecesdk.feature.enable('ly.img.delete');Example: Enable Multiple Features#
// Enable multiple features at oncecesdk.feature.enable(['ly.img.delete', 'ly.img.duplicate']);Example: Enable with Glob Pattern#
// Enable all video featurescesdk.feature.enable('ly.img.video.*');
// Enable all crop featurescesdk.feature.enable('ly.img.crop.*');Disable Feature#
The disable() method provides a convenient way to explicitly disable one or more features:
disable(featureId: FeatureId | FeatureId[])This method disables features by setting their enable/disable state to false. Note that disable() works best with enable() for simple on/off control. If you’ve used set() with boolean predicates, those will be evaluated first and may override the disable state.
Example: Disable Single Feature#
cesdk.feature.disable('ly.img.delete');Example: Disable Multiple Features#
cesdk.feature.disable(['ly.img.delete', 'ly.img.duplicate']);Example: Disable with Glob Pattern#
// Disable all video featurescesdk.feature.disable('ly.img.video.*');
// Disable all crop featurescesdk.feature.disable('ly.img.crop.*');Set Feature#
The set() method is the unified approach for configuring feature state with custom predicates:
set(featureId: FeatureId, enabled: boolean | FeaturePredicate)The enabled parameter can be:
- A boolean (
trueorfalse) to enable or disable the feature - A function (predicate) that takes a context and returns a boolean
The predicate function receives an EnableFeatureContext with:
engine: CreativeEngine- The engine instanceisPreviousEnable: () => boolean- Returns the result of any previously registered predicatesdefaultPredicate: () => boolean- Returns the result of the default predicate
Understanding Predicate Chaining and Evaluation Order#
Multiple predicates can be registered for the same feature, forming a predicate chain. Understanding the evaluation order is crucial:
Evaluation Order:
- Most recent
set()predicate runs FIRST - Older
set()predicates in reverse chronological order (most recent first) enable()/disable()state runs LAST
This means:
set()predicates can overrideenable()anddisable()- They’re evaluated first- Boolean predicates are always terminal - They immediately return their value without continuing the chain
- Function predicates control the chain - The function implementation decides whether to call
isPreviousEnable()(continue chain) or return directly (end chain)
Key Principles:
- Use
enable()anddisable()for simple on/off control - Use
set()when you need custom logic or want to override enable/disable - Each
set()call adds a new predicate to the front of the chain - Boolean predicates (true/false) are always terminal - they cannot continue the chain
- Function predicates decide whether to continue the chain by calling
isPreviousEnable(), or end it by returning directly
Example: Enable Feature#
cesdk.feature.set('ly.img.delete', true);Example: Disable Feature#
cesdk.feature.set('ly.img.delete', false);Important: Using set() with a boolean creates a terminal predicate. If you later call enable() or disable(), they won’t have an effect because set() predicates are evaluated first:
// This creates a terminal predicatecesdk.feature.set('ly.img.delete', true);
// This won't disable the feature because set(true) is terminalcesdk.feature.disable('ly.img.delete');// Feature is still enabled!
// For simple on/off, use enable() and disable() instead:cesdk.feature.enable('ly.img.delete'); // Enabledcesdk.feature.disable('ly.img.delete'); // Now disabledExample: Custom Predicate#
cesdk.feature.set('ly.img.delete', ({ engine }) => { const selectedBlocks = engine.block.findAllSelected(); return selectedBlocks.length > 0;});Example: Extending Default Predicate#
You can extend the default predicate provided for built-in features:
cesdk.feature.set('ly.img.delete', ({ defaultPredicate }) => { // Only allow delete after 10 pm return defaultPredicate() && new Date().getHours() >= 22;});Example: Chaining Predicates#
Predicates can access the result of previously registered predicates:
// First, enable with defaultcesdk.feature.enable('my.feature');
// Then, add additional logic that chains with previous predicatescesdk.feature.set('my.feature', ({ isPreviousEnable }) => { // Disable the feature after 10 pm, otherwise use previous result return new Date().getHours() >= 22 ? false : isPreviousEnable();});Example: Overwriting Defaults for Custom Block Types#
Let’s say you introduced a new kind of block that represents an Avatar. You want to hide the duplicate & delete buttons in the canvas menu for this block:
cesdk.feature.set('ly.img.delete', ({ engine, isPreviousEnable }) => { const selectedBlock = engine.block.findAllSelected()[0]; const kind = engine.block.getKind(selectedBlock); if (kind === 'avatar') { return false; } else { return isPreviousEnable(); }});
cesdk.feature.set('ly.img.duplicate', ({ engine, isPreviousEnable }) => { const selectedBlock = engine.block.findAllSelected()[0]; const kind = engine.block.getKind(selectedBlock); if (kind === 'avatar') { return false; } else { return isPreviousEnable(); }});Example: Glob Pattern with Predicate#
// Apply custom logic to all video featurescesdk.feature.set('ly.img.video.*', ({ engine }) => { return engine.scene.getMode() === 'Video';});Check Feature#
The following API allows to query if the feature is currently enabled:
isEnabled(featureId: FeatureId): booleanThis method returns true if the feature is currently enabled, false otherwise.
Example#
if (!cesdk.feature.isEnabled('ly.img.navigation.close')) { return null;}
// Check multiple featuresif ( cesdk.feature.isEnabled('ly.img.delete') && cesdk.feature.isEnabled('ly.img.duplicate')) { console.log('Both delete and duplicate are enabled');}
// Check with glob patternif (cesdk.feature.isEnabled('ly.img.video.*')) { console.log('All video features are enabled');}List Features#
The list() method returns all registered feature IDs, with optional pattern matching:
list(options?: { matcher?: string }): FeatureId[]This method is useful for discovering available features and debugging feature configurations.
Example: List All Features#
const allFeatures = cesdk.feature.list();console.log('All features:', allFeatures);Example: List with Pattern Matching#
// List all video featuresconst videoFeatures = cesdk.feature.list({ matcher: 'ly.img.video.*' });
// List all crop featuresconst cropFeatures = cesdk.feature.list({ matcher: 'ly.img.crop.*' });
// List all navigation featuresconst navFeatures = cesdk.feature.list({ matcher: 'ly.img.navigation.*' });Get Feature Predicates#
The get() method allows you to retrieve the predicates associated with a feature:
get(featureId: FeatureId): FeaturePredicate[] | undefinedThis is useful for debugging or understanding what predicates have been registered for a feature.
Example#
const predicates = cesdk.feature.get('ly.img.delete');console.log(`Feature has ${predicates?.length || 0} predicates`);Glob Pattern Support#
All main Feature API methods support glob pattern matching for batch operations, allowing you to control multiple related features at once.
Supported Methods#
enable(pattern)- Enable all matching featuresdisable(pattern)- Disable all matching featuresset(pattern, predicate)- Set all matching featuresisEnabled(pattern)- Check if all matching features are enabledlist({ matcher: pattern })- List features matching pattern
Pattern Syntax#
*matches any sequence of characters within a segmently.img.video.*matches all features starting withly.img.video.ly.img.crop.*matches all features starting withly.img.crop.
Examples#
// Enable all video featurescesdk.feature.enable('ly.img.video.*');
// Disable all crop featurescesdk.feature.disable('ly.img.crop.*');
// Check if all navigation features are enabledconst allEnabled = cesdk.feature.isEnabled('ly.img.navigation.*');
// Set all filter features with custom predicatecesdk.feature.set('ly.img.filter.*', ({ engine }) => { const selectedBlocks = engine.block.findAllSelected(); return selectedBlocks.some((id) => engine.block.hasEffects(id));});
// List all features in a namespaceconst allVideoFeatures = cesdk.feature.list({ matcher: 'ly.img.video.*' });Best Practices#
- Use glob patterns to manage related features together
- Combine with predicates for conditional bulk operations
- Use
list()with matchers to discover available features in a namespace
Built-In Features#
The following features are built-in to CE.SDK:
| Feature ID | Description |
|---|---|
ly.img.navigation.bar | Controls visibility of the Navigation Bar. Defaults to the value of the configuration option ui.elements.navigation, or true if not set. |
ly.img.navigation.back | Controls visibility of the “Back” button in the Navigation Bar. |
ly.img.navigation.close | Controls visibility of the “Close” button in the Navigation Bar. |
ly.img.navigation.undoRedo | Controls visibility of the “Undo” and “Redo” button in the Navigation Bar. |
ly.img.navigation.zoom | Controls visibility of the “Zoom” controls in the Navigation Bar. |
ly.img.navigation.actions | Controls visibility of the “Actions” in the Navigation Bar. |
ly.img.inspector.bar | Controls the visibility of the “Inspector Bar” in the Editor. Defaults to the value of the configuration option ui.elements.inspectorBar, or true if not set. |
ly.img.inspector.panel | Controls the visibility of the “Advanced Inspector” in the Editor. Defaults to false if not explicitly enabled. |
ly.img.inspector.toggle | Controls presence of the Inspector Toggle button in the Inspector bar. |
ly.img.canvas.bar | Controls the visibility of the “Canvas Bar” in the Editor. |
ly.img.canvas.menu | Controls the visibility of the “Canvas Menu” in the Editor. |
ly.img.dock | Controls the visibility of the “Dock” in the Editor. Defaults to the value of the configuration option ui.elements.dock, or true if not set. |
ly.img.library.panel | Controls the visibility of the “Asset Library” panel in the Editor. Defaults to true if not explicitly disabled. |
ly.img.settings | Controls the visibility of the “Settings” panel in the Editor. Defaults to false if not explicitly enabled. |
ly.img.preview | Controls existence of the “Preview” button in the Navigation Bar. Returns true when cesdk.engine.editor.getRole() returns Creator, e.g. when editing in the Creator role. |
ly.img.delete | Controls the ability to delete a block. Changes visibility of the “Delete” button in the Canvas Menu, as well as the ability to delete by pressing the delete key. Will return false when the operation would delete all pages of the document. Will return false when target block is a page and page management features are disabled via Feature API, or during 'Video' scene mode. |
ly.img.duplicate | Controls visibility of the “Duplicate” button in the Canvas Menu. Copy/paste using keyboard shortcuts will be disabled when set to false. Will return false when target block is a page and page management features are disabled via Feature API, or during 'Video' scene mode, or when scene layout is set to 'Free' or 'DepthStack'. |
ly.img.replace | Controls presence of the “Replace” button in the Canvas Menu, and in the Fill Panel for image and video fills. Returns false by default for stickers. |
ly.img.group | Controls features for creating and dissolving groups, currently: The existence of “Group” and “Ungroup” buttons in the Inspector Bar. Returns false during 'Video' scene mode. |
ly.img.placeholder | Controls visibility of the “Placeholder” button in the Canvas Menu. Will return true for blocks of type '//ly.img.ubq/text', '//ly.img.ubq/group', '//ly.img.ubq/page', '//ly.img.ubq/audio', or '//ly.img.ubq/graphic'. |
ly.img.position | Controls presence of the Position dropdown, and can disable the corresponding controls in the Advanced UI Inspector Panel. Returns false if target block is a page. |
ly.img.options | Controls presence of the Options button (... button) in the Default UI Inspector Bar. Returns true by default. |
ly.img.animations | Controls presence of the Animations button. Returns true by default for Graphic and Text blocks in video mode. |
ly.img.page.add | Controls the ability to add pages, by showing the “Add Page” button in the Canvas Bar. Returns false during 'Video' scene mode, or when scene layout is set to 'Free' or 'DepthStack'. |
ly.img.page.move | Controls the ability to move pages, by showing the “Move Up/Down/Left/Right” buttons in the Canvas Menu. Returns false during 'Video' scene mode, or when scene layout is set to 'Free' or 'DepthStack'. Note that the “Move Up/Left” components will not show up when the target page is already the first page of the document, and “Move Down/Right” will not show up when the target page is already the last page of the document. |
ly.img.page.resize | Controls the presence of the Resize button in the navigation bar, as well as the page formats button in the document inspector. |
ly.img.text.edit | Controls presence of the “Edit” button in the Canvas Menu. Only returns true for text blocks by default. |
ly.img.text.typeface | Controls presence of the Typeface dropdown, and can disable the corresponding dropdown in the Advanced UI Inspector Panel. Only returns true for text blocks by default. |
ly.img.text.fontSize | Controls presence of the Font Size input, and can disable the corresponding input in the Advanced UI Inspector Panel. Only returns true for text blocks by default. |
ly.img.text.fontStyle | Controls presence of the Font Style controls (Bold toggle, Italic toggle), in the Canvas Menu, and can disable the corresponding inputs in the Advanced UI Inspector Panel. Only returns true for text blocks by default. |
ly.img.text.alignment | Controls presence of the Text Horizontal Alignment dropdown, and can disable the corresponding controls in the Advanced UI Inspector Panel. Only returns true for text blocks by default. |
ly.img.text.advanced | Controls the presence of the Advanced text controls in the Editor. Only returns true for text blocks by default. |
ly.img.fill | Controls presence of the Fill button (opening the Fill Panel), and can disable the corresponding button in the Advanced UI Inspector Panel. Returns false for stickers by default. |
ly.img.stroke | Controls presence of the Stroke controls (Color, Width, Stroke), and can disable the corresponding controls in the Advanced UI Inspector Panel. Returns false for stickers by default. |
ly.img.adjustment | Controls visibility of the “Adjustments” button, and can disable the corresponding button in the Advanced UI Inspector Panel. Returns false for stickers by default. |
ly.img.filter | Controls visibility of the “Filter” button, and can disable the corresponding button in the Advanced UI Inspector Panel. Returns false for stickers by default. |
ly.img.filter.lut | Controls visibility of LUT (Lookup Table) filter controls. |
ly.img.filter.duotone | Controls visibility of duotone filter controls. |
ly.img.effect | Controls visibility of the “Effect” button, and can disable the corresponding button in the Advanced UI Inspector Panel. Returns false for stickers by default. |
ly.img.blur | Controls visibility of the “Blur” button, and can disable the corresponding button in the Advanced UI Inspector Panel. Returns false for stickers by default. |
ly.img.shadow | Controls visibility of the Shadow button, and can disable the corresponding control in the Advanced UI Inspector Panel. Returns false for pages by default. |
ly.img.shape.options | Controls presence of the Shape Options dropdown in the Default UI Inspector Bar, and can disable the corresponding button in the Advanced UI Inspector Panel. Returns true by default, but note that the component itself checks for the target block type and will only render for shape blocks. |
ly.img.combine | Controls presence of the Combine dropdown, and can disable the corresponding button in the Advanced UI Inspector Panel. Returns true by default, but note that the component itself checks for the target block type and will only render if the selection contains only shape blocks and text, or only cutouts. |
ly.img.cutout | Controls visibility of the Cutout controls (Cutout Type, Cutout Offset, Cutout Smoothing), and can disable the corresponding controls in the Advanced UI Inspector Panel. Only returns true for cutouts by default. |
ly.img.transform.position | Controls presence of the Transform X and Y Position controls. |
ly.img.transform.size | Controls presence of the Transform width and height controls. |
ly.img.transform.rotation | Controls presence of the Transform Rotation controls. |
ly.img.transform.flip | Controls presence of the Transform Flip controls. |
ly.img.crop | Controls presence of the Crop button, and can disable the corresponding button in the Fill Panel. Returns false for stickers by default. |
ly.img.crop.size | Controls visibility of crop size controls. |
ly.img.crop.position | Controls visibility of crop position controls. |
ly.img.crop.rotation | Controls visibility of crop rotation controls. |
ly.img.crop.flip | Controls visibility of crop flip controls. |
ly.img.crop.scale | Controls visibility of crop scale controls. |
ly.img.crop.fillMode | Controls visibility of crop fill mode controls. |
ly.img.crop.panel.autoOpen | Controls whether the crop panel automatically opens when entering crop mode. Defaults to true. When disabled, integrators can programmatically control panel opening via cesdk.ui.openPanel() or implement custom workflows. |
ly.img.trim | Controls presence of the Trim button, and can disable the corresponding button in the Fill Panel. Only returns true when scene mode is 'Video'. |
ly.img.volume | Controls presence of the Volume control, and can disable the corresponding button in the Fill Panel. Only returns true when scene mode is 'Video'. Disabled for pages by default. |
ly.img.video.timeline | Controls the visibility of the “Video Timeline” in the Editor. |
ly.img.video.clips | Controls visibility and behavior of the video clips track in the timeline. |
ly.img.video.overlays | Controls visibility and behavior of the overlays track in the timeline. |
ly.img.video.audio | Controls visibility and behavior of the audio track in the timeline. |
ly.img.video.addClip | Controls the ability to add new clips to the timeline. |
ly.img.video.controls | Base feature for all video control UI elements. |
ly.img.video.controls.toggle | Controls visibility of the video timeline collapse/expand toggle button. |
ly.img.video.controls.playback | Controls visibility of play/pause button, playback loop, and timestamp controls in video mode. |
ly.img.video.controls.loop | Controls visibility of the loop toggle control. |
ly.img.video.controls.split | Controls visibility of the split clip control. |
ly.img.video.controls.background | Controls visibility of background color controls in video mode. |
ly.img.video.controls.timelineZoom | Controls visibility of timeline zoom controls. |