angular-rich-text-editor
Version:
A lightweight, configurable rich-text editor component for Angular applications.
74 lines (73 loc) • 1.93 kB
TypeScript
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
export interface RTEInstance {
id: string;
component: any;
element: HTMLElement;
}
export declare class RichTextEditorService {
private assetsPath;
private currentEditor;
private contentSubject;
content$: Observable<string>;
constructor(assetsPath: string);
getContentCssUrl(): string;
getPreviewCssUrl(): string;
getPreviewScriptUrl(): string;
setCurrentEditor(component: any): void;
clearCurrentEditor(): void;
insertContentAtCursor(content: string): boolean;
/**
* Get HTML content from current editor
* @returns HTML string (empty string if no content/editor)
*/
getContent(): string;
/**
* Fallback method to retrieve content
*/
private getContentFallback;
/**
* Set HTML content for current editor
*/
setContent(content: string): boolean;
/**
* Clear editor content
*/
clearContent(): boolean;
/**
* Focus current editor
*/
focus(): boolean;
/**
* Execute command on the editor
*/
executeCommand(command: string, value?: any): boolean;
/**
* Get selected text from editor
*/
getSelectedText(): string;
/**
* Check if content is empty
*/
isContentEmpty(): boolean;
/**
* Get character count
*/
getCharacterCount(): number;
/**
* Get word count
*/
getWordCount(): number;
isReadonly(): boolean;
isAvailable(): boolean;
/**
* Hide all floating panels (useful for cleanup)
*/
hideFloatingPanels(): void;
/**
* Removes the last inserted image with a temporary blob or data URL.
*/
removeLastPlaceholderImage(): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<RichTextEditorService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RichTextEditorService>;
}