mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Add toPlainText config option
This allows you to customise how HTML you cut/copy in the editor is converted into plain text.
This commit is contained in:
parent
e324748f0f
commit
9aa62781d0
2 changed files with 4 additions and 2 deletions
|
@ -163,7 +163,7 @@ const _onCut = function (this: Squire, event: ClipboardEvent): void {
|
||||||
root,
|
root,
|
||||||
true,
|
true,
|
||||||
this._config.willCutCopy,
|
this._config.willCutCopy,
|
||||||
null,
|
this._config.toPlainText,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
|
@ -187,7 +187,7 @@ const _onCopy = function (this: Squire, event: ClipboardEvent): void {
|
||||||
this._root,
|
this._root,
|
||||||
false,
|
false,
|
||||||
this._config.willCutCopy,
|
this._config.willCutCopy,
|
||||||
null,
|
this._config.toPlainText,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,6 +87,7 @@ interface SquireConfig {
|
||||||
};
|
};
|
||||||
addLinks: boolean;
|
addLinks: boolean;
|
||||||
willCutCopy: null | ((html: string) => string);
|
willCutCopy: null | ((html: string) => string);
|
||||||
|
toPlainText: null | ((html: string) => string);
|
||||||
sanitizeToDOMFragment: (html: string, editor: Squire) => DocumentFragment;
|
sanitizeToDOMFragment: (html: string, editor: Squire) => DocumentFragment;
|
||||||
didError: (x: any) => void;
|
didError: (x: any) => void;
|
||||||
}
|
}
|
||||||
|
@ -221,6 +222,7 @@ class Squire {
|
||||||
},
|
},
|
||||||
addLinks: true,
|
addLinks: true,
|
||||||
willCutCopy: null,
|
willCutCopy: null,
|
||||||
|
toPlainText: null,
|
||||||
sanitizeToDOMFragment: (
|
sanitizeToDOMFragment: (
|
||||||
html: string,
|
html: string,
|
||||||
/* editor: Squire, */
|
/* editor: Squire, */
|
||||||
|
|
Loading…
Reference in a new issue