147 lines
4.9 KiB
TypeScript
147 lines
4.9 KiB
TypeScript
import { RawEditorOptions } from "tinymce";
|
|
|
|
export class HtmlEditorSettings implements RawEditorOptions {
|
|
parentComponent?: any = null;
|
|
base_url?: string = '/tinymce';
|
|
suffix?: string = '.min';
|
|
menubar?: boolean = false;
|
|
inline?: boolean = false;
|
|
indent_use_margin? = false;
|
|
theme?: string = 'silver';
|
|
plugins?: string[] = [
|
|
'link',
|
|
'lists',
|
|
'autolink',
|
|
'noneditable',
|
|
'table',
|
|
'code',
|
|
'fullscreen'
|
|
];
|
|
toolbar?: string[] = [
|
|
'undo redo | bold italic underline | fontselect fontsizeselect forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent | code fullscreen'
|
|
];
|
|
extraToolBar?: string;
|
|
fullscreen_native?: boolean = false;
|
|
statusbar?: boolean = false;
|
|
noneditable_editable_class?: string = 'editable';
|
|
noneditable_noneditable_class?: string = 'templateParameter';
|
|
autoresize_bottom_margin?: number = 2;
|
|
min_height?: number = 200;
|
|
height?: number | string;
|
|
content_style?: string =
|
|
'.parameterInput { color:antiquewhite; background:lightslategrey; padding-left:5px; padding-right:5px; }' +
|
|
'.reportParameter { color:antiquewhite; background:slateblue; padding-left:5px; padding-right:5px;} ' +
|
|
'.parameterInput:empty:not(:focus):before { content: \' \' attr(data-name) \' (Empty)\'; }';
|
|
|
|
extended_valid_elements?: string = `parameter[id|style|class]`;
|
|
|
|
|
|
constructor(config: Partial<HtmlEditorSettings>) {
|
|
|
|
if (config.extraToolBar) {
|
|
this.toolbar[0] += ' ' + config.extraToolBar;
|
|
}
|
|
Object.assign(this, config);
|
|
}
|
|
}
|
|
|
|
export interface ITinyMceEditor {
|
|
|
|
// focus(skipFocus: Boolean);
|
|
// addCommand(name: String, callback: Function, scope: Object);
|
|
// hasPlugin(name: String, loaded: Boolean): Boolean;
|
|
// getDoc(): HTMLElement;
|
|
// getContent(args?: Object): String;
|
|
// //https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.editor/#insertContent
|
|
// insertContent(content: String, args?: Object);
|
|
// isDirty(): Boolean;
|
|
// off(name?: String, callback?: Function): Object;
|
|
|
|
// instance.on('event', (e) => {
|
|
// // Callback logic
|
|
// });
|
|
on(name: String, callback?: Function, prepend?: Boolean): Object;
|
|
resetContent(initialContent: String);
|
|
documentBaseUrl: string;
|
|
baseUri: string;
|
|
id: string;
|
|
plugins: Record<string, Plugin>;
|
|
documentBaseURI: string;
|
|
baseURI: string;
|
|
contentCSS: string[];
|
|
contentStyles: string[];
|
|
setMode: (mode: string) => void;
|
|
loadedCSS: Record<string, any>;
|
|
suffix: string;
|
|
inline: boolean;
|
|
isNotDirty: boolean;
|
|
callbackLookup: any;
|
|
bodyElement: HTMLElement;
|
|
bookmark: any;
|
|
composing: boolean;
|
|
container: HTMLElement;
|
|
contentAreaContainer: HTMLElement;
|
|
contentDocument: Document;
|
|
contentWindow: Window;
|
|
delegates: Record<string, (event: any) => void>;
|
|
destroyed: boolean;
|
|
editorContainer: HTMLElement;
|
|
eventRoot?: Element;
|
|
formElement: HTMLElement;
|
|
formEventDelegate: (e: Event) => void;
|
|
hasHiddenInput: boolean;
|
|
hasVisual: boolean;
|
|
hidden: boolean;
|
|
iframeElement: HTMLIFrameElement | null;
|
|
iframeHTML: string;
|
|
initialized: boolean;
|
|
orgDisplay: string;
|
|
orgVisibility: string;
|
|
readonly: boolean;
|
|
removed: boolean;
|
|
startContent: string;
|
|
targetElm: HTMLElement;
|
|
theme: string;
|
|
validate: boolean;
|
|
_beforeUnload: () => void;
|
|
_mceOldSubmit: any;
|
|
_pendingNativeEvents: string[];
|
|
_skinLoaded: boolean;
|
|
render(): void;
|
|
focus(skipFocus?: boolean): void;
|
|
hasFocus(): boolean;
|
|
execCallback(name: string, ...x: any[]): any;
|
|
getParam<T>(name: string, defaultVal: T, type?: string): T;
|
|
hasPlugin(name: string, loaded?: boolean): boolean;
|
|
nodeChanged(args?: any): void;
|
|
execCommand(cmd: string, ui?: boolean, value?: any, args?: any): boolean;
|
|
queryCommandState(cmd: string): boolean;
|
|
queryCommandValue(cmd: string): string;
|
|
queryCommandSupported(cmd: string): boolean;
|
|
show(): void;
|
|
hide(): void;
|
|
isHidden(): boolean;
|
|
setProgressState(state: boolean, time?: number): void;
|
|
load(args?: any): string;
|
|
save(args?: any): string;
|
|
setContent(content: string): string;
|
|
getContent(): string;
|
|
insertContent(content: string, args?: any): void;
|
|
resetContent(initialContent?: string): void;
|
|
isDirty(): boolean;
|
|
setDirty(state: boolean): void;
|
|
getContainer(): HTMLElement;
|
|
getContentAreaContainer(): HTMLElement;
|
|
getElement(): HTMLElement;
|
|
getWin(): Window;
|
|
getDoc(): Document;
|
|
getBody(): HTMLElement;
|
|
convertURL(url: string, name: string, elm?: any): string;
|
|
addVisual(elm?: HTMLElement): void;
|
|
remove(): void;
|
|
destroy(automatic?: boolean): void;
|
|
addButton(): void;
|
|
addSidebar(): void;
|
|
addMenuItem(): void;
|
|
addContextToolbar(): void;
|
|
} |