X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/471681497ab6e3ae9919f4e67f8edfc5e63a0670..1dfb9c497ad66a5c0025e806bd6ee4777baaf1aa:/src/editor/modules/documentCanvas/canvas/canvas.js

diff --git a/src/editor/modules/documentCanvas/canvas/canvas.js b/src/editor/modules/documentCanvas/canvas/canvas.js
index 70c0f49..f8e9927 100644
--- a/src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/src/editor/modules/documentCanvas/canvas/canvas.js
@@ -357,16 +357,16 @@ $.extend(Cursor.prototype, {
             return {
                 element: anchorElement,
                 offset: selection.anchorOffset,
-                offsetAtBeginning: selection.anchorOffset === 0,
-                offsetAtEnd: selection.anchorNode.data.length === selection.anchorOffset
+                offsetAtBeginning: selection.anchorOffset === 0 || anchorElement.getText() === '',
+                offsetAtEnd: selection.anchorNode.data.length === selection.anchorOffset || anchorElement.getText() === ''
             };
         }
         if(which === 'focus') {
             return {
                 element: focusElement,
                 offset: selection.focusOffset,
-                offsetAtBeginning: selection.focusOffset === 0,
-                offsetAtEnd: selection.focusNode.data.length === selection.focusOffset
+                offsetAtBeginning: selection.focusOffset === 0 || focusElement.getText() === '',
+                offsetAtEnd: selection.focusNode.data.length === selection.focusOffset || focusElement.getText() === '',
             };
         }
         
@@ -414,8 +414,8 @@ $.extend(Cursor.prototype, {
         return {
             element: placeData.element,
             offset: placeData.offset,
-            offsetAtBeginning: placeData.offset === 0,
-            offsetAtEnd: nodeLen === placeData.offset
+            offsetAtBeginning: placeData.offset === 0 || focusElement.getText() === '',
+            offsetAtEnd: nodeLen === placeData.offset || focusElement.getText() === ''
         };
     }
 });