I followed the advice on this page: <http://wiki.script.aculo.us/scriptaculous/show/HowtoExtendAndOverride> And created an extension.js file and added the following to it: Object.extend(Ajax, { getText: function() { return this.element.childNodes[0] ? this.element.childNodes[0].nodeValue : ''''; } }); This works perfectly, I now get my entity-escaped characters like & showing correctly in the editor. But when I tried to do this: Object.extend(Ajax, { onLoadedExternalText: function(transport) { Element.removeClassName(this.form, this.options.loadingClassName); this.editField.disabled = false; this.editField.value = transport.responseText; Field.scrollFreeActivate(this.editField); } }); The base function was not overridden. (I am trying to remove the stripTags() call from the end of responseText.) The only thing that worked was to comment out line 655 of controls.js, like so: //this.editField.value = transport.responseText.stripTags(); this.editField.value = transport.responseText; Can anyone spot what I''m doing wrong here that I''m not able to override this function from an extensions.js file? Thanks, Walter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
It looks like you''re extending the wrong object. Try this: (untested) Object.extend(Ajax.InPlaceEditor.prototype, { // <-- here onLoadedExternalText: function (transport) { // ... } }); TAG On Apr 17, 2007, at 12:14 PM, Walter Lee Davis wrote:> > I followed the advice on this page: > > <http://wiki.script.aculo.us/scriptaculous/show/ > HowtoExtendAndOverride> > > And created an extension.js file and added the following to it: > > Object.extend(Ajax, { > getText: function() { > return this.element.childNodes[0] ? > this.element.childNodes[0].nodeValue : ''''; > } > }); > > > This works perfectly, I now get my entity-escaped characters like > & > showing correctly in the editor. > > But when I tried to do this: > > Object.extend(Ajax, { > onLoadedExternalText: function(transport) { > Element.removeClassName(this.form, this.options.loadingClassName); > this.editField.disabled = false; > this.editField.value = transport.responseText; > Field.scrollFreeActivate(this.editField); > } > }); > > The base function was not overridden. (I am trying to remove the > stripTags() call from the end of responseText.) > > The only thing that worked was to comment out line 655 of controls.js, > like so: > > //this.editField.value = transport.responseText.stripTags(); > this.editField.value = transport.responseText; > > Can anyone spot what I''m doing wrong here that I''m not able to > override > this function from an extensions.js file? > > Thanks, > > Walter > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Apr-17 18:53 UTC
Re: Trying to extend IPE -- some success, one failure
Cool. This works perfectly. So the fact that the other one (getText) worked was just magic? Walter On Apr 17, 2007, at 2:28 PM, Tom Gregory wrote:> > It looks like you''re extending the wrong object. > > Try this: (untested) > > Object.extend(Ajax.InPlaceEditor.prototype, { // <-- here > onLoadedExternalText: function (transport) { > // ... > } > }); > > > TAG > > On Apr 17, 2007, at 12:14 PM, Walter Lee Davis wrote: > >> >> I followed the advice on this page: >> >> <http://wiki.script.aculo.us/scriptaculous/show/ >> HowtoExtendAndOverride> >> >> And created an extension.js file and added the following to it: >> >> Object.extend(Ajax, { >> getText: function() { >> return this.element.childNodes[0] ? >> this.element.childNodes[0].nodeValue : ''''; >> } >> }); >> >> >> This works perfectly, I now get my entity-escaped characters like >> & >> showing correctly in the editor. >> >> But when I tried to do this: >> >> Object.extend(Ajax, { >> onLoadedExternalText: function(transport) { >> Element.removeClassName(this.form, this.options.loadingClassName); >> this.editField.disabled = false; >> this.editField.value = transport.responseText; >> Field.scrollFreeActivate(this.editField); >> } >> }); >> >> The base function was not overridden. (I am trying to remove the >> stripTags() call from the end of responseText.) >> >> The only thing that worked was to comment out line 655 of controls.js, >> like so: >> >> //this.editField.value = transport.responseText.stripTags(); >> this.editField.value = transport.responseText; >> >> Can anyone spot what I''m doing wrong here that I''m not able to >> override >> this function from an extensions.js file? >> >> Thanks, >> >> Walter >> >> >>> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 17, 2007, at 12:53 PM, Walter Lee Davis wrote:> ... So the fact that the other one (getText) > worked was just magic?Probably. =) That''s all programming is really ... magic, sorcery, ridiculous words, and a lot of hand waving. Christophe could probably provide you with a better explanation, especially if it''s a class/inheritance issue. Without diving too much into the code, I might suggest that perhaps your other one wasn''t actually working--after all, it has essentially the same functionality as the original getText: getText: function() { return this.element.innerHTML; }, I''m glad you got it working. TAG --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Apr-17 21:18 UTC
Re: Trying to extend IPE -- some success, one failure
Hey Walter, I should stress that IPE and IPCE are being 100% rewritten these days, and an entirely new version will soon be in trunk. The current codebase just has too many issues from a variety of perspectives. Sincerely, -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Apr-18 01:47 UTC
Re: Trying to extend IPE -- some success, one failure
That''s very encouraging. I know it gets a lot of wind up on this list -- so many people want it to change or have endless conf. flags. Personally, I''m just delighted that I was able to get this extension thing to work. I hate having to trawl through all that code and fix two or three things. It''s good to be actually learning how to extend... Walter On Apr 17, 2007, at 5:18 PM, Christophe Porteneuve wrote:> > Hey Walter, > > I should stress that IPE and IPCE are being 100% rewritten these days, > and an entirely new version will soon be in trunk. The current > codebase > just has too many issues from a variety of perspectives. > > Sincerely, > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---