vue-wysiwyg icon indicating copy to clipboard operation
vue-wysiwyg copied to clipboard

forcePlainTextOnPaste doesn't work

Open JanMP opened this issue 6 years ago • 13 comments

Text copied while this option is set to true is still copied with styling.

JanMP avatar Sep 04 '18 07:09 JanMP

+1

tychovbh avatar Sep 07 '18 20:09 tychovbh

+1

MrSunshyne avatar Sep 21 '18 14:09 MrSunshyne

+1

alexvargash avatar Oct 18 '18 17:10 alexvargash

Just found out that the functionality was added to the repository on commit: 3ac688fba67c06d5bbc722d4e452b842f93dee75

@chmln But the npm package was never updated.

alexvargash avatar Oct 19 '18 01:10 alexvargash

+1

clamarque avatar Oct 19 '18 14:10 clamarque

+1

weblabio avatar Mar 05 '19 11:03 weblabio

When will this be added to the NPM package? otherwise - is there a way to work around this?

Latentimagedesign avatar Apr 22 '19 15:04 Latentimagedesign

When will this be added to the NPM package? otherwise - is there a way to work around this?

I guess you could have NPM refer to the specific commit. A workaround would be that you implement the required code yourself. When you look into 3ac688f, you'll see that basically the paste-method must be somehow overwritten. Without diving into the code too much I wouldn't know how to add the eventListener to the component, but instead you could add an eventListener to the document, since you're only required to call execCommand on document.

So instead of using

import wysiwyg from "vue-wysiwyg";
Vue.use(wysiwyg, {
    forcePlainTextOnPaste: true
});

You could end up with something like:

import wysiwyg from "vue-wysiwyg";
Vue.use(wysiwyg);
document.addEventListener('paste', function (e) {
    e.preventDefault();
    document.execCommand("insertHTML", false, e.clipboardData.getData("text/plain"));
});

k3ssen avatar May 26 '19 09:05 k3ssen

Hi @chmln could you kindly add the commit 3ac688f (#72) to the npm package or should we find a workaround?

All the best

fayt81 avatar Sep 16 '19 14:09 fayt81

Use this if you want: https://www.npmjs.com/package/vue-wysiwyg-fixed

jezzdk avatar Apr 03 '20 12:04 jezzdk

@fayt81 @Latentimagedesign my bad for taking a while, I will push a release out very soon.

chmln avatar Apr 11 '20 19:04 chmln

@chmln, any time now would be sweet!

limeandcoconut avatar Aug 04 '20 18:08 limeandcoconut

Yes, please update https://www.npmjs.com/package/vue-wysiwyg if you are able to @chmln! I also need forcePlainTextOnPaste working for my project. Thank you!

nathanchase avatar Feb 09 '21 16:02 nathanchase