You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
767 B

4 years ago
  1. 'use strict';
  2. exports.type = 'perItem';
  3. exports.active = true;
  4. exports.params = {
  5. removeAny: true
  6. };
  7. exports.description = 'removes <desc>';
  8. var standardDescs = /^(Created with|Created using)/;
  9. /**
  10. * Removes <desc>.
  11. * Removes only standard editors content or empty elements 'cause it can be used for accessibility.
  12. * Enable parameter 'removeAny' to remove any description.
  13. *
  14. * https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
  15. *
  16. * @param {Object} item current iteration item
  17. * @return {Boolean} if false, item will be filtered out
  18. *
  19. * @author Daniel Wabyick
  20. */
  21. exports.fn = function(item, params) {
  22. return !item.isElem('desc') || !(params.removeAny || item.isEmpty() ||
  23. standardDescs.test(item.content[0].text));
  24. };