Version Description
- December 23rd, 2016 =
- The editor should only default to the 'Visual' tab for our Custom Product Tabs (no other editors)
- Added all of the default WordPress settings to the editor
Download this release
Release Info
Developer | yikesitskevin |
Plugin | Custom Product Tabs for WooCommerce |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
js/repeatable-custom-tabs-shared.js
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
yikes_woo_toggle_controls( 'enable' );
|
27 |
|
28 |
// If call failed, show error message
|
29 |
-
if ( response.success
|
30 |
jQuery( '.' + textarea_id + '_field' ).html( '<p>' + repeatable_custom_tabs_shared.get_wp_editor_failure_message + '</p>' );
|
31 |
|
32 |
return false;
|
@@ -41,11 +41,68 @@
|
|
41 |
jQuery( '.' + textarea_id + '_field' ).html( response ).addClass( '_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic' );
|
42 |
|
43 |
// Initialize quicktags (for working in 'Text tab' mode)
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
// Initialize tinymce
|
47 |
if( typeof( tinymce ) != 'undefined' ) {
|
48 |
-
tinymce.execCommand( 'mceAddEditor', false, textarea_id );
|
49 |
}
|
50 |
|
51 |
// After tinymce is initialized, let's check if we need to disable the box (because it's a saved tab)
|
26 |
yikes_woo_toggle_controls( 'enable' );
|
27 |
|
28 |
// If call failed, show error message
|
29 |
+
if ( typeof( response.success ) !== 'undefined' && response.success === false ) {
|
30 |
jQuery( '.' + textarea_id + '_field' ).html( '<p>' + repeatable_custom_tabs_shared.get_wp_editor_failure_message + '</p>' );
|
31 |
|
32 |
return false;
|
41 |
jQuery( '.' + textarea_id + '_field' ).html( response ).addClass( '_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic' );
|
42 |
|
43 |
// Initialize quicktags (for working in 'Text tab' mode)
|
44 |
+
if ( typeof( quicktags() ) !== 'undefined' ) {
|
45 |
+
quicktags( { id: textarea_id } ); // currently does not work -- text tab buttons are not there until refresh
|
46 |
+
}
|
47 |
+
|
48 |
+
// These are WordPress default editor settings, retrieved from wp-includes\class-wp-editor.php
|
49 |
+
// The `setup:` function is not part of the WordPress core, but the default styles were not being applied
|
50 |
+
tinymce.init({
|
51 |
+
selector: '#' + textarea_id,
|
52 |
+
theme: 'modern',
|
53 |
+
skin: 'lightgray',
|
54 |
+
language: 'en',
|
55 |
+
formats: {
|
56 |
+
alignleft: [
|
57 |
+
{ selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: { textAlign:'left' } },
|
58 |
+
{ selector: 'img,table,dl.wp-caption', classes: 'alignleft' }
|
59 |
+
],
|
60 |
+
aligncenter: [
|
61 |
+
{ selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: { textAlign:'center' } },
|
62 |
+
{ selector: 'img,table,dl.wp-caption', classes: 'aligncenter' }
|
63 |
+
],
|
64 |
+
alignright: [
|
65 |
+
{ selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: { textAlign:'right' } },
|
66 |
+
{ selector: 'img,table,dl.wp-caption', classes: 'alignright' }
|
67 |
+
],
|
68 |
+
strikethrough: { inline: 'del' }
|
69 |
+
},
|
70 |
+
relative_urls: false,
|
71 |
+
remove_script_host: false,
|
72 |
+
convert_urls: false,
|
73 |
+
browser_spellcheck: true,
|
74 |
+
fix_list_elements: true,
|
75 |
+
entities: '38,amp,60,lt,62,gt',
|
76 |
+
entity_encoding: 'raw',
|
77 |
+
keep_styles: false,
|
78 |
+
paste_webkit_styles: 'font-weight font-style color',
|
79 |
+
preview_styles: 'font-family font-size font-weight font-style text-decoration text-transform',
|
80 |
+
end_container_on_empty_block: true,
|
81 |
+
wpeditimage_disable_captions: false,
|
82 |
+
wpeditimage_html5_captions: true,
|
83 |
+
plugins: 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview,wpembed',
|
84 |
+
resize: 'vertical',
|
85 |
+
menubar: false,
|
86 |
+
wpautop: true,
|
87 |
+
indent: false,
|
88 |
+
toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_adv',
|
89 |
+
toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
|
90 |
+
toolbar3: '',
|
91 |
+
toolbar4: '',
|
92 |
+
tabfocus_elements: ':prev,:next',
|
93 |
+
body_class: 'id post-type-post post-status-publish post-format-standard',
|
94 |
+
setup: function( editor ) {
|
95 |
+
editor.on( 'init', function() {
|
96 |
+
this.getBody().style.fontFamily = 'Georgia, "Times New Roman", "Bitstream Charter", Times, serif';
|
97 |
+
this.getBody().style.fontSize = '16px';
|
98 |
+
this.getBody().style.color = '#333';
|
99 |
+
});
|
100 |
+
}
|
101 |
+
});
|
102 |
|
103 |
// Initialize tinymce
|
104 |
if( typeof( tinymce ) != 'undefined' ) {
|
105 |
+
tinymce.execCommand( 'mceAddEditor', false, textarea_id );
|
106 |
}
|
107 |
|
108 |
// After tinymce is initialized, let's check if we need to disable the box (because it's a saved tab)
|
js/repeatable-custom-tabs-shared.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function yikes_woo_get_wp_editor_ajax(a,b,c){var d={action:"yikes_woo_get_wp_editor",textarea_id:a,tab_content:c,security_nonce:repeatable_custom_tabs_shared.get_wp_editor_security_nonce};jQuery.post(repeatable_custom_tabs_shared.ajaxurl,d,function(c){if(yikes_woo_toggle_controls("enable"),
|
1 |
+
function yikes_woo_get_wp_editor_ajax(a,b,c){var d={action:"yikes_woo_get_wp_editor",textarea_id:a,tab_content:c,security_nonce:repeatable_custom_tabs_shared.get_wp_editor_security_nonce};jQuery.post(repeatable_custom_tabs_shared.ajaxurl,d,function(c){if(yikes_woo_toggle_controls("enable"),"undefined"!=typeof c.success&&c.success===!1)return jQuery("."+a+"_field").html("<p>"+repeatable_custom_tabs_shared.get_wp_editor_failure_message+"</p>"),!1;b===!0&&jQuery(".button-holder").show(),jQuery("."+a+"_field").html(c).addClass("_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic"),"undefined"!=typeof quicktags()&&quicktags({id:a}),tinymce.init({selector:"#"+a,theme:"modern",skin:"lightgray",language:"en",formats:{alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table,dl.wp-caption",classes:"alignleft"}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img,table,dl.wp-caption",classes:"aligncenter"}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table,dl.wp-caption",classes:"alignright"}],strikethrough:{inline:"del"}},relative_urls:!1,remove_script_host:!1,convert_urls:!1,browser_spellcheck:!0,fix_list_elements:!0,entities:"38,amp,60,lt,62,gt",entity_encoding:"raw",keep_styles:!1,paste_webkit_styles:"font-weight font-style color",preview_styles:"font-family font-size font-weight font-style text-decoration text-transform",end_container_on_empty_block:!0,wpeditimage_disable_captions:!1,wpeditimage_html5_captions:!0,plugins:"charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview,wpembed",resize:"vertical",menubar:!1,wpautop:!0,indent:!1,toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_adv",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",toolbar3:"",toolbar4:"",tabfocus_elements:":prev,:next",body_class:"id post-type-post post-status-publish post-format-standard",setup:function(a){a.on("init",function(){this.getBody().style.fontFamily='Georgia, "Times New Roman", "Bitstream Charter", Times, serif',this.getBody().style.fontSize="16px",this.getBody().style.color="#333"})}}),"undefined"!=typeof tinymce&&tinymce.execCommand("mceAddEditor",!1,a);var d=yikes_woo_get_tab_number_from_id(a);return jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+d).hasClass("yikes_woo_disable_this_tab")&&(jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+d).removeClass("yikes_woo_disable_this_tab"),yikes_woo_toggle_reusable_override_overlay("disable",d)),!0})}function yikes_woo_get_tab_number_from_id(a){return a.slice(a.lastIndexOf("_")+1)}function yikes_woo_toggle_controls(a){"disable"===a?(jQuery(".remove_this_tab").attr("disabled","disabled"),jQuery("#add_another_tab").attr("disabled","disabled"),jQuery("._yikes_wc_apply_a_saved_tab").attr("disabled","disabled"),jQuery(".move-tab-data-up").hide(),jQuery(".move-tab-data-down").hide()):(jQuery(".remove_this_tab").removeAttr("disabled"),jQuery("#add_another_tab").removeAttr("disabled"),jQuery("._yikes_wc_apply_a_saved_tab").removeAttr("disabled"),jQuery(".move-tab-data-up").show(),jQuery(".move-tab-data-down").show())}function yikes_woo_display_feedback_messages(a,b,c,d){var e={inline:!1,classes:[],css_string:"",time:3e3},f=jQuery.extend(e,d);jQuery("._yikes_wc_feedback_message").remove();var g="";f.css_string.length>0&&(g=f.css_string);var h=e.classes;f.classes.length>0&&f.classes.each(function(a,b){h+=b});var i="";i=f.inline===!0?'<span id="'+b+'" class="_yikes_wc_feedback_message '+h+'" style="'+g+'">'+c+"</span>":'<p id="'+b+'" class="_yikes_wc_feedback_message '+h+'" style="'+g+'">'+c+"</p>",jQuery(a).after(i),jQuery("#"+b).fadeIn(500).delay(f.time).fadeOut(500)}function yikes_woo_toggle_how_to(){jQuery(".yikes-woo-tabs-hidden-how-to-info").slideToggle("fast",function(){jQuery("#yikes-woo-help-me-icon").hasClass("dashicons-editor-help")?jQuery("#yikes-woo-help-me-icon").removeClass("dashicons-editor-help").addClass("dashicons-dismiss"):jQuery("#yikes-woo-help-me-icon").removeClass("dashicons-dismiss").addClass("dashicons-editor-help")})}function yikes_woo_get_content_from_wysiwyg(a){var b="";return"undefined"!==tinymce&&null!==tinymce.get(a)?(b=tinymce.get(a).getContent(),0===b.length&&jQuery("#"+a).val().length>0&&(b=jQuery("#"+a).val())):b=jQuery("#"+a).val(),b}function yikes_woo_set_content_for_wysiwyg(a,b){"undefined"!==tinymce&&null!==tinymce.get(a)?(tinymce.get(a).setContent(b),jQuery("#"+a).val(b)):jQuery("#"+a).val(b)}
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Requires at least: 3.8
|
|
6 |
Tested up to: 4.7
|
7 |
Requires WooCommerce at least: 2.0
|
8 |
Tested WooCommerce up to: 2.6.9
|
9 |
-
Stable tag: 1.5.
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Add custom tabs with content to products in WooCommerce.
|
@@ -74,6 +74,10 @@ Yes! Since v1.4 we've added the necessary code to ensure the custom tab data is
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
77 |
= 1.5.1 - December 22nd, 2016 =
|
78 |
* Fixed bug that caused content to be copied incorrectly when moving tabs up / down
|
79 |
* Only on the product page will the editor defaul to 'Visual' (instead of every page)
|
6 |
Tested up to: 4.7
|
7 |
Requires WooCommerce at least: 2.0
|
8 |
Tested WooCommerce up to: 2.6.9
|
9 |
+
Stable tag: 1.5.2
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Add custom tabs with content to products in WooCommerce.
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.5.2 - December 23rd, 2016 =
|
78 |
+
* The editor should only default to the 'Visual' tab for our Custom Product Tabs (no other editors)
|
79 |
+
* Added all of the default WordPress settings to the editor
|
80 |
+
|
81 |
= 1.5.1 - December 22nd, 2016 =
|
82 |
* Fixed bug that caused content to be copied incorrectly when moving tabs up / down
|
83 |
* Only on the product page will the editor defaul to 'Visual' (instead of every page)
|
yikes-inc-easy-custom-woocommerce-product-tabs.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
6 |
* Author: YIKES, Inc
|
7 |
* Author URI: http://www.yikesinc.com
|
8 |
-
* Version: 1.5.
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
*
|
@@ -62,7 +62,7 @@
|
|
62 |
private $tab_data = false;
|
63 |
|
64 |
/** plugin version number */
|
65 |
-
const VERSION =
|
66 |
|
67 |
/** plugin text domain */
|
68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
@@ -1131,18 +1131,23 @@
|
|
1131 |
* @since 1.5
|
1132 |
*
|
1133 |
* @param string | $mode | The current mode of the editor
|
1134 |
-
* @return string 'tinymce' ||
|
1135 |
*/
|
1136 |
public function yikes_woo_set_editor_to_visual( $mode ) {
|
1137 |
global $post;
|
1138 |
|
1139 |
-
// Only
|
1140 |
if ( isset( $post ) && isset( $post->post_type ) && $post->post_type !== 'product' ) {
|
1141 |
return $mode;
|
1142 |
}
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
|
|
|
|
|
|
|
|
|
|
1146 |
}
|
1147 |
|
1148 |
/* End Misc. */
|
5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
6 |
* Author: YIKES, Inc
|
7 |
* Author URI: http://www.yikesinc.com
|
8 |
+
* Version: 1.5.2
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
*
|
62 |
private $tab_data = false;
|
63 |
|
64 |
/** plugin version number */
|
65 |
+
const VERSION = '1.5.2';
|
66 |
|
67 |
/** plugin text domain */
|
68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
1131 |
* @since 1.5
|
1132 |
*
|
1133 |
* @param string | $mode | The current mode of the editor
|
1134 |
+
* @return string 'tinymce' || $mode
|
1135 |
*/
|
1136 |
public function yikes_woo_set_editor_to_visual( $mode ) {
|
1137 |
global $post;
|
1138 |
|
1139 |
+
// Only continue if we're on the products page
|
1140 |
if ( isset( $post ) && isset( $post->post_type ) && $post->post_type !== 'product' ) {
|
1141 |
return $mode;
|
1142 |
}
|
1143 |
+
|
1144 |
+
// This is funky, but only default the editor when we don't have a post (and we're on the product page)
|
1145 |
+
// This a result of calling the wp_editor via AJAX - I think
|
1146 |
+
if ( ! isset( $post ) ) {
|
1147 |
+
return apply_filters( 'yikes_woocommerce_default_editor_mode', 'tinymce' );
|
1148 |
+
} else {
|
1149 |
+
return $mode;
|
1150 |
+
}
|
1151 |
}
|
1152 |
|
1153 |
/* End Misc. */
|