Plugin Directory

Changeset 2494300


Ignore:
Timestamp:
03/12/2021 03:40:47 PM (4 years ago)
Author:
xsonic
Message:

minor fixes

Location:
wp-virtualtour/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • wp-virtualtour/trunk/README.txt

    r2460938 r2494300  
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    9 Stable tag: 1.0.0
     9Stable tag: 1.0.6
    1010
    1111Easily create interactive virtual 360° tours.
  • wp-virtualtour/trunk/admin/block/build/index.asset.php

    r2460938 r2494300  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'd1cc74301d316551d465c7ebbf379610');
     1<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '6e04e23d396c6e9ffccd019aaf92c780');
  • wp-virtualtour/trunk/admin/block/build/index.js

    r2460938 r2494300  
    1 !function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=window.wp.element},function(t,e){t.exports=window.wp.i18n},function(t,e){t.exports=window.wp.blockEditor},function(t,e){t.exports=window.wp.components},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e,n){var r=n(11);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}},function(t,e,n){var r=n(12),o=n(13);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?o(t):e}},function(t,e){t.exports=window.wp.blocks},function(t,e,n){"use strict";n.r(e);var r=n(5),o=n.n(r),i=n(6),u=n.n(i),a=n(7),l=n.n(a),c=n(8),p=n.n(c),s=n(4),f=n.n(s),b=n(0),d=n(9),y=n(1),m=n(2),v=n(3);Object(d.registerBlockType)("wp-virtualtour/wp-virtualtour-block",{apiVersion:2,title:Object(y.__)("WP Virtual Tour","wp_virtualtour"),description:Object(y.__)("Block to show a virtual tour.","wp_virtualtour"),keywords:[Object(y.__)("tour","wp_virtualtour"),Object(y.__)("virtual tour","wp_virtualtour"),Object(y.__)("3d","wp_virtualtour"),Object(y.__)("360","wp_virtualtour")],icon:"images-alt",category:"media",supports:{alignWide:!0,align:["full"]},attributes:{id:{type:"string",default:""},height:{type:"integer",default:400},pannellumInstance:{type:"object",default:{}}},edit:function(t){l()(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=f()(e);if(n){var o=f()(this).constructor;t=Reflect.construct(r,arguments,o)}else t=r.apply(this,arguments);return p()(this,t)});function i(){var t;return o()(this,i),(t=r.apply(this,arguments)).state={alignment:t.props.attributes.alignment,id:t.props.attributes.id,height:t.props.attributes.height,pannellumInstance:t.props.attributes.pannellumInstance},t}return u()(i,[{key:"render",value:function(){var t,e=this,n=this.props.attributes,r=(n.alignment,n.height),o=n.id,i=(n.pannellumInstance,function(t){e.props.setAttributes({id:t}),u(t)}),u=function(t){Object.keys(e.props.attributes.pannellumInstance).length&&e.props.attributes.pannellumInstance.destroy(),setTimeout((function(){e.props.attributes.pannellumInstance=window.pannellum.viewer("panorama-"+t,wp_virtualtour.tours.filter((function(e){return e.id===t}))[0])}),100)};return this.props.attributes.id&&u(this.props.attributes.id),this.props.attributes.id||i(wp_virtualtour.tours[0].id),Object(b.createElement)(b.Fragment,null,Object(b.createElement)(m.InspectorControls,null,Object(b.createElement)(v.PanelBody,{title:Object(y.__)("Settings","wp_virtualtour")},Object(b.createElement)(v.RangeControl,{label:"Height",value:r,onChange:function(t){e.props.setAttributes({height:t}),e.props.attributes.pannellumInstance.resize()},min:0,max:1e3}),Object(b.createElement)(v.SelectControl,{label:Object(y.__)("Select tour","wp_virtualtour"),value:o,onChange:i,options:(t=[{value:null,label:Object(y.__)("Select tour","wp_virtualtour"),disabled:!0}],wp_virtualtour.tours.forEach((function(e,n){t.push({value:e.id,label:e.default.title})})),t)}))),Object(b.createElement)(m.__experimentalBlock.div,null,Object(b.createElement)("div",{style:{height:r+"px"},id:"panorama-"+o})))}}]),i}(b.Component),save:function(t){var e=m.useBlockProps.save(),n=t.attributes.id,r=t.attributes.height;return Object(b.createElement)("div",e,Object(b.createElement)("div",{style:{height:r+"px"},id:"panorama_"+n,class:"wp-virtualtour-element","data-id":n}))}})},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}}]);
     1!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=window.wp.element},function(t,e){t.exports=window.wp.i18n},function(t,e){t.exports=window.wp.components},function(t,e){t.exports=window.wp.blockEditor},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e,n){var r=n(11);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}},function(t,e,n){var r=n(12),o=n(13);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?o(t):e}},function(t,e){t.exports=window.wp.blocks},function(t,e,n){"use strict";n.r(e);var r=n(5),o=n.n(r),u=n(6),i=n.n(u),a=n(7),c=n.n(a),l=n(8),s=n.n(l),p=n(4),f=n.n(p),b=n(0),d=n(9),y=n(1),m=n(3),v=n(2);Object(d.registerBlockType)("wp-virtualtour/wp-virtualtour-block",{apiVersion:2,title:Object(y.__)("WP Virtual Tour","wp_virtualtour"),description:Object(y.__)("Block to show a virtual tour.","wp_virtualtour"),keywords:[Object(y.__)("tour","wp_virtualtour"),Object(y.__)("virtual tour","wp_virtualtour"),Object(y.__)("3d","wp_virtualtour"),Object(y.__)("360","wp_virtualtour")],icon:"images-alt",category:"media",supports:{alignWide:!0,align:["full"]},attributes:{id:{type:"string",default:""},focused:{type:"boolean",default:!1},height:{type:"integer",default:400},pannellumInstance:{type:"object",default:{}}},edit:Object(v.withFocusOutside)(function(t){c()(u,t);var e,n,r=(e=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=f()(e);if(n){var o=f()(this).constructor;t=Reflect.construct(r,arguments,o)}else t=r.apply(this,arguments);return s()(this,t)});function u(){var t;return o()(this,u),(t=r.apply(this,arguments)).state={alignment:t.props.attributes.alignment,id:t.props.attributes.id,height:t.props.attributes.height,pannellumInstance:t.props.attributes.pannellumInstance,focused:t.props.focused},t}return i()(u,[{key:"handleFocusOutside",value:function(){this.props.setAttributes({focused:!1})}},{key:"render",value:function(){var t=this;this.props.isSelected&&this.props.setAttributes({focused:!0});var e,n=this.props.attributes,r=(n.alignment,n.height),o=n.id,u=(n.pannellumInstance,n.focused),i=function(e){t.props.setAttributes({id:e}),a(e)},a=function(e){Object.keys(t.props.attributes.pannellumInstance).length&&t.props.attributes.pannellumInstance.destroy(),setTimeout((function(){t.props.attributes.pannellumInstance=window.pannellum.viewer("panorama-"+e,wp_virtualtour.tours.filter((function(t){return t.id===e}))[0])}),100)};return this.props.attributes.id&&a(this.props.attributes.id),this.props.attributes.id||i(wp_virtualtour.tours[0].id),Object(b.createElement)(b.Fragment,null,Object(b.createElement)(m.InspectorControls,null,Object(b.createElement)(v.PanelBody,{title:Object(y.__)("Settings","wp_virtualtour")},Object(b.createElement)(v.RangeControl,{label:"Height",value:r,onChange:function(e){t.props.setAttributes({height:e}),t.props.attributes.pannellumInstance.resize()},min:0,max:1e3}),Object(b.createElement)(v.SelectControl,{label:Object(y.__)("Select tour","wp_virtualtour"),value:o,onChange:i,options:(e=[{value:null,label:Object(y.__)("Select tour","wp_virtualtour"),disabled:!0}],wp_virtualtour.tours.forEach((function(t,n){e.push({value:t.id,label:t.default.title})})),e)}))),Object(b.createElement)(m.__experimentalBlock.div,null,Object(b.createElement)("div",{className:"panorama-wrapper ".concat(u?"focused":"")},Object(b.createElement)("div",{style:{height:r+"px"},id:"panorama-"+o}))))}}]),u}(b.Component)),save:function(t){var e=m.useBlockProps.save(),n=t.attributes.id,r=t.attributes.height;return Object(b.createElement)("div",e,Object(b.createElement)("div",{style:{height:r+"px"},id:"panorama_"+n,class:"wp-virtualtour-element","data-id":n}))}})},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}}]);
  • wp-virtualtour/trunk/admin/block/package-lock.json

    r2460938 r2494300  
    33123312          "dev": true
    33133313        },
    3314         "prettier": {
    3315           "version": "npm:[email protected]",
    3316           "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.2.1-beta-1.tgz",
    3317           "integrity": "sha512-+JHkqs9LC/JPp51yy1hzs3lQ7qeuWCwOcSzpQNeeY/G7oSpnF61vxt7hRh87zNRTr6ob2ndy0W8rVzhgrcA+Gw==",
    3318           "dev": true
    3319         },
    3320         "puppeteer": {
    3321           "version": "npm:[email protected]",
    3322           "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-3.0.0.tgz",
    3323           "integrity": "sha512-oWjZFGMc0q2ak+8OxdmMffS79LIT0UEtmpV4h1/AARvESIqqKljf8mrfP+dQ2kas7XttsAZIxRBuWu7Y5JH8KQ==",
    3324           "dev": true,
    3325           "requires": {
    3326             "@types/mime-types": "^2.1.0",
    3327             "debug": "^4.1.0",
    3328             "extract-zip": "^2.0.0",
    3329             "https-proxy-agent": "^4.0.0",
    3330             "mime": "^2.0.3",
    3331             "mime-types": "^2.1.25",
    3332             "progress": "^2.0.1",
    3333             "proxy-from-env": "^1.0.0",
    3334             "rimraf": "^3.0.2",
    3335             "tar-fs": "^2.0.0",
    3336             "unbzip2-stream": "^1.3.3",
    3337             "ws": "^7.2.3"
    3338           }
    3339         },
    3340         "rimraf": {
    3341           "version": "3.0.2",
    3342           "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
    3343           "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
    3344           "dev": true,
    3345           "requires": {
    3346             "glob": "^7.1.3"
    3347           }
    3348         },
    33493314        "supports-color": {
    33503315          "version": "7.2.0",
     
    42534218    },
    42544219    "bl": {
    4255       "version": "4.0.3",
    4256       "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz",
    4257       "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==",
     4220      "version": "4.1.0",
     4221      "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
     4222      "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
    42584223      "dev": true,
    42594224      "requires": {
     
    1274112706      "dev": true
    1274212707    },
     12708    "prettier": {
     12709      "version": "npm:[email protected]",
     12710      "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.2.1-beta-1.tgz",
     12711      "integrity": "sha512-+JHkqs9LC/JPp51yy1hzs3lQ7qeuWCwOcSzpQNeeY/G7oSpnF61vxt7hRh87zNRTr6ob2ndy0W8rVzhgrcA+Gw==",
     12712      "dev": true
     12713    },
    1274312714    "prettier-linter-helpers": {
    1274412715      "version": "1.0.0",
     
    1294112912      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
    1294212913      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
     12914    },
     12915    "puppeteer": {
     12916      "version": "npm:[email protected]",
     12917      "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-3.0.0.tgz",
     12918      "integrity": "sha512-oWjZFGMc0q2ak+8OxdmMffS79LIT0UEtmpV4h1/AARvESIqqKljf8mrfP+dQ2kas7XttsAZIxRBuWu7Y5JH8KQ==",
     12919      "dev": true,
     12920      "requires": {
     12921        "@types/mime-types": "^2.1.0",
     12922        "debug": "^4.1.0",
     12923        "extract-zip": "^2.0.0",
     12924        "https-proxy-agent": "^4.0.0",
     12925        "mime": "^2.0.3",
     12926        "mime-types": "^2.1.25",
     12927        "progress": "^2.0.1",
     12928        "proxy-from-env": "^1.0.0",
     12929        "rimraf": "^3.0.2",
     12930        "tar-fs": "^2.0.0",
     12931        "unbzip2-stream": "^1.3.3",
     12932        "ws": "^7.2.3"
     12933      },
     12934      "dependencies": {
     12935        "rimraf": {
     12936          "version": "3.0.2",
     12937          "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
     12938          "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
     12939          "dev": true,
     12940          "requires": {
     12941            "glob": "^7.1.3"
     12942          }
     12943        }
     12944      }
    1294312945    },
    1294412946    "q": {
     
    1570615708    },
    1570715709    "tar-stream": {
    15708       "version": "2.1.4",
    15709       "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz",
    15710       "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==",
     15710      "version": "2.2.0",
     15711      "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
     15712      "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
    1571115713      "dev": true,
    1571215714      "requires": {
  • wp-virtualtour/trunk/admin/block/src/index.js

    r2460938 r2494300  
    44    useBlockProps,
    55    InspectorControls,
    6     __experimentalBlock as Block
     6    __experimentalBlock as Block, BlockControls
    77} from '@wordpress/block-editor'
    8 import { PanelBody, RangeControl, SelectControl } from '@wordpress/components'
     8import { PanelBody, RangeControl, SelectControl, withFocusOutside, withFocusReturn } from '@wordpress/components'
    99import { Component } from '@wordpress/element'
    1010
     
    3030            default: ''
    3131        },
     32        focused: {
     33            type: 'boolean',
     34            default: false
     35        },
    3236        height: {
    3337            type: 'integer',
     
    4044    },
    4145    // edit: (props) => {
    42     edit: class extends Component {
     46    edit:
     47        withFocusOutside(
     48            class extends Component {
    4349
    44         constructor() {
    45             super(...arguments)
     50                constructor() {
     51                    super(...arguments)
    4652
    47             // example how to bind `this` to the current component for our callbacks
    48             // this.onChangeContent = this.onChangeContent.bind(this)
     53                    // example how to bind `this` to the current component for our callbacks
     54                    // this.onChangeContent = this.onChangeContent.bind(this)
    4955
    50             // some place for your state
    51             this.state = {
    52                 alignment: this.props.attributes.alignment,
    53                 id: this.props.attributes.id,
    54                 height: this.props.attributes.height,
    55                 pannellumInstance: this.props.attributes.pannellumInstance
     56                    // some place for your state
     57                    this.state = {
     58                        alignment: this.props.attributes.alignment,
     59                        id: this.props.attributes.id,
     60                        height: this.props.attributes.height,
     61                        pannellumInstance: this.props.attributes.pannellumInstance,
     62                        focused: this.props.focused
     63                    }
     64
     65                }
     66
     67                handleFocusOutside() {
     68                    this.props.setAttributes({
     69                        focused: false
     70                    })
     71                }
     72
     73                render() {
     74                    if (this.props.isSelected) {
     75                        this.props.setAttributes({
     76                            focused: true
     77                        })
     78                    }
     79
     80                    const {
     81                        attributes: {
     82                            alignment,
     83                            height,
     84                            id,
     85                            pannellumInstance,
     86                            focused
     87                        }
     88                    } = this.props
     89
     90                    const onChangeHeight = (newHeight) => {
     91                        this.props.setAttributes({
     92                            height: newHeight
     93                        })
     94                        this.props.attributes.pannellumInstance.resize()
     95                    }
     96
     97                    const onChangeTour = (tourId) => {
     98                        this.props.setAttributes({
     99                            id: tourId
     100                        })
     101                        initPannellum(tourId)
     102                    }
     103
     104                    const initPannellum = (tourId) => {
     105                        if (Object.keys(this.props.attributes.pannellumInstance).length) {
     106                            this.props.attributes.pannellumInstance.destroy()
     107                        }
     108                        setTimeout(() => { // wait for the block to have the id assigned
     109                            this.props.attributes.pannellumInstance = window.pannellum.viewer('panorama-' + tourId, wp_virtualtour.tours.filter(tour => tour.id === tourId)[0])
     110                        }, 100)
     111                    }
     112
     113                    if (this.props.attributes.id) {
     114                        initPannellum(this.props.attributes.id)
     115                    }
     116
     117                    if (!this.props.attributes.id) {
     118                        onChangeTour(wp_virtualtour.tours[0].id)
     119                    }
     120
     121                    const getTourOptions = () => {
     122                        const tourOptions = [{value: null, label: __('Select tour', 'wp_virtualtour'), disabled: true}]
     123                        wp_virtualtour.tours.forEach((tour, i) => {
     124                            tourOptions.push({
     125                                value: tour.id,
     126                                label: tour.default.title
     127                            })
     128                        })
     129                        return tourOptions
     130                    }
     131
     132                    const onChangeAlignment = (updatedAlignment) => {
     133                        this.props.setAttributes({alignment: updatedAlignment})
     134                    }
     135
     136                    return (
     137                        <>
     138                            {/*<BlockControls>*/}
     139                            {/*</BlockControls>*/}
     140                            <InspectorControls>
     141                                <PanelBody title={__('Settings', 'wp_virtualtour')}>
     142                                    <RangeControl
     143                                        label="Height"
     144                                        value={height}
     145                                        onChange={onChangeHeight}
     146                                        min={0}
     147                                        max={1000}
     148                                    />
     149                                    <SelectControl
     150                                        label={__('Select tour', 'wp_virtualtour')}
     151                                        value={id}
     152                                        onChange={onChangeTour}
     153                                        options={getTourOptions()}
     154                                    />
     155                                </PanelBody>
     156                            </InspectorControls>
     157                            <Block.div>
     158                                <div className={`panorama-wrapper ${focused ? 'focused' : ''}`}>
     159                                    <div style={{
     160                                        height: height + 'px'
     161                                    }} id={'panorama-' + id}></div>
     162                                </div>
     163                            </Block.div>
     164                        </>
     165                    )
     166                }
     167
    56168            }
    57 
    58         }
    59 
    60         render() {
    61             const {
    62                 attributes: {
    63                     alignment,
    64                     height,
    65                     id,
    66                     pannellumInstance
    67                 }
    68             } = this.props
    69 
    70             const onChangeHeight = (newHeight) => {
    71                 this.props.setAttributes({
    72                     height: newHeight
    73                 })
    74                 this.props.attributes.pannellumInstance.resize()
    75             }
    76 
    77             const onChangeTour = (tourId) => {
    78                 this.props.setAttributes({
    79                     id: tourId
    80                 })
    81                 initPannellum(tourId)
    82             }
    83 
    84             const initPannellum = (tourId) => {
    85                 if (Object.keys(this.props.attributes.pannellumInstance).length) {
    86                     this.props.attributes.pannellumInstance.destroy()
    87                 }
    88                 setTimeout(() => { // wait for the block to have the id assigned
    89                     this.props.attributes.pannellumInstance = window.pannellum.viewer('panorama-' + tourId, wp_virtualtour.tours.filter(tour => tour.id === tourId)[0])
    90                 }, 100)
    91             }
    92 
    93             if (this.props.attributes.id) {
    94                 initPannellum(this.props.attributes.id)
    95             }
    96 
    97             if (!this.props.attributes.id) {
    98                 onChangeTour(wp_virtualtour.tours[0].id)
    99             }
    100 
    101             const getTourOptions = () => {
    102                 const tourOptions = [{value: null, label: __('Select tour', 'wp_virtualtour'), disabled: true}]
    103                 wp_virtualtour.tours.forEach((tour, i) => {
    104                     tourOptions.push({
    105                         value: tour.id,
    106                         label: tour.default.title
    107                     })
    108                 })
    109                 return tourOptions
    110             }
    111 
    112             const onChangeAlignment = (updatedAlignment) => {
    113                 this.props.setAttributes({alignment: updatedAlignment})
    114             }
    115 
    116             return (
    117                 <>
    118                     {/*<BlockControls>*/}
    119                     {/*</BlockControls>*/}
    120                     <InspectorControls>
    121                         <PanelBody title={__('Settings', 'wp_virtualtour')}>
    122                             <RangeControl
    123                                 label="Height"
    124                                 value={height}
    125                                 onChange={onChangeHeight}
    126                                 min={0}
    127                                 max={1000}
    128                             />
    129                             <SelectControl
    130                                 label={__('Select tour', 'wp_virtualtour')}
    131                                 value={id}
    132                                 onChange={onChangeTour}
    133                                 options={getTourOptions()}
    134                             />
    135                         </PanelBody>
    136                     </InspectorControls>
    137                     <Block.div>
    138                         <div style={{
    139                             height: height + 'px'
    140                         }} id={'panorama-' + id}></div>
    141                     </Block.div>
    142                 </>
    143             )
    144         }
    145 
    146     },
     169        ),
    147170    save: (props) => {
    148171        const blockProps = useBlockProps.save()
  • wp-virtualtour/trunk/admin/class-wp_virtualtour-admin.php

    r2460938 r2494300  
    6363    $completeTourData = array();
    6464
     65    if (!$tours) {
     66      return;
     67    }
     68
    6569    foreach ($tours as $tour) {
    6670      $completeTourData[] = get_option('wp_virtualtours_tour_' . $tour->id);
     
    126130      wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'vue-app/dist/style.css', array(), $this->version, 'all');
    127131    }
     132    wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'assets/block-editor.css', array(), $this->version, 'all');
    128133  }
    129134
  • wp-virtualtour/trunk/admin/class-wp_virtualtour-ajax-actions.php

    r2460938 r2494300  
    2828  }
    2929
    30   private function general_ajax_action()
     30  public function general_ajax_action()
    3131  {
    3232    $data = null;
  • wp-virtualtour/trunk/public/class-wp_virtualtour-public.php

    r2460938 r2494300  
    8585  public function enqueue_block_assets()
    8686  {
     87
     88    $allTourData = array();
     89    $tours = get_option('wp_virtualtours_tours');
     90
     91    if (!count($tours)) {
     92      return;
     93    }
     94
    8795    wp_enqueue_script($this->plugin_name . '_pannellum', plugin_dir_url(__FILE__) . 'js/[email protected]', array('jquery'), rand(0, 99999), true);
    8896    wp_enqueue_script($this->plugin_name . '_script', plugin_dir_url(__FILE__) . 'js/wp_virtualtour-public.js', array(), rand(0, 99999), true);
    8997
    90     $allTourData = array();
    91     $tours = get_option('wp_virtualtours_tours');
    9298    foreach ($tours as $tour) {
    93       $allTourData[$tour['id']] = get_option('wp_virtualtours_tour_' . $tour['id']);
     99      $allTourData[$tour->id] = get_option('wp_virtualtours_tour_' . $tour->id);
    94100    }
    95101
  • wp-virtualtour/trunk/wp-virtualtour.php

    r2460938 r2494300  
    1010  Plugin Name:       WP Virtual Tour
    1111  Description:       Create virtual 360° tours.
    12   Version:           1.0.0
     12Version:           1.0.6
    1313  Author:            Martin Blaas
    14  License:           GPL-2.0+
    15  License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
    16  Text Domain:       wp_virtualtour
     14  License:           GPL-2.0+
     15  License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     16  Text Domain:       wp_virtualtour
    1717  Domain Path:       /languages
    1818 */
Note: See TracChangeset for help on using the changeset viewer.