Plugin Directory

Changeset 2068697


Ignore:
Timestamp:
04/15/2019 08:20:20 AM (7 years ago)
Author:
heremobilitydemand
Message:

Tagger version 1.0.11

Location:
here-mobility
Files:
1 edited
26 copied

Legend:

Unmodified
Added
Removed
  • here-mobility/tags/1.0.11/js/gutenberg-here-widget.js

    r2062123 r2068697  
    306306    RadioControl = _wp$components.RadioControl,
    307307    TextControl = _wp$components.TextControl,
    308     SelectControl = _wp$components.SelectControl;
     308    SelectControl = _wp$components.SelectControl,
     309    Notice = _wp$components.Notice;
    309310
    310311
     
    407408            type: 'string',
    408409            default: 'center'
     410        },
     411        isShowNotice: {
     412            type: 'boolean',
     413            default: 'false'
    409414        }
    410415    },
     
    437442        }
    438443
     444        var checkSizeValid = function checkSizeValid() {
     445            if (attributes.unit === 'px' && (attributes.width && parseInt(attributes.width, 10) < 360 || attributes.width && parseInt(attributes.height, 10) < 450)) {
     446                setAttributes({
     447                    isShowNotice: true
     448                });
     449            } else {
     450                setAttributes({
     451                    isShowNotice: false
     452                });
     453            }
     454        };
     455
     456        checkSizeValid();
     457
    439458        var onChangeSettings = function onChangeSettings(value) {
    440459            if (value === 'default') {
     
    463482        };
    464483
    465         // if (!attributes.width && !attributes.height) {
    466         //   onChangeDisplay('default');
    467         // }
     484        var onBlur = function onBlur() {
     485            checkSizeValid();
     486        };
    468487
    469488        return [isSelected && wp.element.createElement(
     
    517536            wp.element.createElement(
    518537                'div',
    519                 null,
     538                { 'class': 'display-container' },
    520539                wp.element.createElement(
    521540                    'h2',
     
    526545                    'p',
    527546                    null,
    528                     'You can use the default size of the widget or set a custom size. Please note that HERE Mobility The widget\u2019s minimum size is ',
     547                    'You can use the default size of the widget or set a custom size. Please note that HERE Mobility widget\'s minimum size is ',
    529548                    wp.element.createElement(
    530549                        'b',
    531550                        null,
    532                         '360x 450'
     551                        '360x450'
    533552                    ),
    534553                    '\u202Fpixels and its maximum size is ',
     
    542561                        'b',
    543562                        null,
    544                         '512*450'
     563                        '512x450'
    545564                    ),
    546565                    ' pixels.'
     566                ),
     567                attributes.isShowNotice && wp.element.createElement(
     568                    Notice,
     569                    { status: 'error', isDismissible: false },
     570                    'Please set correct widget size. HERE Mobility widget\u2019s minimum size is ',
     571                    wp.element.createElement(
     572                        'b',
     573                        null,
     574                        '360x450'
     575                    ),
     576                    '\u202Fpixels.'
    547577                ),
    548578                wp.element.createElement(RadioControl, {
     
    583613    },
    584614
    585     save: function save(props) {
     615    save: function save(props, prev) {
    586616        return null;
    587617    }
     
    632662            setAttributes = props.setAttributes;
    633663
     664        var prevAttributes = Object.assign({}, attributes);
    634665
    635666        if (!attributes.id) {
  • here-mobility/trunk/js/gutenberg-here-widget.js

    r2062123 r2068697  
    306306    RadioControl = _wp$components.RadioControl,
    307307    TextControl = _wp$components.TextControl,
    308     SelectControl = _wp$components.SelectControl;
     308    SelectControl = _wp$components.SelectControl,
     309    Notice = _wp$components.Notice;
    309310
    310311
     
    407408            type: 'string',
    408409            default: 'center'
     410        },
     411        isShowNotice: {
     412            type: 'boolean',
     413            default: 'false'
    409414        }
    410415    },
     
    437442        }
    438443
     444        var checkSizeValid = function checkSizeValid() {
     445            if (attributes.unit === 'px' && (attributes.width && parseInt(attributes.width, 10) < 360 || attributes.width && parseInt(attributes.height, 10) < 450)) {
     446                setAttributes({
     447                    isShowNotice: true
     448                });
     449            } else {
     450                setAttributes({
     451                    isShowNotice: false
     452                });
     453            }
     454        };
     455
     456        checkSizeValid();
     457
    439458        var onChangeSettings = function onChangeSettings(value) {
    440459            if (value === 'default') {
     
    463482        };
    464483
    465         // if (!attributes.width && !attributes.height) {
    466         //   onChangeDisplay('default');
    467         // }
     484        var onBlur = function onBlur() {
     485            checkSizeValid();
     486        };
    468487
    469488        return [isSelected && wp.element.createElement(
     
    517536            wp.element.createElement(
    518537                'div',
    519                 null,
     538                { 'class': 'display-container' },
    520539                wp.element.createElement(
    521540                    'h2',
     
    526545                    'p',
    527546                    null,
    528                     'You can use the default size of the widget or set a custom size. Please note that HERE Mobility The widget\u2019s minimum size is ',
     547                    'You can use the default size of the widget or set a custom size. Please note that HERE Mobility widget\'s minimum size is ',
    529548                    wp.element.createElement(
    530549                        'b',
    531550                        null,
    532                         '360x 450'
     551                        '360x450'
    533552                    ),
    534553                    '\u202Fpixels and its maximum size is ',
     
    542561                        'b',
    543562                        null,
    544                         '512*450'
     563                        '512x450'
    545564                    ),
    546565                    ' pixels.'
     566                ),
     567                attributes.isShowNotice && wp.element.createElement(
     568                    Notice,
     569                    { status: 'error', isDismissible: false },
     570                    'Please set correct widget size. HERE Mobility widget\u2019s minimum size is ',
     571                    wp.element.createElement(
     572                        'b',
     573                        null,
     574                        '360x450'
     575                    ),
     576                    '\u202Fpixels.'
    547577                ),
    548578                wp.element.createElement(RadioControl, {
     
    583613    },
    584614
    585     save: function save(props) {
     615    save: function save(props, prev) {
    586616        return null;
    587617    }
     
    632662            setAttributes = props.setAttributes;
    633663
     664        var prevAttributes = Object.assign({}, attributes);
    634665
    635666        if (!attributes.id) {
Note: See TracChangeset for help on using the changeset viewer.