Editor.UI (DOM Utils Module)

Methods

Editor.UI.createStyleElement (url)

Load url content and create a style element to wrap it.

Editor.UI.clear (element)

Remove all child element.

Editor.UI.index (element)

Get the index of the element

Editor.UI.parentElement (element)

Get the parent element, it will go through the host if it is a shadow element.

Editor.UI.offsetTo (el, parentEL)

Returns the offset {x, y} from el to parentEL

Editor.UI.walk (el, [opts,] cb)

Recursively search children use depth first algorithm.

Editor.UI.fire (element, eventName, opts)

Fires a CustomEvent to the specific element. Example:

Editor.fire(el, 'foobar', {
  bubbles: false,
  detail: {
    value: 'Hello World!'
  }
});

Editor.UI.acceptEvent (event)

Call preventDefault and stopImmediatePropagation for the event

Editor.UI.installDownUpEvent (element)

Handle mouse down and up event for button like element

Editor.UI.inDocument (el)

Check if the element is in document

Editor.UI.inPanel (el)

Check if the element is in panel

Editor.UI.isVisible (el)

Check if the element is visible by itself

Editor.UI.isVisibleInHierarchy (el)

Check if the element is visible in hierarchy

Editor.UI.startDrag (cursor, event, onMove, onEnd, onWheel)

Start handling element dragging behavior

Editor.UI.cancelDrag ()

Cancel dragging element

Editor.UI.addDragGhost (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)

Add hit mask

Editor.UI.removeHitGhost ()

Remove hit mask

Editor.UI.addLoadingMask (options, onclick)

Add loading mask

Editor.UI.removeLoadingMask ()

Remove loading mask

Editor.UI.toHumanText (text)

Convert a string to human friendly text. For example, fooBar will be Foo bar

Editor.UI.camelCase (text)

Convert a string to camel case text. For example, foo-bar will be fooBar

Editor.UI.kebabCase (text)

Convert a string to kebab case text. For example, fooBar will be foo-bar