SMethods

Additional methods for CKEditor plugins.

Requirements

Browser Compatibility

SMethods has the same browser compatibility as CKEditor.

Installation

  1. Put the plugin into the CKEditor plugins folder.
  2. Require smethods in plugin.js where you want to use its functionality:
requires: 'smethods';

Methods

array

without(array, ...values) -> Array

Returns a copy of the array with all instances of the values removed.

Arguments
Returns

dialog

getCurrentPageId() -> String

Gets the current page id.

Returns

editor

addCommands(definitions)

Adds one or more commands from the specified definition object to the editor instance.

Arguments

element

matchClass(regexp) -> Array | Boolean

Gets the element class names that match a regular expression.

Arguments
Returns

rmClass(remove) -> element

Removes a CSS class name from the element classes. Other classes remain untouched.

Arguments
Returns

toggleClass(name, remove) -> element

Adds a CSS class to the element or removes it if it exists.

Arguments
Returns

toggleAttribute(name, value) -> element

Adds an attribute to the element or removes it if it exists.

Arguments
Returns

matchAttribute(regexp) -> Array

Gets the element attribute name(s) that matches a regular expression.

Arguments
Returns

realName() -> String

Gets the element's real name (real tag name).

Returns

isReal(name) -> Boolean

Checks if the element's real name matches the specified criteria.

Arguments
Returns

findParent(selector) -> element

Returns the first parent element of this element that matches the specified selector.

Arguments
Returns

ui

addMenuButton(name, definition)

Adds a menu button definition to the UI elements list.

Arguments

uiElement

getValues() -> Array

Gets all values of this dialog UI object.

Returns

hasFocus() -> Boolean

Determines whether a UI element is focused or not.

Returns

toggleState()

Toggle disable/enable UI element.

isOnCurrentPage() -> Boolean

Determines whether a UI element is on the current tab or not.

Returns

Download