From 59a5931ac3ab77de0ab5b1139c51a9b6b4ca8942 Mon Sep 17 00:00:00 2001 From: Michael Wnuk Date: Tue, 10 Jun 2014 18:03:25 -0500 Subject: [PATCH] simplified inline size & crop options --- bower.json | 2 +- package.json | 2 +- src/modules/inline.js | 21 +++++---------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/bower.json b/bower.json index 482cee4..2205d5c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "onion-editor", - "version": "0.1.13", + "version": "0.1.14", "homepage": "https://github.com/theonion/editor", "authors": [ "Mike Wnuk " diff --git a/package.json b/package.json index 715d910..b7b3d1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onion-editor", - "version": "0.1.13", + "version": "0.1.14", "author": { "name": "Mike Wnuk", "email": "mwnuk@theonion.com" diff --git a/src/modules/inline.js b/src/modules/inline.js index b7c8ab5..e134b17 100644 --- a/src/modules/inline.js +++ b/src/modules/inline.js @@ -130,14 +130,13 @@ } + function getSizes() { - return Object.keys(options.inline[$(activeElement).attr("data-type")].size); + return options.inline[$(activeElement).attr("data-type")].size; } function getCrops() { - return options - .inline[$(activeElement).attr("data-type")] - .size[$(activeElement).attr("data-size")]; + return options.inline[$(activeElement).attr("data-type")].crop; } //TODO: Determine how to handle two adjacent inline elements. Probably skip over? @@ -155,19 +154,9 @@ inline_size: function() { var l = getSizes(); toggleAttribute("size", l); - - var currentCrop = $(activeElement).attr("data-crop"); - var cropOptions = getCrops(); - //this crop isn't available for the new size option - if (cropOptions.indexOf(currentCrop) === -1) { - setValue("crop", cropOptions[0]); - } - }, inline_crop: function() { - var l = options - .inline[$(activeElement).attr("data-type")] - .size[$(activeElement).attr("data-size")]; + var l = getCrops(); toggleAttribute("crop", l); }, inline_up: function() { @@ -228,7 +217,7 @@ } } - + function setValue(attribute, value) { editor.changed(); var currentValue = $(activeElement).attr("data-" + attribute);