mirror of
https://github.com/codex-team/editor.js
synced 2024-06-09 17:32:31 +02:00
adding onPasteHTML config
This commit is contained in:
parent
07b1ce2aca
commit
093dfe8e22
|
@ -202,6 +202,10 @@ export default class Paste extends Module {
|
|||
htmlData = '<p>' + (htmlData.trim() ? htmlData : plainData) + '</p>';
|
||||
}
|
||||
|
||||
if (_.isFunction(this.config.onPasteHTML)) {
|
||||
htmlData = String(this.config.onPasteHTML(htmlData) || htmlData);
|
||||
}
|
||||
|
||||
/** Add all tags that can be substituted to sanitizer configuration */
|
||||
const toolsTags = Object.keys(this.toolsTags).reduce((result, tag) => {
|
||||
/**
|
||||
|
|
7
types/configs/editor-config.d.ts
vendored
7
types/configs/editor-config.d.ts
vendored
|
@ -94,6 +94,13 @@ export interface EditorConfig {
|
|||
*/
|
||||
onChange?(api: API, event: CustomEvent): void;
|
||||
|
||||
/**
|
||||
* On Paste hook for parsing HTML before sanitization
|
||||
* @param {string} html Input pasted HTML
|
||||
* @returns {string} cleaned / updated HTML
|
||||
*/
|
||||
onPasteHTML?(html: string): string;
|
||||
|
||||
/**
|
||||
* Defines default toolbar for all tools.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue