From: Aleksander Ɓukasz Date: Mon, 2 Dec 2013 13:29:47 +0000 (+0100) Subject: Fix: Do not set text on canvas element if it didn't change. X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/890e3143c7146ecc4b1982e13369134d518864df?hp=00c7fb9e5f0a51e841d754cc2707b65db9c2737e Fix: Do not set text on canvas element if it didn't change. On setting the same text on a text node Chrome does nothing, but FF triggers ContentObserver handler. --- diff --git a/src/editor/modules/documentCanvas/canvas/wlxmlListener.js b/src/editor/modules/documentCanvas/canvas/wlxmlListener.js index ce9de6d..80da027 100644 --- a/src/editor/modules/documentCanvas/canvas/wlxmlListener.js +++ b/src/editor/modules/documentCanvas/canvas/wlxmlListener.js @@ -73,7 +73,9 @@ var handlers = { if(toSet === '') { toSet = utils.unicode.ZWS; } - canvasElement.setText(toSet); + if(toSet !== canvasElement.getText()) { + canvasElement.setText(toSet); + } } };