Ok I got it to work, thank you. However most (almost all) of my TextAreas that 
a user can paste into live on AMDs. When these refresh the tiny_mce.js gets 
lost. I don't think this is the correct answer to my problem. No without really 
understanding how this works.

What I don't understand is why this isn't a bigger issue for webobjects in 
general? 

Anyplace there is a WOText area is susceptible to this effect. To anyone. I 
can't believe that other people didn't get bitten by this issue many times and 
that there would be a simpler solution than 'roll your own'. Either that or I 
am more of a Noob than I care to admit.

I started playing with the NSValidation, but I am beginning to think this isn't 
quite right either (or rather catching it and processing the setter is fine 
too).

I just wonder what else I should be filtering for, and I won't know until it 
bites my client.

I am just realizing all the places that my client can paste text into my app 
and it doesn't look pretty.

I will keep plugging until someone says, 'there is an easier way!'.

Ted



--- On Mon, 10/18/10, Kai S. Wong <kw...@objectbiz.com> wrote:

From: Kai S. Wong <kw...@objectbiz.com>
Subject: Re: re-post text encoding in a WOText area?
To: "Theodore Petrosky" <tedp...@yahoo.com>
Cc: "David Avendasora" <webobje...@avendasora.com>, 
webobjects-dev@lists.apple.com
Date: Monday, October 18, 2010, 3:21 PM

Hi Ted,


I use <wo:ERXJavaScript filename = "tiny_mce/tiny_mce.js" /> and make sure you 
have tinyMCE package unzip under WebServerResources/tiny_mce (plugins, themes, 
utils) and tiny_mce.js.


Also, for the tinyMCE init, I just added it under HEAD tag right after 
ERXJavaScript.


Regards,
Kai S. Wong

On Mon, Oct 18, 2010 at 11:25 AM, Theodore Petrosky <tedp...@yahoo.com> wrote:

Kai,



Can you give a little more information on how you used this? I added the 
tiny_mce.js to my WebServerResources folder, and in my appendToResponce:



AjaxUtils.addScriptResourceInHead (context, response, "app", "tiny_mce.js");



I copied and pasted the script into the head of my wrapper:



    <script type = "text/javascript">

      tinyMCE.init({

          mode : "textareas",

          theme : "advanced",

          theme_advanced_toolbar_location: "top",

          theme_advanced_buttons1 : 
"bold,italic,separator,underline,strikethrough,separator,bullist,numlist,separator,undo,redo,separator,cleanup,
 separator, spellchecker, iespell",

          theme_advanced_buttons2 : "",

          theme_advanced_buttons3 : "",

          verify_html : true,

          cleanup : true,

          plugins : "legacyoutput,paste,spellchecker,iespell",

          extended_valid_elements : "b,i,strike,u"

      });

    </script>



What do i have to do to bind my textarea (WOText) to the script?



Ted





--- On Mon, 10/18/10, Kai S. Wong <kw...@objectbiz.com> wrote:



From: Kai S. Wong <kw...@objectbiz.com>

Subject: Re: re-post text encoding in a WOText area?

To: "Theodore Petrosky" <tedp...@yahoo.com>

Cc: "David Avendasora" <webobje...@avendasora.com>, 
webobjects-dev@lists.apple.com

Date: Monday, October 18, 2010, 12:06 PM



Hi Theodore,



I use TinyMCE with paste and legacyoutput plug-in and I was able to solve copy 
and paste issue.



Here is the sample tinyMCE setting:



    <script type = "text/javascript">



      tinyMCE.init({

          mode : "textareas",

          theme : "advanced",

          theme_advanced_toolbar_location: "top",

          theme_advanced_buttons1 : 
"bold,italic,separator,underline,strikethrough,separator,bullist,numlist,separator,undo,redo,separator,cleanup,
 separator, spellchecker, iespell",



          theme_advanced_buttons2 : "",

          theme_advanced_buttons3 : "",

          verify_html : true,

          cleanup : true,

          plugins : "legacyoutput,paste,spellchecker,iespell",



          extended_valid_elements : "b,i,strike,u"

      });

    </script>





Regards,

Kai S. Wong





On Mon, Oct 18, 2010 at 6:21 AM, Theodore Petrosky <tedp...@yahoo.com> wrote:



Is the Word issue the same as mine. When I view the logs I see 0x00 as the 
offending character. If you look at the accessor (setJobDescription) from 
below, you will see the NSLog that prints the int value of the characters. this 
is where I discovered the 'zero' at the end of the string.










As I said I can not believe I was the only one that could have had this problem 
so what do others do with it? Is there a way to handle this globally?







Obviously, there is no way to type a string with the trailing zero, so it only 
comes when pasting in text.







If I use the accessor method to fix this, that implies that I must fix any text 
area on any page that I generate. (this is of course only an issue with the 
WOText not WOTextField)







Maybe I should override the accessor in my model?







Ted







--- On Mon, 10/18/10, David Avendasora <webobje...@avendasora.com> wrote:







> From: David Avendasora <webobje...@avendasora.com>



> Subject: Re: re-post text encoding in a WOText area?



> To: "Theodore Petrosky" <tedp...@yahoo.com>



> Date: Monday, October 18, 2010, 7:30 AM



> Hi Ted,



>



> I am about to deal with similar issue. I know we have seen



> problems with pasting text out of a Word document before



> also. I'm not sure what to tell you to try. What PDF reader



> are you using? Do you see the same issue with other PDF



> readers?



>



> Dave



>



> On Oct 18, 2010, at 4:41 AM, Theodore Petrosky wrote:



>



> > Last week I asked whether anyone had seen a problem



> with inserting text that was copied from a PDF and pasted



> into a WOText area.



> >



> > My client was creating a new object (a job). She



> copied some meta data (text) from a PDF and pasted it into a



> WOText:



> >



> > <wo:WOText value = "$jobDescription" cols = "40"



> rows = "8" />



> >



> > she then clicked the save button that fired the



> saveChanges() on the EC.



> >



> > The new object threw an exception and after looking at



> the logs I discovered that the text that was pasted from the



> PDF had a trailing byte with a value of '0'. I googled



> around and came up with a solution to parse the text before



> trying to insert it into the database.



> >



> > this is the setter for the WOText (now):



> >



> > public void setJobDescription(String aJobDescription)



> {



> >     String theString = "";



> >    



> >     for(char



> c:aJobDescription.toCharArray()){



> >      



>    if((c&(char)0xff00)==0 &&



> (int)c != 0 ) {



> >        



>      theString=theString+c;



> >        



>      //NSLog.out.appendln("character 



> = " + (int)c);



> >          }



> >     }



> >        



> >     _jobDescription = theString;



> > }



> >



> > First, has anyone seen this before (text coming from a



> PDF with anomalies that will then require processing) and



> > B, is there a better solution?



> >



> > I can not be the only person to have a problem with



> this. I think it is unreasonable for me to tell my client,



> "Just copy and paste the text into a text editor before



> copying it again then paste it into the web page."



> >



> >



> > :-)



> >



> > Ted



> >



> >



> >



> > _______________________________________________



> > Do not post admin requests to the list. They will be



> ignored.



> > Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)



> > Help/Unsubscribe/Update your Subscription:



> > http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com



> >



> > This email sent to webobje...@avendasora.com



> >



> >



>



>















 _______________________________________________



Do not post admin requests to the list. They will be ignored.



Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)



Help/Unsubscribe/Update your Subscription:



http://lists.apple.com/mailman/options/webobjects-dev/kwong%40objectbiz.com







This email sent to kw...@objectbiz.com





















 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to