Stripping styling from the clipboard...

Richmond Mathewson richmondmathewson at gmail.com
Sat Jun 23 16:32:25 EDT 2018


Hey, Wow, it's the Richmond school of shovels and primitive stuff at its 
worst.

If I have a field that conatins some styled text (let's call it "ff1"), 
and I want to shift it
with its styling removed into another field (let's call it "ff2") then 
this does the trick in a button:

onmouseUp
gettheplainTextoffld "ff1"
putit intofld "ff2"
endmouseUp

and that, oddly enough, might not be a bad place to get started.

ALTHOUGH (ouch) this does NOT work:

onpasteKey
    gettheplainTextoftheclipboardData
    putit intofld "ff2"
endpasteKey

and this does not work:

onpasteKey
   puttheclipboardDataintofld "ff1"
   send"mouseUp" tobtn "Button"
endpasteKey

which would seem to suggest pasteKey is NOT trapping the paste signal at 
all.

Richmond.


On 23/6/2018 5:15 pm, Paul Dupuis via use-livecode wrote:
> Using LC9, I want to add a "paste without formatting" (as seen in may
> browser edit menus) command and I can't see to figure out how to do it.
>
> My most recent attempt of many still pastes formatted text (with
> underlining, bolding, italics, fonts, colors, etc. in place)
>
> *on*pasteKey *-- remove formatting*
> *if* theclipboardData["text"] isnotempty*then*
> *set*thetextofthetemplateFieldtoclipboardData["text"]
> *set*theclipboardDatatoempty
> *set*theclipboardData["text"] totheplaintextofthetemplateField
> *end* *if*
> *paste*
> *end*pasteKey
>
> Maybe I just haven't had enough Caffeine yet?
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list