not really known
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.

39 lines
1.1 KiB

  1. var BaseImageFormat = Quill.import('formats/image');
  2. const ImageFormatAttributesList = [
  3. 'alt',
  4. 'height',
  5. 'width',
  6. 'style'
  7. ];
  8. class ImageFormat extends BaseImageFormat {
  9. static formats(domNode) {
  10. return ImageFormatAttributesList.reduce(function(formats, attribute) {
  11. if (domNode.hasAttribute(attribute)) {
  12. formats[attribute] = domNode.getAttribute(attribute);
  13. }
  14. return formats;
  15. }, {});
  16. }
  17. format(name, value) {
  18. if (ImageFormatAttributesList.indexOf(name) > -1) {
  19. if (value) {
  20. this.domNode.setAttribute(name, value);
  21. } else {
  22. this.domNode.removeAttribute(name);
  23. }
  24. } else {
  25. super.format(name, value);
  26. }
  27. }
  28. }
  29. Quill.register(ImageFormat, true);
  30. // Register font families
  31. var Font = Quill.import('formats/font');
  32. Font.whitelist = ['comic', 'arial','Verdana'];
  33. Quill.register(Font, true);
  34. // Register Font sizes
  35. var fontSizeStyle = Quill.import('attributors/style/size');
  36. fontSizeStyle.whitelist = ['16px','24px', '32px' ,'40px', '48px' , '56px', '64px' , '72px' , '80px' , '100px'];
  37. Quill.register(fontSizeStyle, true);