Marius Dumitru Florea wrote:
Hi devs,
To explain the issue lets consider the following scenario:
* Edit a new page with the new WYSIWYG editor.
* Type "foobar" and place the caret as in "foo|bar", where the pipe
represents the caret.
* Press the Bold button or type CRTL+B in order to start typing bold
text at the current insertion point.
* At this moment, the HTML should be "foo<strong>|</strong>bar"
where
the pipe represents the caret.
The Problem
In Mozilla it's easy to place the caret as suggested. In IE it's
impossible (this weekend I tried all sort of things and search
desperately on Google..). What I can easily do in IE is either
"foo|<strong></strong>bar" or
"foo<strong></strong>|bar". The workaround
that I found is to use a special space symbol
http://en.wikipedia.org/wiki/Zero-width_non-joiner inside the strong tag
(before, it had an empty text node inside) and place the caret just
after this special space symbol.
Question: does IE support clicking bold outside/at the start/end of the
word? For example:
* Type " foo bar "
* What happens when the cursor is like: "| foo bar "?
* What happens when the cursor is like: " |foo bar "?
* What happens when the cursor is like: " foo| bar "?
* What happens when the cursor is like: " foo |bar "?
* What happens when the cursor is like: " foo bar| "?
* What happens when the cursor is like: " foo bar |"?
* What happens when the cursor is like: " foo | bar "?
If the " foo | bar " case works fine, then this is just another example
of how IE is so incredibly wrongly coded...
These cases (along with "foo|bar") should be tested in several browsers
and see what's happening.
IE behaves exactly as Word. The answer to all your questions is: They
don't insert a strong element immediately, but just as soon as you type
a letter. And this is the right behavior, I think. On the contrary, I
insert the strong element right away and that's why I need to place the
caret inside it. I'll change my implementation to delay the insertion of
the strong element, thus avoiding the use of the special space symbol.
Thanks,
Marius.