Search Docs
Loading...
Skip to content

Class: FeatureAPI

The earlier way to switch editor features on and off by key.

Old calls keep working: they carry over to FeaturesAPI (cesdk.features), and each logs a warning with its replacement. An editor that declares a compatibility version before 1.87 gets no warning. Many old keys are now an option, a setting, or a button in a region’s order; the migration guide lists where each one went.

Deprecated#

Use FeaturesAPI (cesdk.features) instead. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.

Constructors#

Constructor#


FeatureAPI

Feature Control#

Methods for enabling and checking the status of editor features based on custom predicates.

enable()#


Enables one or more features using their default predicates.

Each feature has a default predicate that determines when it is available in the UI. To customize the behavior, use the set() method instead.

Supports glob patterns (e.g., ‘ly.img.video.*’) to enable multiple features at once. Use * as a wildcard to match any sequence of characters.

Parameters#
Parameter Type Description
featureId FeatureId
Returns#

void

Examples#

Enable single feature with its default predicate:

cesdk.feature.enable('ly.img.delete');

Enable multiple features at once:

cesdk.feature.enable(['ly.img.delete', 'ly.img.duplicate']);

Enable all video features using a glob pattern:

cesdk.feature.enable('ly.img.video.*');

Enable all navigation features:

cesdk.feature.enable('ly.img.navigation.*');
Deprecated#

Use cesdk.features.configure({ [newId]: { enabled: true } }) instead, with newId from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.

Call Signature#

enable(featureId, predicate): void;

Enables one or more features based on the provided predicate.

Parameters#
Parameter Type Description
featureId FeatureId
predicate FeaturePredicate The condition that determines if the feature is enabled.
Returns#

void

Deprecated#

Use cesdk.features.configure({ [newId]: { enabled: true, when: rule } }) instead, with newId from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.


disable()#


Disables one or more features.

This is a convenience method that adds a false predicate to the feature’s predicate chain, effectively disabling the feature. Disabled features will not be shown in the UI.

Supports glob patterns (e.g., ‘ly.img.video.*’) to disable multiple features at once. Use * as a wildcard to match any sequence of characters.

Parameters#

Parameter Type Description
featureId FeatureId

Returns#

void

Examples#

Disable a single feature:

cesdk.feature.disable('ly.img.delete');

Disable multiple features at once:

cesdk.feature.disable([
'ly.img.delete',
'ly.img.duplicate',
'ly.img.group'
]);

Disable all video features using a glob pattern:

cesdk.feature.disable('ly.img.video.*');

Disable all crop features:

cesdk.feature.disable('ly.img.crop.*');

Deprecated#

Use cesdk.features.configure({ [newId]: { enabled: false } }) instead, with newId from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.


set()#


Sets a feature’s enabled state, replacing any existing predicates.

This method provides a unified way to enable or disable features. When setting to true, the feature’s default predicate is used. When setting to false, the feature is explicitly disabled. You can also provide a custom predicate function for advanced control.

Supports glob patterns (e.g., ‘ly.img.video.*’) to set multiple features at once. Use * as a wildcard to match any sequence of characters.

Parameters#

Parameter Type Description
featureId FeatureId The feature ID or glob pattern to set.
enabled FeaturePredicate Boolean to enable/disable, or a predicate function for custom logic.

Returns#

void

Examples#

Enable a feature using its default predicate:

cesdk.feature.set('ly.img.delete', true);

Disable a feature:

cesdk.feature.set('ly.img.delete', false);

Set a feature with a custom predicate:

cesdk.feature.set('ly.img.delete', ({ engine }) => {
return engine.block.findAllSelected().length > 0;
});

Disable all video features using a glob pattern:

cesdk.feature.set('ly.img.video.*', false);

Enable all filter features with a custom predicate:

cesdk.feature.set('ly.img.filter.*', ({ engine }) => {
// Only enable filters for images
const selected = engine.block.findAllSelected();
return selected.some(id => engine.block.getType(id) === '//ly.img.ubq/graphic');
});

Deprecated#

Use cesdk.features.configure({ [newId]: { enabled } }) for a boolean, or { [newId]: { enabled: true, when: rule } } for a predicate; newId is the old key’s new place, from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.


list()#


Lists all registered feature IDs, optionally filtered by a pattern.

This method is useful for debugging and discovering which features are currently registered in the editor. You can provide a glob-style pattern to filter the results.

Parameters#

Parameter Type Description
options? { matcher?: string; } Optional configuration object with a matcher property for glob-style pattern filtering (e.g., ‘ly.img.video.*’).
options.matcher? string -

Returns#

FeatureId[]

An array of feature IDs sorted alphabetically.

Examples#

List all registered features:

const allFeatures = cesdk.feature.list();
console.log(allFeatures); // ['ly.img.delete', 'ly.img.duplicate', ...]

List features matching a pattern:

const videoFeatures = cesdk.feature.list({ matcher: 'ly.img.video.*' });
console.log(videoFeatures); // ['ly.img.video.timeline', 'ly.img.video.timeline.clips', ...]

List navigation features:

const navFeatures = cesdk.feature.list({ matcher: 'ly.img.navigation.*' });

Deprecated#

Use cesdk.features.list() instead. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.


get()#


Gets the predicate chain for a specific feature.

This method returns the array of predicates currently registered for a feature, allowing you to inspect the feature’s configuration. Returns undefined if the feature is not registered.

Parameters#

Parameter Type Description
featureId FeatureId The feature ID to query.

Returns#

FeaturePredicate[]

The array of predicates for the feature, or undefined if not registered.

Examples#

Get predicates for a feature:

const predicates = cesdk.feature.get('ly.img.delete');
if (predicates) {
console.log(`Feature has ${predicates.length} predicates`);
}

Check if a feature is registered:

const isRegistered = cesdk.feature.get('ly.img.delete') !== undefined;

Deprecated#

Use cesdk.features.get(newId) instead, with newId from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.


isEnabled()#


Checks if one or more features are currently enabled.

Supports glob patterns (e.g., ‘ly.img.video.*’) to check multiple features at once. When a glob pattern is used, returns true only if all matching features are enabled.

Parameters#

Parameter Type Description
featureId FeatureId The feature ID or glob pattern to check.
context? IsEnabledFeatureContext The context object containing a reference to the underlying engine.

Returns#

boolean

True if the feature (or all matching features for glob patterns) is enabled, false otherwise.

Examples#

Check if a single feature is enabled:

const isDeleteEnabled = cesdk.feature.isEnabled('ly.img.delete');

Check if all video features are enabled:

const allVideoFeaturesEnabled = cesdk.feature.isEnabled('ly.img.video.*');

Check with custom context (useful in predicates):

cesdk.feature.set('ly.img.delete', ({ engine }) => {
return cesdk.feature.isEnabled('ly.img.duplicate', { engine });
});

Deprecated#

Use cesdk.features.evaluate(newId).status === 'available' instead, passing { blockId } for a feature that works per block; newId is the old key’s new place, from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.


has()#


Checks if a feature has registered predicates.

Returns true if the feature has any predicates (boolean or function) in its chain. Returns false if the feature is unknown or has no predicates.

Parameters#

Parameter Type Description
featureId FeatureId The feature ID to check.

Returns#

boolean

True if the feature has registered predicates.

Deprecated#

Use cesdk.features.get(newId).enabled instead, with newId from the key table in the v1.87 upgrade guide. It will be removed no earlier than 12 months after CE.SDK 1.87.

See#

The guide “Migrating from cesdk.feature” in the CE.SDK documentation.