EditorUtils
Represents a wrapping namespace for the utility functions, nodes, and marks objects of the Editor.
Definition
Package:@progress/kendo-vue-editor
Variables
imageResizeKey
PluginKey
The PluginKey used in the Editor by the image resizing plugin.
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 used in the Editor to pass editor props to the tools.
editorPropsKey
Methods
Aligns the block elements in the selection.
boolean
- If alignment is applied to any of the elements, returns
true.
Wraps the selection in a span element with inline styles.
boolean
- If a style is applied to any of the elements, returns
true.
Applies the link mark.
boolean
- If the link is applied, returns
true.
Checks if any of the list elements in the selection can be indented.
boolean
Checks if a node can be inserted in the current selection.
The state object of the Editor.
The type of the node that will be inserted.
Returns:boolean
- The node of this type can be inserted in the current selection.
Checks if any of the list elements in the selection can be outdented.
boolean
Converts the MS Word lists into HTML lists.
The input HTML.
Returns:string
- The result HTML.
Creates an Editor document from HTML content.
The schema object of the Editor.
The HTML content.
parseOptions?ParseOptionsThe HTML parsing options. Defaults to { preserveWhitespace: 'full' }.
Node
- The
documentobject of the Editor.
Creates a table.
An object which contains table, table_row, and table_cell node types.
The number of rows.
columnsnumberThe number of columns.
Returns:Node
- The generated table.
Formats the paragraph and heading nodes in the selection.
boolean
- If an element is formatted, returns
true.
Returns the paragraph and heading nodes in the selection.
string[]
Gets the HTML from the EditorState object.
The state object of the Editor or an object containing editor's doc and schema
- { doc: value, schema: value.types.schema } where the
valuevariable is the editor's value prop.
string
- The HTML content.
string[]
- An array of matched styles that are found in the selection.
Returns a mark of the specified type from the nodes in selection.
Mark | undefined
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.
Shortcuts
- An object which holds the shortcuts.
Checks if according to the specified InlineFormatOptions a node in the selection is present.
boolean
Checks if the selection contains a specific type of node.
boolean
Creates a plugin which adds image resizing functionality.
The resizing option (Optional).
Returns:Plugin
- The image resizing plugin.
Indents the block elements in the selection.
boolean
- If indentation is applied to any of the elements, returns
true.
Adds new lines after block elements and hard breaks.
The HTML content.
Returns:string
- The indented HTML.
Inserts a node in the selection.
The view object of the Editor.
A node object of the Editor.
An optional parameter. Defines if the content element will be scrolled to the current selection.
Checks if any of the block elements in the selection is aligned.
boolean
Checks if any of the block elements in the selection is indented.
boolean
A function for sanitizing the content on paste (see example).
The input HTML.
settingsPasteCleanupSettingsThe settings used for sanitizing the content.
Returns:string
- The resulting HTML.
A function that will remove a DOM attribute from the pasted content (see example).
The DOM attribute that will be removed.
Removes the comments from the HTML.
The input HTML.
Returns:string
- The result HTML.
Removes the specified tag from the HTML and keeps its child nodes.
The input HTML.
tagstringA tag or multiple tags separated by a vertical slash which will be removed.
For example, span or b|i|u|span.
string
- The resulting HTML.
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.
The input HTML (pasted HTML).
clipboardDataDataTransferThe paste event clipboardData object (event.clipboardData).
Returns:string
- The html with the replaced images sources.
Removes the invalid HTML.
The HTML which will be sanitized.
Returns:string
- The sanitized HTML.
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>.
The DOM class attribute that will be sanitized.
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>.
The DOM style attribute that will be sanitized.
Sets the HTML to the EditorView.
The view object of the Editor.
The HTML content.
command?CommandAn optional parameter.
Defines the type of the command that will be set to the setHtml metadata of the transaction.
Defaults to SetContent.
An optional parameter.
Defines the options that will be used for parsing the HTML. Defaults to { preserveWhitespace: 'full' }.
Creates a plugin which highlights the matches of Find and Replace dialog.
The key of the plugin (Optional).
Returns:Plugin
- The text highlight plugin.
Toggles the inline element formatting according to the InlineFormatOptions and markAttrs settings.
boolean
Toggles a list of the specified type.
boolean
Interfaces
ImageResizeOptions
ImageResizeOptions
The image resizing plugin options.
Shortcuts
Shortcuts
Represents the Shortcuts object.