Dialog
- Hierarchy
- Implements
- constructor
- STATUSES
- async
- uid
- ownerWindow
- TOOLBAR
- registeredButtons
- isJodit
- isView
- parent
- mods
- id
- components
- ES
- version
- esNext
- esModern
- create
- events
- toolbar
- OPTIONS
- dialog
- workplace
- isOpened
- defaultOptions
- componentName
- ownerDocument
- od
- ow
- isReady
- isDestructed
- isInDestruct
- componentStatus
- toolbarContainer
- basePath
- minified
- defaultTimeout
- buffer
- message
- storage
- c
- container
- e
- progressbar
- options
- o
- isLocked
- isFullSize
- getFullElName
- get
- bindDestruct
- setStatus
- hookStatus
- isInstanceOf
- getElm
- getElms
- afterSetMod
- setMod
- getMod
- setPanel
- getRegisteredButtonGroups
- registerButton
- unregisterButton
- i18n
- isLockedNotBy
- lock
- unlock
- getVersion
- getVersion
- getInstance
- className
- setSize
- calcAutoSize
- setPosition
- setHeader
- setContent
- setFooter
- getZIndex
- getMaxZIndexDialog
- setMaxZIndex
- toggleFullSize
- open
- setModal
- close
- destruct
modules/dialog.Dialog
Module to generate dialog windows
Hierarchy
-
↳
Dialog
Implements
constructor
new Dialog(options?): Dialog
Parameters
| Name | Type |
|---|---|
options |
Partial<IDialogOptions> |
Returns
Overrides
ViewWithToolbar.constructor
Defined in
src/modules/dialog/dialog.ts#704
STATUSES
Static STATUSES: Object = STATUSES
Type declaration
| Name | Type |
|---|---|
beforeInit |
"beforeInit" |
ready |
"ready" |
beforeDestruct |
"beforeDestruct" |
destructed |
"destructed" |
Inherited from
Defined in
src/core/component/component.ts#40
async
async: IAsync
Implementation of
Inherited from
Defined in
src/core/component/component.ts#44
uid
Readonly uid: string
Implementation of
Inherited from
Defined in
src/core/component/component.ts#59
ownerWindow
ownerWindow: Window = window
The window in which jodit was created
Implementation of
Inherited from
Defined in
src/core/component/component.ts#109
TOOLBAR
TOOLBAR: IToolbarCollection
Inherited from
Defined in
src/core/view/view-with-toolbar.ts#35
registeredButtons
registeredButtons: Set<IPluginButton>
Inherited from
ViewWithToolbar.registeredButtons
Defined in
src/core/view/view-with-toolbar.ts#88
isJodit
Readonly isJodit: boolean = false
Inherited from
Defined in
src/core/view/view-with-toolbar.ts#165
isView
Readonly isView: true
Implementation of
Inherited from
Defined in
parent
parent: Nullable<IViewBased<IViewOptions>> = null
Implementation of
Inherited from
Defined in
mods
Readonly mods: IDictionary<null | string | boolean> = {}
Implementation of
Inherited from
Defined in
id
id: string
ID attribute for a source element, id add {id}_editor it's editor's id
Implementation of
Inherited from
Defined in
components
Readonly components: Set<IComponent<IViewBased<IViewOptions>>>
All created ViewComponent inside this view
Implementation of
Inherited from
Defined in
ES
Static Readonly ES: "es5" | "es2015" | "es2018" | "es2021" = ES
Inherited from
Defined in
version
Static Readonly version: string = APP_VERSION
Inherited from
Defined in
esNext
Static Readonly esNext: boolean = IS_ES_NEXT
Inherited from
Defined in
esModern
Static Readonly esModern: boolean = IS_ES_MODERN
Inherited from
Defined in
create
Readonly create: ICreate
Implementation of
Inherited from
Defined in
events
events: IEventEmitter
Implementation of
Inherited from
Defined in
toolbar
toolbar: IToolbarCollection
Overrides
Defined in
src/modules/dialog/dialog.ts#91
OPTIONS
OPTIONS: IDialogOptions
Implementation of
Overrides
Defined in
src/modules/dialog/dialog.ts#340
dialog
Readonly dialog: HTMLElement
Implementation of
Defined in
src/modules/dialog/dialog.ts#342
workplace
workplace: HTMLDivElement
Defined in
src/modules/dialog/dialog.ts#344
isOpened
isOpened: boolean = false
True, if dialog was opened
Implementation of
Defined in
src/modules/dialog/dialog.ts#635
defaultOptions
Static defaultOptions: IDialogOptions
Overrides
ViewWithToolbar.defaultOptions
Defined in
src/modules/dialog/dialog.ts#855
componentName
get componentName(): string
Returns
string
Implementation of
Inherited from
ViewWithToolbar.componentName
Defined in
src/core/component/component.ts#46
ownerDocument
get ownerDocument(): Document
The document in which jodit was created
Returns
Implementation of
Inherited from
ViewWithToolbar.ownerDocument
Defined in
src/core/component/component.ts#95
od
get od(): Document
Shortcut for this.ownerDocument
Returns
Implementation of
Inherited from
ViewWithToolbar.od
Defined in
src/core/component/component.ts#102
ow
get ow(): Window
Returns
Implementation of
Inherited from
ViewWithToolbar.ow
Defined in
src/core/component/component.ts#110
isReady
get isReady(): boolean
Component is ready for work
Returns
boolean
Implementation of
Inherited from
ViewWithToolbar.isReady
Defined in
src/core/component/component.ts#145
isDestructed
get isDestructed(): boolean
Component was destructed
Returns
boolean
Implementation of
Inherited from
ViewWithToolbar.isDestructed
Defined in
src/core/component/component.ts#152
isInDestruct
get isInDestruct(): boolean
The component is currently undergoing destructuring or has already been destroyed.
Those. you should not the app froze new events on him now or do anything else with him.
Returns
boolean
Implementation of
Inherited from
ViewWithToolbar.isInDestruct
Defined in
src/core/component/component.ts#160
componentStatus
get componentStatus(): ComponentStatus
Current component status
Returns
Implementation of
Inherited from
ViewWithToolbar.componentStatus
Defined in
src/core/component/component.ts#210
set componentStatus(componentStatus): void
Setter for current component status
Parameters
| Name | Type |
|---|---|
componentStatus |
ComponentStatus |
Returns
void
Implementation of
Inherited from
ViewWithToolbar.componentStatus
Defined in
src/core/component/component.ts#217
toolbarContainer
get toolbarContainer(): HTMLElement
Container for toolbar
Returns
Inherited from
ViewWithToolbar.toolbarContainer
Defined in
src/core/view/view-with-toolbar.ts#44
basePath
get basePath(): string
Get a path for loading extra staff
Returns
string
Implementation of
Inherited from
ViewWithToolbar.basePath
Defined in
minified
get minified(): boolean
Plugin autoloader should load minified version of the file
Returns
boolean
Implementation of
Inherited from
ViewWithToolbar.minified
Defined in
defaultTimeout
get defaultTimeout(): number
Return a default timeout period in milliseconds for some debounce or throttle functions.
By default, {history.timeout} options
Returns
number
Implementation of
Inherited from
ViewWithToolbar.defaultTimeout
Defined in
buffer
get buffer(): IStorage<StorageValueType>
Some extra data inside editor
Returns
See
copyformat plugin
Implementation of
Inherited from
ViewWithToolbar.buffer
Defined in
message
get message(): IMessages
Returns
Implementation of
Inherited from
ViewWithToolbar.message
Defined in
storage
get storage(): IStorage<StorageValueType>
Container for persistent set/get value
Returns
Implementation of
Inherited from
ViewWithToolbar.storage
Defined in
c
get c(): this["create"]
Short alias for create
Returns
this["create"]
Implementation of
Inherited from
ViewWithToolbar.c
Defined in
container
get container(): HTMLDivElement
Returns
Implementation of
Inherited from
ViewWithToolbar.container
Defined in
set container(container): void
Parameters
| Name | Type |
|---|---|
container |
HTMLDivElement |
Returns
void
Implementation of
Inherited from
ViewWithToolbar.container
Defined in
e
get e(): this["events"]
Short alias for events
Returns
this["events"]
Implementation of
Inherited from
ViewWithToolbar.e
Defined in
progressbar
get progressbar(): IProgressBar
progress_bar Progress bar
Returns
Implementation of
Inherited from
ViewWithToolbar.progressbar
Defined in
options
get options(): this["OPTIONS"]
Returns
this["OPTIONS"]
Implementation of
Inherited from
ViewWithToolbar.options
Defined in
set options(options): void
Parameters
| Name | Type |
|---|---|
options |
this["OPTIONS"] |
Returns
void
Implementation of
Inherited from
ViewWithToolbar.options
Defined in
o
get o(): this["options"]
Short alias for options
Returns
this["options"]
Implementation of
Inherited from
ViewWithToolbar.o
Defined in
isLocked
get isLocked(): boolean
View is locked
Returns
boolean
Implementation of
Inherited from
ViewWithToolbar.isLocked
Defined in
isFullSize
get isFullSize(): boolean
View is in fullSize
Returns
boolean
Implementation of
Inherited from
ViewWithToolbar.isFullSize
Defined in
getFullElName
getFullElName(elementName): string
Calc BEM element class name
Parameters
| Name | Type | Description |
|---|---|---|
elementName |
string |
element name in the bem classification |
Returns
string
Implementation of
Inherited from
Defined in
src/core/component/component.ts#65
getFullElName(elementName, mod): string
Parameters
| Name | Type |
|---|---|
elementName |
string |
mod |
string |
Returns
string
Implementation of
Inherited from
Defined in
src/core/component/component.ts#66
getFullElName(elementName, mod, modValue): string
Parameters
| Name | Type |
|---|---|
elementName |
string |
mod |
string |
modValue |
string | boolean |
Returns
string
Implementation of
Inherited from
Defined in
src/core/component/component.ts#67
get
get<T>(chain, obj?): Nullable<T>
Safe get any field
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
chain |
string |
the path to be traversed in the obj object |
obj? |
IDictionary |
the object in which the value is searched |
Returns
Nullable<T>
Example
private a = {
b: {
c: {
e: {
g: {
color: 'red'
}
}
}
}
}
this.get('a.b.c.e.g.color'); // Safe access to color
// instead using optionsl chaining
this?.a?.b?.c?.e?.g?.color
Implementation of
Inherited from
Defined in
src/core/component/component.ts#138
bindDestruct
bindDestruct(component): this
Bind destructor to some View
Parameters
| Name | Type |
|---|---|
component |
IComponent<IViewBased<IViewOptions>> |
Returns
this
Implementation of
Inherited from
Defined in
src/core/component/component.ts#170
setStatus
setStatus(componentStatus): void
Set component status
Parameters
| Name | Type | Description |
|---|---|---|
componentStatus |
ComponentStatus |
component status |
Returns
void
See
ComponentStatus
Implementation of
Inherited from
Defined in
src/core/component/component.ts#226
hookStatus
hookStatus(status, callback): void
Adds a handler for changing the component's status
Parameters
| Name | Type | Description |
|---|---|---|
status |
ComponentStatus |
the status at which the callback is triggered |
callback |
(component: this) => void |
a function that will be called when the status is status |
Returns
void
Implementation of
Inherited from
Defined in
src/core/component/component.ts#265
isInstanceOf
isInstanceOf<T>(c, constructorFunc): c is T
Type parameters
| Name | Type |
|---|---|
T |
extends Component |
Parameters
| Name | Type |
|---|---|
c |
unknown |
constructorFunc |
Function |
Returns
c is T
Inherited from
Defined in
src/core/component/component.ts#283
getElm
getElm<T>(this, elementName): Nullable<HTMLElement>
Return element with BEM class name
Type parameters
| Name | Type |
|---|---|
T |
extends IComponent<IViewBased<IViewOptions>> & IContainer & IElms |
Parameters
| Name | Type |
|---|---|
this |
T |
elementName |
string |
Returns
Implementation of
Inherited from
Defined in
getElms
getElms<T>(this, elementName): HTMLElement[]
Return elements with BEM class name
Type parameters
| Name | Type |
|---|---|
T |
extends IComponent<IViewBased<IViewOptions>> & IContainer & IElms |
Parameters
| Name | Type |
|---|---|
this |
T |
elementName |
string |
Returns
Implementation of
Inherited from
Defined in
afterSetMod
afterSetMod(name, value): void
Parameters
| Name | Type |
|---|---|
name |
string |
value |
ModType |
Returns
void
Implementation of
Inherited from
Defined in
setMod
setMod<T>(this, name, value, container?): T
Set/remove BEM class modification
Type parameters
| Name | Type |
|---|---|
T |
extends IComponent<IViewBased<IViewOptions>> & IContainer & IMods |
Parameters
| Name | Type | Description |
|---|---|---|
this |
T |
- |
name |
string |
- |
value |
ModType |
if null, mod will be removed |
container? |
HTMLElement |
- |
Returns
T
Implementation of
Inherited from
Defined in
getMod
getMod(this, name): ModType
Get BEM class modification value
Parameters
| Name | Type |
|---|---|
this |
IMods |
name |
string |
Returns
Implementation of
Inherited from
Defined in
setPanel
setPanel(element): void
Change panel container
Parameters
| Name | Type |
|---|---|
element |
string | HTMLElement |
Returns
void
Inherited from
Defined in
src/core/view/view-with-toolbar.ts#64
getRegisteredButtonGroups
getRegisteredButtonGroups(): IDictionary<string[]>
Returns
IDictionary<string[]>
Inherited from
ViewWithToolbar.getRegisteredButtonGroups
Defined in
src/core/view/view-with-toolbar.ts#91
registerButton
registerButton(btn): this
Register button for a group
Parameters
| Name | Type |
|---|---|
btn |
IPluginButton |
Returns
this
Inherited from
ViewWithToolbar.registerButton
Defined in
src/core/view/view-with-toolbar.ts#98
unregisterButton
unregisterButton(btn): this
Remove button from a group
Parameters
| Name | Type |
|---|---|
btn |
IPluginButton |
Returns
this
Inherited from
ViewWithToolbar.unregisterButton
Defined in
src/core/view/view-with-toolbar.ts#118
i18n
i18n(text, ...params): string
Internationalization method. Uses Jodit.lang object
Parameters
| Name | Type |
|---|---|
text |
string |
...params |
(string | number)[] |
Returns
string
Implementation of
Inherited from
Defined in
isLockedNotBy
isLockedNotBy(name): boolean
Parameters
| Name | Type |
|---|---|
name |
string |
Returns
boolean
Implementation of
Inherited from
Defined in
lock
lock(name?): boolean
Disable selecting
Parameters
| Name | Type | Default value |
|---|---|---|
name |
string |
'any' |
Returns
boolean
Implementation of
Inherited from
Defined in
unlock
unlock(): boolean
Enable selecting
Returns
boolean
Implementation of
Inherited from
Defined in
getVersion
getVersion(): string
Return current version
Returns
string
Implementation of
Inherited from
Defined in
getVersion
getVersion(): string
Returns
string
Inherited from
Defined in
getInstance
getInstance<T>(module, options?): T
Make one instance of one module
Type parameters
| Name | Type |
|---|---|
T |
extends IComponent<IViewBased<IViewOptions>> |
Parameters
| Name | Type |
|---|---|
module |
Function |
options? |
object |
Returns
T
Implementation of
Inherited from
Defined in
getInstance<T>(moduleName, options?): T
Type parameters
| Name | Type |
|---|---|
T |
extends IComponent<IViewBased<IViewOptions>> |
Parameters
| Name | Type |
|---|---|
moduleName |
string |
options? |
object |
Returns
T
Implementation of
Inherited from
Defined in
className
className(): string
Returns
string
Implementation of
Overrides
Defined in
src/modules/dialog/dialog.ts#86
setSize
setSize(w?, h?): this
Specifies the size of the window
Parameters
| Name | Type | Description |
|---|---|---|
w? |
string | number |
The width of the window |
h? |
string | number |
The height of the window |
Returns
this
Implementation of
Defined in
src/modules/dialog/dialog.ts#357
calcAutoSize
calcAutoSize(): this
Recalculate auto sizes
Returns
this
Implementation of
Defined in
src/modules/dialog/dialog.ts#377
setPosition
setPosition(x?, y?): this
Specifies the position of the upper left corner of the window . If x and y are specified,
the window is centered on the center of the screen
Parameters
| Name | Type | Description |
|---|---|---|
x? |
number |
Position px Horizontal |
y? |
number |
Position px Vertical |
Returns
this
Implementation of
Defined in
src/modules/dialog/dialog.ts#391
setHeader
setHeader(content): this
Specifies the dialog box title . It can take a string and an array of objects
Parameters
| Name | Type | Description |
|---|---|---|
content |
Content |
A string or an HTML element , or an array of strings and elements |
Returns
this
Example
var dialog = new Jodi.modules.Dialog(parent);
dialog.setHeader('Hello world');
dialog.setHeader(['Hello world', '<button>OK</button>', $('<div>some</div>')]);
dialog.open();
Implementation of
Defined in
src/modules/dialog/dialog.ts#431
setContent
setContent(content): this
It specifies the contents of the dialog box. It can take a string and an array of objects
Parameters
| Name | Type | Description |
|---|---|---|
content |
Content |
A string or an HTML element , or an array of strings and elements |
Returns
this
Example
var dialog = new Jodi.modules.Dialog(parent);
dialog.setHeader('Hello world');
dialog.setContent('<form onsubmit="alert(1);"><input type="text" /></form>');
dialog.open();
Implementation of
Defined in
src/modules/dialog/dialog.ts#449
setFooter
setFooter(content): this
Sets the bottom of the dialog. It can take a string and an array of objects
Parameters
| Name | Type | Description |
|---|---|---|
content |
Content |
A string or an HTML element , or an array of strings and elements |
Returns
this
Example
var dialog = new Jodi.modules.Dialog(parent);
dialog.setHeader('Hello world');
dialog.setContent('<form><input id="someText" type="text" /></form>');
dialog.setFooter([
$('<a class="jodit-button">OK</a>').click(function () {
alert($('someText').val())
dialog.close();
})
]);
dialog.open();
Implementation of
Defined in
src/modules/dialog/dialog.ts#473
getZIndex
getZIndex(): number
Get zIndex from dialog
Returns
number
Implementation of
Defined in
src/modules/dialog/dialog.ts#482
getMaxZIndexDialog
getMaxZIndexDialog(): IDialog
Get dialog instance with maximum z-index displaying it on top of all the dialog boxes
Returns
Defined in
src/modules/dialog/dialog.ts#489
setMaxZIndex
setMaxZIndex(): void
Sets the maximum z-index dialog box, displaying it on top of all the dialog boxes
Returns
void
Defined in
src/modules/dialog/dialog.ts#511
toggleFullSize
toggleFullSize(isFullSize?): void
Expands the dialog on full browser window
Parameters
| Name | Type |
|---|---|
isFullSize? |
boolean |
Returns
void
Implementation of
Overrides
ViewWithToolbar.toggleFullSize
Defined in
src/modules/dialog/dialog.ts#528
open
open(destroyAfterClose): this
It opens a dialog box to center it, and causes the two event.
Parameters
| Name | Type | Description |
|---|---|---|
destroyAfterClose |
boolean |
true - After closing the window , the destructor will be called. |
Returns
this
See
setHeader
Implementation of
Defined in
src/modules/dialog/dialog.ts#538
open(destroyAfterClose, modal): this
It opens a dialog box to center it, and causes the two event.
Parameters
| Name | Type | Description |
|---|---|---|
destroyAfterClose |
boolean |
true - After closing the window , the destructor will be called. |
modal |
boolean |
true window will be opened in modal mode |
Returns
this
See
setHeader
Implementation of
Defined in
src/modules/dialog/dialog.ts#540
open(content?, title?, destroyAfterClose?, modal?): this
It opens a dialog box to center it, and causes the two event.
Parameters
| Name | Type | Description |
|---|---|---|
content? |
string | HTMLElement | IContainer | ContentItem[] | (string | HTMLElement | IContainer | ContentItem[])[] |
- |
title? |
string | HTMLElement | IContainer | ContentItem[] | (string | HTMLElement | IContainer | ContentItem[])[] |
specifies the title of the dialog box, |
destroyAfterClose? |
boolean |
true - After closing the window , the destructor will be called. |
modal? |
boolean |
true window will be opened in modal mode |
Returns
this
See
setHeader
Implementation of
Defined in
src/modules/dialog/dialog.ts#542
setModal
setModal(modal): this
Set modal mode
Parameters
| Name | Type |
|---|---|
modal |
undefined | boolean |
Returns
this
Implementation of
Defined in
src/modules/dialog/dialog.ts#625
close
close(): this
Closes the dialog box , if you want to call the method destruct
Returns
this
See
destroy
Example
//You can close dialog two ways
var dialog = new Jodit.modules.Dialog();
dialog.open('Hello world!', 'Title');
var $close = dialog.create.fromHTML('<a href="#" style="float:left;" class="jodit-button">
<i class="icon icon-check"></i> ' + Jodit.prototype.i18n('Ok') + '</a>');
$close.addEventListener('click', function () {
dialog.close();
});
dialog.setFooter($close);
// and second way, you can close dialog from content
dialog.open('<a onclick="var event = doc.createEvent('HTMLEvents'); event.initEvent('close_dialog', true, true);
this.dispatchEvent(event)">Close</a>', 'Title');
Implementation of
Defined in
src/modules/dialog/dialog.ts#658
destruct
destruct(): void
It destroys all objects created for the windows and also includes all the handlers for the window object
Returns
void
Implementation of
Overrides
Defined in
jodit/src/modules/dialog/dialog.ts:832