Search
Loading...
Skip to content

Disable or Enable Features

Control which editor features are available to users using the Feature API.

Disable or Enable Features example showing the CE.SDK editor with feature controls

10 mins
estimated time
Download
StackBlitz
GitHub

The Feature API provides control over the visibility and availability of editor functionality. Use it to hide delete buttons from certain users, disable crop controls based on context, or conditionally enable features based on user roles or selection state. Unlike hiding UI elements with ordering APIs, disabling features affects both the UI and underlying functionality.

This guide covers how to enable and disable features with simple toggles, create custom predicates for conditional feature access, use glob patterns for bulk operations, and debug feature configurations.

Feature API Methods#

The following table summarizes the main Feature API methods and when to use each:

MethodUse Case
cesdk.feature.enable()Enable features with their default predicates
cesdk.feature.disable()Disable features (hide from UI)
cesdk.feature.set()Set features with custom predicates or boolean values
cesdk.feature.isEnabled()Check if a feature is currently enabled
cesdk.feature.list()Discover registered feature IDs
cesdk.feature.get()Get predicate chain for debugging

Enable Features#

Use cesdk.feature.enable() to activate a feature with its default predicate behavior. The method accepts a single feature ID, an array of IDs, or a glob pattern.

// Enable delete feature with default predicate
cesdk.feature.enable('ly.img.delete');

You can enable multiple features at once by passing an array:

// Enable multiple features at once
cesdk.feature.enable(['ly.img.duplicate', 'ly.img.group']);

Glob patterns allow you to enable all features matching a pattern. The * wildcard matches any sequence of characters:

// Enable all video features using glob pattern
cesdk.feature.enable('ly.img.video*');

Disable Features#

Use cesdk.feature.disable() to hide features from the UI. Like enable(), it accepts single IDs, arrays, or glob patterns.

// Disable crop feature
cesdk.feature.disable('ly.img.crop');

Disable multiple features at once by passing an array:

// Disable multiple features at once
cesdk.feature.disable(['ly.img.notifications', 'ly.img.preview']);

Use glob patterns to disable all features matching a pattern:

// Disable all transform features using glob pattern
cesdk.feature.disable('ly.img.transform*');

Custom Predicates#

The cesdk.feature.set() method allows you to configure features with custom logic. You can pass a boolean value or a function predicate.

Boolean Predicates#

Passing true or false creates a terminal predicate that overrides any enable() or disable() calls:

// Set feature with boolean (terminal predicate)
cesdk.feature.set('ly.img.fill', true);

Function Predicates#

Function predicates receive a context object with engine, isPreviousEnable(), and defaultPredicate(). Use them for dynamic conditions based on selection or other state:

// Set feature with custom predicate based on selection
cesdk.feature.set('ly.img.duplicate', ({ engine }) => {
return engine.block.findAllSelected().length > 0;
});

This predicate enables the duplicate feature only when at least one block is selected.

Extending Default Behavior#

You can build on a feature’s default predicate using defaultPredicate(). This lets you add conditions while preserving the built-in logic:

// Extend default predicate with additional condition
cesdk.feature.set('ly.img.delete', ({ defaultPredicate }) => {
// Only allow delete in design mode
return defaultPredicate() && engine.scene.getMode() === 'Design';
});

Layering Conditions#

Use isPreviousEnable() to chain with previously registered predicates. This enables layered conditions from multiple set() calls:

// Chain multiple predicates using isPreviousEnable
cesdk.feature.set('ly.img.replace', ({ isPreviousEnable, engine }) => {
const previousResult = isPreviousEnable();
const hasSelection = engine.block.findAllSelected().length > 0;
return previousResult && hasSelection;
});

Evaluation Order#

When multiple predicates are registered for a feature, they evaluate in this order:

  1. Most recent set() predicates run first
  2. Older set() predicates in reverse chronological order
  3. enable()/disable() state runs last

Boolean predicates are terminal and immediately return their value without continuing the chain. Function predicates control whether to continue by calling isPreviousEnable() or returning directly.

Glob Patterns#

All main Feature API methods support glob pattern matching for bulk operations. The * wildcard matches any sequence of characters within a segment.

Supported methods:

  • cesdk.feature.enable('ly.img.video.*') - Enable all video features
  • cesdk.feature.disable('ly.img.crop.*') - Disable all crop features
  • cesdk.feature.set('ly.img.navigation.*', predicate) - Set all navigation features
  • cesdk.feature.isEnabled('ly.img.video.*') - Check if ALL matching features are enabled
  • cesdk.feature.list({ matcher: 'ly.img.video.*' }) - List matching features

Check Feature Status#

Use cesdk.feature.isEnabled() to query if a feature is currently enabled:

// Check if a feature is enabled
const isDeleteEnabled = cesdk.feature.isEnabled('ly.img.delete');
console.log('Delete feature enabled:', isDeleteEnabled);

When using a glob pattern with isEnabled(), it returns true only if all matching features are enabled:

// Check if all video features are enabled (returns true only if ALL match)
const allVideoEnabled = cesdk.feature.isEnabled('ly.img.video*');
console.log('All video features enabled:', allVideoEnabled);

Discover Features#

Use cesdk.feature.list() to get all registered feature IDs. You can filter with the optional matcher parameter:

// List all registered feature IDs
const allFeatures = cesdk.feature.list();
console.log('All features:', allFeatures.slice(0, 10), '...');

Filter the list with a glob pattern:

// List features matching a pattern
const navigationFeatures = cesdk.feature.list({
matcher: 'ly.img.navigation*'
});
console.log('Navigation features:', navigationFeatures);

Built-in Features#

CE.SDK includes many built-in features organized by category:

Feature IDDescription
ly.img.navigation.barControls visibility of the Navigation Bar
ly.img.navigation.backControls visibility of the “Back” button
ly.img.navigation.closeControls visibility of the “Close” button
ly.img.navigation.undoRedoControls visibility of “Undo” and “Redo” buttons
ly.img.navigation.zoomControls visibility of zoom controls
ly.img.navigation.actionsControls visibility of navigation actions

Inspector Features#

Feature IDDescription
ly.img.inspector.barControls visibility of the Inspector Bar
ly.img.inspector.panelControls visibility of the Advanced Inspector
ly.img.inspector.toggleControls presence of the Inspector Toggle button

Canvas Features#

Feature IDDescription
ly.img.canvas.barControls visibility of the Canvas Bar
ly.img.canvas.menuControls visibility of the Canvas Menu

Editing Features#

Feature IDDescription
ly.img.deleteControls ability to delete blocks
ly.img.duplicateControls ability to duplicate blocks
ly.img.replaceControls presence of the Replace button
ly.img.groupControls grouping functionality
ly.img.placeholderControls Placeholder button visibility

Video Features#

Feature IDDescription
ly.img.video.timelineControls visibility of the Video Timeline
ly.img.video.clipsControls visibility of video clips track
ly.img.video.overlaysControls visibility of overlays track
ly.img.video.audioControls visibility of audio track
ly.img.video.addClipControls ability to add clips
ly.img.video.controls.*Controls various video controls

Text Features#

Feature IDDescription
ly.img.text.editControls presence of the Edit button
ly.img.text.typefaceControls typeface dropdown
ly.img.text.fontSizeControls font size input
ly.img.text.fontStyleControls bold/italic toggles
ly.img.text.alignmentControls text alignment
ly.img.text.advancedControls advanced text options

Effects Features#

Feature IDDescription
ly.img.fillControls Fill button
ly.img.strokeControls Stroke controls
ly.img.adjustmentControls Adjustments button
ly.img.filterControls Filter button
ly.img.effectControls Effect button
ly.img.blurControls Blur button
ly.img.shadowControls Shadow button
ly.img.cropControls Crop button

Transform Features#

Feature IDDescription
ly.img.transform.positionControls X/Y position controls
ly.img.transform.sizeControls width/height controls
ly.img.transform.rotationControls rotation controls
ly.img.transform.flipControls flip controls

Other Features#

Feature IDDescription
ly.img.dockControls visibility of the Dock
ly.img.previewControls Preview button
ly.img.page.addControls Add Page button
ly.img.page.moveControls page move buttons
ly.img.page.resizeControls Resize button
ly.img.notificationsControls notification toasts
ly.img.notifications.undoControls undo notifications
ly.img.notifications.redoControls redo notifications

Troubleshooting#

Feature Not Visible#

If a feature doesn’t appear in the UI after calling enable():

  1. Check if a set() call with a boolean is overriding it. Boolean predicates are terminal and take precedence.
  2. Verify the feature ID spelling matches exactly.
  3. Confirm the feature is relevant for the current context (e.g., video features only appear in Video mode).

disable() Not Working#

If disable() doesn’t hide a feature:

  1. Check if a set() predicate exists for that feature. The set() predicates evaluate before disable().
  2. Use cesdk.feature.get() to inspect the predicate chain.

Glob Pattern Not Matching#

If a glob pattern doesn’t affect expected features:

  1. Verify the pattern syntax is correct.
  2. Use cesdk.feature.list({ matcher: 'your.pattern.*' }) to see which features match.
  3. Check that features are registered before applying the pattern.

API Reference#

MethodSignaturePurpose
cesdk.feature.enable()enable(featureId: FeatureId | FeatureId[]): voidEnable features with default predicates
cesdk.feature.disable()disable(featureId: FeatureId | FeatureId[]): voidDisable features
cesdk.feature.set()set(featureId: FeatureId, enabled: boolean | FeaturePredicate): voidSet feature state with custom predicates
cesdk.feature.isEnabled()isEnabled(featureId: FeatureId, context?: FeatureContext): booleanCheck if feature is enabled
cesdk.feature.list()list(options?: { matcher?: string }): FeatureId[]List registered feature IDs
cesdk.feature.get()get(featureId: FeatureId): FeaturePredicate[] | undefinedGet predicate chain for debugging

Next Steps#