Stripping styling from the clipboard...
richmondmathewson at gmail.com
Sat Jun 23 16:33:57 EDT 2018
Indeed: over "here" on MacOS 10.7.5 Livecode 8.1.10 the pasteKey command
seems to be non-functional.
On 23/6/2018 11:07 pm, Paul Dupuis via use-livecode wrote:
> Thank you for this.
> However, it appears my problem is not with converting the clipboard from
> styled text to plain text, but with the "pasteKey" message.
> In LC9.0.0 under Windows 8.1, I create a new text stack and add and
> empty field and place the following handler in EITHER the card or stack
> on pasteKey
> end pasteKey
> on makeClipboardPlainText
> local tClip, tRawType
> if the platform is "MacOS" then
> put "public.utf8-plain-text" into tRawType -- OSX
> else if the platform is "Linux" then
> put "text/plain;charset=utf-8" into tRawType -- Linux
> else if the platform contains "Win" then
> put "CF_UNICODETEXT" into tRawType -- Windows
> end if
> lock the clipBoard
> put the rawClipboardData[tRawType] into tClip
> set the rawClipboardData to empty
> set the rawClipboardData[tRawType] to tClip
> unlock the clipBoard
> end makeClipboardPlainText
> And set a break point on the call to makeClipboardPlainText instruction.
> I then switch to another applications with styled text, select the text
> copy it to the clipboard, return for LC with the insertion point in the
> field and press Control-V.
> RESULT: the breakpoint is never triggered and styled text is pasted into
> the field.
> If I just have a pasteKey handler with a beep (or anything else) as the
> sole instruction, the same result, the breakpoint is never triggered.
> The pasteKey message appears broken under both Windows and OSX (tested
> under 10.9.5) in LC9.0.0? Can anyone confirm this bug?
> On 6/23/2018 1:23 PM, Brian Milby wrote:
>> Check out this handler. I can answer questions about it this evening
>> if needed.
>> On Jun 23, 2018, 9:18 AM -0500, Paul Dupuis via use-livecode
>> <use-livecode at lists.runrev.com>, 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*theclipboardData["text"] totheplaintextofthetemplateField
>>> *end* *if*
>>> 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:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode