New to KendoReactStart a free 30-day trial

EditorUtils
Premium

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

NameTypeDefaultDescription

alignBlocks

Aligns the block elements in the selection.

applyInlineStyle

Wraps the selection in a span element with inline styles.

Applies the link mark.

canIndentList

Checks if any of the list elements in the selection can be indented.

canInsert

Checks if a node can be inserted in the current selection.

canOutdentList

Checks if any of the list elements in the selection can be outdented.

convertMsLists

Converts the MS Word lists into HTML lists.

createDocument

Creates an Editor document from HTML content.

createTable

Creates a table.

jsx
import { EditorUtils } from '@progress/kendo-react-editor';

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

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

formatBlockElements

Formats the paragraph and heading nodes in the selection.

getBlockFormats

Returns the paragraph and heading nodes in the selection.

getHtml

Gets the HTML from the EditorState object.

getInlineStyles

getMark

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

getShortcuts

A function which returns the mapped Shortcuts object based on the passed settings. Useful when the default Editor nodes or tool settings are changed and the Shortcuts object has to be regenerated.

@params—An object which holds specific types of nodes and tool settings that are used by the default Shortcuts handlers. @returns—An object which holds the shortcuts.

hasMark

Checks if according to the specified InlineFormatOptions a node in the selection is present.

hasNode

Checks if the selection contains a specific type of node.

imageResizeKey

PluginKey

The PluginKey used in the Editor by the image resizing plugin.

ImageResizeOptions

The image resizing plugin options.

imageResizing

Creates a plugin which adds image resizing functionality.

indentBlocks

Indents the block elements in the selection.

indentHtml

Adds new lines after block elements and hard breaks.

insertNode

Inserts a node in the selection.

isAligned

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

isIndented

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

marks

{[mark: string]: MarkSpec}

Represents the marks object of the Editor.

nodes

{[node: string]: NodeSpec}

Represents the nodes object of the Editor.

pasteCleanup

A function for sanitizing the content on paste (see example).

propsKey

PluginKey

The PluginKey used in the Editor to pass editor props to the tools.

removeAttribute

A function that will remove a DOM attribute from the pasted content (see example).

removeComments

Removes the comments from the HTML.

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

removeTag

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

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

replaceImageSourcesFromRtf

If the input html contains images with 'src' pointing to local file system (it happens when pasting images and text from MS Word), the function will extract the images sources from the RTF in base64 format and replace them in the input html.

sanitize

Removes the invalid HTML.

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

sanitizeClassAttr

A function for sanitizing the CSS classes of the pasted from MS Word content (see example). The function will remove any class attribute which value starts with Mso. For example <p class="MsoNormal">pasted from MS Word</p> will result in <p>pasted from MS Word</p>.

sanitizeStyleAttr

A function for sanitizing the style attributes of the pasted from MS Word content (see example). The function will loop through all styles and will remove those that are invalid. For example <p><span style='color:#7C7C7C;mso-themecolor:accent3;mso-themeshade:191;background:silver;'>content</span></p>, will result in <p><span style="color: #7C7C7C; background: silver;">content</span></p>.

setHtml

Sets the HTML to the EditorView.

Shortcuts

Represents the Shortcuts object.

tableResizing

Returns a collection of plugins that adds table resizing functionality.

textHighlight

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

toggleInlineFormat

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

toggleList

Toggles a list of the specified type.

Not finding the help you need?
Contact Support