0
Fork 0
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:
Neil Jenkins 2023-10-02 13:01:16 +11:00
parent e324748f0f
commit 9aa62781d0
2 changed files with 4 additions and 2 deletions

View file

@ -163,7 +163,7 @@ const _onCut = function (this: Squire, event: ClipboardEvent): void {
root,
true,
this._config.willCutCopy,
null,
this._config.toPlainText,
false,
);
if (!handled) {
@ -187,7 +187,7 @@ const _onCopy = function (this: Squire, event: ClipboardEvent): void {
this._root,
false,
this._config.willCutCopy,
null,
this._config.toPlainText,
false,
);
};

View file

@ -87,6 +87,7 @@ interface SquireConfig {
};
addLinks: boolean;
willCutCopy: null | ((html: string) => string);
toPlainText: null | ((html: string) => string);
sanitizeToDOMFragment: (html: string, editor: Squire) => DocumentFragment;
didError: (x: any) => void;
}
@ -221,6 +222,7 @@ class Squire {
},
addLinks: true,
willCutCopy: null,
toPlainText: null,
sanitizeToDOMFragment: (
html: string,
/* editor: Squire, */