Make sure that the picture is not lost when i set forcePlainText: true
How can i do this please?
forcePlainText will force the pasted content to be plain text. So you'll indeed lose your picture. Otherwise, you need to switch to false to keep your picture.
Please provide more information on what you are trying to achieve..
(my guess is allowing rich markup through whitelisted. where his only whitelist is , while preserving the behavior of forcePlainText). Might be achievable through overriding the regexps on the default and tweaking the config values, and is certainly achievable by creating a custom "paste" extension to override the builtin paste handling.
I am sorry,my english is poor.When i copy rich text form other site,i want to get both the plain text and the picture
@phiggins42 Yeah, that's what I mean.
@j0k3r Is there a plan to add this feature?
Thank you for your answer.
Adding a whitelist to a paste extension is a pretty reasonable idea. What we have now is a blacklist. What you can try to do now, is to set forcePlainText to false, as @j0k3r said, but then set cleanPastedHTML to true. Then you have to specify array of tags to be removed yourself in cleanTags (e.g.: ['meta', 'strong', 'a', ...]);
Since we have only the blacklist (cleanTags), this is probably the only option right now. Or if you're feeling adventurous, you can try to write your own regexp that would replace everything except img tags in cleanReplacements.
You can find more info about paste extension here: https://github.com/yabwe/medium-editor/tree/5.16.1#paste-options
@j0k3r can correct me, if I'm mistaken. He knows the paste extension much better than I do.
@orthes thank you very much~~ I will try
Most helpful comment
Adding a whitelist to a paste extension is a pretty reasonable idea. What we have now is a blacklist. What you can try to do now, is to set
forcePlainTexttofalse, as @j0k3r said, but then setcleanPastedHTMLtotrue. Then you have to specify array of tags to be removed yourself incleanTags(e.g.:['meta', 'strong', 'a', ...]);Since we have only the blacklist (
cleanTags), this is probably the only option right now. Or if you're feeling adventurous, you can try to write your own regexp that would replace everything exceptimgtags incleanReplacements.You can find more info about paste extension here: https://github.com/yabwe/medium-editor/tree/5.16.1#paste-options
@j0k3r can correct me, if I'm mistaken. He knows the paste extension much better than I do.