Editor.UI (DOM Utils Module)
Methods
Editor.UI.createStyleElement (url)
urlstring
Load url content and create a style element to wrap it.
Editor.UI.clear (element)
elementHTMLElement
Remove all child element.
Editor.UI.index (element)
elementHTMLElement
Get the index of the element
Editor.UI.parentElement (element)
elementHTMLElement
Get the parent element, it will go through the host if it is a shadow element.
Editor.UI.offsetTo (el, parentEL)
elHTMLElementparentELHTMLElement
Returns the offset {x, y} from el to parentEL
Editor.UI.walk (el, [opts,] cb)
elHTMLElementoptsobjectdiveToShadowbooleanexcludeSelfboolean
cbfunction
Recursively search children use depth first algorithm.
Editor.UI.fire (element, eventName, opts)
elementHTMLElementeventNamestringoptsobject
Fires a CustomEvent to the specific element. Example:
Editor.fire(el, 'foobar', {
bubbles: false,
detail: {
value: 'Hello World!'
}
});
Editor.UI.acceptEvent (event)
eventEvent
Call preventDefault and stopImmediatePropagation for the event
Editor.UI.installDownUpEvent (element)
elementHTMLElement
Handle mouse down and up event for button like element
Editor.UI.inDocument (el)
elHTMLElement
Check if the element is in document
Editor.UI.inPanel (el)
elHTMLElement
Check if the element is in panel
Editor.UI.isVisible (el)
elHTMLElement
Check if the element is visible by itself
Editor.UI.isVisibleInHierarchy (el)
elHTMLElement
Check if the element is visible in hierarchy
Editor.UI.startDrag (cursor, event, onMove, onEnd, onWheel)
cursorstring - CSS cursoreventEventonMovefunctiononEndfunctiononWheelfunction
Start handling element dragging behavior
Editor.UI.cancelDrag ()
Cancel dragging element
Editor.UI.addDragGhost (cursor)
cursorstring - CSS cursor
Add a dragging mask to keep the cursor not changed while dragging
Editor.UI.removeDragGhost ()
Remove the dragging mask
Editor.UI.addHitGhost (cursor, zindex, onhit)
cursorstring - CSS cursorzindexnumberonhitfunction
Add hit mask
Editor.UI.removeHitGhost ()
Remove hit mask
Editor.UI.addLoadingMask (options, onclick)
optionsobjectonclickfunction
Add loading mask
Editor.UI.removeLoadingMask ()
Remove loading mask
Editor.UI.toHumanText (text)
textstring
Convert a string to human friendly text. For example, fooBar will be Foo bar
Editor.UI.camelCase (text)
textstring
Convert a string to camel case text. For example, foo-bar will be fooBar
Editor.UI.kebabCase (text)
textstring
Convert a string to kebab case text. For example, fooBar will be foo-bar