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

#26, words did not get highlighted correctly in rich editors. #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peter-klaesson-stratsys

No description provided.

…s. The first and last words in the elements did not get highlighted correctly.
@badsyntax
Copy link
Owner

Thanks for this, I've merged this change into the develop branch. (In the future, please target the develop branch when submitting pull requests.)

I'm going to make some changes to this code. As you've figured out, the issue here is the lack of whitespace in the markup. I've tried my best to avoid managing whitespace but it's pretty clear now I have to accommodate the lack of whitespace in a DOM tree.

The issue:

<p>Some text</p><p>Some more text</p>

It's difficult to know if the <p> is a block level, and if so it should break the sentences. If the <p> is not block level then it should not break the sentences.

It's difficult to extract text from markup when styles influence how words are broken.

I'll update this ticket with my changes soon...

badsyntax added a commit that referenced this pull request Mar 10, 2013
…fix for processing markup without whitespace between nodes by comparing node display style refs #29
@badsyntax
Copy link
Owner

Please can you test my change with the latest code from the develop branch? Or you can just use this version to test: https://github.com/badsyntax/jquery-spellchecker/blob/develop/dist/js/jquery.spellchecker.js

@peter-klaesson-stratsys
Copy link
Author

It looks good, the tests passed. I will not be able to test it within our code base yet due to that we are in a regression test phase, but we will merge it for our next release.

@badsyntax
Copy link
Owner

This needs more work. My approach is wrong, I think. We can't test for styles because block !== newline (eg, if an element is block and floated).

I will follow what CKEditor does. CKeditor parses and transforms markup. I will try understand how CKEditor does this and then apply the same logic.

I believe most of the logic you can find here: http://docs.ckeditor.com/source/htmldataprocessor.html possibly within the createBogusAndFillerRules() and isBlockBoundary() functions.

I spoke with some of the core devs a little while back about handling the lack of whitespace here: http://dev.ckeditor.com/ticket/9578

Their responses suggest they assume certain elements to be block and thus require new line whitespace.

@badsyntax
Copy link
Owner

I've gone back to simply comparing the nodeName to a list of known block level element with commit: ee51122

This seems to have fixed a lot of the issues. Once I get some more testing done I will release this and other fixes as v0.2.5

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

Successfully merging this pull request may close these issues.

2 participants