magner
Version:
Universal admin panel magnetic to any backend
55 lines (54 loc) • 1.48 kB
TypeScript
/**
* Thanks to the https://github.com/editor-js/simple-image-tutorial/blob/master/simple-image.js
* for this simple image Editorjs plugin tutorial
*/
import { BlockTool, API, BlockToolConstructorOptions, ToolConfig, BlockToolData } from '@editorjs/editorjs';
type OutputCodeBlock = BlockToolData<{
url: string;
caption: string;
}>;
export default class SimpleImage implements BlockTool {
api: API;
config: ToolConfig;
readOnly: boolean;
wrapper: HTMLElement | null;
data: OutputCodeBlock;
constructor({ data, api, config, readOnly, }: BlockToolConstructorOptions);
render(): HTMLElement;
_createImage(url: string, captionText?: string): void;
save(blockContent: HTMLElement): {
url: string;
caption: string;
} & {
url: string;
caption: string;
};
validate(savedData: OutputCodeBlock): boolean;
static get sanitize(): {
url: {};
caption: {
b: boolean;
a: {
href: boolean;
};
i: boolean;
};
};
static get toolbox(): {
title: string;
icon: string;
};
static get pasteConfig(): {
tags: string[];
files: {
mimeTypes: string[];
extensions: string[];
};
patterns: {
image: RegExp;
};
};
onPaste(event: CustomEvent): void;
static get isReadOnlySupported(): boolean;
}
export {};