mirror of
https://github.com/outline/outline.git
synced 2026-12-02 17:52:07 +03:00
Avoid instantiating serializer on each copy
This commit is contained in:
1 parent
96de47eb18
commit
6af2fc91d7
1 file changed
+6
-7
@@ -3,8 +3,7 @@ import Extension from "@shared/editor/lib/Extension";
|
||||
|
||||
/**
|
||||
* A plugin that allows overriding the default behavior of the editor to allow
|
||||
* copying text for nodes that do not inherently have text children by defining
|
||||
* a `toPlainText` method in the node spec.
|
||||
* copying text including the markdown formatting.
|
||||
*/
|
||||
export default class ClipboardTextSerializer extends Extension {
|
||||
get name() {
|
||||
@@ -12,16 +11,16 @@ export default class ClipboardTextSerializer extends Extension {
|
||||
}
|
||||
|
||||
get plugins() {
|
||||
const serializer = this.editor.extensions.serializer();
|
||||
|
||||
return [
|
||||
new Plugin({
|
||||
key: new PluginKey("clipboardTextSerializer"),
|
||||
props: {
|
||||
clipboardTextSerializer: (slice) => {
|
||||
const serializer = this.editor.extensions.serializer();
|
||||
return serializer.serialize(slice.content, {
|
||||
clipboardTextSerializer: (slice) =>
|
||||
serializer.serialize(slice.content, {
|
||||
softBreak: true,
|
||||
});
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user