diff --git a/plugins/removeDesc.js b/plugins/removeDesc.js index 40ecdb34..a6066413 100644 --- a/plugins/removeDesc.js +++ b/plugins/removeDesc.js @@ -2,11 +2,18 @@ exports.type = 'perItem'; -exports.active = false; +exports.active = true; + +exports.params = { + removeAny: false +}; + +var standardDescs = /^Created with/; /** - * Remove . - * Disabled by default cause it may be used for accessibility. + * Removes . + * Removes only standard editors content or empty elements 'cause it can be used for accessibility. + * Enable parameter 'removeAny' to remove any description. * * https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc * @@ -15,8 +22,9 @@ exports.active = false; * * @author Daniel Wabyick */ -exports.fn = function(item) { +exports.fn = function(item, params) { - return !item.isElem('desc'); + return !item.isElem('desc') || !(params.removeAny || item.isEmpty() || + standardDescs.test(item.content[0].text)); }; diff --git a/test/plugins/removeDesc.01.svg b/test/plugins/removeDesc.01.svg index cafe5830..7b174d5d 100644 --- a/test/plugins/removeDesc.01.svg +++ b/test/plugins/removeDesc.01.svg @@ -1,5 +1,5 @@ - ... + Created with Sketch.