UNPKG

@init-kz/editorjs-code-highlight

Version:

A micro code-editor for awesome web pages

77 lines (74 loc) 2.33 kB
import { BlockTool, SanitizerConfig } from '@editorjs/editorjs'; import { BlockToolConstructorOptions, MenuConfig } from '@editorjs/editorjs/types/tools'; type EditorJsCodeHighlightData = { code?: string; language?: string; showlinenumbers?: boolean; showCopyButton?: boolean; }; type EditorJsCodeHighlightConfig = { placeholder?: string; preserveBlank?: boolean; }; type EditorJsCodeHighlightOptions = BlockToolConstructorOptions<EditorJsCodeHighlightData, EditorJsCodeHighlightConfig>; declare class EditorJsCodeHighlight implements BlockTool { sanitize?: SanitizerConfig | undefined; /** * Editor.js API instance */ private api; /** * Stores current block data internally */ private _data; private readOnly; private _CSS; private _element; private editorInstance; constructor({ api, data, readOnly }: EditorJsCodeHighlightOptions); /** * Return Tool data */ private get data(); /** * Return Tool data */ private set data(value); /** * Icon and title for displaying at the Toolbox * * @return {{icon: string, title: string}} */ static get toolbox(): { icon: string; title: string; }; /** * Returns true to notify the core that read-only mode is supported * * @return {boolean} */ static get isReadOnlySupported(): boolean; /** * Check if text content is empty and set empty string to inner html. * We need this because some browsers (e.g. Safari) insert <br> into empty contenteditanle elements * * @param {KeyboardEvent} e - key up event */ protected onKeyUp(e: KeyboardEvent): void; protected _updateEditorHeight(length: number): void; _debounce(func: Function, timeout?: number): (...args: any[]) => void; private _toggleLineNumbers; private _updateLanguage; save(_: HTMLElement): { code: string; language: string | undefined; showlinenumbers: boolean | undefined; showCopyButton: boolean | undefined; }; renderSettings(): HTMLElement | MenuConfig; render(): HTMLElement | Promise<HTMLElement>; static get DEFAULT_PLACEHOLDER(): string; static get enableLineBreaks(): boolean; } export { EditorJsCodeHighlight as default };