GetmeUK / ContentEdit

A JavaScript library that provides a set of classes for building content-editable HTML elements.
http://getcontenttools.com/api/content-edit
MIT License
253 stars 51 forks source link

Wrong selection used to apply bold/italic #27

Open magiksd opened 6 years ago

magiksd commented 6 years ago

Hello, I'm currently implementing your awesome tool in my CMS, but I encountered a weird bug when simply applying a bold or italic on text.

See it by yourself on the demo :

  1. Start a new paragraph
  2. Write "aaaaa bbbbb"
  3. Select "bbbbb"
  4. Set it bold or italic
  5. Bug happen

Another way to see it :

  1. Start a new paragraph
  2. Write "aaaaa bbbbb"
  3. Set bold to "aaaaa"
  4. Set italic to "bbbbb"
  5. Select all text
  6. Set it bold
  7. Bug happen again

In both cases, selection seems to change before applying.

anthonyjb commented 6 years ago

Hey @magiksd could you let me know what browser and version of CT your using please. I'm not able to repeat the bug in Chrome on the demo page per your instructions.

magiksd commented 6 years ago

Thank you for your quick answer. Indeed, I just tried in Chrome and the bug is not present. I encountered it in Firefox 63.0 on Ubuntu and Windows.

anthonyjb commented 6 years ago

OK I can repeat this in firefox - it's an odd one - once you click away and re-enter the paragraph the bug is not longer present. I'll flag this as a bug and take a look ASAP - the issue will be in ContentSelect I'm sure so will fix there and bring CT up to date.

magiksd commented 6 years ago

Thank you :)

magiksd commented 5 years ago

Hello, I just noticed that the bug only occurs when double clicking the part to select, not when selecting carefully with the mouse, maybe this will help.

anthonyjb commented 5 years ago

@magiksd thanks for the extra info - much appreciated :+1: