ContextMenu

modules/context-menu.ContextMenu

Module to generate context menu

Hierarchy

  • Popup

    ↳ ContextMenu

Implements

constructor

new ContextMenu(jodit, smart?): ContextMenu

Parameters

Name Type Default value
jodit IViewBased<IViewOptions> undefined
smart boolean true

Returns

ContextMenu

Inherited from

Popup.constructor

Defined in

src/core/ui/popup/popup.ts#465

STATUSES

Static STATUSES: Object = STATUSES

Type declaration

Name Type
beforeInit "beforeInit"
ready "ready"
beforeDestruct "beforeDestruct"
destructed "destructed"

Inherited from

Popup.STATUSES

Defined in

src/core/component/component.ts#40


async

async: IAsync

Implementation of

IContextMenu.async

Inherited from

Popup.async

Defined in

src/core/component/component.ts#44


uid

Readonly uid: string

Implementation of

IContextMenu.uid

Inherited from

Popup.uid

Defined in

src/core/component/component.ts#59


ownerWindow

ownerWindow: Window = window

The window in which jodit was created

Implementation of

IContextMenu.ownerWindow

Inherited from

Popup.ownerWindow

Defined in

src/core/component/component.ts#109


jodit

jodit: IViewBased<IViewOptions>

Parent View element

Implementation of

IContextMenu.jodit

Inherited from

Popup.jodit

Defined in

src/core/component/view-component.ts#22


container

container: HTMLElement

Implementation of

IContextMenu.container

Inherited from

Popup.container

Defined in

src/core/ui/element.ts#32


name

name: string = ''

Implementation of

IContextMenu.name

Inherited from

Popup.name

Defined in

src/core/ui/element.ts#33


mods

Readonly mods: IDictionary<null | string | boolean> = {}

Implementation of

IContextMenu.mods

Inherited from

Popup.mods

Defined in

src/core/ui/element.ts#119


syncMod

syncMod: boolean = false

Synchronize mods to all children

Inherited from

Popup.syncMod

Defined in

src/core/ui/group/group.ts#42


elements

elements: IUIElement[] = []

Inherited from

Popup.elements

Defined in

src/core/ui/group/group.ts#44


buttonSize

buttonSize: "small" | "tiny" | "xsmall" | "middle" | "large" = 'middle'

Inherited from

Popup.buttonSize

Defined in

src/core/ui/group/group.ts#71


options

Optional Readonly options: IDictionary

Inherited from

Popup.options

Defined in

src/core/ui/group/group.ts#155


isOpened

isOpened: boolean = false

Implementation of

IContextMenu.isOpened

Inherited from

Popup.isOpened

Defined in

src/core/ui/popup/popup.ts#58


strategy

strategy: PopupStrategy = 'leftBottom'

Implementation of

IContextMenu.strategy

Inherited from

Popup.strategy

Defined in

src/core/ui/popup/popup.ts#59


viewBound

viewBound: () => IBound

Type declaration

(): IBound

Returns

IBound

Implementation of

IContextMenu.viewBound

Inherited from

Popup.viewBound

Defined in

src/core/ui/popup/popup.ts#69


smart

Readonly smart: boolean = true

Inherited from

Popup.smart

Defined in

src/core/ui/popup/popup.ts#467

componentName

get componentName(): string

Returns

string

Implementation of

IContextMenu.componentName

Inherited from

Popup.componentName

Defined in

src/core/component/component.ts#46


ownerDocument

get ownerDocument(): Document

The document in which jodit was created

Returns

Document

Implementation of

IContextMenu.ownerDocument

Inherited from

Popup.ownerDocument

Defined in

src/core/component/component.ts#95


od

get od(): Document

Shortcut for this.ownerDocument

Returns

Document

Implementation of

IContextMenu.od

Inherited from

Popup.od

Defined in

src/core/component/component.ts#102


ow

get ow(): Window

Returns

Window

Implementation of

IContextMenu.ow

Inherited from

Popup.ow

Defined in

src/core/component/component.ts#110


isReady

get isReady(): boolean

Component is ready for work

Returns

boolean

Implementation of

IContextMenu.isReady

Inherited from

Popup.isReady

Defined in

src/core/component/component.ts#145


isDestructed

get isDestructed(): boolean

Component was destructed

Returns

boolean

Implementation of

IContextMenu.isDestructed

Inherited from

Popup.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

IContextMenu.isInDestruct

Inherited from

Popup.isInDestruct

Defined in

src/core/component/component.ts#160


componentStatus

get componentStatus(): ComponentStatus

Current component status

Returns

ComponentStatus

Implementation of

IContextMenu.componentStatus

Inherited from

Popup.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

IContextMenu.componentStatus

Inherited from

Popup.componentStatus

Defined in

src/core/component/component.ts#217


j

get j(): T

Shortcut for this.jodit

Returns

T

Implementation of

IContextMenu.j

Inherited from

Popup.j

Defined in

src/core/component/view-component.ts#27


defaultTimeout

get defaultTimeout(): number

Returns

number

Implementation of

IContextMenu.defaultTimeout

Inherited from

Popup.defaultTimeout

Defined in

src/core/component/view-component.ts#31


parentElement

get parentElement(): Nullable<IUIElement>

Returns

Nullable<IUIElement>

Implementation of

IContextMenu.parentElement

Inherited from

Popup.parentElement

Defined in

src/core/ui/element.ts#37

set parentElement(parentElement): void

Parameters

Name Type
parentElement Nullable<IUIElement>

Returns

void

Implementation of

IContextMenu.parentElement

Inherited from

Popup.parentElement

Defined in

src/core/ui/element.ts#41


allChildren

get allChildren(): IUIElement[]

All group children

Returns

IUIElement[]

Inherited from

Popup.allChildren

Defined in

src/core/ui/group/group.ts#49

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

IContextMenu.getFullElName

Inherited from

Popup.getFullElName

Defined in

src/core/component/component.ts#65

getFullElName(elementName, mod): string

Parameters

Name Type
elementName string
mod string

Returns

string

Implementation of

IContextMenu.getFullElName

Inherited from

Popup.getFullElName

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

IContextMenu.getFullElName

Inherited from

Popup.getFullElName

Defined in

src/core/component/component.ts#67


bindDestruct

bindDestruct(component): this

Bind destructor to some View

Parameters

Name Type
component IComponent<IViewBased<IViewOptions>>

Returns

this

Implementation of

IContextMenu.bindDestruct

Inherited from

Popup.bindDestruct

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

IContextMenu.setStatus

Inherited from

Popup.setStatus

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

IContextMenu.hookStatus

Inherited from

Popup.hookStatus

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

Popup.isInstanceOf

Defined in

src/core/component/component.ts#283


i18n

i18n(text, ...params): string

Parameters

Name Type
text string
...params (string | number)[]

Returns

string

Implementation of

IContextMenu.i18n

Inherited from

Popup.i18n

Defined in

src/core/component/view-component.ts#35


setParentView

setParentView(jodit): this

Attach component to View

Parameters

Name Type
jodit IViewBased<IViewOptions>

Returns

this

Implementation of

IContextMenu.setParentView

Inherited from

Popup.setParentView

Defined in

src/core/component/view-component.ts#42


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

Nullable<HTMLElement>

Implementation of

IContextMenu.getElm

Inherited from

Popup.getElm

Defined in

src/core/traits/elms.ts#18


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

HTMLElement[]

Implementation of

IContextMenu.getElms

Inherited from

Popup.getElms

Defined in

src/core/traits/elms.ts#30


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

IContextMenu.setMod

Inherited from

Popup.setMod

Defined in

src/core/traits/mods.ts#30


getMod

getMod(this, name): ModType

Get BEM class modification value

Parameters

Name Type
this IMods
name string

Returns

ModType

Implementation of

IContextMenu.getMod

Inherited from

Popup.getMod

Defined in

src/core/traits/mods.ts#64


bubble

bubble(callback): this

Apply callback for all parents

Parameters

Name Type
callback (parent: IUIElement) => void

Returns

this

Implementation of

IContextMenu.bubble

Inherited from

Popup.bubble

Defined in

src/core/ui/element.ts#51


get

get<T>(chain, obj?): Nullable<T>

Type parameters

Name
T

Parameters

Name Type
chain string
obj? IDictionary

Returns

Nullable<T>

Implementation of

IContextMenu.get

Inherited from

Popup.get

Defined in

src/core/ui/element.ts#68


closest

closest<T>(type): Nullable<T extends typeof UIElement ? InstanceType<T<T>> : T>

Find match parent

Type parameters

Name Type
T extends typeof UIElement | UIElement<IViewBased<IViewOptions>>

Parameters

Name Type
type Function | UIElement<IViewBased<IViewOptions>>

Returns

Nullable<T extends typeof UIElement ? InstanceType<T<T>> : T>

Implementation of

IContextMenu.closest

Inherited from

Popup.closest

Defined in

src/core/ui/element.ts#75


closestElement

closestElement(node, type): Nullable<IUIElement>

Find closest UIElement in DOM

Parameters

Name Type
node Node
type Function

Returns

Nullable<IUIElement>

Inherited from

Popup.closestElement

Defined in

src/core/ui/element.ts#106


appendTo

appendTo(element): this

Append container to element

Parameters

Name Type
element HTMLElement

Returns

this

Implementation of

IContextMenu.appendTo

Inherited from

Popup.appendTo

Defined in

src/core/ui/element.ts#131


update

update(): void

Update all children

Returns

void

Implementation of

IContextMenu.update

Inherited from

Popup.update

Defined in

src/core/ui/group/group.ts#77


append

append(elm, distElement?): this

Append new element into group

Parameters

Name Type
elm IUIElement | IUIElement[]
distElement? string

Returns

this

Inherited from

Popup.append

Defined in

src/core/ui/group/group.ts#85


afterSetMod

afterSetMod(name, value): void

Parameters

Name Type
name string
value ModType

Returns

void

Implementation of

IContextMenu.afterSetMod

Inherited from

Popup.afterSetMod

Defined in

src/core/ui/group/group.ts#111


remove

remove(elm): this

Remove element from group

Parameters

Name Type
elm IUIElement

Returns

this

Inherited from

Popup.remove

Defined in

src/core/ui/group/group.ts#127


clear

clear(): this

Clear group

Returns

this

Inherited from

Popup.clear

Defined in

src/core/ui/group/group.ts#142


updateParentElement

updateParentElement(target): this

Parameters

Name Type
target IUIElement

Returns

this

Implementation of

IContextMenu.updateParentElement

Inherited from

Popup.updateParentElement

Defined in

src/core/ui/popup/popup.ts#80


setContent

setContent(content): this

Set popup content

Parameters

Name Type
content string | HTMLElement | IUIElement

Returns

this

Implementation of

IContextMenu.setContent

Inherited from

Popup.setContent

Defined in

src/core/ui/popup/popup.ts#103


open

open(getBound, keepPosition?, parentContainer?): this

Open popup near with some bound

Parameters

Name Type Default value
getBound getBoundFunc undefined
keepPosition boolean false
parentContainer? HTMLElement undefined

Returns

this

Implementation of

IContextMenu.open

Inherited from

Popup.open

Defined in

src/core/ui/popup/popup.ts#126


updatePosition

updatePosition(): this

Update container position

Returns

this

Implementation of

IContextMenu.updatePosition

Inherited from

Popup.updatePosition

Defined in

src/core/ui/popup/popup.ts#249


close

close(): this

Close popup

Returns

this

Implementation of

IContextMenu.close

Inherited from

Popup.close

Defined in

src/core/ui/popup/popup.ts#366


isOwnClick

isOwnClick(e): boolean

Parameters

Name Type
e MouseEvent

Returns

boolean

Implementation of

IContextMenu.isOwnClick

Inherited from

Popup.isOwnClick

Defined in

src/core/ui/popup/popup.ts#396


setZIndex

setZIndex(index): void

Set ZIndex

Parameters

Name Type
index string | number

Returns

void

Implementation of

IContextMenu.setZIndex

Inherited from

Popup.setZIndex

Defined in

src/core/ui/popup/popup.ts#461


render

render(): string

Returns

string

Inherited from

Popup.render

Defined in

src/core/ui/popup/popup.ts#473


destruct

destruct(): any

Returns

any

Implementation of

IContextMenu.destruct

Inherited from

Popup.destruct

Defined in

src/core/ui/popup/popup.ts#480


className

className(): string

Returns

string

Implementation of

IContextMenu.className

Overrides

Popup.className

Defined in

src/modules/context-menu/context-menu.ts#27


show

show(x, y, actions): void

Generate and show context menu

Parameters

Name Type Description
x number Global coordinate by X
y number Global coordinate by Y
actions (false | IContextMenuAction)[] Array with plain objects {icon: 'bin', title: 'Delete', exec: function () {}}

Returns

void

Example

parent.show(e.clientX, e.clientY, [{icon: 'bin', title: 'Delete', exec: function () { alert(1) }}]);

Implementation of

IContextMenu.show

Defined in

jodit/src/modules/context-menu/context-menu.ts:42