From: Aleksander Ɓukasz Date: Wed, 17 Apr 2013 10:40:57 +0000 (+0200) Subject: Visual editor - moving meta add button out of table + some styling X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/7e96084b977d9ecea7b0569fad7357035c017325?ds=inline;hp=9b7ac89bcf60dac7430e708452257f01db25f01e Visual editor - moving meta add button out of table + some styling --- diff --git a/editor.css b/editor.css index 2eab7fc..c5c3ee7 100644 --- a/editor.css +++ b/editor.css @@ -61,11 +61,18 @@ body { width: 290px; } +#rng-visualEditor-meta table { + margin-bottom:10px; +} + #rng-visualEditor-meta table [contenteditable] { font-size: 11px; line-height:13px; cursor: pointer; +} +#rng-visualEditor-meta table li:last-child { + border-bottom: none !important; } #rng-visualEditor-meta table tr td:nth-child(1) [contenteditable] { @@ -76,8 +83,9 @@ body { width:150px; } -#rng-visualEditor-meta table .rng-visualEditor-addMetaRow td:nth-child(3) { - width:15px; +#rng-visualEditor-meta .rng-visualEditor-metaAddBtn { + float:right; + margin-right:6px; } #rng-visualEditor-meta .btn{ diff --git a/modules/visualEditor.js b/modules/visualEditor.js index bd90b0a..9721d29 100644 --- a/modules/visualEditor.js +++ b/modules/visualEditor.js @@ -33,7 +33,7 @@ rng.modules.visualEditor = function(sandbox) { var metaTable = this.metaTable = this.node.find('#rng-visualEditor-meta table'); - this.metaTable.find('.rng-visualEditor-metaAddBtn').click(function() { + this.node.find('.rng-visualEditor-metaAddBtn').click(function() { var newRow = view._addMetaRow('', ''); $(newRow.find('td div')[0]).focus(); isDirty = true; @@ -52,7 +52,7 @@ rng.modules.visualEditor = function(sandbox) { } else { var input = $(''); input.appendTo('body').focus() - metaTable.find('.rng-visualEditor-metaAddBtn').focus(); + view.node.find('.rng-visualEditor-metaAddBtn').focus(); input.remove(); } e.preventDefault(); @@ -63,7 +63,7 @@ rng.modules.visualEditor = function(sandbox) { }, getMetaData: function() { var toret = {}; - this.metaTable.find('tr').not('.rng-visualEditor-addMetaRow').each(function() { + this.metaTable.find('tr').each(function() { var tr = $(this); var inputs = $(this).find('td [contenteditable]'); var key = $(inputs[0]).text(); @@ -75,7 +75,7 @@ rng.modules.visualEditor = function(sandbox) { }, setMetaData: function(metadata) { var view = this; - this.metaTable.find('tr').not('.rng-visualEditor-addMetaRow').remove(); + this.metaTable.find('tr').remove(); _.each(_.keys(metadata), function(key) { view._addMetaRow(key, metadata[key]); }); @@ -91,9 +91,8 @@ rng.modules.visualEditor = function(sandbox) { node.addClass('rng-current'); }, _addMetaRow: function(key, value) { - var addRow = this.metaTable.find('.rng-visualEditor-addMetaRow'); var newRow = $(sandbox.getTemplate('metaItem')({key: key || '', value: value || ''})); - newRow.insertBefore(addRow); + newRow.appendTo(this.metaTable); return newRow; } };