Closed jamienk closed 10 years ago
Yes, both callbacks receive the html before and after it was pasted, and expects that you return some modified version of the html. Let me know if you have any more questions.
Got it -- I'm using this (from http://sujeetgholap.github.io/typesmart.js/) to make pasted quotes turn "smart":
afterPasteClean : function (ev)
{
ev=ev+' ';//this turns it into a string, sometimes it's not a string?
// Strategy :
// 1) First replace all quotes following whitespace into opening ones.
// 2) Then all those which are after any character into closing ones.
// 3) Then remaining into opening ones.
newev=ev.replace(/(\s)'/g, "$1\u2018") // Opening singles
.replace(/(\s)"/g, "$1\u201c") // Opening doubles
// After one or more whitespace.
.replace(/(.)'/g, "$1\u2019") // Closing singles
.replace(/(.)"/g, "$1\u201d") // Closing doubles
.replace(/'/g, "\u2018") // Opening singles
.replace(/"/g, "\u201c"); // Opening doubles
return newev;
}
I'm not sure how to use these callbacks?
I have
...can I manipulate the pasted contents inside the before/afterPasteClean function?