Plugin Directory

Changeset 2444566


Ignore:
Timestamp:
12/22/2020 07:00:31 PM (5 years ago)
Author:
imibrar
Message:

bug fix, popup button not visible in WordPress 5.6 in classic editor.

Location:
i2-pro-cons/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • i2-pro-cons/trunk/dist/js/admin-popup-classic-editor.js

    r2418679 r2444566  
    1 jQuery(function ($) {
     1//jQuery(function ($) {
     2    var i2pcModule = {};
     3    (function() {
     4    console.log("init 0");
     5    console.log(tinymce);
    26    tinymce.create('tinymce.plugins.i2pc_ce_popup_plugin', {
    3         //url argument holds the absolute url of our plugin directory
     7        //url argument holds the absolute url of our plugin directory       
    48        init: function (ed, url) {
     9            console.log("init 11");
     10            console.log(ed);
    511            //add new button
    612            ed.addButton('i2pc_ce_popup_button', {
     
    2127                var attrs = wp.shortcode.attrs(content).named;
    2228                console.log(attrs);
    23 
    24                 if (attrs.hasOwnProperty('pros_icon')) {
    25                     $('#pros-icon').val(attrs.pros_icon);
    26                 }
    27                 if (attrs.hasOwnProperty('cons_icon')) {
    28                     $('#cons-icon').val(attrs.cons_icon);
    29                 }
    30                 if (attrs.hasOwnProperty('show_title')) {
    31                     $('#show_title').prop('checked', attrs.show_title == 'true');
    32                     $('#show_title').trigger('change');
    33                 } else {
    34                     $('#show_title').prop('checked', true);
    35                 }
    36 
    37                 if (attrs.hasOwnProperty('show_button')) {
    38                     $('#show_button').prop('checked', attrs.show_button == 'true');
    39                     $('#show_button').trigger('change');
    40                 } else {
    41                     $('#show_button').trigger('change');
    42                 }
    43 
    44                 if (attrs.hasOwnProperty('title')) {
    45                     $('#main-title').val(attrs.title);
    46                 }
    47                 if (attrs.hasOwnProperty('use_heading_icon')) {
    48                     $('#use_heading_icon').val(attrs.use_heading_icon);
    49                 }
    50 
    51                 if (attrs.hasOwnProperty('pros_title')) {
    52                     $('#pros_title').val(attrs.pros_title);
    53                 }
    54                 if (attrs.hasOwnProperty('cons_title')) {
    55                     $('#cons_title').val(attrs.cons_title);
    56                 }
    57                 if (attrs.hasOwnProperty('heading_pros_icon')) {
    58                     $('#heading_pros_icon').val(attrs.heading_pros_icon);
    59                 }
    60                 if (attrs.hasOwnProperty('heading_cons_icon')) {
    61                     $('#heading_cons_icon').val(attrs.heading_cons_icon);
    62                 }
    63                 if (attrs.hasOwnProperty('button_icon')) {
    64                     $('#button_icon').val(attrs.button_icon);
    65                 }
    66                 if (attrs.hasOwnProperty('link_text')) {
    67                     $('#link_text').val(attrs.link_text);
    68                 }
    69                 if (attrs.hasOwnProperty('link')) {
    70                     $('#link').val(attrs.link);
    71                 }
    72 
    73                 if (wp.shortcode.regexp('i2pc').test(content)) {
    74                     var i2pros = content.match(wp.shortcode.regexp('i2pros'))[0];
    75                     i2pros = i2pros.substr(8, i2pros.length - 17);
    76                     $('#i2pc_ce_editor_popup #i2pc-pros').val(i2pros.replace(/<br\s*[\/]?>/gi, '\n'));
    77 
    78                     var i2cons = content.match(wp.shortcode.regexp('i2cons'))[0];
    79                     i2cons = i2cons.substr(8, i2cons.length - 17);
    80                     $('#i2pc_ce_editor_popup #i2pc-cons').val(i2cons.replace(/<br\s*[\/]?>/gi, '\n'));
    81                 }
    82 
    83                 //console.log($('#i2pc_ce_editor_popup').length);
    84                 $('#i2pc_ce_editor_popup').addClass('i2pc-ce-popup-display');
    85                 $('body').css('overflow', 'hidden');
     29                i2pcModule.i2pc_show_popup(attrs,content);
     30
    8631            });
    8732        },
     
    9742
    9843    tinymce.PluginManager.add('i2pc_ce_popup_button', tinymce.plugins.i2pc_ce_popup_plugin);
     44})();
     45
     46
     47
     48
     49jQuery(function ($) {
     50    i2pcModule.i2pc_show_popup  = function (attrs,content){
     51        console.log("inside dd");
     52        console.log(attrs);
     53       
     54        if (attrs.hasOwnProperty('pros_icon')) {
     55            $('#pros-icon').val(attrs.pros_icon);
     56        }
     57        if (attrs.hasOwnProperty('cons_icon')) {
     58            $('#cons-icon').val(attrs.cons_icon);
     59        }
     60        if (attrs.hasOwnProperty('show_title')) {
     61            $('#show_title').prop('checked', attrs.show_title == 'true');
     62            $('#show_title').trigger('change');
     63        } else {
     64            $('#show_title').prop('checked', true);
     65        }
     66   
     67        if (attrs.hasOwnProperty('show_button')) {
     68            $('#show_button').prop('checked', attrs.show_button == 'true');
     69            $('#show_button').trigger('change');
     70        } else {
     71            $('#show_button').trigger('change');
     72        }
     73   
     74        if (attrs.hasOwnProperty('title')) {
     75            $('#main-title').val(attrs.title);
     76        }
     77        if (attrs.hasOwnProperty('use_heading_icon')) {
     78            $('#use_heading_icon').val(attrs.use_heading_icon);
     79        }
     80   
     81        if (attrs.hasOwnProperty('pros_title')) {
     82            $('#pros_title').val(attrs.pros_title);
     83        }
     84        if (attrs.hasOwnProperty('cons_title')) {
     85            $('#cons_title').val(attrs.cons_title);
     86        }
     87        if (attrs.hasOwnProperty('heading_pros_icon')) {
     88            $('#heading_pros_icon').val(attrs.heading_pros_icon);
     89        }
     90        if (attrs.hasOwnProperty('heading_cons_icon')) {
     91            $('#heading_cons_icon').val(attrs.heading_cons_icon);
     92        }
     93        if (attrs.hasOwnProperty('button_icon')) {
     94            $('#button_icon').val(attrs.button_icon);
     95        }
     96        if (attrs.hasOwnProperty('link_text')) {
     97            $('#link_text').val(attrs.link_text);
     98        }
     99        if (attrs.hasOwnProperty('link')) {
     100            $('#link').val(attrs.link);
     101        }
     102   
     103        if (wp.shortcode.regexp('i2pc').test(content)) {
     104            var i2pros = content.match(wp.shortcode.regexp('i2pros'))[0];
     105            i2pros = i2pros.substr(8, i2pros.length - 17);
     106            $('#i2pc_ce_editor_popup #i2pc-pros').val(i2pros.replace(/<br\s*[\/]?>/gi, '\n'));
     107   
     108            var i2cons = content.match(wp.shortcode.regexp('i2cons'))[0];
     109            i2cons = i2cons.substr(8, i2cons.length - 17);
     110            $('#i2pc_ce_editor_popup #i2pc-cons').val(i2cons.replace(/<br\s*[\/]?>/gi, '\n'));
     111        }
     112   
     113        //console.log($('#i2pc_ce_editor_popup').length);
     114        $('#i2pc_ce_editor_popup').addClass('i2pc-ce-popup-display');
     115        $('body').css('overflow', 'hidden');
     116    }
     117    //i2pcModule.i2pc_show_popup = i2pc_show_popup;
    99118
    100119    $('#i2pc-ce-submit').on('click', function (e) {
     
    197216        }
    198217    });
    199 
    200218    String.prototype.isEmpty = function () {
    201219        return this.length === 0 || !this.trim();
    202     };
     220    }; 
    203221});
  • i2-pro-cons/trunk/i2-pros-and-cons.php

    r2422759 r2444566  
    88 * Author URI: https://github.com/imibrar
    99 * Text Domain: i2-pros-and-cons
    10  * Version: 1.2.7
     10 * Version: 1.3.0
    1111 * License: GPLv3
    1212 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1919
    2020define('I2PC_MORE_THEMES_PLUGINS_URL', 'https://themesfirst.com');
    21 define('I2PC_VER', '1.2.6');
    22 define('I2PC_CSS_VER', '1.2.6');
     21define('I2PC_VER', '1.3.0');
     22define('I2PC_CSS_VER', '1.3.0');
    2323
    2424//include_once('include/ibr-test-block.php');
  • i2-pro-cons/trunk/include/ce-popup.php

    r2418679 r2444566  
    1818function i2pc_ce_editor_style($hook)
    1919{
    20     if ($hook == 'post-new.php' || $hook == 'post.php') {
     20    if ( ($hook == 'post-new.php' || $hook == 'post.php') && get_user_option( 'rich_editing' ) == 'true') {
    2121        wp_enqueue_style('i2pc_ce_editor_style', plugins_url('../dist/css/admin-ce-popup.min.css', __FILE__), null, I2PC_CSS_VER);
    22         i2pc_ce_editor_popup();
     22                add_filter('admin_footer', 'i2pc_ce_editor_popup');
    2323    }
    2424}
  • i2-pro-cons/trunk/readme.txt

    r2422759 r2444566  
    22Contributors: imibrar
    33Tags: Pros & Cons, Amazon Pros & Cons, Pros and Cons, WP Pros & Cons
    4 Tested up to: 5.5.3
    5 Stable tag: 1.2.6
     4Tested up to: 5.6
     5Stable tag: 1.3.0
    66Requires PHP: 5.x
    77License: GPLv3
     
    1313
    1414**Update**
     15v1.3.0 bug fix, popup button not visible in WordPress 5.6 in classic editor.
    1516v1.2.6 bug fix, showing notice "rest_validate_value_from_schema was called incorrectly" in debug mode.
    1617v1.2.4 allow to add pros and cons in single popup for gutenberg.
     
    8384
    8485You can contact me from [here](https://themesfirst.com/ "i2 Pros & Cons")
    85 Waiting for your [Suggestion, feedback](https://themesfirst.com/feedback/, "i2 Pros & Cons Feedback")
     86Waiting for your [Suggestion, feedback](https://themesfirst.com/feedback/ "i2 Pros & Cons Feedback")
    8687
    8788== Screenshots ==
Note: See TracChangeset for help on using the changeset viewer.