X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/fc68f216c84ebb1cba54a1d7cc2b90c5f2923443..c0e11a8f6d0d9a4c030aa90fe91f0fc49cd05e0e:/modules/visualEditor.js diff --git a/modules/visualEditor.js b/modules/visualEditor.js index 73622f9..f3c0a5c 100644 --- a/modules/visualEditor.js +++ b/modules/visualEditor.js @@ -107,8 +107,13 @@ rng.modules.visualEditor = function(sandbox) { var firstNodeWithText = this.node.find('[wlxml-tag]').filter(function() { return $(this).clone().children().remove().end().text().trim() !== ''; }).first(); + var node; if(firstNodeWithText.length) - this.selectNode($(firstNodeWithText[0])); + node = $(firstNodeWithText[0]) + else { + node = this.node.find('[wlxml-class|="p"]') + } + this.selectNode(node); }, _addMetaRow: function(key, value) { var newRow = $(sandbox.getTemplate('metaItem')({key: key || '', value: value || ''}));