File "main.js"

Full Path: /home/romayxjt/public_html/wp-content/plugins/orderable/inc/modules/receipt-layouts/assets/admin/js/block-editor/main.js
File size: 1.38 KB
MIME-type: text/plain
Charset: utf-8

const {
  addFilter
} = wp.hooks;
addFilter('blocks.registerBlockType', 'orderable/modify-block-supports', function (settings, name) {
  if (!settings?.supports || !name.includes('core/')) {
    return {
      ...settings,
      attributes: {
        ...settings.attributes,
        style: {
          type: 'object',
          default: {
            ...settings.attributes.style?.default,
            color: {
              ...settings.attributes.style?.default?.color,
              text: '#111111'
            }
          }
        }
      }
    };
  }
  return {
    ...settings,
    supports: {
      ...settings.supports,
      align: false,
      anchor: false,
      spacing: {
        margin: true,
        padding: true
      },
      typography: {
        textAlign: true,
        fontSize: false
      },
      color: {
        text: true,
        background: true
      }
    },
    attributes: {
      ...settings.attributes,
      style: {
        type: 'object',
        default: {
          color: {
            text: '#111111'
          }
        }
      }
    }
  };
});
wp.data.dispatch('core/notices').createInfoNotice(wp.i18n.__('This preview will contain real data order once the receipt is generated, and will adapt to the width of your printer page setup. Please ensure you have selected a default layout in Orderable > Settings > Printing.', 'orderable'), {
  isDismissible: false
});