Files
Testing/emaildesigner/node_modules/ngx-sendune-editor/lib/ngx-suneditor.component.d.ts
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

644 lines
20 KiB
TypeScript

import { AfterViewInit, EventEmitter, NgZone } from '@angular/core';
import { Context } from 'suneditor/src/lib/context';
import SunEditor, { audioInputInformation, commands, Controllers, Core, fileInfo, imageInputInformation, videoInputInformation } from 'suneditor/src/lib/core';
import { SunEditorOptions } from 'suneditor/src/options';
import * as i0 from "@angular/core";
export declare class NgxSuneditorComponent implements AfterViewInit {
private ngZone;
private editor;
private localStorageId;
private isAutoSaveToLocalStorage;
private isAutoLoadToLocalStorage;
private _disabled;
private _hidden;
private _loading;
private _readonly;
private _content;
private _fullScreenMode;
private _displayBlocks;
private _codeView;
/**
* Content to show in the Editor. If this value is set the content will be set.
*/
set content(content: string);
/**
* HTML DOM id PropertyHTML DOM id Property
*/
editorID: string;
/**
* SunEditorOptions Object is used once when the editor is created
*/
options: SunEditorOptions;
/**
* Parameter that is passed to the onDrop event to control the behavior.
* @default true
*/
onDrop_param: boolean;
/**
* Parameter that is passed to the onCopy event to control the behavior.
* @default true
*/
onCopy_param: boolean;
/**
* Parameter that is passed to the onCut event to control the behavior.
* @default true
*/
onCut_param: boolean;
/**
* Parameter that is passed to the onAudioUploadError event to control the behavior.
* @default true
*/
onAudioUploadError_param: boolean | undefined;
/**
* Parameter that is passed to the onImageUploadBefore event to control the behavior.
* @default true
*/
onImageUploadBefore_param: boolean | undefined;
/**
* Parameter that is passed to the onImageUploadError event to control the behavior.
* @default true
*/
onImageUploadError_param: boolean | undefined;
/**
* Parameter that is passed to the onVideoUploadBefore event to control the behavior.
* @default true
*/
onVideoUploadBefore_param: boolean | undefined;
/**
* Parameter that is passed to the onVideoUploadError event to control the behavior.
* @default true
*/
onVideoUploadError_param: boolean | undefined;
/**
* Parameter that is passed to the onAudioUploadBefore event to control the behavior.
* @default true
*/
onAudioUploadBefore_param: boolean | undefined;
/**
* Parameter that is passed to the onResizeEditor event to control the behavior.
* @default {}
*/
onResizeEditor_param: Object | undefined;
private _imageUploadHandler;
/**
* Callback to replace the default imageUploadHandler function
*/
set imageUploadHandler(callback: (xmlHttp: XMLHttpRequest, info: imageInputInformation, core: Core) => void);
private _videoUploadHandler;
/**
* Callback to replace the default videoUploadHandler function
*/
set videoUploadHandler(callback: (xmlHttp: XMLHttpRequest, info: videoInputInformation, core: Core) => void);
private _audioUploadHandler;
/**
* Callback to replace the default audioUploadHandler function
*/
set audioUploadHandler(callback: (xmlHttp: XMLHttpRequest, info: audioInputInformation, core: Core) => void);
/**
* The localStorageConfig Object {id: string, autoSave: boolean, autoLoad: boolean}
* id is the localStorageKey where the Content gets saved.
* autoSave decides if the content should be automaticly saved in the onChange event
* autoLoad decides if the content should be automaticly loaded on startUp
* @Default = {id: 'ngxSunEditor', autoSave: false, autoLoad: false}
*/
set localStorageConfig(config: {
id?: string;
autoSave?: boolean;
autoLoad?: boolean;
});
/**
* Emitted after the editor compontent was created
*/
created: EventEmitter<NgxSuneditorComponent>;
/**
* When reloaded with the "setOptions" method
*/
onload: EventEmitter<{
core: Core;
reload: boolean;
}>;
/**
* Scroll event
*/
onScroll: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* Mouse down
*/
onMouseDown: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* clicked
*/
onClick: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* Wysiwyg editor area Input event
*/
onInput: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* keydown event
*/
onKeyDown: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* keyup event
*/
onKeyUp: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* Focus event
*/
onFocus: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* Blur event
*/
onBlur: EventEmitter<{
e: Event;
core: Core;
}>;
/**
* Called when the editor is resized using the bottom bar
*/
onResizeEditor: EventEmitter<{
height: number;
prevHeight: number;
core: Core;
}>;
/**
* Called before the audio is uploaded
*/
onAudioUploadBefore: EventEmitter<{
files: any[];
info: audioInputInformation;
core: Core;
uploadHandler: Function;
}>;
/**
* Called on video upload error
*/
onVideoUploadError: EventEmitter<{
errorMessage: string;
result: any;
core: Core;
}>;
/**
* Called before the video is uploaded
*/
onVideoUploadBefore: EventEmitter<{
files: any[];
info: videoInputInformation;
core: Core;
uploadHandler: Function;
}>;
/**
* Called on image upload error
*/
onImageUploadError: EventEmitter<{
errorMessage: string;
result: any;
core: Core;
}>;
/**
* Called before the image is uploaded
*/
onImageUploadBefore: EventEmitter<{
files: any[];
info: imageInputInformation;
core: Core;
uploadHandler: Function;
}>;
/**
* Called on audio upload error
*/
onAudioUploadError: EventEmitter<{
errorMessage: string;
result: any;
core: Core;
}>;
/**
* Drop event
*/
onDrop: EventEmitter<{
e: Event;
cleanData: string;
maxCharCount: number;
core: Core;
}>;
/**
* Called when the contents changes
*/
onChange: EventEmitter<{
content: string;
core: Core;
}>;
/**
* Called just after the controller is positioned and displayed on the screen
*/
showController: EventEmitter<{
name: String;
controllers: Controllers;
core: Core;
}>;
/**
* Called when toggling full screen
*/
toggleFullScreen: EventEmitter<{
isFullScreen: boolean;
core: Core;
}>;
/**
* Called when toggling between code view and wysiwyg view
*/
toggleCodeView: EventEmitter<{
isCodeView: boolean;
core: Core;
}>;
/**
* Called just before the inline toolbar is positioned and displayed on the screen
*/
showInline: EventEmitter<{
toolbar: Element;
context: Context;
core: Core;
}>;
/**
* Called on audio upload
*/
onAudioUpload: EventEmitter<{
targetElement: HTMLAudioElement;
index: number;
state: string;
info: fileInfo;
remainingFilesCount: number;
core: Core;
}>;
/**
* Called on video upload
*/
onVideoUpload: EventEmitter<{
targetElement: HTMLIFrameElement | HTMLVideoElement;
index: number;
state: string;
info: fileInfo;
remainingFilesCount: number;
core: Core;
}>;
/**
* Called on image upload
*/
onImageUpload: EventEmitter<{
targetElement: HTMLImageElement;
index: number;
state: string;
info: fileInfo;
remainingFilesCount: number;
core: Core;
}>;
/**
* Called when cut to clipboard
*/
onCut: EventEmitter<{
e: Event;
clipboardData: any;
core: Core;
}>;
/**
* Called when copy to clipboard
*/
onCopy: EventEmitter<{
e: Event;
clipboardData: any;
core: Core;
}>;
constructor(ngZone: NgZone, options?: SunEditorOptions);
ngAfterViewInit(): void;
/**
* Returns the HTML id Attribute that is randomly generated on startup on every editor instance.
*/
getEditorID(): string;
/**
* Returns the raw editor instance.
* @returns SunEditor
*/
getEditor(): SunEditor;
/**
* Set the toolbar buttons
* @param buttonList any[]
*/
setToolbarButtons(buttonList: any[]): void;
/**
* Pass a `SunEditorOptions` object to the editor to change the options after the editor was created
* @param options SunEditorOptions
*/
setOptions(options: SunEditorOptions): void;
/**
* Define the style of the edit area without re render
* @param style Style string
*/
setDefaultStyle(style: string): void;
/**
* Opens a message in the notice panel (Alert)
* @param message string
*/
noticeOpen(message: string): void;
/**
* Closes the notice panel (Alert)
*/
noticeClose(): void;
/**
* Copying the contents of the editor to the original textarea and return the content or the full textarea. When passed true as param it only returns the content.
* Otherwise the original `HTMLInputElement` is returned
* @param onlyContent boolean
* @returns string | HTMLInputElement - content or the full textarea
*/
save(onlyContent?: boolean): HTMLInputElement | string;
/**
* Gets the SunEditor's context object. Contains settings, plugins, and cached element objects
*/
getContext(): Context;
/**
* Gets the contents of the suneditor
* @param onlyContents boolean - Return only the contents of the body without headers when the "fullPage" option is true
* @returns string - editor content
*/
getContents(onlyContents: boolean): string;
/**
* Gets only the text of the suneditor contents
*/
getText(): string;
/**
* Get the editor's number of characters or binary data size. You can use the "charCounterType" option format.
* @param charCounterType charCounterType
* options - charCounterType ('char', 'byte', 'byte-html') If argument is no value, the currently set "charCounterType" option is used.
* @returns number
*/
getCharCount(charCounterType?: string | undefined): number;
/**
* Gets uploaded images informations
* index: data index
* name: file name
* size: file size
* select: select function
* delete: delete function
* element: img element
* src: src attribute of img tag
* @returns fileInfo[]
*/
getImagesInfo(): fileInfo[];
/**
* Gets uploaded files(plugin using fileManager) information list. image: [img], video: [video, iframe],
* audio: [audio] When the argument value is 'image', it is the same function as "getImagesInfo".
* @param pluginName Plugin name (image, video, audio)
* @returns fileInfo[]
*/
getFilesInfo(pluginName: string): fileInfo[];
/**
* Upload images using image plugin
* @param files FileList
*/
insertImage(files: FileList): void;
/**
* Inserts an HTML element or HTML string or plain string at the current cursor position
* @param html HTML Element or HTML string or plain string
* @param notCleaningData If true, inserts the HTML string without refining it with core.cleanHTML.
* @param checkCharCount f true, if "options.maxCharCount" is exceeded when "element" is added, null is returned without addition.
* @param rangeSelection If true, range select the inserted node.
*/
insertHTML(html: string | Element, notCleaningData?: boolean | undefined, checkCharCount?: boolean | undefined, rangeSelection?: boolean | undefined): void;
/**
* Change the contents of the suneditor
* @param contents Contents to Input
*/
setContents(contents: string): void;
/**
* Add contents to the suneditor
* @param contents Contents to Input
*/
appendContents(contents: string): void;
/**
* Switch to or off "ReadOnly" mode.
* @param value "readOnly" boolean value.
*/
readOnly(value: boolean): void;
/**
* Returns the readonly state of the SunEditor
* @returns boolean
*/
isReadOnly(): boolean;
/**
* Disable the suneditor
*/
disabled(): void;
/**
* Returns the disabled state of the SunEditor
* @returns boolean
*/
isDisabled(): boolean;
/**
* Enable the suneditor
*/
enabled(): void;
/**
* Show the editor
*/
show(): void;
/**
* Hide the editor
*/
hide(): void;
/**
* Returns the hidden state of the editor
* @returns boolean
*/
isHidden(): boolean;
/**
* Add or remove the class name of "body" so that the code block is visible
*/
toggleDisplayBlocks(): void;
/**
* Returns the displayBlocks state of the editor
* @returns boolean
*/
isDisplayBlocks(): boolean;
/**
* Changes to code view or wysiwyg view
*/
toggleCodeViewMode(): void;
/**
* Returns the CodeViewMode state of the editor
* @returns boolean
*/
isCodeViewMode(): boolean;
/**
* Undo changes
*/
undo(): void;
/**
* Redo changes
*/
redo(): void;
/**
* Remove format of the currently selected range
*/
removeFormat(): void;
/**
* Prints the current contents of the editor.
*/
print(): void;
/**
* Open a new tab as preview window.
*/
preview(): void;
/**
* Get the actual history Stack
* @returns any[]
*/
getHistory(): any[];
/**
* Select all in the editor
*/
selectAll(): void;
/**
* Get window selection obejct
* @returns Selection
*/
getSelection(): Selection;
/**
* Set the editor in loading mode. Show a loading spinner, disable inputs and grey out
*/
showLoading(): void;
/**
* Remove the loading mode
*/
closeLoading(): void;
/**
* Returns the loading state of the SunEditor
* @returns boolean
*/
isLoading(): boolean;
/**
* Enabled submenu
* @param element Submenu's button element to call
*/
submenuOn(element: Element): void;
/**
* Disable submenu
*/
submenuOff(): void;
/**
* Enabled container
* @param element Container's button element to call
*/
containerOn(element: Element): void;
/**
* Disable container
*/
containerOff(): void;
/**
* Append the className value of the argument value element
* @param element Elements to add class name
* @param className Class name to be add
*/
addClass(element: Element, className: string): void;
/**
* Class name to be add
* @param element Elements to remove class name
* @param className Class name to be remove
*/
removeClass(element: Element, className: string): void;
/**
* Set style, if all styles are deleted, the style properties are deleted
* @param element Element to set style
* @param styleName Style attribute name (marginLeft, textAlign...)
* @param value Style value
*/
setStyle(element: Element, styleName: string, value: string | number): void;
/**
* Add an event to document. When created as an Iframe, the same event is added to the document in the Iframe.
* @param type event type
* @param listener listener
* @param useCapture boolean
*/
addDocEvent(type: string, listener: EventListener, useCapture: boolean): void;
/**
* Remove events from document. * When created as an Iframe, the event of the document inside the Iframe is also removed
* @param type Event type
* @param listener Event listener
*/
removeDocEvent(type: string, listener: EventListener): void;
/**
* Run plugin calls and basic commands.
* @param command Command string
* @param display Display type string ('command', 'submenu', 'dialog', 'container')
* @param target The element of command button
*/
actionCall(command: string, display: 'dialog' | 'command' | 'submenu' | 'container', target: Element): void;
/**
* Set indentation separator "indent" or "outdent"
* @param command 'indent' | 'outdent'
*/
indent_outdent(command: 'indent' | 'outdent'): void;
/**
* Display blocks in the editor
*/
showBlocks(): void;
/**
* Toggle the editor fullscreen mode
*/
toggleFullScreenMode(): void;
/**
* Returns the fullScreenMode state of the editor
* @returns boolean
*/
isFullScreenMode(): boolean;
/**
* Execute command of command button(All Buttons except submenu and dialog)
* (undo, redo, bold, underline, italic, strikethrough, subscript, superscript, removeFormat,
* indent, outdent, fullscreen, showBlocks, codeview, preview, print, copy, cut, paste)
* @param element The element of command button
* @param command Property of command button (data-value)
*/
commandHandler(element: Element | null, command: commands): void;
/**
* loads the localStorageContent to the Editor
*/
loadLocalStorageContent(): void;
/**
* Save Content to LocalStorage
*/
saveToLocalStorage(): void;
/**
* returns the LocalStorageKey
*/
getLocalStorageKey(): string;
/**
* returns AutoSaveToLocalStorage
*/
getIsAutoSaveToLocalStorage(): boolean;
/**
* returns AutoLoadToLocalStorage
*/
getIsAutoLoadToLocalStorage(): boolean;
private registerEvents;
private generateID;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxSuneditorComponent, [null, { optional: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<NgxSuneditorComponent, "ngx-suneditor", never, { "content": "content"; "editorID": "editorID"; "options": "options"; "onDrop_param": "onDrop_param"; "onCopy_param": "onCopy_param"; "onCut_param": "onCut_param"; "onAudioUploadError_param": "onAudioUploadError_param"; "onImageUploadBefore_param": "onImageUploadBefore_param"; "onImageUploadError_param": "onImageUploadError_param"; "onVideoUploadBefore_param": "onVideoUploadBefore_param"; "onVideoUploadError_param": "onVideoUploadError_param"; "onAudioUploadBefore_param": "onAudioUploadBefore_param"; "onResizeEditor_param": "onResizeEditor_param"; "imageUploadHandler": "imageUploadHandler"; "videoUploadHandler": "videoUploadHandler"; "audioUploadHandler": "audioUploadHandler"; "localStorageConfig": "localStorageConfig"; }, { "created": "created"; "onload": "onload"; "onScroll": "onScroll"; "onMouseDown": "onMouseDown"; "onClick": "onClick"; "onInput": "onInput"; "onKeyDown": "onKeyDown"; "onKeyUp": "onKeyUp"; "onFocus": "onFocus"; "onBlur": "onBlur"; "onResizeEditor": "onResizeEditor"; "onAudioUploadBefore": "onAudioUploadBefore"; "onVideoUploadError": "onVideoUploadError"; "onVideoUploadBefore": "onVideoUploadBefore"; "onImageUploadError": "onImageUploadError"; "onImageUploadBefore": "onImageUploadBefore"; "onAudioUploadError": "onAudioUploadError"; "onDrop": "onDrop"; "onChange": "onChange"; "showController": "showController"; "toggleFullScreen": "toggleFullScreen"; "toggleCodeView": "toggleCodeView"; "showInline": "showInline"; "onAudioUpload": "onAudioUpload"; "onVideoUpload": "onVideoUpload"; "onImageUpload": "onImageUpload"; "onCut": "onCut"; "onCopy": "onCopy"; }, never, never, false, never>;
}