Namespace: switchEditors

switchEditors

Expose the switch editors to be used globally.
Source:

Methods


<static> autop(text)

Replaces two line breaks with a paragraph tag and one line break with a
. Similar to `wpautop()` in formatting.php.
Parameters:
Name Type Description
text string The text input.
Since:
  • 2.5.0
Source:
Returns:
The formatted text.
Type
string

<static> pre_wpautop(html)

Fires custom jQuery events `beforePreWpautop` and `afterPreWpautop` when jQuery is available.
Parameters:
Name Type Description
html String The content from the visual editor.
Since:
  • 2.9.0
Source:
Returns:
the filtered content.
Type
String

<static> removep(html)

Replaces

tags with two line breaks. "Opposite" of wpautop(). Replaces

tags with two line breaks except where the

has attributes. Unifies whitespace. Indents

  • ,
    and
    for better readability.
  • Parameters:
    Name Type Description
    html string The content from the editor.
    Since:
    • 2.5.0
    Source:
    Returns:
    The content with stripped paragraph tags.
    Type
    string

    <static> switchEditor(id, mode)

    Switches the editor between Visual and Text mode.
    Parameters:
    Name Type Description
    id string The id of the editor you want to change the editor mode for. Default: `content`.
    mode string The mode you want to switch to. Default: `toggle`.
    Since:
    • 2.5.0
    Source:
    Returns:
    Type
    void

    <static> wpautop(text)

    Fires custom jQuery events `beforeWpautop` and `afterWpautop` when jQuery is available.
    Parameters:
    Name Type Description
    text String The content from the text editor.
    Since:
    • 2.9.0
    Source:
    Returns:
    filtered content.
    Type
    String