mesh-ui icon indicating copy to clipboard operation
mesh-ui copied to clipboard

Make Quill Options configurable

Open philippguertler opened this issue 6 years ago • 1 comments

Currently the quill options are hardcoded here:

https://github.com/gentics/mesh-ui/blob/ab6a0b6e8ef907adcf639fd01514c01f05a3d7fa/src/app/form-generator/components/html-field/html-field.component.ts#L32-L58

It would be nice to make it configurable in the mesh-ui-config.js

philippguertler avatar Feb 26 '20 07:02 philippguertler

Would be great if it's possible to define these settings based on the node/micronode which has the HTML field set. An plain object or a function similar to the previewUrls would be nice:

{
  formattingOptions: [
    [{ header: [1, 2, 3, 4, 5, 6, false] }],
    ['bold', 'italic', 'underline'], 
  
     [{ list: 'ordered' }, { list: 'bullet' }], 
     [{ script: 'sub' }, { script: 'super' }], 
  ],
}
{
  formattingOptions: function(node, microNode) {
    var options = [];
    switch (node.schema.name) {
      case 'category':
        options.push(['bold', 'italic', 'underline']);
        break;
    }
    switch (microNode.schema.name) {
      case 'text':
        options.push([{ list: 'ordered' }, { list: 'bullet' }], [{ script: 'sub' }, { script: 'super' }]);
        break;
    }
    return options;
  },
}

The check can then simply be done with the type of it: typeof config.formattingOptions === 'function'

deckdom avatar Mar 02 '20 10:03 deckdom