Opened 11 years ago

Closed 11 years ago

#900 closed enhancement (fixed)

retain editing position position between modes

Reported by: ray Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc:

Description

This is IMHO a very valuable function which I would like to add to the trunk

I attach it as a plugin for testing purposes. Please give me some feedback

Attachments (1)

RetainPosition.zip (1.5 KB) - added by ray 11 years ago.
the plugin

Download all attachments as: .zip

Change History (14)

Changed 11 years ago by ray

the plugin

comment:1 Changed 11 years ago by mharrisonline

Wow! This works great!

The only thing I can think of to improve it would be if the cursor was focused in the same place when you switch modes, or if you had highlighted something, it would be highlighted in code view, and vice versa. Even so, what an improvement!

comment:2 Changed 11 years ago by mharrisonline

It only seems to work one way in FireFox?, from HTML mode to WYSIWYG mode. In IE it works both ways.

comment:3 Changed 11 years ago by ray

  • Component changed from Documentation to Xinha Core
  • Owner changed from akaEdge to gogo

Though it's not perfect, committed this in rev [703]

mharrisonline, your ideas are good but I honestly don't know how it would best be done :(

comment:4 Changed 11 years ago by guest

Also found it doesn't work on Firefox for the Mac

comment:5 Changed 11 years ago by jedi58

oops, forgot to say it was version 1.5.0.9 I tested it in

comment:6 Changed 11 years ago by ray

but works on FF 2.0.0.1 Mac

comment:7 Changed 11 years ago by ray

rev [706]: fixed an error that occured in IE if an image ("Control") was selected when switching from WYSIWYG to text

comment:8 Changed 11 years ago by ray

rev [707]: now using different control characters in IE and GEcko, because the one I used in the first place (String.fromCharCode(173)) was expanded to ­ in IE when using the (former) GetHtml plugin. The one that is now used in IE on the other hand doesn't work in Gecko...

comment:9 Changed 11 years ago by ray

rev [712]: In case the cursor is inside a link automatically created from a url by IE the cc also appears in the url and we have to strip it out additionally

comment:10 Changed 11 years ago by ray

rev [754]: There seems to be something going on beyond my understanding in fullpage mode in gecko. Catched the error

comment:11 Changed 11 years ago by ray

  • Resolution set to fixed
  • Status changed from new to closed

comment:12 Changed 11 years ago by wymsy

  • Resolution fixed deleted
  • Status changed from closed to reopened

In FF (2.0.0.3 Mac) this works only one way, from WYSIWYG to html. I'm pretty sure the problem is that focus is not being set correctly, for the following reasons:

  • If I put an alert() anywhere in the "else" branch of findCC() in Gecko.js, it works. I think this does not suggest a timing problem, but rather clicking OK in the alert sets the focus.
  • Without the alert(), after switching back to WYSIWYG, if I press 'tab' one or sometimes more times (depends on the page content) it starts working. I think this is the tab stepping through the form elements until it gets to the xinha iframe.

However, I have not managed to figure out how to fix it. It should be just a 'focus()' method applied to something, and I'm probably missing something simple, but nothing I have tried so far works. Any ideas?

comment:13 Changed 11 years ago by wymsy

  • Resolution set to fixed
  • Status changed from reopened to closed

Found it. Just add

this._iframe.contentWindow.focus();

and all is well. Commited in changeset:808.

Note: See TracTickets for help on using tickets.