From: Aleksander Ɓukasz Date: Thu, 24 Jul 2014 14:00:48 +0000 (+0200) Subject: editor: Improved use of contenteditable for a caret support X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/2d4b18135a37d60f45c008271dbbd5c038bd76d1?ds=sidebyside;hp=2d4b18135a37d60f45c008271dbbd5c038bd76d1 editor: Improved use of contenteditable for a caret support This change stops declaring the whole canvas as being contenteditable=true, marks as such only current canvas text element instead. This approach has many advantages: 1. We no longer need to handle unspecified caret behavior, where caret could be put anywhere in the canvas DOM tree (outside of canvas text elements in particular) which needed tricky corrections on the fly. 2. Canvas widgets and custom canvas elements no longer need to use contenteditable=false nesting inside contenteditable=true, effects of which are not fully specified and which was leading to many unexpected behaviors, especially in Firefox. 3. It makes it possible the make a selection across any fragment of a document (contenteditable=true elements nested in contentedtiable=false are blocking selection crossing its borders from the inside). The downside is the need to handle keyboard navigation on the borders of canvas text elements manually. ---