Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
simplified inline size & crop options
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewnuk committed Jun 10, 2014
1 parent b31b636 commit 59a5931
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onion-editor",
"version": "0.1.13",
"version": "0.1.14",
"homepage": "https://github.com/theonion/editor",
"authors": [
"Mike Wnuk <mwnuk@theonion.com>"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onion-editor",
"version": "0.1.13",
"version": "0.1.14",
"author": {
"name": "Mike Wnuk",
"email": "mwnuk@theonion.com"
Expand Down
21 changes: 5 additions & 16 deletions src/modules/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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() {
Expand Down Expand Up @@ -228,7 +217,7 @@
}

}

function setValue(attribute, value) {
editor.changed();
var currentValue = $(activeElement).attr("data-" + attribute);
Expand Down

0 comments on commit 59a5931

Please sign in to comment.