Re: copy in WebView
Re: copy in WebView
- Subject: Re: copy in WebView
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 13 Oct 2012 18:12:33 +0700
On 12 Oct 2012, at 23:02, Kyle Sluder <email@hidden> wrote:
> On Oct 12, 2012, at 1:47 AM, "Gerriet M. Denkmann" <email@hidden> wrote:
>
>>
>> I managed (using: <body oncopy="return MyJavaScriptFunction()">) to get the selection and modify it (removing unwanted characters) but I do not know how to put the resulting string onto the clipboard.
>
> That should be sufficient to get the right string on the clipboard. You've modified the DOM, and now the browser will copy the text from the DOM to the pasteboard.
No, I have not modified the DOM.
I did:
var t0 = window.getSelection();
var t1 = String(t0);
then I removed the unwanted chars from this string.
Then I wanted to put the cleaned up string to the pasteboard, but failed.
The unwanted characters are in the WebView for a reason (and should stay there for the same reason):
Mac OS X, iOS (and the ICU, where the code probably comes from) have some problems parsing Thai text into words.
E.g. "แล้วกลับ". When you double click in this phrase, you will see either "แล้วก" or "ลับ" highlighted.
But this does not make sense. There is no word like "แล้วก".
Inserting a zero width space results in correct behaviour:
"แล้วกลับ" - when you double click here you will see either "แล้ว" or "กลับ" highlighted, which is correct.
The problem: when some ill-advised computer changes the text I copy-pasted from my WebView (e.g. into charset="tis-620" (whatever that is)) then the zero width spaces get converted into '?', which looks rather silly.
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden