HEX
Server: Apache
System: Linux websend04.greenconsulting.it 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User: web20 (5023)
PHP: 7.2.34-38+ubuntu18.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/clients/client0/web20/web/wp-content/plugins/easy-panorama/block/src/index.js
const { __ } = wp.i18n;

const {
  registerBlockType,
  createBlock
} = wp.blocks;

const { settings } = easyPanorama;

import './i18n.js';
import './editor.scss';
import PanoramaBlock from './block';

registerBlockType( 'easy-panorama/block', {
  title: __( 'Panorama' ),
  description: __('Panorama is a great way to share wide/panoramic images on your site.'),
  icon: 'cover-image',
  category: 'layout',
  attributes: {
    id: {
      type: 'number',
    },
    url: {
      type: 'string',
    },
    alt: {
      type: 'string',
    },
    title: {
      type: 'string',
    },
    containerHeight: {
      type: 'number',
      default: settings.containerHeight
    },
    startPosition: {
      type: 'number',
      default: settings.startPosition
    },
    gracefulFailure: {
      type: 'bool',
      default: settings.gracefulFailure
    },
    failureMessage: {
      type: 'string',
      default: settings.failureMessage
    },
    failureMessageInsert: {
      type: 'string',
      default: settings.failureMessage
    },
    minimumOverflow: {
      type: 'number',
      default: settings.minimumOverflow
    },
    displayMeta: {
      type: 'bool',
      default: settings.displayMeta
    }
  },
  supports: {
    html: false
  },
  transforms: {
    from: [
      {
        type: 'block',
        isMultiBlock: true,
        blocks: [ 'core/image' ],
        transform: ( attributes ) => {
          return createBlock( 'easy-panorama/block', ...attributes );
        },
      },
      {
        type: 'shortcode',
        tag: 'easy_panorama',
        attributes: {
          id: {
            type: 'number',
            shortcode: ( { named: { id } } ) => {
              return id;
            },
          },
          url: {
            type: 'string',
            shortcode: ( { named: { url } } ) => {
              return url;
            },
          },
          title: {
            type: 'string',
            shortcode: ( { named: { title } } ) => {
              return title;
            },
          },
          alt: {
            type: 'string',
            shortcode: ( { named: { alt } } ) => {
              return alt;
            },
          },
          height: {
            type: 'number',
            shortcode: ( { named: { height } } ) => {
              return height;
            },
          },
          graceful_failure: {
            type: 'bool',
            shortcode: ( { named: { graceful_failure } } ) => {
              return graceful_failure;
            },
          },
          failure_message: {
            type: 'string',
            shortcode: ( { named: { failure_message } } ) => {
              return failure_message;
            },
          },
          failure_message_insert: {
            type: 'string',
            shortcode: ( { named: { failure_message_insert } } ) => {
              return failure_message_insert;
            },
          },
          meta: {
            type: 'bool',
            shortcode: ( { named: { meta } } ) => {
              return meta;
            },
          },
          minimum_overflow: {
            type: 'number',
            shortcode: ( { named: { minimum_overflow } } ) => {
              return minimum_overflow;
            },
          },
          start_position: {
            type: 'number',
            shortcode: ( { named: { start_position } } ) => {
              return start_position;
            },
          },

        },
      },
    ],
    to: [
      {
        type: 'block',
        blocks: [ 'core/image' ],
        transform: ( { id, url, alt, title } ) => {
          return createBlock( 'core/image', { id, url, alt, title } );
        },
      },
    ],
  },

  edit: PanoramaBlock,

  save: props => {
    const {
      className,
      attributes: {
        id,
        url,
        alt,
        title
      }
    } = props;
    return (
      <div className={ className } key="easypanorama-block-save">
        {
          url && (
            <figure key="easypanorama-block-save-figure">
              <img key="easypanorama-block-save-image" className={`wp-image-${ id }`} src={ url } alt={ alt } title={ title } />
            </figure>
          )
        }
      </div>
    );
  }
});