vue-wysiwyg
vue-wysiwyg copied to clipboard
forcePlainTextOnPaste doesn't work
Text copied while this option is set to true is still copied with styling.
+1
+1
+1
Just found out that the functionality was added to the repository on commit: 3ac688fba67c06d5bbc722d4e452b842f93dee75
@chmln But the npm package was never updated.
+1
+1
When will this be added to the NPM package? otherwise - is there a way to work around this?
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"));
});
Hi @chmln could you kindly add the commit 3ac688f (#72) to the npm package or should we find a workaround?
All the best
Use this if you want: https://www.npmjs.com/package/vue-wysiwyg-fixed
@fayt81 @Latentimagedesign my bad for taking a while, I will push a release out very soon.
@chmln, any time now would be sweet!
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!