In a recent discussion it was noted that in the new version of Scriptaculous, pressing the escape key for an InPlaceEditor field to cancel the editing, no longer works as it did in the older version. I realize that this code has been substantially re-written by Christophe Porteneuve, and perhaps I''m either using the control incorrectly or this behavior has already been patched. Please correct me if that is the case. I''ve patched my local version, but since I won''t touch the original controls.js file this required some funky function wrapping. Here is what I changed: http://pastie.textmate.org/138848 1) I removed the keydown listener from the base listeners object, since there is no point in attaching this listener to a span element. 2) I''ve wrapped the initialize method so that I can set up a private variable with with a binding to the keydown listener method (checkForEscapeOrReturn) 3) I''ve wrapped the enterEditMode method to attach the keydown listener to the input box after it is created 4) I''ve wrapped the removeForm method to detach the keydown listener before removing the input box My code is crufty and ugly, but it hitting escape while the focus is inside an IPE input control will now do what you expect. -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
After further testing I''ve made a slight change to my above code. I didn''t realize that the removeForm() method is called multiple times. Here is the updated version: http://pastie.textmate.org/138869 Also note that I figured out how to use apply() to properly pass arguments on through to the wrapped method. Now you can''t make snide remarks to the effect "you think you''re cool, but you don''t even know how to use apply()"! I kid ;) -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Justin Perkins wrote:> In a recent discussion it was noted that in the new version of > Scriptaculous, pressing the escape key for an InPlaceEditor field to > cancel the editing, no longer works as it did in the older version.That''s not actually the bug I reported - I said the cancel button doesn''t work. I actually didn''t notice the escape key issue. Steve --~--~---------~--~----~------------~-------~--~----~ 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 Jan 14, 2008 8:04 PM, Steve Prior <sprior-k+eNSbF9ABhWk0Htik3J/w@public.gmane.org> wrote:> That''s not actually the bug I reported - I said the cancel button doesn''t work. > I actually didn''t notice the escape key issue.This only happens when submitOnBlur is set to true and you are using a cancel button/link. Read on for background info and perhaps why you might not want to do that... I was assuming it was the same issue, since they both invoke the same behavior. But since we''re talking about keylisteners, then I guess it''s clear that they''re two different issues. The one I noticed in relation to the cancel button/link was that it would invoke the submit event, but this is only when I have the option, submitOnBlur, set to true, at least in my experience. For times when you will use a cancel button/link, it does not make sense to use submitOnBlur, since the blur even will fire at the same time that clicking the cancel button occurs. So, maybe the IPE code could do some fancy attribute preparation and turn off cancelControl when submitOnBlur is true, but really I think it is up to the developer to set up the appropriate options. As an exercise, I looked into modifying the handleFormSubmission method such that it would not allow form submission if the cancel click event occurred, but it seems that the blur event is fired beforehand (which is not surprising). Have a great evening. -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Justin Perkins wrote:> This only happens when submitOnBlur is set to true and you are using a > cancel button/link. Read on for background info and perhaps why you > might not want to do that...I''m pretty sure I was not using submitOnBlur and I was never talking about a keylistener (unless it''s built into IPE). Here''s the code I fixed the problem with: Object.extend(Ajax.InPlaceEditor.prototype, { handleFormSubmission: function(e) { var form = this._form; var value = $F(this._controls.editor); this.prepareSubmission(); var params = this.options.callback(form, value) || ''''; if (Object.isString(params)) params = params.toQueryParams(); params.editorId = this.element.id; if (this.options.htmlResponse) { var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); Object.extend(options, { parameters: params, onComplete: this._boundWrapperHandler, onFailure: this._boundFailureHandler }); new Ajax.Updater({ success: this.element }, this.url, options); } else { this._savedUserEntry = value; // steve var options = Object.extend({ method: ''get'' }, this.options.ajaxOptions); Object.extend(options, { parameters: params, onComplete: this._boundWrapperHandler, onFailure: this._boundFailureHandler }); new Ajax.Request(this.url, options); } if (e) Event.stop(e); }, wrapUp: function(transport) { this.leaveEditMode(); if ((this._savedUserEntry != null) && (!this.options.htmlResponse)){ // steve this.element.innerHTML = this._savedUserEntry; // steve this._savedUserEntry = null; } // steve // Can''t use triggerCallback due to backward compatibility: requires // binding + direct element this._boundComplete(transport, this.element); } }); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Perhaps we''re using different versions of Scriptaculous. The version I am using is 1.7.1_beta1 (from the website a few weeks ago) and when I set cancelControl to true (submitOnBlur cannot be true), I get expected behavior (same as hitting escape should do, which my earlier patch seems to fix). Your code seems to set the value of the span (or whatever element triggered the edit event) to the value from the input box, in the case when htmlResponse is set to false. If that is true, what does that solve that cannot be achieved with built-in functionality? I mean this question in a genuine way :) -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Just FYI: I''ll try to find the time today or soon enough anyway to review the thread in detail and either promote your patch or put another one in. But yeah, I''m tracking this :-) -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
Justin: 1.7.1beta1 includes the FORMER version of IPE/IPCE. It was replaced by 1.8.0 on the website on Nov 7, 2007, quite some time ago. Perhaps you downloaded it through one monster cache :-? I suggest all of you guys move on to the latest lib (1.8.1, currently available on the official website) and retest in sync… -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
On the submitOnBlur / cancelControl issue: - Yes, they don''t make sense together, and submitOnBlur will, of necessity, hold sway: the blur event on the text editor will trigger before any click event on the cancel control. - I''m not too sure about adding to the already fancy option prep, but perhaps that''s not a bad idea… - The valid values for cancelControl and okControl are ''button'', ''link'' and false. Although a deprecation layer lets you still use former options and values, it won''t last forever. Read up on the detailed coverage in Thomas'' blog at the time (I think it was back in July) for a full detail of what changed. -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
Some suggest: - instead of submitOnBlur: actionOnBlur : ''cancel'',''submit''; - new option to define listener for editing. Some peoples prefer dblclick than click. The second problem to listen on click is when editable item is draggable/sortable/... The current code don''t convert the <br> tag in "\n", for my application i include this feature. line ~553: fld.value = 1 >= this.options.rows ? text : text.gsub(/<br>/ i,"\n") ; // convert <br> in \n if rows > 1 (textarea) Thanks for your works R1 --~--~---------~--~----~------------~-------~--~----~ 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 Jan 15, 2008 1:44 AM, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> 1.7.1beta1 includes the FORMER version of IPE/IPCE. It was replaced by > 1.8.0 on the website on Nov 7, 2007, quite some time ago. Perhaps you > downloaded it through one monster cache :-?Well, I guess I need to explain myself now ;) I had downloaded the latest version from the site at the end of December and in the process of updating all the files in my application, I decided to "trim the fat" (anything we didn''t use), so I did not include the scriptaculous.js file and a few others that we have never used. After about a week or so I realized that the version number was built into the scriptaculous.js file, so I added it back along with adding all the other files I did not previously include. It makes more sense to me to just include everything as a package. So I must have just re-included an old version of that file (scriptaculous.js) from our repository instead of the version I had recently downloaded, hence the version mixup since I''m for sure using the new version of the library. -justin --~--~---------~--~----~------------~-------~--~----~ 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 wrote:> I suggest all of you guys move on to the latest lib (1.8.1, currently > available on the official website) and retest in sync… >I''m currently on version 1.8.0 - wasn''t even aware 1.8.1 had come out. The changelog on the website doesn''t seem to cover ver 1.8.1 and browsing the source through trac doesn''t seem to be up to date either. It''s kind of a big deal to get a new version installed where I work, but a patch would be slightly easier if it were small - is there some more info available on what has really changed since 1.8.0? Steve --~--~---------~--~----~------------~-------~--~----~ 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 Jan 15, 2008 1:39 AM, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> > Just FYI: I''ll try to find the time today or soon enough anyway to > review the thread in detail and either promote your patch or put another > one in. But yeah, I''m tracking this :-)If it makes it any easier, or more motivating, I can make a patch file if you''d prefer. -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Steve Prior a écrit :> a patch would be slightly easier if it were small - is there some more > info available on what has really changed since 1.8.0?http://dev.rubyonrails.org/browser/spinoffs/scriptaculous/CHANGELOG -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve wrote:> Steve Prior a écrit : >> a patch would be slightly easier if it were small - is there some more >> info available on what has really changed since 1.8.0? > > http://dev.rubyonrails.org/browser/spinoffs/scriptaculous/CHANGELOG >Thanks, if you follow the link on http://script.aculo.us/downloads you still get the 1.8.0 version. Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Steve Prior a écrit :> Thanks, if you follow the link on > > http://script.aculo.us/downloads > > you still get the 1.8.0 version.You''ve got some monster cache issues. These links currently go 1.8.1 for me (both in their labels, filenames and contents), and have since January 3 indeed. -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve wrote:> Steve Prior a écrit : >> Thanks, if you follow the link on >> >> http://script.aculo.us/downloads >> >> you still get the 1.8.0 version. > > You''ve got some monster cache issues. These links currently go 1.8.1 > for me (both in their labels, filenames and contents), and have since > January 3 indeed. >It is only the CHANGELOG link which still shows the 1.8.0 info for me (because it has ?rev=8083 at the end), all the other links on the page point to the new 1.8.1 versions. The CHANGELOG link works for you? Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Steve Prior a écrit :> It is only the CHANGELOG link which still shows the 1.8.0 info for me > (because it has ?rev=8083 at the end), all the other links on the page > point to the new 1.8.1 versions.Ah, here''s the rub! Indeed, Thomas forgot to update the rev# on this. D''oh. I suggest you email him about it through the site. -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
On Jan 15, 2008 9:59 AM, Steve Prior <sprior-k+eNSbF9ABhWk0Htik3J/w@public.gmane.org> wrote:> Thanks, if you follow the link on > > http://script.aculo.us/downloads > > you still get the 1.8.0 version.fyi, I just grabbed the latest version (1.8.1) from the site today with no issues. -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I wanted to open up this thread again because I found a problem with my patch code (pastie linked earlier). Currently the code just blindly attaches the key listeners to the form control (input or textarea), but in the case of a textarea element it obviously doesn''t make sense to submit the form when enter is pressed. The easy fix for this would be to *not* attach the key listeners if the control is a textarea (this.options.rows > 1). This has the side effect of not canceling edit mode in the event of hitting the escape key unless the key listener was modified to do a similar check (is it a textarea or not) before invoking the submit action. -justin On Jan 15, 3:10 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 15, 2008 9:59 AM, Steve Prior <spr...-k+eNSbF9ABhWk0Htik3J/w@public.gmane.org> wrote: > > > Thanks, if you follow the link on > > >http://script.aculo.us/downloads > > > you still get the 1.8.0 version. > > fyi, I just grabbed the latest version (1.8.1) from the site today > with no issues. > > -justin--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---