Fix error that occur when clicking "insert image" button

If "element.childNodes" is empty, "element.tagName" cause "TypeError: Cannot read property 'tagName' of undefined".
This problem may occurs in clicking "insert image" button or "insert table" button, when textarea is empty. (Mac OSX 10.9.4, Chrome 35.0.1916.153)