These are chat archives for GetmeUK/ContentTools

6th
Nov 2015
Luis Vegerano
@lvegerano
Nov 06 2015 20:28
Cursor_and_HTML_Page.png
Hey guys I noticed that indexOf() is not returning the right index. Granted my HTMLString has <br> &nbsp; &zwnj; but I still think if should return the correct index.
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:24
Hi @lvegerano - I think that's right isn't it? Or have I miss counted the characters?
I've counted a dozen times now and it's always 15 for me
Luis Vegerano
@lvegerano
Nov 06 2015 22:28
Hi @anthonyjb no but I just realized that the html must be getting optimized thus removing one of the <br>. I was able to get it working by doing
content.indexOf(new HTMLString.String(‘|’))
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:30
ahh - yes your correct, when you output the string using .html() the content is optimized (https://github.com/GetmeUK/ContentEdit/blob/3630852d7e7732efc3f886b6342ab0f699b588a6/src/scripts/text.coffee#L484)
however optimizing shouldn't remove a character it should only change the tag structure
Luis Vegerano
@lvegerano
Nov 06 2015 22:34
Correct but the example I pasted is outdated basically I had a html string that had something like foo <br><br>| and indexOf(‘|’) was off by 1.
so inserting a <br> in the characters array does takes a spot. In this case I needed both but it was being optimized :D
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:35
You know that might well be a bug with optimize - it probably sees the two <br> tags as the same type and merges them to optimize - I need to resolve that
Luis Vegerano
@lvegerano
Nov 06 2015 22:35
It seem that way
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:35
good spot - I'll post a bug regarding this now
:)
Luis Vegerano
@lvegerano
Nov 06 2015 22:37
I also would like too look at &nbsp; insided tags where the char does not includes the tag. But HTML.String is hefty and havent felt brave enough plus “I don’t drink coffee” :D
Either way this set of libs have save our lives here and I really appreciate all the effort that has been put into this project. Hopefully once we’re done here we can open source and extension
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:40

Do you mind if you're using HTMLString in a project or just trying it out - I'm always interested to hear about what people are doing with the libraries.

I'll have some time this weekend so will focus on resolving the HTMLString issues you've found :)

Luis Vegerano
@lvegerano
Nov 06 2015 22:42
Sure, I cant give you a run down of what we’re trying to accomplish. But in essence we have overwritten most fo the Text class
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:43
Ahh - so you're not just using HTMLString but ContentEdit too?
Luis Vegerano
@lvegerano
Nov 06 2015 22:44
ContentEdit is the base and HTMLString for text manipulations
Anthony Blackshaw
@anthonyjb
Nov 06 2015 22:44
awesome :)
Luis Vegerano
@lvegerano
Nov 06 2015 22:45
:+1: :D