Module to generate dialog windows

Hierarchy

Implements

Constructors

Properties

ES: "es5" | "es2015" | "es2018" | "es2021" = ES
STATUSES: {
    beforeDestruct: "beforeDestruct";
    beforeInit: "beforeInit";
    destructed: "destructed";
    ready: "ready";
} = STATUSES

Type declaration

  • Readonly beforeDestruct: "beforeDestruct"
  • Readonly beforeInit: "beforeInit"
  • Readonly destructed: "destructed"
  • Readonly ready: "ready"
async: IAsync = ...
components: Set<IComponent<IViewBased<IViewOptions>>> = ...

All created ViewComponent inside this view

create: ICreate
defaultOptions: IViewOptions
dialog: HTMLElement
esModern: boolean = IS_ES_MODERN
esNext: boolean = IS_ES_NEXT
id: string

ID attribute for source element, id add {id}_editor it's editor's id

isJodit: boolean = false
isOpened: boolean = false

True, if dialog was opened

isView: true = ...
mods: IDictionary<null | string | boolean> = {}
ownerWindow: Window = window

The window in which jodit was created

registeredButtons: Set<IPluginButton> = ...
uid: string
version: string = APP_VERSION
workplace: HTMLDivElement

Accessors

  • get basePath(): string
  • Get path for loading extra staff

    Returns string

  • get c(): this["create"]
  • Returns this["create"]

  • get componentName(): string
  • Returns string

  • get componentStatus(): ComponentStatus
  • Current component status

    Returns ComponentStatus

  • set componentStatus(componentStatus): void
  • Setter for current component status

    Parameters

    Returns void

  • get defaultTimeout(): number
  • Return default timeout period in milliseconds for some debounce or throttle functions. By default, {history.timeout} options

    Returns number

  • get e(): this["events"]
  • Returns this["events"]

  • get isDestructed(): boolean
  • Component was destructed

    Returns boolean

  • get isFullSize(): boolean
  • View is in fullSize

    Returns boolean

  • get isInDestruct(): boolean
  • The component is currently undergoing destructuring or has already been destroyed. Those. you should not hang new events on him now or do anything else with him.

    Returns boolean

  • get isLocked(): boolean
  • View is locked

    Returns boolean

  • get isReady(): boolean
  • Component is ready for work

    Returns boolean

  • get o(): this["options"]
  • Short alias for options

    Returns this["options"]

  • get options(): this["OPTIONS"]
  • Returns this["OPTIONS"]

  • set options(options): void
  • Parameters

    • options: this["OPTIONS"]

    Returns void

  • get ownerDocument(): Document
  • The document in which jodit was created

    Returns Document

Methods

  • Parameters

    Returns void

  • Recalculate auto sizes

    Returns Dialog

  • Returns string

    • Closes the dialog box , if you want to call the method destruct

    Returns Dialog

    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>&nbsp;' + 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');
  • It destroys all objects created for the windows and also includes all the handlers for the window object

    Returns void

  • Safe get any field

    Type Parameters

    • T

    Parameters

    • chain: string

      the path to be traversed in the obj object

    • Optional 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
  • Calc BEM element class name

    Parameters

    • elementName: string

      element name in the bem classification

    Returns string

  • Parameters

    • elementName: string
    • mod: string

    Returns string

  • Parameters

    • elementName: string
    • mod: string
    • modValue: string | boolean

    Returns string

  • Make one instance of one module

    Type Parameters

    Parameters

    • moduleName: string
    • Optional options: object

    Returns T

  • Get dialog instance with maximum z-index displaying it on top of all the dialog boxes

    Returns IDialog

  • Get BEM class modification value

    Parameters

    • this: IMods
    • name: string

    Returns ModType

  • Returns string

  • Return current version

    Returns string

  • Get zIndex from dialog

    Returns number

  • Adds a handler for changing the component's status

    Parameters

    • status: ComponentStatus

      the status at which the callback is triggered

    • callback: ((component) => void)

      a function that will be called when the status is status

        • (component): void
        • Parameters

          Returns void

    Returns void

  • Internationalization method. Uses Jodit.lang object

    Parameters

    • text: string
    • Rest ...params: (string | number)[]

    Returns string

  • Parameters

    • name: string

    Returns boolean

  • Disable selecting

    Parameters

    • name: string = 'any'

    Returns boolean

  • It opens a dialog box to center it, and causes the two event.

    Parameters

    • destroyAfterClose: boolean

      true - After closing the window , the destructor will be called.

    Returns Dialog

    See

    setHeader

  • It opens a dialog box to center it, and causes the two event.

    Parameters

    • destroyAfterClose: boolean

      true - After closing the window , the destructor will be called.

    • modal: boolean

      true window will be opened in modal mode

    Returns Dialog

    See

    setHeader

  • It opens a dialog box to center it, and causes the two event.

    Parameters

    • Optional content: Content
    • Optional title: Content

      specifies the title of the dialog box,

    • Optional destroyAfterClose: boolean

      true - After closing the window , the destructor will be called.

    • Optional modal: boolean

      true window will be opened in modal mode

    Returns Dialog

    See

    setHeader

  • It specifies the contents of the dialog box. It can take a string and an array of objects

    Parameters

    • content: Content

      A string or an HTML element , or an array of strings and elements

    Returns Dialog

    Example

    var dialog = new Jodi.modules.Dialog(parent);
    dialog.setHeader('Hello world');
    dialog.setContent('<form onsubmit="alert(1);"><input type="text" /></form>');
    dialog.open();
  • Sets the bottom of the dialog. It can take a string and an array of objects

    Parameters

    • content: Content

      A string or an HTML element , or an array of strings and elements

    Returns Dialog

    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();
  • Specifies the dialog box title . It can take a string and an array of objects

    Parameters

    • content: Content

      A string or an HTML element , or an array of strings and elements

    Returns Dialog

    Example

    var dialog = new Jodi.modules.Dialog(parent);
    dialog.setHeader('Hello world');
    dialog.setHeader(['Hello world', '<button>OK</button>', $('<div>some</div>')]);
    dialog.open();
  • Sets the maximum z-index dialog box, displaying it on top of all the dialog boxes

    Returns void

  • Set modal mode

    Parameters

    • modal: undefined | boolean

    Returns Dialog

  • Change panel container

    Parameters

    Returns void

  • 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

    • Optional x: number

      Position px Horizontal

    • Optional y: number

      Position px Vertical

    Returns Dialog

  • Specifies the size of the window

    Parameters

    • Optional w: string | number

      The width of the window

    • Optional h: string | number

      The height of the window

    Returns Dialog

  • Set component status

    Parameters

    Returns void

    See

    ComponentStatus

  • Expands the dialog on full browser window

    Parameters

    • Optional isFullSize: boolean

    Returns void

  • Enable selecting

    Returns boolean

Jodit PRO

If you like Jodit - try Jodit PRO