Plugin Directory

Changeset 3127782


Ignore:
Timestamp:
07/30/2024 04:39:42 AM (20 months ago)
Author:
svgator
Message:

(1.3.1) Block select SVG updating wrong block

Location:
svgator
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • svgator/tags/1.3.1/admin/css/svgator.css

    r3123949 r3127782  
    165165    Pagination
    166166 */
     167#svgator-projects-pagination {
     168    float: right;
     169    max-width: 100%;
     170}
     171
    167172#svgator-projects-pagination ul {
    168173    display: inline-flex;
     174    flex-wrap: wrap;
    169175    justify-content: center;
     176    margin: 0;
    170177    width: 100%;
    171178}
     
    182189    height: 34px;
    183190    line-height: 34px;
    184     margin: 5px;
     191    margin: 0 5px 5px;
    185192    min-width: 34px;
    186193    padding: 0 5px;
     
    315322}
    316323
    317 .wp-block .wp-svgator-image.placeholder {
     324.wp-block .wp-svgator-image.wp-svgator-placeholder {
    318325    background: #fff;
    319326    border: solid 1px #000;
     
    323330}
    324331
    325 .wp-block .wp-svgator-image .placeholder-title {
     332.wp-block .wp-svgator-image .wp-svgator-placeholder-title {
    326333    font-weight: 600;
    327334}
    328335
    329 .wp-block .wp-svgator-image .placeholder-description {
     336.wp-block .wp-svgator-image .wp-svgator-placeholder-description {
    330337    margin: 10px 0;
    331338}
    332339
    333 .wp-block .wp-svgator-image .placeholder-button {
     340.wp-block .wp-svgator-image .wp-svgator-placeholder-button {
    334341    background-color: #007bb9;
    335342    border: none;
     
    340347}
    341348
    342 .wp-block .wp-svgator-image .placeholder-button:hover {
     349.wp-block .wp-svgator-image .wp-svgator-placeholder-button:hover {
    343350    background-color: #006ba1;
    344351}
     
    441448    word-break: break-word;
    442449}
    443 
    444 /**
    445     Pagination
    446  */
    447 
    448 #svgator-projects-pagination {
    449     float: right;
    450 }
    451 
    452 #svgator-projects-pagination ul {
    453     margin: 0;
    454 }
    455 
    456 #svgator-projects-pagination li {
    457     background-color: #fff;
    458     border-radius: 4px;
    459     box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2),
    460     0 2px 2px 0 rgba(0, 0, 0, .14),
    461     0 1px 5px 0 rgba(0, 0, 0, .12);
    462     color: rgba(0, 0, 0, .87);
    463     cursor: pointer;
    464     font-size: 16px;
    465     height: 34px;
    466     line-height: 34px;
    467     margin: 0 5px 5px;
    468     min-width: 34px;
    469     padding: 0 5px;
    470     text-align: center;
    471     transition: .3s cubic-bezier(0, 0, .2, 1);
    472 }
    473 
    474 #svgator-projects-pagination li.active {
    475     background-color: #1976d2;
    476     box-shadow: 0 2px 4px -1px rgba(0, 0, 0, .2),
    477     0 4px 5px 0 rgba(0, 0, 0, .14),
    478     0 1px 10px 0 rgba(0, 0, 0, .12);
    479     color: #fff;
    480 }
  • svgator/tags/1.3.1/admin/js/WP_SVGatorBlock.js

    r3123949 r3127782  
    88
    99        let plcHandler = {
    10             empty: function(onSvgatorMediaOpen){
     10            empty: function(onSvgatorMediaOpen) {
    1111                const placeholderContent = [
    1212                    createEl(
    1313                        'div',
    1414                        {
    15                             key: 'placeholder-title',
    16                             className: 'placeholder-title',
     15                            key: 'wp-svgator-placeholder-title',
     16                            className: 'wp-svgator-placeholder-title',
    1717                        },
    1818                        'SVGator',
     
    2121                        'div',
    2222                        {
    23                             key: 'placeholder-description',
    24                             className: 'placeholder-description',
     23                            key: 'wp-svgator-placeholder-description',
     24                            className: 'wp-svgator-placeholder-description',
    2525                        },
    2626                        'Import a SVG from your SVGator library, or add one from your WordPress library',
     
    2929                        'button',
    3030                        {
    31                             key: 'placeholder-content',
    32                             className: 'placeholder-button',
     31                            key: 'wp-svgator-placeholder-content',
     32                            className: 'wp-svgator-placeholder-button',
    3333                            onClick: () => onSvgatorMediaOpen(),
    3434                        },
     
    3939                    'div',
    4040                    {
    41                         key: 'placeholder',
    42                         className: 'wp-svgator-image placeholder',
     41                        key: 'wp-svgator-placeholder',
     42                        className: 'wp-svgator-image wp-svgator-placeholder',
    4343                    },
    4444                    placeholderContent,
    4545                );
    4646            },
    47             preview: function(props){
    48                 let attr = props.attributes;
    49                 if(!Object.keys(attr).length) {
     47            preview: function(props) {
     48                let attr = props?.attributes;
     49                if(!attr || !Object.keys(attr).length) {
    5050                    return;
    5151                }
     
    219219                        };
    220220
    221                         let placeholder = plcHandler.preview(props) || plcHandler.empty(() => svgatorMedia.open(svgatorMediaOptions));
     221                        const placeholder = plcHandler.preview(props) || plcHandler.empty(() => svgatorMedia.open(svgatorMediaOptions));
    222222
    223223                        if (props.isSelected && !props.attributes.src) {
     
    230230                        childElements.push(createBlockControlButton(
    231231                            'Select SVG',
    232                             function(){
     232                            function() {
    233233                                svgatorMedia.open(svgatorMediaOptions);
    234234                            })
  • svgator/tags/1.3.1/admin/js/WP_SVGatorMedia.js

    r3123949 r3127782  
    167167        }
    168168
    169         function open(options){
     169        function open(options) {
    170170            setOptions(options);
    171171            frame.open();
     
    183183
    184184        this.open = open;
    185         this.setOptions = setOptions;
    186185    }
    187186
  • svgator/tags/1.3.1/admin/js/WP_SVGatorMenu.js

    r3123949 r3127782  
    1313        };
    1414
    15         $dom.close.on('click', function () {
     15        $dom.close.on('click', function() {
    1616            close();
    1717        });
     
    3131        }
    3232
    33         timeout = window.setTimeout(function () {
     33        timeout = window.setTimeout(function() {
    3434            close();
    3535            timeout = false;
     
    6666        this._loginNonce = slf.$('#login-container input[name="svgator_logIn_nonce"]').val();
    6767
    68         slf.$('#svgator-filter').on('submit', function (e) {
     68        slf.$('#svgator-filter').on('submit', function(e) {
    6969            e.preventDefault();
    7070        });
    7171
    72         slf.$('#svgator-filter [type="search"]').on('keyup search', function (e) {
     72        slf.$('#svgator-filter [type="search"]').on('keyup search', function(e) {
    7373            slf.filterProjects(e.target.value);
    7474        });
    7575
    76         slf.$('#login-to-svgator').on('click', function (e) {
     76        slf.$('#login-to-svgator').on('click', function(e) {
    7777            e.preventDefault();
    7878
    79             slf.updateAuthToken().then(function () {
     79            slf.updateAuthToken().then(function() {
    8080                let pr = slf.loadProjects();
    8181                if (!pr) {
     
    8383                }
    8484
    85                 pr.then(function (data) {
     85                pr.then(function(data) {
    8686                    slf.updateExports(data && data.limits && data.limits.exports);
    8787                    slf.listProjects(data.response);
    8888                    slf._importProjectNonce = data.nonce;
    89                 }).catch(function (err) {
     89                }).catch(function(err) {
    9090                    slf.notice.show({
    9191                        msg: (err && err.error) || 'Failed to load projects',
     
    9797                    }
    9898                });
    99             }).catch(function (json) {
     99            }).catch(function(json) {
    100100                let msg = json && json.error || json;
    101101                slf.notice.show({
     
    106106        });
    107107
    108         slf.$('#svgator-header .logout').on('click', function (e) {
     108        slf.$('#svgator-header .logout').on('click', function(e) {
    109109            e.preventDefault();
    110110
    111111            let pr = slf.logout();
    112112
    113             pr.finally(function () {
     113            pr.finally(function() {
    114114                slf.paginateVisibleProjects();
    115115            });
     
    131131        $lis.removeClass('on-filter');
    132132
    133         $lis.each(function (idx, li) {
     133        $lis.each(function(idx, li) {
    134134            let $li = slf.$(li);
    135135            let liText = $li.find('.svgator-title-container').text().toLowerCase();
     
    172172                    .text(page);
    173173
    174                 $li.on('click', function () {
     174                $li.on('click', function() {
    175175                    $projects.removeClass('on-page');
    176176                    $projects.filter('[data-page="' + page + '"]').addClass('on-page');
     
    193193            'action': 'svgator_logOut',
    194194            'svgator_logOut_nonce': this._logoutNonce,
    195         }).then(function () {
     195        }).then(function() {
    196196            slf.notice.show({
    197197                msg: 'Logged out successfully.',
     
    201201
    202202            slf.$('#svgator-projects').empty();
    203         }).catch(function (err) {
     203        }).catch(function(err) {
    204204            slf.notice.show({
    205205                msg: err && err.error || 'Failed to log out.',
     
    212212    updateAuthToken() {
    213213        let slf = this;
    214         return new Promise(function (resolve, reject) {
     214        return new Promise(function(resolve, reject) {
    215215
    216216            const host = ['wp.local', 'localhost'].includes(location.hostname) || location.hostname.includes('.svgator.net')
     
    226226                false,
    227227                endpoint,
    228             ).then(function (resp) {
     228            ).then(function(resp) {
    229229                if (!resp || !resp.auth_code || !resp.app_id) {
    230230                    if (reject) {
     
    235235
    236236                slf.saveToken(resp)
    237                     .then(function (data) {
     237                    .then(function(data) {
    238238                        if (!data || !data.success) {
    239239                            reject(data && data.error || data);
     
    246246                        }
    247247                    })
    248                     .catch(function (data) {
     248                    .catch(function(data) {
    249249                        if (reject) {
    250250                            reject(data);
    251251                        }
    252252                    });
    253             }).catch(function (err) {
     253            }).catch(function(err) {
    254254                let eMsg = 'Failed to connect to SVGator.';
    255255                if (err) {
     
    337337                .text('IMPORT TO MEDIA')
    338338                .addClass('svgator-commands-import')
    339                 .on('click', function (e) {
     339                .on('click', function(e) {
    340340                    e.preventDefault();
    341341
     
    364364        }, {
    365365            hoverContainer: project.$dom,
    366         }).then(function (data) {
     366        }).then(function(data) {
    367367            const exports = data
    368368                && data.response
     
    374374                msg: 'Project imported successfully.',
    375375            });
    376         }).catch(function (error) {
     376        }).catch(function(error) {
    377377            const exports = error
    378378                && error.data
     
    392392    makeRequest(data, options) {
    393393        let slf = this;
    394         return new Promise(function (resolve, reject) {
     394        return new Promise(function(resolve, reject) {
    395395            let $loader = slf.$('<div>').addClass('svgator-loader');
    396396            if (options && options.hoverContainer) {
     
    405405                null,
    406406                'json',
    407             ).done(function (data) {
     407            ).done(function(data) {
    408408                if (data && data.success === false) {
    409409                    if (reject) {
     
    416416                    resolve.call(slf, data);
    417417                }
    418             }).fail(function () {
     418            }).fail(function() {
    419419                if (reject) {
    420420                    reject.call(slf, data);
    421421                }
    422             }).always(function () {
     422            }).always(function() {
    423423                $loader.remove();
    424424            });
     
    427427}
    428428
    429 window.jQuery(function () {
     429window.jQuery(function() {
    430430    let wpSvgator = new WP_SVGator(jQuery, SVGator);
    431431
     
    436436        }
    437437
    438         pr.then(function (data) {
     438        pr.then(function(data) {
    439439            wpSvgator.updateExports(data.limits && data.limits.exports);
    440440            wpSvgator.listProjects(data.response);
    441441            wpSvgator._importProjectNonce = data.nonce;
    442         }).catch(function (err) {
     442        }).catch(function(err) {
    443443            wpSvgator.notice.show({
    444444                msg: (err && err.error) || 'Failed to load projects',
  • svgator/tags/1.3.1/includes/class/WP_SVGator/Media.php

    r3123949 r3127782  
    3636        }
    3737
    38         //$params['content'] = self::fixResponsiveSvg( $params['content'] );
    39 
    4038        // WP_Filesystem_Direct has an $args parameter that is mandatory, however it is not used
    4139        $fs  = new WP_Filesystem_Direct( [] );
  • svgator/tags/1.3.1/includes/class/WP_SVGator/Svg_Support.php

    r3123949 r3127782  
    3535
    3636    function wp_svgInlineReplaceBlock( $content, $block_array, WP_Block $instance ) {
    37         if ( ! $instance->block_type || $instance->block_type->name !== Block::block_type_name ) {
     37        if ( empty($instance->block_type->name) || $instance->block_type->name !== Block::block_type_name ) {
    3838            return $content;
    3939        }
     
    140140     */
    141141    public static function fixScript( string $svgContent ) {
    142         //Remove CDATA, since Wordpress does not allow it inside the content
     142        //Remove CDATA, since WordPress does not allow it inside the content
    143143        $svgContent = str_replace( '<![CDATA[', '', $svgContent );
    144144        $svgContent = str_replace( ']]>', '', $svgContent );
     
    189189        }
    190190
    191         global $wp_filesystem;
    192 
    193191        // WP_Filesystem_Direct has an $args parameter that is mandatory, however it is not used
    194192        $fs         = new WP_Filesystem_Direct( [] );
  • svgator/tags/1.3.1/includes/class/WP_SVGator/Widget_Media_SVGator.php

    r3123949 r3127782  
    115115        }
    116116
    117         // building up $allowed_html list from the output bellow it (we know that only these tags and attributes appear in the output)
     117        // building up $allowed_html list from the output below it (we know that only these tags and attributes appear in the output)
    118118        $allowed_html = array(
    119119            'div'   => array(
  • svgator/tags/1.3.1/readme.txt

    r3123949 r3127782  
    9292
    9393= 1.3.1 =
    94 * Fixed an issue where sometimes selecting an SVG for an SVGator block would update the wrong SVGator block
     94* Bugfix - Issue present since original release fixed: From time to time while adding a new SVG, another one on the page got replaced instead
    9595
    9696= 1.3.0 =
  • svgator/trunk/admin/css/svgator.css

    r3123220 r3127782  
    165165    Pagination
    166166 */
     167#svgator-projects-pagination {
     168    float: right;
     169    max-width: 100%;
     170}
     171
    167172#svgator-projects-pagination ul {
    168173    display: inline-flex;
     174    flex-wrap: wrap;
    169175    justify-content: center;
     176    margin: 0;
    170177    width: 100%;
    171178}
     
    182189    height: 34px;
    183190    line-height: 34px;
    184     margin: 5px;
     191    margin: 0 5px 5px;
    185192    min-width: 34px;
    186193    padding: 0 5px;
     
    315322}
    316323
    317 .wp-block .wp-svgator-image.placeholder {
     324.wp-block .wp-svgator-image.wp-svgator-placeholder {
    318325    background: #fff;
    319326    border: solid 1px #000;
     
    323330}
    324331
    325 .wp-block .wp-svgator-image .placeholder-title {
     332.wp-block .wp-svgator-image .wp-svgator-placeholder-title {
    326333    font-weight: 600;
    327334}
    328335
    329 .wp-block .wp-svgator-image .placeholder-description {
     336.wp-block .wp-svgator-image .wp-svgator-placeholder-description {
    330337    margin: 10px 0;
    331338}
    332339
    333 .wp-block .wp-svgator-image .placeholder-button {
     340.wp-block .wp-svgator-image .wp-svgator-placeholder-button {
    334341    background-color: #007bb9;
    335342    border: none;
     
    340347}
    341348
    342 .wp-block .wp-svgator-image .placeholder-button:hover {
     349.wp-block .wp-svgator-image .wp-svgator-placeholder-button:hover {
    343350    background-color: #006ba1;
    344351}
     
    441448    word-break: break-word;
    442449}
    443 
    444 /**
    445     Pagination
    446  */
    447 
    448 #svgator-projects-pagination {
    449     float: right;
    450 }
    451 
    452 #svgator-projects-pagination ul {
    453     margin: 0;
    454 }
    455 
    456 #svgator-projects-pagination li {
    457     background-color: #fff;
    458     border-radius: 4px;
    459     box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2),
    460     0 2px 2px 0 rgba(0, 0, 0, .14),
    461     0 1px 5px 0 rgba(0, 0, 0, .12);
    462     color: rgba(0, 0, 0, .87);
    463     cursor: pointer;
    464     font-size: 16px;
    465     height: 34px;
    466     line-height: 34px;
    467     margin: 0 5px 5px;
    468     min-width: 34px;
    469     padding: 0 5px;
    470     text-align: center;
    471     transition: .3s cubic-bezier(0, 0, .2, 1);
    472 }
    473 
    474 #svgator-projects-pagination li.active {
    475     background-color: #1976d2;
    476     box-shadow: 0 2px 4px -1px rgba(0, 0, 0, .2),
    477     0 4px 5px 0 rgba(0, 0, 0, .14),
    478     0 1px 10px 0 rgba(0, 0, 0, .12);
    479     color: #fff;
    480 }
  • svgator/trunk/admin/js/WP_SVGatorBlock.js

    r3123949 r3127782  
    88
    99        let plcHandler = {
    10             empty: function(onSvgatorMediaOpen){
     10            empty: function(onSvgatorMediaOpen) {
    1111                const placeholderContent = [
    1212                    createEl(
    1313                        'div',
    1414                        {
    15                             key: 'placeholder-title',
    16                             className: 'placeholder-title',
     15                            key: 'wp-svgator-placeholder-title',
     16                            className: 'wp-svgator-placeholder-title',
    1717                        },
    1818                        'SVGator',
     
    2121                        'div',
    2222                        {
    23                             key: 'placeholder-description',
    24                             className: 'placeholder-description',
     23                            key: 'wp-svgator-placeholder-description',
     24                            className: 'wp-svgator-placeholder-description',
    2525                        },
    2626                        'Import a SVG from your SVGator library, or add one from your WordPress library',
     
    2929                        'button',
    3030                        {
    31                             key: 'placeholder-content',
    32                             className: 'placeholder-button',
     31                            key: 'wp-svgator-placeholder-content',
     32                            className: 'wp-svgator-placeholder-button',
    3333                            onClick: () => onSvgatorMediaOpen(),
    3434                        },
     
    3939                    'div',
    4040                    {
    41                         key: 'placeholder',
    42                         className: 'wp-svgator-image placeholder',
     41                        key: 'wp-svgator-placeholder',
     42                        className: 'wp-svgator-image wp-svgator-placeholder',
    4343                    },
    4444                    placeholderContent,
    4545                );
    4646            },
    47             preview: function(props){
    48                 let attr = props.attributes;
    49                 if(!Object.keys(attr).length) {
     47            preview: function(props) {
     48                let attr = props?.attributes;
     49                if(!attr || !Object.keys(attr).length) {
    5050                    return;
    5151                }
     
    219219                        };
    220220
    221                         let placeholder = plcHandler.preview(props) || plcHandler.empty(() => svgatorMedia.open(svgatorMediaOptions));
     221                        const placeholder = plcHandler.preview(props) || plcHandler.empty(() => svgatorMedia.open(svgatorMediaOptions));
    222222
    223223                        if (props.isSelected && !props.attributes.src) {
     
    230230                        childElements.push(createBlockControlButton(
    231231                            'Select SVG',
    232                             function(){
     232                            function() {
    233233                                svgatorMedia.open(svgatorMediaOptions);
    234234                            })
  • svgator/trunk/admin/js/WP_SVGatorMedia.js

    r3123949 r3127782  
    167167        }
    168168
    169         function open(options){
     169        function open(options) {
    170170            setOptions(options);
    171171            frame.open();
     
    183183
    184184        this.open = open;
    185         this.setOptions = setOptions;
    186185    }
    187186
  • svgator/trunk/admin/js/WP_SVGatorMenu.js

    r3123949 r3127782  
    1313        };
    1414
    15         $dom.close.on('click', function () {
     15        $dom.close.on('click', function() {
    1616            close();
    1717        });
     
    3131        }
    3232
    33         timeout = window.setTimeout(function () {
     33        timeout = window.setTimeout(function() {
    3434            close();
    3535            timeout = false;
     
    6666        this._loginNonce = slf.$('#login-container input[name="svgator_logIn_nonce"]').val();
    6767
    68         slf.$('#svgator-filter').on('submit', function (e) {
     68        slf.$('#svgator-filter').on('submit', function(e) {
    6969            e.preventDefault();
    7070        });
    7171
    72         slf.$('#svgator-filter [type="search"]').on('keyup search', function (e) {
     72        slf.$('#svgator-filter [type="search"]').on('keyup search', function(e) {
    7373            slf.filterProjects(e.target.value);
    7474        });
    7575
    76         slf.$('#login-to-svgator').on('click', function (e) {
     76        slf.$('#login-to-svgator').on('click', function(e) {
    7777            e.preventDefault();
    7878
    79             slf.updateAuthToken().then(function () {
     79            slf.updateAuthToken().then(function() {
    8080                let pr = slf.loadProjects();
    8181                if (!pr) {
     
    8383                }
    8484
    85                 pr.then(function (data) {
     85                pr.then(function(data) {
    8686                    slf.updateExports(data && data.limits && data.limits.exports);
    8787                    slf.listProjects(data.response);
    8888                    slf._importProjectNonce = data.nonce;
    89                 }).catch(function (err) {
     89                }).catch(function(err) {
    9090                    slf.notice.show({
    9191                        msg: (err && err.error) || 'Failed to load projects',
     
    9797                    }
    9898                });
    99             }).catch(function (json) {
     99            }).catch(function(json) {
    100100                let msg = json && json.error || json;
    101101                slf.notice.show({
     
    106106        });
    107107
    108         slf.$('#svgator-header .logout').on('click', function (e) {
     108        slf.$('#svgator-header .logout').on('click', function(e) {
    109109            e.preventDefault();
    110110
    111111            let pr = slf.logout();
    112112
    113             pr.finally(function () {
     113            pr.finally(function() {
    114114                slf.paginateVisibleProjects();
    115115            });
     
    131131        $lis.removeClass('on-filter');
    132132
    133         $lis.each(function (idx, li) {
     133        $lis.each(function(idx, li) {
    134134            let $li = slf.$(li);
    135135            let liText = $li.find('.svgator-title-container').text().toLowerCase();
     
    172172                    .text(page);
    173173
    174                 $li.on('click', function () {
     174                $li.on('click', function() {
    175175                    $projects.removeClass('on-page');
    176176                    $projects.filter('[data-page="' + page + '"]').addClass('on-page');
     
    193193            'action': 'svgator_logOut',
    194194            'svgator_logOut_nonce': this._logoutNonce,
    195         }).then(function () {
     195        }).then(function() {
    196196            slf.notice.show({
    197197                msg: 'Logged out successfully.',
     
    201201
    202202            slf.$('#svgator-projects').empty();
    203         }).catch(function (err) {
     203        }).catch(function(err) {
    204204            slf.notice.show({
    205205                msg: err && err.error || 'Failed to log out.',
     
    212212    updateAuthToken() {
    213213        let slf = this;
    214         return new Promise(function (resolve, reject) {
     214        return new Promise(function(resolve, reject) {
    215215
    216216            const host = ['wp.local', 'localhost'].includes(location.hostname) || location.hostname.includes('.svgator.net')
     
    226226                false,
    227227                endpoint,
    228             ).then(function (resp) {
     228            ).then(function(resp) {
    229229                if (!resp || !resp.auth_code || !resp.app_id) {
    230230                    if (reject) {
     
    235235
    236236                slf.saveToken(resp)
    237                     .then(function (data) {
     237                    .then(function(data) {
    238238                        if (!data || !data.success) {
    239239                            reject(data && data.error || data);
     
    246246                        }
    247247                    })
    248                     .catch(function (data) {
     248                    .catch(function(data) {
    249249                        if (reject) {
    250250                            reject(data);
    251251                        }
    252252                    });
    253             }).catch(function (err) {
     253            }).catch(function(err) {
    254254                let eMsg = 'Failed to connect to SVGator.';
    255255                if (err) {
     
    337337                .text('IMPORT TO MEDIA')
    338338                .addClass('svgator-commands-import')
    339                 .on('click', function (e) {
     339                .on('click', function(e) {
    340340                    e.preventDefault();
    341341
     
    364364        }, {
    365365            hoverContainer: project.$dom,
    366         }).then(function (data) {
     366        }).then(function(data) {
    367367            const exports = data
    368368                && data.response
     
    374374                msg: 'Project imported successfully.',
    375375            });
    376         }).catch(function (error) {
     376        }).catch(function(error) {
    377377            const exports = error
    378378                && error.data
     
    392392    makeRequest(data, options) {
    393393        let slf = this;
    394         return new Promise(function (resolve, reject) {
     394        return new Promise(function(resolve, reject) {
    395395            let $loader = slf.$('<div>').addClass('svgator-loader');
    396396            if (options && options.hoverContainer) {
     
    405405                null,
    406406                'json',
    407             ).done(function (data) {
     407            ).done(function(data) {
    408408                if (data && data.success === false) {
    409409                    if (reject) {
     
    416416                    resolve.call(slf, data);
    417417                }
    418             }).fail(function () {
     418            }).fail(function() {
    419419                if (reject) {
    420420                    reject.call(slf, data);
    421421                }
    422             }).always(function () {
     422            }).always(function() {
    423423                $loader.remove();
    424424            });
     
    427427}
    428428
    429 window.jQuery(function () {
     429window.jQuery(function() {
    430430    let wpSvgator = new WP_SVGator(jQuery, SVGator);
    431431
     
    436436        }
    437437
    438         pr.then(function (data) {
     438        pr.then(function(data) {
    439439            wpSvgator.updateExports(data.limits && data.limits.exports);
    440440            wpSvgator.listProjects(data.response);
    441441            wpSvgator._importProjectNonce = data.nonce;
    442         }).catch(function (err) {
     442        }).catch(function(err) {
    443443            wpSvgator.notice.show({
    444444                msg: (err && err.error) || 'Failed to load projects',
  • svgator/trunk/includes/class/WP_SVGator/Media.php

    r3123220 r3127782  
    3636        }
    3737
    38         //$params['content'] = self::fixResponsiveSvg( $params['content'] );
    39 
    4038        // WP_Filesystem_Direct has an $args parameter that is mandatory, however it is not used
    4139        $fs  = new WP_Filesystem_Direct( [] );
  • svgator/trunk/includes/class/WP_SVGator/Svg_Support.php

    r3123220 r3127782  
    3535
    3636    function wp_svgInlineReplaceBlock( $content, $block_array, WP_Block $instance ) {
    37         if ( ! $instance->block_type || $instance->block_type->name !== Block::block_type_name ) {
     37        if ( empty($instance->block_type->name) || $instance->block_type->name !== Block::block_type_name ) {
    3838            return $content;
    3939        }
     
    140140     */
    141141    public static function fixScript( string $svgContent ) {
    142         //Remove CDATA, since Wordpress does not allow it inside the content
     142        //Remove CDATA, since WordPress does not allow it inside the content
    143143        $svgContent = str_replace( '<![CDATA[', '', $svgContent );
    144144        $svgContent = str_replace( ']]>', '', $svgContent );
     
    189189        }
    190190
    191         global $wp_filesystem;
    192 
    193191        // WP_Filesystem_Direct has an $args parameter that is mandatory, however it is not used
    194192        $fs         = new WP_Filesystem_Direct( [] );
  • svgator/trunk/includes/class/WP_SVGator/Widget_Media_SVGator.php

    r3123220 r3127782  
    115115        }
    116116
    117         // building up $allowed_html list from the output bellow it (we know that only these tags and attributes appear in the output)
     117        // building up $allowed_html list from the output below it (we know that only these tags and attributes appear in the output)
    118118        $allowed_html = array(
    119119            'div'   => array(
  • svgator/trunk/readme.txt

    r3123949 r3127782  
    9292
    9393= 1.3.1 =
    94 * Fixed an issue where sometimes selecting an SVG for an SVGator block would update the wrong SVGator block
     94* Bugfix - Issue present since original release fixed: From time to time while adding a new SVG, another one on the page got replaced instead
    9595
    9696= 1.3.0 =
Note: See TracChangeset for help on using the changeset viewer.