JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.3
[ckeditor.git] / _source / plugins / elementspath / plugin.js
index 7c39fce..58cacc3 100644 (file)
@@ -133,7 +133,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                        editor.on( 'contentDomUnload', function()\r
                                {\r
-                                       getSpaceElement().setHtml( emptyHtml );\r
+                                       // If the spaceElement hasn't been initialized, don't try to do it at this time\r
+                                       // Only reuse existing reference.\r
+                                       spaceElement && spaceElement.setHtml( emptyHtml );\r
                                });\r
 \r
                        editor.addCommand( 'elementsPathFocus', commands.toolbarFocus );\r
@@ -153,7 +155,15 @@ CKEDITOR._.elementsPath =
                editor.focus();\r
 \r
                var element = editor._.elementsPath.list[ elementIndex ];\r
-               editor.getSelection().selectElement( element );\r
+\r
+               if ( element.is( 'body' ) )\r
+               {\r
+                       var range = new CKEDITOR.dom.range( editor.document );\r
+                       range.selectNodeContents( element );\r
+                       range.select();\r
+               }\r
+               else\r
+                       editor.getSelection().selectElement( element );\r
 \r
                return false;\r
        },\r