@silexlabs/grapesjs-advanced-selector
Version:
A GrapesJS plugin for managing advanced CSS selectors with a visual interface
48 lines • 2.55 kB
TypeScript
import { Component, Editor } from 'grapesjs';
import { ComplexSelector } from './ComplexSelector';
import { SimpleSelector } from './SimpleSelector';
export declare function getTranslation(editor: Editor, key: string): string;
export declare function getUntranslatedKeys(): string[];
/**
* Get all selectors that match the selected component
*/
export declare function getSelectors(editor: Editor): ComplexSelector[];
/**
* Function to edit or add style based on the selector
*/
export declare function editStyle(editor: Editor, selector: string): void;
/**
* Check if all the selected components are selected by the provided selector
*/
export declare function matchSelectorAll(selector: string, components: Component[]): boolean;
/**
* Check if some of the selected components are selected by the provided selector
*/
export declare function matchSelectorSome(selector: string, components: Component[]): boolean;
/**
* Remove the style (rules) for the current selector (edited selector)
*/
export declare function clearStyle(editor: Editor): void;
export declare function getSelectedStyle(editor: Editor): any;
export declare function setSelectedStyle(editor: Editor, style: any): void;
export declare function renameSelector(editor: Editor, oldSelector: SimpleSelector, newSelector: SimpleSelector): void;
/**
* Store a selector in a component's attributes
*/
export declare function setComponentSelector(component: Component, selector: ComplexSelector): void;
export declare function getComponentSelector(component: Component): ComplexSelector;
/**
* Get the suggestions for the selected components which have the provided selector
* We want to suggest the main selector:
* - The component tag name and ID
* - Any classes that are in the current website (will be added to the component if selected) but no classes that are already in the component
*/
export declare function getSuggestionsMain(editor: Editor, components: Component[], selector: ComplexSelector): SimpleSelector[];
/**
* Get the suggestions for the related selectors. Depending on the operator (> => look for children, '+' => look for siblings, ' ' => look for parents):
* - Any classes that are in the parents/children/siblings of the selected components
* - Add the classes that are on each parent/child/sibling but not on the selected components
* - Same for IDs, tag names
*/
export declare function getSuggestionsRelated(editor: Editor, components: Component[], selector: ComplexSelector): SimpleSelector[];
//# sourceMappingURL=GrapesJsSelectors.d.ts.map