These are chat archives for GetmeUK/ContentTools

24th
Aug 2016
Jesper Bränn
@Yopi
Aug 24 2016 09:12
@anthonyjb would you happen to remember at the top of your head where the merge/removal of multiple <br> tags happen?
Jesper Bränn
@Yopi
Aug 24 2016 09:21
Wow, nevermind, I was editing in the wrong place. Awkward, sorry! 😅
Another question though! I have some content which uses <strong> instead of <b>. Since <b> is not registered like the other big element types, is there some way I can make the Bold class work mount both <b> and <strong>, even if it only writes <b>?
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:22
Hi @Yopi - I'm not sure I understand what your asking? Why do you mean by <b> is not registered like the other big element types?
Jesper Bränn
@Yopi
Aug 24 2016 10:24
Haha, mm. Maybe I missed it, but I couldnt find a place where it's registered like for example ContentEdit.TagNames.get().register(ContentEdit.Image, 'img')
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:29
ok so bold and strong are inline tags and as such there's no ContentEdit element for them. Are you trying to make a strong tag, so that it's managed like a paragraph, e.g <p>...</p><strong>...</strong>...?
Jesper Bränn
@Yopi
Aug 24 2016 10:30
Yeah, that's what I meant. No I'm just trying to make the bold tool work on strong elements as well.
As it is right now I can't debold <strong>-elements
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:30
ahh I see
Jesper Bränn
@Yopi
Aug 24 2016 10:31
If I can prevent it, it would be nice to not have to update all previous markup
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:32
You could switch the tool to use strong instead easily, e.g ContentTools.Tools.Bold.tagName = 'strong'
Jesper Bränn
@Yopi
Aug 24 2016 10:33
Mhm, I was considering if adding something like tagNames = ['strong', 'b'], and then checking for both in isApplied could work
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:34

it would but you need to modify the coffee slightly I think it would have to be:

return element.content.slice(from, to).hasTags(@tagName..., true)

to unpack the arguments (that's line 99 of the tools.coffee file)
Jesper Bränn
@Yopi
Aug 24 2016 10:34
Yeah
oh that would be enough? Does hasTags support multiple tags?
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:35
yeah
Jesper Bränn
@Yopi
Aug 24 2016 10:35
Oooh, that's easier than I thought then
Cool
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:35
let me know how you get on :D
Jesper Bränn
@Yopi
Aug 24 2016 10:35
Yeah absolutely. Thanks!
Anthony Blackshaw
@anthonyjb
Aug 24 2016 10:36
np
Jesper Bränn
@Yopi
Aug 24 2016 14:02
So, fwiw I had to modify it a bit more. https://gist.github.com/Yopi/4c63dc5d0690ab590154fbd06cc76fda row 30-31, and row 40
since i needed to know which one to unformat to be able to remove it