prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
36 lines (35 loc) • 2.11 kB
TypeScript
import { EditorOptions, PrismEditor } from "..";
export type SetupOptions = Partial<EditorOptions> & {
theme: string;
};
/**
* Updates the theme of an editor. The editor needs to be inside a shadow root
* with a style element for the theme whoose `id` is `"theme"`.
* @param editor Editor you want to change the theme of.
* @param theme Name of the new theme.
*/
declare const updateTheme: (editor: PrismEditor, theme: string) => void;
/**
* Adds an editor inside a shadow root to the given element and asynchronously loads the styles.
* @param container Must be an element you can attach a shadow root to
* @param options Options to create the editor as well as the theme to use.
* @param readyCallback Function called when the styles are loaded.
* @returns Object to interact with the editor.
*/
declare const minimalEditor: (container: HTMLElement | string, options: SetupOptions, readyCallback?: () => any) => PrismEditor;
/**
* Same as {@link minimalEditor}, but also adds {@link indentGuides}, {@link highlightSelectionMatches},
* {@link matchBrackets}, {@link highlightBracketPairs} and {@link defaultCommands}
* extensions and language specific behvaior.
*/
declare const basicEditor: (container: HTMLElement | string, options: SetupOptions, readyCallback?: () => any) => PrismEditor;
/** Same as {@link basicEditor}, but also adds the {@link searchWidget} and {@link matchTags} extensions. */
declare const fullEditor: (container: HTMLElement | string, options: SetupOptions, readyCallback?: () => any) => PrismEditor;
/**
* Same as {@link minimalEditor}, but also adds the {@link copyButton}, {@link matchBrackets},
* {@link highlightBracketPairs}, {@link matchTags}, {@link indentGuides}, {@link highlightSelectionMatches}
* and {@link readOnlyCodeFolding} extensions. No commands are added which makes this setup
* best used with the `readOnly` option set to true.
*/
declare const readonlyEditor: (container: HTMLElement | string, options: SetupOptions, readyCallback?: () => any) => PrismEditor;
export { basicEditor, fullEditor, minimalEditor, readonlyEditor, updateTheme };