New to Kendo UI for Vue? Start a free 30-day trial

Represents a wrapping namespace for the utility functions, nodes, and marks objects of the Editor.

Definition

Package:@progress/kendo-vue-editor

Variables

The PluginKey that the image resizing plugin of the Editor uses.

Default:

imageResizeKeyCommon

marks

{ [mark: string]: MarkSpec }

Represents the marks object of the Editor.

nodes

{ [node: string]: NodeSpec }

Represents the nodes object of the Editor.

propsKey

PluginKey

The PluginKey that the Editor uses to pass its props to the tools.

Default:

editorPropsKey

Methods

Aligns the block elements in the selection.

Parameters:viewEditorViewactionsAlignAction[]command?CommandReturns:

boolean

  • Returns true if the function aligns any of the elements.

Wraps the selection in a span element with inline styles.

Parameters:viewEditorViewoptions{ style: string; value: string }command?CommandReturns:

boolean

  • Returns true if the function applies a style to any of the elements.

Applies the link mark.

Parameters:viewanyoptions{ mark: string; attrs: any }command?CommandReturns:

boolean

  • Returns true if the function applies the link.

Checks if you can indent any of the list elements in the selection.

Parameters:stateEditorStatenodeTypeNodeTypeReturns:

boolean

Checks if you can insert a node in the current selection.

Parameters:stateEditorState

The state object of the Editor.

nodeTypeNodeType

The type of the node to insert.

Returns:

boolean

Returns true if you can insert a node of this type in the current selection.

Checks if you can outdent any of the list elements in the selection.

Parameters:stateEditorStatelistsTypes{ listItem: string; orderedList: string; bulletList: string }Returns:

boolean

Converts MS Word lists into HTML lists.

Parameters:htmlstring

The input HTML.

Returns:

string

The resulting HTML.

Creates an Editor document from HTML content.

Parameters:schemaSchema​<any, any>

The schema object of the Editor.

htmlstring

The HTML content.

parseOptions?ParseOptions

The HTML parsing options. Defaults to { preserveWhitespace: 'full' }.

Returns:

Node

The document object of the Editor.

Creates a table.

Parameters:tableTypes{ table: NodeType; table_row: NodeType; table_cell: NodeType }

An object that contains the table, table_row, and table_cell node types.

rowsnumber

The number of rows.

columnsnumber

The number of columns.

Returns:

Node

The generated table.

Example:
jsx
import { EditorUtils } from '@progress/kendo-vue-editor';

const nodes = editorRef.view.state.schema.nodes;
const rows = 3;
const columns = 4;

const table = EditorUtils.createTable(nodes, rows, columns);

Formats the paragraph and heading nodes in the selection.

Parameters:viewEditorViewvalue"p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"commandName?CommandReturns:

boolean

Returns true if the function formats any element.

Returns the paragraph and heading nodes in the selection.

Parameters:stateEditorStateReturns:

string[]

Gets the HTML from the EditorState object.

Parameters:stateEditorState | { doc: Node; schema: Schema​<any, any> }

The state object of the Editor, or an object that contains the doc and schema of the Editor. For example, { doc: value, schema: value.types.schema }, where value is the value prop of the Editor.

Returns:

string

The HTML content.

Returns the inline styles in the selection that match the specified style.

Parameters:stateEditorStatestyle{ name: string; value: RegExp }Returns:

string[]

An array of the matching styles in the selection.

Returns a mark of the specified type from the nodes in the selection.

Parameters:stateEditorStatemarkTypeMarkTypeReturns:

Mark | undefined

The mark of the specified type from the nodes in the selection.

Returns the Shortcuts object that matches the settings you pass. Use it when you change the default Editor nodes or tool settings and need to create the Shortcuts object again.

Parameters:settings?{ types?: { listItem: string; hardBreak: string }; toolsSettings?: { bold?: InlineFormatOptions; italic?: InlineFormatOptions; underline?: InlineFormatOptions } }Returns:

Shortcuts

An object that holds the shortcuts.

Checks if the selection contains a node that matches the specified InlineFormatOptions.

Parameters:stateEditorStateoptionsInlineFormatOptionsReturns:

boolean

Returns true if the selection contains a node that matches the specified InlineFormatOptions.

Checks if the selection contains a specific type of node.

Parameters:stateEditorStatenodeTypeNodeTypeReturns:

boolean

Returns true if the selection contains a specific type of node.

Creates a plugin that lets you resize images.

Parameters:options?ImageResizeOptions

Optional. The resizing options.

Returns:

Plugin

The image resizing plugin.

Indents the block elements in the selection.

Parameters:viewEditorViewactionsIndentAction[]command?Commanddir?stringReturns:

boolean

Returns true if the function indents any of the elements.

Adds new lines after block elements and hard breaks.

Parameters:contentstring

The HTML content.

Returns:

string

The indented HTML.

Inserts a node in the selection.

Parameters:viewEditorView | { state: EditorState; dispatch: (tr: Transaction) => void }

The view object of the Editor.

nodeNode

A node object of the Editor.

scrollIntoView?boolean

Optional. Sets whether the content element scrolls to the current selection.

Checks if any of the block elements in the selection is aligned.

Parameters:stateEditorStateactionsAlignAction[]Returns:

boolean

Returns true if any of the block elements in the selection is aligned.

Checks if any of the block elements in the selection is indented.

Parameters:stateanyactionsIndentAction[]dir?stringReturns:

boolean

Returns true if any of the block elements in the selection is indented.

Cleans up the pasted content (see example).

Parameters:htmlstring

The input HTML.

settingsPasteCleanupSettings

The settings that the function uses to clean up the content.

Returns:

string

The resulting HTML.

Removes a DOM attribute from the pasted content (see example).

Parameters:attrAttr

The DOM attribute to remove.

Removes the comments from the HTML.

Parameters:htmlstring

The input HTML.

Returns:

string

The resulting HTML.

Example:
jsx
import { EditorUtils } from '@progress/kendo-vue-editor';
const html = EditorUtils.removeComments('<p>some content<!-- comment --></p>');

Removes the specified tag from the HTML and keeps its child nodes.

Parameters:htmlstring

The input HTML.

tagstring

The tag to remove. To remove more than one tag, separate them with a vertical bar. For example, span or b|i|u|span.

Returns:

string

The resulting HTML.

Example:
jsx
import { EditorUtils } from '@progress/kendo-vue-editor';
const html = EditorUtils.removeTag('<p>some <span>content</span></p>', 'span|p');

Replaces local image sources in the HTML with base64 sources from the RTF data. This happens when you paste images and text from MS Word, because the src of each image points to the local file system.

Parameters:htmlstring

The input HTML (the pasted HTML).

clipboardDataDataTransfer

The clipboardData object of the paste event (event.clipboardData).

Returns:

string

The HTML with the replaced image sources.

Removes the invalid HTML.

Parameters:htmlstring

The HTML to sanitize.

Returns:

string

The sanitized HTML.

Example:
jsx
import { EditorUtils } from '@progress/kendo-vue-editor';
const html = EditorUtils.sanitize('something pasted from MS Word, containing <o:p>, <w:sdtPr>, <v:shapes tags');

Cleans up the CSS classes of content that you paste from MS Word (see example). The function removes every class attribute whose value starts with Mso. For example, <p class="MsoNormal">pasted from MS Word</p> becomes <p>pasted from MS Word</p>.

Parameters:attrAttr

The DOM class attribute to clean up.

Cleans up the style attributes of content that you paste from MS Word (see example). The function checks all styles and removes the invalid ones. For example, <p><span style='color:#7C7C7C;mso-themecolor:accent3;mso-themeshade:191;background:silver;'>content</span></p> becomes <p><span style="color: #7C7C7C; background: silver;">content</span></p>.

Parameters:attrAttr

The DOM style attribute to clean up.

Sets the HTML to the EditorView.

Parameters:viewEditorView

The view object of the Editor.

htmlstring

The HTML content.

command?Command

Optional. The type of the command that the function sets to the setHtml metadata of the transaction. Defaults to SetContent.

parseOptions?ParseOptions

Optional. The options that the function uses to parse the HTML. Defaults to { preserveWhitespace: 'full' }.

Creates a plugin that highlights the matches of the Find and Replace dialog.

Parameters:key?PluginKey​<any>

Optional. The key of the plugin.

Returns:

Plugin

The text highlight plugin.

Toggles the inline element formatting according to the InlineFormatOptions and markAttrs settings.

Parameters:view{ state: EditorState; dispatch: (tr: Transaction) => void }optionsInlineFormatOptionstransaction?TransactionmarkAttrs?anyReturns:

boolean

Toggles a list of the specified type.

Parameters:viewEditorViewtypes{ listType: string; orderedList: string; bulletList: string; listItem: string }command?CommandReturns:

boolean

Interfaces

ImageResizeOptions

ImageResizeOptions

Represents the options of the image resizing plugin.

Shortcuts

Shortcuts

Represents the Shortcuts object.