Hey there,
I noticed you bind your event handlers when the field is focused, but these are never unbound. This results in some unwanted behavior:

  • focus the editable element
  • unfocus it
  • focus it again
  • make a change
  • press save

you will now get the "Your changes were saved." message twice...

ideal solution would be to not unbind, but check which element is focussed when the callback is fired

CommentFileSizeAuthor
#1 html5_contenteditable-refactored.patch5.68 KBseutje

Comments

seutje’s picture

Status: Active » Needs review
StatusFileSize
new5.68 KB

ended up refactoring the entire javascript file, the resulting file is more performant, more readable and more flexible in terms of extending...
this does however fix the issue at hand...

cheers!

kmadel’s picture

Status: Needs review » Fixed

Thanks for the interest. I applied, committed and pushed your patch with one change, I modified a bit around the focusin for the controls. I didn't like how they just instantly appeared on the new area you were editing and wanted some effect to provide better visual feedback to the user that the controls moved.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.