/* eslint-disable quotes */ /* eslint-disable space-in-parens */ /* eslint-disable valid-jsdoc */ /** * BLOCK: epyt/vi */ // Import CSS. import "./style.scss"; import "./editor.scss"; const { __ } = wp.i18n; // Import __() from wp.i18n const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks const { Component, Fragment } = wp.element; /** * Register: aa Gutenberg Block. * * Registers a new block provided a unique name and an object defining its * behavior. Once registered, the block is made editor as an option to any * editor interface where blocks are implemented. * * @link https://wordpress.org/gutenberg/handbook/block-api/ * @param {string} name Block name. * @param {Object} settings Block settings. * @return {?WPBlock} The block, if it has been successfully * registered; otherwise `undefined`. */ registerBlockType("epyt/vi", { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block. title: __("Video Ad"), // Block title. icon: ( /* */ ), category: "embed", // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed. keywords: [__("video"), __("story"), __("ad")], description: __("Video ad powered by vi intelligence."), supports: { multiple: false }, attributes: { shortcode: { type: "string", default: "[embed-vi-ad]" } }, /** * The edit function describes the structure of your block in the context of the editor. * This represents what the editor will render when the block is used. * * The "edit" property must be a valid function. * * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/ */ edit: class extends Component { constructor(props) { super(...arguments); this.props = props; } render() { if (this.props.attributes.shortcode) { return (
VIDEO AD + CONTENT {window._EPYT_.vi_active == "1" ? null : ( Note: Ads are currently turned off.
When you are ready to make ads appear on your website, visit the{" "} Monetize {" "} page to turn ads on.
)}
Example vi Story Title Text
featured by {" "} vi logo
); } return null; } }, /** * The save function defines the way in which the different attributes should be combined * into the final markup, which is then serialized by Gutenberg into post_content. * * The "save" property must be specified and must be a valid function. * * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/ */ save: function(props) { return {props.attributes.shortcode}; } }); x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586