Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotes issues #7

Closed
jamienk opened this issue Apr 22, 2014 · 13 comments
Closed

Quotes issues #7

jamienk opened this issue Apr 22, 2014 · 13 comments
Labels

Comments

@jamienk
Copy link

jamienk commented Apr 22, 2014

  • Quotes after parentheses:
("Stop!" he said) <--opening quote is wrong 

(this is also messed up when a quote comes after a dash,
but your dash handling forces a space, see #6)

  • Closing big quote after nested small quote
"I told her 'This is crazy'" <--closing quote incorrect
@danyaPostfactum
Copy link
Owner

closing quote incorrect

Why? I get: “I told her ‘This is crazy’”. What's wrong?

@jamienk
Copy link
Author

jamienk commented Apr 24, 2014

I get “I said ‘This is nuts’“ <--final closing quote is backwards

@danyaPostfactum
Copy link
Owner

@jamienk autocorrect does not handle text across different text nodes at present. Text can be separated to a text node by formatting elements (for example, you make 'This is nuts' italic), or in some cases while editing (sometimes browser splits whole text into a sequence of small text nodes).
This can cause mentioned quote issue.

@jamienk
Copy link
Author

jamienk commented Apr 26, 2014

I see what you're saying about the text node being split. How and why and when does this happen? I see it in Firebug. Why does CKEDITOR add line breaks in text nodes? (I understand that the line breaks are part of the HTML formatting and can be controlled, but why inside text nodes?)

@danyaPostfactum
Copy link
Owner

I see it in Firebug

Yes, this is Firefox issue. Anyway, I need to write CharacterWalker, that would jump between nodes and skeep bookmarks (they keep cursor position).
What line breaks do you mean? \n character? I don't see it. <br> element? But it's impossible. Text nodes contain character data only.

@jamienk
Copy link
Author

jamienk commented Apr 26, 2014

When I inspect the text node that I write it has line breaks in firebug so that the text inside the paragraph tags is broken into multiple lines. I can't see the line breaks get created because I have to hide and show the text in order for firebug to refresh the contents.

@jamienk
Copy link
Author

jamienk commented Apr 28, 2014

Example, when inspected in Firebug:

<p>
She’
s a big fan. A guy she met and doesn’
t like
wrote to her that he’
s thinking about her all the time
, and she texted back “
I’
m thinking about you all the time too!”
</p>

Where is that whitespace coming from? Not seeing this in Chrome. Can't find anything on it.

@jamienk jamienk mentioned this issue Apr 28, 2014
@danyaPostfactum
Copy link
Owner

There is no line breaks. This is just a presentation of a sequence of text nodes.
Other browsers normalize text by merging sibling text nodes while editing.

By the way, an element has a normalize() method, that invokes text normalization.

@jamienk
Copy link
Author

jamienk commented Apr 28, 2014

Hm, so when you wrote: "autocorrect does not handle text across different text nodes at present" << does that mean that if we first normalize() then the nodes will be merged and it'll work?

@jamienk
Copy link
Author

jamienk commented Apr 28, 2014

(and BTW, than you for this great work!)

@danyaPostfactum
Copy link
Owner

does that mean that if we first normalize() then the nodes will be merged and it'll work?

Yes. But I don't think this is good idea. Moreover, formatting element nodes (<b>, <i> etc) break autocorrect also. So I created CharacterIterator, that abstracts me from nodes, just giving me a sequence of characters.

You can try current master branch. It mostly done, but I did not tested yet.

@danyaPostfactum
Copy link
Owner

(and BTW, than you for this great work!)

Thank you for testing and your bug reports!

@jamienk
Copy link
Author

jamienk commented Apr 28, 2014

From my small set of test cases it works good!
Nice and fast work. I'm gonna check it out to learn from you! Will report back any issues...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants