CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

TIWCGJQHTMLEditor - trying to scroll to the top

by ScottWGast » 03 Jul 2014 19:37

Let's say that a user hits "Reply" to an email, I would like the HTML editor to auto-magically scroll to the top of the editor so that the user's cursor will be @ 0,0 when they begin typing ...

I've tried this code, but it does not seem to work:
Code: Select all
  // this _should_ scroll to the top of the HTML editor
  strJS:= Format('$($("#%s").find("iframe")[0].contentDocument.body).scrollTop(0);',[Self.htmleditorEmailBody.Name]);
  WebApplication.CallBackResponse.AddJavaScriptToExecute(strJS);


I have also tried using .HTMLName, to no avail:
Code: Select all
  // this _should_ scroll to the top of the HTML editor
  strJS:= Format('$($("#%s").find("iframe")[0].contentDocument.body).scrollTop(0);',[Self.htmleditorEmailBody.HTMLName]);
  WebApplication.CallBackResponse.AddJavaScriptToExecute(strJS);


This is the value of strJS:
Code: Select all
          $($("#HTMLEDITOREMAILBODYCOMPONENT_FAD6E7B9").find("iframe")[0].contentDocument.body).scrollTop(0);


I'm definitely not a JS guru... anyone care to weigh in?

Thanks,
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 04 Jul 2014 15:29

Hi ScottWGast,

auto-magically scroll to the top of the editor so that the user's cursor will be @ 0,0 when they begin typing ...


hm..I think you want only scroll to top and set position of cursor (0,0)

Attached demo.

Best Regards.
You do not have the required permissions to view the files attached to this post.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by ScottWGast » 07 Jul 2014 17:46

Thank you for the demo for scrolling to the top of the HTML editor... while the demo shows how to scroll to the top, it does not actually place the cursor at the top of the editor @ 0,0. When you click the "Scroll to top" button, it does scroll... but if you start typing, the cursor returns to it's original location.
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 08 Jul 2014 09:30

Hi ScottWGast,

Sorry, didn't save the form before making the zip.

Please check attached demo.

Note: Check Javascript property.

Best Regards.
You do not have the required permissions to view the files attached to this post.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by ScottWGast » 08 Jul 2014 14:56

Much better! Thank you very much :)

Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 22 Jul 2014 11:26

Hi ScottWGast,

We have implemented the new method to do this, available since V2.2.1.12.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by DelphiStudent » 22 Apr 2020 16:27

Alexander Bulei wrote:Hi ScottWGast,

Sorry, didn't save the form before making the zip.

Please check attached demo.

Note: Check Javascript property.

Best Regards.


the attached demo is not available, can you please re-post them,
or explain the solution?
Thank you so much
DelphiStudent
 
Posts: 11
Joined: 15 May 2017 21:45


Return to JQHTMLEditor

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.