Version Description
- Fix - JS issues when no TinyMCE instance is loaded on the page
- Fix - better conditional loading of CSS and JS
Download this release
Release Info
Developer | DesignsAndCode |
Plugin | Forget About Shortcode Buttons |
Version | 2.1.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 2.1.2
admin/class-forget-about-shortcode-buttons-admin.php
CHANGED
@@ -52,9 +52,8 @@ class Forget_About_Shortcode_Buttons_Admin {
|
|
52 |
$this->plugin_name = $plugin_name;
|
53 |
$this->version = $version;
|
54 |
|
55 |
-
|
56 |
-
add_filter('
|
57 |
-
add_filter('mce_buttons', array($this, 'load_mce_fasc_button'));
|
58 |
|
59 |
//Admin Ajax
|
60 |
add_action( 'wp_ajax_fasc_buttons', array($this, 'fasc_buttons') ); //if logged in
|
@@ -177,12 +176,10 @@ class Forget_About_Shortcode_Buttons_Admin {
|
|
177 |
}
|
178 |
|
179 |
public function load_mce_fasc_plugin ($plugin_array) {
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
}
|
185 |
-
|
186 |
return $plugin_array;
|
187 |
}
|
188 |
|
@@ -193,6 +190,15 @@ class Forget_About_Shortcode_Buttons_Admin {
|
|
193 |
*/
|
194 |
public function enqueue_styles() {
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
//wp_enqueue_style( 'thickbox' );
|
198 |
wp_enqueue_style( 'wp-color-picker' );
|
@@ -221,73 +227,77 @@ class Forget_About_Shortcode_Buttons_Admin {
|
|
221 |
*
|
222 |
* @since 1.0.0
|
223 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
public function enqueue_scripts() {
|
225 |
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
return;
|
228 |
}
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
echo "".$wp_scripts->registered[$script]->src . ";\r\n";
|
235 |
-
endforeach;
|
236 |
-
*/
|
237 |
-
|
238 |
-
global $current_screen;
|
239 |
-
$type = $current_screen->post_type;
|
240 |
-
$base = $current_screen->base;
|
241 |
-
|
242 |
-
//only add the script to post edit screens and all public post types
|
243 |
-
|
244 |
-
$args = array(
|
245 |
-
'public' => true
|
246 |
-
);
|
247 |
-
|
248 |
-
$post_types = get_post_types( $args, 'names' );
|
249 |
-
|
250 |
-
//wp_enqueue_script( 'thickbox' );
|
251 |
-
wp_enqueue_script( 'wp-color-picker' );
|
252 |
wp_enqueue_script( $this->plugin_name.'-fasc-views', plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-fasc-views.js', array( 'jquery', 'editor', 'mce-view', 'wp-color-picker'), $this->version, false );
|
253 |
-
|
254 |
//wp_enqueue_script( $this->plugin_name.'-fasc-plugin', plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-fasc-plugin.js', array( 'jquery', 'editor', $this->plugin_name.'-fasc-views' ), $this->version, false );
|
255 |
-
|
256 |
-
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-
|
257 |
-
wp_localize_script($this->plugin_name, 'Fasc', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'plugin_url' => plugin_dir_url( __FILE__ ), 'home_url' => (home_url('/')) ));
|
258 |
-
|
259 |
wp_enqueue_script( $this->plugin_name.'-minicolors', plugin_dir_url( __FILE__ ) . 'js/jquery.minicolors.min.js', array( 'jquery', $this->plugin_name.'-fasc-views', 'wp-color-picker' ), $this->version, false );
|
260 |
-
|
|
|
|
|
|
|
261 |
}
|
262 |
|
263 |
-
public function mce_add_editor_style() {
|
264 |
-
|
265 |
-
add_editor_style( plugin_dir_url( __FILE__ ) . 'css/forget-about-shortcode-buttons-mce.css' );
|
266 |
-
|
267 |
}
|
268 |
|
|
|
|
|
|
|
269 |
public function admin_footer() {
|
270 |
|
271 |
-
if(!
|
|
|
|
|
272 |
return;
|
273 |
}
|
274 |
-
/*global $current_screen;
|
275 |
-
$type = $current_screen->post_type;
|
276 |
-
$base = $current_screen->base;
|
277 |
-
|
278 |
-
//only add the script to post edit screens and all public post types
|
279 |
-
$args = array(
|
280 |
-
'public' => true
|
281 |
-
);
|
282 |
-
|
283 |
-
$post_types = get_post_types( $args, 'names' );*/
|
284 |
-
|
285 |
-
//if (is_admin() && ( in_array($type, $post_types) || ( $base == "widgets" ) ) ) {
|
286 |
-
|
287 |
-
// insert relevant templates
|
288 |
-
require_once plugin_dir_path( __FILE__ ) . 'partials/forget-about-shortcode-buttons-admin-backbone-templates.php';
|
289 |
-
//}
|
290 |
-
|
291 |
-
}
|
292 |
|
|
|
|
|
|
|
|
|
|
|
293 |
}
|
52 |
$this->plugin_name = $plugin_name;
|
53 |
$this->version = $version;
|
54 |
|
55 |
+
//add_filter('mce_external_plugins', array($this, 'load_mce_fasc_plugin'));
|
56 |
+
//add_filter('mce_buttons', array($this, 'load_mce_fasc_button'));
|
|
|
57 |
|
58 |
//Admin Ajax
|
59 |
add_action( 'wp_ajax_fasc_buttons', array($this, 'fasc_buttons') ); //if logged in
|
176 |
}
|
177 |
|
178 |
public function load_mce_fasc_plugin ($plugin_array) {
|
179 |
+
|
180 |
+
//$plugin_array['fascview'] = plugin_dir_url( __FILE__ ) . 'js/mce/fasc-plugin.js';
|
181 |
+
//$plugin_array['fascbutton'] = plugin_dir_url( __FILE__ ) . 'js/mce/fasc-button.js';
|
182 |
+
|
|
|
|
|
183 |
return $plugin_array;
|
184 |
}
|
185 |
|
190 |
*/
|
191 |
public function enqueue_styles() {
|
192 |
|
193 |
+
if(!is_admin()) {
|
194 |
+
//return;
|
195 |
+
}
|
196 |
+
|
197 |
+
//don't load scripts if WP isn't loading mce-view
|
198 |
+
if( ! wp_script_is( 'mce-view', 'enqueued' ) ) {
|
199 |
+
//this is basically our dependency for all assets
|
200 |
+
//return;
|
201 |
+
}
|
202 |
|
203 |
//wp_enqueue_style( 'thickbox' );
|
204 |
wp_enqueue_style( 'wp-color-picker' );
|
227 |
*
|
228 |
* @since 1.0.0
|
229 |
*/
|
230 |
+
|
231 |
+
public function enqueue_scripts_editor_styles() {
|
232 |
+
|
233 |
+
if(( ! wp_script_is( 'mce-view', 'enqueued' ) )&&( ! wp_script_is( 'customize-widgets', 'enqueued' ) ))
|
234 |
+
{
|
235 |
+
//this is basically our dependency for all assets
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
$screen = get_current_screen();
|
240 |
+
if ( $screen->base == "customize" ) {
|
241 |
+
//for now we don't support tinymce in customizer (when customising widgets
|
242 |
+
//but we do want to add CSS, so any buttons in the widget area look good at least
|
243 |
+
//passing load_js = false, prevents the FASC MCE plugin from loading, but we do register the CSS
|
244 |
+
wp_enqueue_script( $this->plugin_name."-admin", plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-admin.js', array( 'jquery' ), $this->version, false );
|
245 |
+
wp_localize_script($this->plugin_name."-admin", 'Fasc', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'load_js' => false, 'plugin_url' => plugin_dir_url( __FILE__ ), 'home_url' => (home_url('/')) ));
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
249 |
public function enqueue_scripts() {
|
250 |
|
251 |
+
|
252 |
+
/*echo "stuff";
|
253 |
+
global $wp_scripts;
|
254 |
+
foreach( $wp_scripts->queue as $script ) :
|
255 |
+
//$result['scripts'][] = $wp_scripts->registered[$script]->src . ";";
|
256 |
+
echo "".$wp_scripts->registered[$script]->src . ";\r\n";
|
257 |
+
endforeach;*/
|
258 |
+
|
259 |
+
//don't load scripts if WP isn't loading mce-view
|
260 |
+
//if(( ! wp_script_is( 'mce-view', 'enqueued' ) )&&( ! wp_script_is( 'customize-widgets', 'enqueued' ) )){
|
261 |
+
if( ! wp_script_is( 'mce-view', 'enqueued' ) ){
|
262 |
+
//this is basically our dependency for all assets
|
263 |
return;
|
264 |
}
|
265 |
+
|
266 |
+
// // load this everywhere, to hook into tinymce via JS (for widget area etc)
|
267 |
+
wp_enqueue_script( $this->plugin_name."-admin", plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-admin.js', array( 'jquery' ), $this->version, false );
|
268 |
+
wp_localize_script($this->plugin_name."-admin", 'Fasc', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'load_js' => true, 'plugin_url' => plugin_dir_url( __FILE__ ), 'home_url' => (home_url('/')) ));
|
269 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
wp_enqueue_script( $this->plugin_name.'-fasc-views', plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-fasc-views.js', array( 'jquery', 'editor', 'mce-view', 'wp-color-picker'), $this->version, false );
|
|
|
271 |
//wp_enqueue_script( $this->plugin_name.'-fasc-plugin', plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-fasc-plugin.js', array( 'jquery', 'editor', $this->plugin_name.'-fasc-views' ), $this->version, false );
|
272 |
+
|
273 |
+
wp_enqueue_script( $this->plugin_name."-editor", plugin_dir_url( __FILE__ ) . 'js/forget-about-shortcode-buttons-editor.js', array( 'jquery', $this->plugin_name.'-fasc-views', 'wp-color-picker' ), $this->version, false );
|
274 |
+
//wp_localize_script($this->plugin_name."-editor", 'Fasc', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'plugin_url' => plugin_dir_url( __FILE__ ), 'home_url' => (home_url('/')) ));
|
275 |
+
|
276 |
wp_enqueue_script( $this->plugin_name.'-minicolors', plugin_dir_url( __FILE__ ) . 'js/jquery.minicolors.min.js', array( 'jquery', $this->plugin_name.'-fasc-views', 'wp-color-picker' ), $this->version, false );
|
277 |
+
|
278 |
+
$this->enqueue_styles();
|
279 |
+
|
280 |
+
|
281 |
}
|
282 |
|
283 |
+
public function mce_add_editor_style() {
|
284 |
+
add_editor_style( plugin_dir_url( __FILE__ ) . 'css/forget-about-shortcode-buttons-mce.css' );
|
|
|
|
|
285 |
}
|
286 |
|
287 |
+
public function prefix_customize_register($wp_customize) {
|
288 |
+
$wp_customize->register_control_type( 'WP_Customize_Custom_Control' );
|
289 |
+
}
|
290 |
public function admin_footer() {
|
291 |
|
292 |
+
//if(( ! wp_script_is( 'mce-view', 'enqueued' ) )&&( ! wp_script_is( 'customize-widgets', 'enqueued' ) )){
|
293 |
+
if( ! wp_script_is( 'mce-view', 'enqueued' ) ){
|
294 |
+
//this is basically our dependency for all assets
|
295 |
return;
|
296 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
|
298 |
+
// insert relevant templates
|
299 |
+
require_once plugin_dir_path( __FILE__ ) . 'partials/forget-about-shortcode-buttons-admin-backbone-templates.php';
|
300 |
+
|
301 |
+
|
302 |
+
}
|
303 |
}
|
admin/js/forget-about-shortcode-buttons-admin.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function addFascToEditor(t){function a(t){t.stopPropagation()}function e(){var a=tinymce.activeEditor.dom.select(".fasc-button"),e=!1;jQuery(a).each(function(){if(jQuery(this).is("[data-fasc-style]")){var a=jQuery(this).attr("data-fasc-style").replace(/\s+/,""),o="";jQuery(this).is("[style]")&&(o=jQuery(this).attr("style").replace(/\s+/,"")),a!=o&&(jQuery(this).attr("style",jQuery(this).attr("data-fasc-style")),t.nodeChanged(),e=!0)}})}function o(a){t.undoManager.transact(function(){t.dom.remove(a),c(),t.focus()})}function n(a){var e=t.dom;a&&(a!==f&&(t.getBody().focus(),c(),f=a,e.setAttrib(a,"data-mce-selected",1)),t.nodeChanged())}function c(){var e=t.dom;f&&(e.unbind(f,"beforedeactivate focusin focusout click mouseup",a),e.setAttrib(f,"data-mce-selected",null)),f=null}function i(a){var e=l(a),o=e.find(".fasc-button");o.attr("data-fasc-temp",null),o.attr("data-fasc-style",null);var n=1;return l(o).each(function(){var t=l(this);n++;var a=t.attr("data-fasc-href");t.attr("href",a),t.attr("data-fasc-href",null),t.attr("data-fasc-id",null)}),t.dom.getOuterHTML(e)}function s(){for(var a=t.dom.select(".fasc-button"),e=0;e<a.length;e++){var o=a[e],n=t.dom.getAttrib(o,"href"),c=t.dom.getAttrib(o,"data-fasc-href"),i=t.dom.getAttrib(o,"style");""==c&&""!=n&&(t.dom.setAttrib(o,"data-fasc-href",n),t.dom.setAttrib(o,"href",null)),t.dom.setAttrib(o,"data-fasc-style",i)}}function r(t,a,e,o,i){if(void 0===i)var i="";"function"!=typeof o&&(o=function(o,i){var s=t.$(o);e?t.$(a).replaceWith(s):t.selection.setContent(o);t.$("[data-fasc-id='"+i+"']");c(),t.focus(),t.nodeChanged(),n(t.dom.select("a[data-fasc-id='"+i+"']")[0]),t.undoManager.add()}),wp.mce.fascpopup.open(a,"button",o,e,i)}var f,d,p,u,l=t.$,v=(tinymce.Env,tinymce.util.VK,tinymce.dom.TreeWalker,!0),h=function(){return!1};/iPad|iPod|iPhone/.test(navigator.userAgent);if(t.addButton("button_fasc_insert_button",{title:"Insert Button",icon:"fascbutton-ico",onclick:function(){t.execCommand("popup_insert_fasc_button",0,0)}}),t.addCommand("popup_insert_fasc_button",function(a,e){var o=!1;t.dom.hasClass(t.selection.getNode(),"fasc-button")&&(o=!0);var n=t.selection.getContent({format:"text"});r(t,t.selection.getNode(),o,{},n)}),"undefined"==typeof wp||!wp.mce)return{getView:h};t.on("SetContent",function(){s()}),t.on("init",function(){t.on("dblClick",function(a){if(t.dom.hasClass(a.target,"fasc-button"))return a.preventDefault(),r(t,a.target,!0),!1},!0),t.addCommand("popup_insert_fasc_button",function(a,e){var o=!1;t.dom.hasClass(t.selection.getNode(),"fasc-button")&&(o=!0);var n=t.selection.getContent({format:"text"});r(t,t.selection.getNode(),o,{},n)});var a=!1;t.selection,window.MutationObserver||window.WebKitMutationObserver;t.dom.bind(t.getDoc(),"touchmove",function(){a=!0}),t.on("mousedown mouseup click touchend",function(e){v=!1,t.dom.hasClass(e.target,"fasc-button")?"touchend"===e.type&&a?a=!1:n(e.target):"touchend"!==e.type&&"mousedown"!==e.type||c(),"touchend"===e.type&&a&&(a=!1)},!0)}),t.on("PreProcess",function(t){},!0),t.on("hide",function(){c()}),t.on("PostProcess",function(a){a.content&&t.$("<div>"+a.content+"</div>").clone().find(".fasc-button").length>0&&(a.content=i(a.content))}),t.on("keydown",function(a){if(c(),32==a.keyCode&&t.dom.hasClass(t.selection.getNode(),"fasc-button")&&t.selection.getRng().startOffset==l(t.selection.getNode()).text().length){var e=tinymce.DOM.uniqueId(),o=t.dom.create("span",{id:e}," ");t.dom.insertAfter(o,t.selection.getNode());var n=t.dom.select("span#"+e);return t.selection.select(n[0]),t.selection.collapse(0),t.dom.setAttrib(e,"id",""),!1}}),t.on("focus",function(){p=!0,v=!1}),t.on("blur",function(){p=!1}),t.on("NodeChange",function(a){t.dom,t.dom.select(".fascview-wrap"),a.element.className;d=!1,clearInterval(void 0)}),t.on("BeforeExecCommand",function(){t.selection.getNode()}),t.on("ExecCommand",function(){}),t.on("ResolveName",function(t){}),t.on("PastePostProcess",function(){e()}),t.addButton("fasc_view_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",onclick:function(){f&&r(t,f,!0)}}),t.addButton("fasc_view_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",onclick:function(){f&&o(f)}}),t.once("preinit",function(){t.wp&&t.wp._createToolbar&&(u=t.wp._createToolbar(["fasc_view_edit","fasc_view_remove"]))}),t.on("wptoolbar",function(t){f&&(t.element=f,t.toolbar=u)}),t.wp=t.wp||{}}!function(t){"use strict";function a(t){if(-1==t.search("rgb"))return t;function a(t){return("0"+parseInt(t).toString(16)).slice(-2)}return"#"+a((t=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/))[1])+a(t[2])+a(t[3])}jQuery(document).on("tinymce-editor-setup",function(t,a){-1===a.settings.plugins.indexOf("fascbutton")&&(a.settings.toolbar1+=",button_fasc_insert_button",a.on("PreInit",function(t){a.dom.loadCSS(Fasc.plugin_url+"css/forget-about-shortcode-buttons-mce.css")}),addFascToEditor(a))}),wp.mce=wp.mce||{};var e={};e.button={content_id:"fasc-popup-edit-button",is_editing:!1,$node:{},init:function(t,a,e,o){this.$popup=a,this.$preview_area=a.find(".preview-button-area .centered-button"),this.is_editing=e,this.$node=jQuery(t),this.setupControls(a),this.setupIcons(t,a),this.setupTabs(a),this.is_editing?this.setSettingsFromNode(t,a,!0):this.initEmptyTemplate(t,a,o),this.updatePreview()},setupIcons:function(a,e){var o=this,n=(t(a),e.find('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"]'));n.find("#fasc-popup-icon-type-select").change(function(a){t(this).val();n.find(".ico-grid .grid-container").removeClass("ico-screen-active").hide(),n.find("#"+t(this).val()).addClass("ico-screen-active").show()}),n.find(".ico-grid div").click(function(a){a.preventDefault();var e=n.find(".fasc-ico-position:checked").val();return n.find(".ico-grid div").removeClass("active"),t(this).addClass("active"),"none"!=e&&""!=e||(e="before"),n.find(".fasc-ico-position").removeAttr("checked"),n.find(".fasc-ico-position").prop("checked",!1),n.find('.fasc-ico-position[value="'+e+'"]').prop("checked",!0),o.updatePreview(),!1}),n.find(".fasc-ico-position").change(function(a){if(n.find(".fasc-ico-position").removeAttr("checked"),n.find(".fasc-ico-position").prop("checked",!1),t(this).prop("checked",!0),"none"==t(this).val())n.find(".ico-grid div div:not(.clear)").removeClass("active");else if(n.find(".ico-grid div.active").length<1){n.find(".ico-grid .grid-container.ico-screen-active").length>0?t(n.find(".ico-grid .grid-container.ico-screen-active div:not(.clear)").get(0)).addClass("active"):t(n.find(".ico-grid .grid-container:first-child div:not(.clear)").get(0)).addClass("active")}o.updatePreview()}),t('.fasc-ajax-content select, .fasc-ajax-content input[type="checkbox"]').change(function(){o.updatePreview()}),t('.fasc-ajax-content input[type="text"]').keyup(function(){o.updatePreview()}),t('.fasc-ajax-content input[type="text"]').keyup(function(){o.updatePreview()}),t.get(Fasc.ajax_url+"?action=fasc_buttons&load=get_buttons",function(t){o.parseTemplateButtons(t)},"json"),t(".fasc-save-btn").click(function(){var a={};return a.button=o.createButtonHtml({isSaving:!0}),t.post(Fasc.ajax_url+"?action=fasc_buttons&load=save_button",a,function(t){o.parseTemplateButtons(t)},"json"),o.$tabs.find("li").removeClass("active"),o.$tabs.find("li[data-fasc-tab='3']").addClass("active"),o.loadTab(3,e),!1}),o.updatePreview()},parseTemplateButtons:function(a){var e=this,o=t(".saved-buttons-tab .container-grid ul");o.empty();var n="",c=0;t.each(a,function(e){n="";var i=t(a[e].html),s=i.css("background-color"),r=i.css("color");n+="<li data-index='"+c+"'>",n+='<div class="wrap">',n+='<div class="full_button">'+a[e].html+"</div>",n+='<div class="name"><span>'+a[e].name+'</span> <a class="dashicons dashicons-edit fasc-button-edit"></a><a class="fa fa-check fasc-button-update" data-action="update"></a><a class="dashicons dashicons-no-alt fasc-button-update" data-action="remove"></a></div>',n+='<div class="col fasc-button-remove dashicons dashicons-no-alt"></div>',n+='<div class="col" style="background-color:'+s+';"></div>',n+='<div class="col" style="background-color:'+r+';"></div>',n+='<div class="clear"></div>',n+="</div>",n+="</li>",o.append(n),c++});var i=function(a){var e=a.text(),o=t("<input>",{val:e,type:"text",width:"170px","data-orig-text":e});a.replaceWith(o),o.select()},s=function(a){var e=t("<span>",{text:a.attr("data-orig-text")});a.replaceWith(e),e.on("click",i)},r=function(a){var e=t("<span>",{text:a.val()});a.replaceWith(e),e.on("click",i)};t(".fasc-button-edit").click(function(){return t(this).hide(),t(this).parent().find(".fasc-button-update").show().css("display","inline-block"),i(t(this).parent().find("span")),!1}),t(".fasc-button-remove").click(function(a){a.preventDefault();var o=t(this).closest("li").attr("data-index");return t.get(Fasc.ajax_url+"?action=fasc_buttons&load=remove_button&index="+o,function(t){e.parseTemplateButtons(t)},"json"),!1}),t(".fasc-button-update").click(function(){var a=t(this);if(t(this).parent().find(".fasc-button-update").hide(),t(this).parent().find(".fasc-button-edit").show(),"remove"==a.attr("data-action"))s(t(this).parent().find("input"));else{var o=t(this).closest("li").attr("data-index"),n=encodeURIComponent(t(this).parent().find("input").val());t.get(Fasc.ajax_url+"?action=fasc_buttons&load=update_button&index="+o+"&name="+n,function(t){e.parseTemplateButtons(t)},"json"),r(t(this).parent().find("input"))}return!1});var f=t(".saved-buttons-tab .container-grid li .wrap");f.on("click",function(){f.removeClass("active"),t(this).addClass("active");var a=t(this).find(".full_button a.fasc-button");e.loadButtonTemplate(a,!0),e.updatePreview()})},loadButtonTemplate:function(e,o){var n=this,c=e.attr("target");jQuery(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!1),void 0!==c&&"_blank"==c&&jQuery(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!0);var i=e.attr("rel");if(jQuery(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!1),void 0!==i&&-1!==i.indexOf("nofollow")&&jQuery(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!0),void 0===o){var s=e.text();jQuery(".fasc-ajax-content input#fasc-popup-button-text").val(s)}var r=a(e.css("color"));jQuery("#fasc-popup-text-color").val(r),n.refreshMiniColors(jQuery("#fasc-popup-text-color"),r,n.$popup);var f=a(e.css("background-color"));jQuery("#fasc-popup-button-color").val(f),n.refreshMiniColors(jQuery("#fasc-popup-button-color"),f,n.$popup);var d=n.$popup.find('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"]');d.find(".ico-grid > div > div").removeClass("active");var p=e.attr("class").split(/\s+/);n.$popup.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active","0"),n.$popup.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active","0"),n.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active","0");for(var u=0;u<p.length;u++)if("fasc-type"==p[u].substring(0,9)){var l=p[u];(e.hasClass("fasc-rounded-medium")||e.hasClass("rounded"))&&(l+=" fasc-rounded-medium"),jQuery("#fasc-popup-button-type option").prop("selected",!1),jQuery('#fasc-popup-button-type option[value="'+l+'"]').prop("selected",!0),t("#fasc-popup-button-type").val(l)}else if("fasc-style"==p[u].substring(0,10))"fasc-style-bold"==p[u]?n.$popup.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active","1"):"fasc-style-italic"==p[u]?n.$popup.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active","1"):"fasc-style-strikethrough"==p[u]&&n.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active","1");else if("fasc-size"==p[u].substring(0,9)){var v=p[u];jQuery("#fasc-popup-button-size option").prop("selected",!1),jQuery('#fasc-popup-button-size option[value="'+v+'"]').prop("selected",!0),t("#button-size").val(v)}else if("dashicons"==p[u].substring(0,9)){d.find(".ico-grid .grid-container").removeClass("ico-screen-active"),d.find("#dashicons-grid").addClass("ico-screen-active"),n.$popup.find("#fasc-popup-icon-type-select").val("dashicons-grid"),n.$popup.find("#fasc-popup-icon-type-select").trigger("change");var h=p[u];n.$popup.find(".ico-grid ."+h).addClass("active")}else if("fa-"==p[u].substring(0,3)){d.find(".ico-grid .grid-container").removeClass("ico-screen-active");var b=d.find(".ico-grid").find("."+p[u]).parent().attr("id");d.find("#"+b).addClass("ico-screen-active"),n.$popup.find("#fasc-popup-icon-type-select").val(b),n.$popup.find("#fasc-popup-icon-type-select").trigger("change"),n.$popup.find(".ico-grid ."+p[u]).addClass("active")}e.hasClass("fasc-ico-before")||e.hasClass("fasc-ico-after")?e.hasClass("fasc-ico-before")?(d.find(".fasc-ico-position").prop("checked",!1),d.find('.fasc-ico-position[value="before"]').prop("checked",!0)):e.hasClass("fasc-ico-after")&&(d.find(".fasc-ico-position").prop("checked",!1),d.find('.fasc-ico-position[value="after"]').prop("checked",!0)):(d.find(".fasc-ico-position").prop("checked",!1),d.find('.fasc-ico-position[value="none"]').prop("checked",!0))},setupControls:function(a){var e=this;a.find('.fasc-ajax-content select, .fasc-ajax-content input[type="checkbox"]').change(function(){e.updatePreview()}),a.find('.fasc-ajax-content input[type="text"]').keyup(function(){e.updatePreview()}),a.find('.fasc-ajax-content input[type="text"]').keyup(function(){e.updatePreview()});var o=a.find("[data-fasc-action='popup-colorpicker']");o.click(function(e){var n=t(this),c=n.attr("data-fasc-button-active");o.attr("data-fasc-button-active","");var i=1-c;n.attr("data-fasc-button-active",i);var s=n.data("fasc-action-target"),r=a.find('[data-fasc-colorpicker-name="'+s+'"]'),f=a.find("[data-fasc-colorpicker-name]").not('[data-fasc-colorpicker-name="'+s+'"]'),d=n.position();f.stop(!0,!0).hide(),r.stop(!0,!0).fadeToggle(100),r.css("left",Math.round(d.left)+"px"),r.css("top",Math.round(d.top+n.parent().outerHeight())+"px")}),a.on("click",function(e){0==t(e.target).closest("[data-fasc-action='popup-colorpicker'], .fasc-popup-colorpicker-container").length&&(a.find("[data-fasc-colorpicker-name]").hide(),o.attr("data-fasc-button-active",""))}),a.find(".fasc-mce-button-toggle").on("click",function(){var a=t(this),o=1-a.attr("data-fasc-button-active");a.attr("data-fasc-button-active",o),e.updatePreview()}),e.updatePreview()},updatePreview:function(){this.$preview_area.html(this.createButtonHtml()),this.$preview_area.find(".fasc-button").off(),this.$preview_area.find(".fasc-button").click(function(t){t.preventDefault(),t.stopPropagation()})},createButtonHtml:function(a){var e={content:"",isSaving:!1,hasID:!1};t.extend(e,a);var o=jQuery(".fasc-ajax-content input#fasc-popup-button-url").val(),n=jQuery(".fasc-ajax-content input#fasc-popup-button-text").val(),c=jQuery(".fasc-ajax-content select#fasc-popup-button-size").val(),i=jQuery(".fasc-ajax-content input#fasc-popup-button-color").val(),s=jQuery(".fasc-ajax-content input#fasc-popup-text-color").val(),r=jQuery(".fasc-ajax-content select#fasc-popup-button-type").val(),f=(jQuery(".fasc-ajax-content select#fasc-popup-button-align").val(),jQuery(".fasc-ajax-content input#fasc-popup-new-window").prop("checked")),d=jQuery(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked"),p="",u="",l="",v="";1==f&&(l=' target="_blank"'),1==d&&(v=' rel="nofollow"'),r&&""!=r&&(p=" "+r),c&&""!=c&&(u=" "+c);var h=t(t('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"] .ico-grid div.active').get(0)),b=t('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"] .fasc-ico-position:checked').val(),g="";if(1==h.length){var m=h.attr("class").split(" "),y=0,k="dashicons";for(y=0;y<m.length;y++)"active"!=m[y]&&"fa"!=m[y]&&"dashicons"!=m[y]&&(g+=" "+m[y]),"fa"==m[y]&&(k="fontawesome");y>0&&("before"!=b&&"after"!=b||(g="fontawesome"==k?" ico-fa fasc-ico-"+b+g:" fasc-ico-"+b+g))}var x="";1==this.$popup.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active")&&(x+=" fasc-style-bold"),1==this.$popup.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active")&&(x+=" fasc-style-italic");var w=this.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active");1==w&&(x+=" fasc-style-strikethrough");this.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active");1==w&&(x+=" fasc-style-strikethrough");var j="";e.hasID&&(j=' data-fasc-id="fasc-button-tid-'+(new Date).getTime()+'"');return e.isSaving?'<a class="fasc-button'+u+p+g+x+'"'+l+v+' style="background-color:'+i+";color:"+s+';" data-fasc-style="background-color:'+i+";color:"+s+';"'+j+"></a>":'<a data-fasc-href="'+o+'" class="fasc-button'+u+p+g+x+'"'+l+v+' style="background-color:'+i+";color:"+s+';" data-fasc-style="background-color:'+i+";color:"+s+';"'+j+">"+n+"</a>"},setupTabs:function(a){var e=this;this.$tabs=a.find(".tab-header");var o=this.$tabs.find("li");this.$tabs.find("li a");o.click(function(){var n=t(this),c=n.attr("data-fasc-tab");return o.removeClass("active"),n.addClass("active"),e.loadTab(c,a),!1})},loadTab:function(a,e){e.find(".fasc-ajax-content .fasc-tab-content").hide(),e.find(".fasc-ajax-content .fasc-tab-content[data-fasc-tab="+a+"]").show(),this.loadTabContent(a),t(".ico-grid .grid-container div.active").length>0&&t(".ico-grid").scrollTop(t(".ico-grid .grid-container div.active").position().top-5)},loadTabContent:function(t,a){},refreshMiniColors:function(a,e,o){var n=this;jQuery(".preview-button-area .centered-button");a.is_text_input=!1,a.minicolors({inline:!0,opacity:!1,showSpeed:0,hideSpeed:0,textfield:!0,change:function(e,c){var i=a.val(),s=a.parent().parent().find(".fasc-popup-color-input");1==a.is_text_input?a.is_text_input=!1:s.val(i),s.off("input"),s.on("input",function(){var e=t(this).val();a.is_text_input=!0,a.minicolors("value",e)});var r=t("#fasc-popup-button-color").val(),f=t("#fasc-popup-text-color").val();o.find(".fasc-ico-fg .fg-panel").css("background-color",f),o.find(".fasc-ico-bg .bg-panel").css("background-color",r),n.updatePreview()}}),void 0!==e&&a.minicolors("value",e)},initEmptyTemplate:function(t,e,o){jQuery("#fasc-popup-button-text").val(o);var n=e.find(".preview-button-area .centered-button .fasc-button");this.refreshMiniColors(e.find("#fasc-popup-text-color"),a(n.css("color")),e),this.refreshMiniColors(e.find("#fasc-popup-button-color"),a(n.css("background-color")),e)},setSettingsFromNode:function(e,o,n){var c=t(e),i=c.attr("data-fasc-href");o.find(".fasc-ajax-content input#fasc-popup-button-url").val(i);var s=c.attr("target");o.find(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!1),void 0!==s&&"_blank"==s&&o.find(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!0);var r=c.attr("rel");o.find(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!1),void 0!==r&&-1!==r.indexOf("nofollow")&&o.find(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!0);var f=c.text();o.find(".fasc-ajax-content input#fasc-popup-button-text").val(f);var d=a(c.css("color"));o.find("#fasc-popup-text-color").val(d),o.find(".fasc-ico-fg .fg-panel").css("background-color",d),this.refreshMiniColors(o.find("#fasc-popup-text-color"),d,o);var p=a(c.css("background-color"));o.find("#fasc-popup-button-color").val(p),o.find(".fasc-ico-bg .bg-panel").css("background-color",p),this.refreshMiniColors(o.find("#fasc-popup-button-color"),p,o);var u=o.find('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"]'),l=c.attr("class").split(/\s+/);u.find(".ico-grid > div > div").removeClass("active");for(var v=0;v<l.length;v++)if("fasc-type"==l[v].substring(0,9)){var h=l[v];(c.hasClass("fasc-rounded-medium")||c.hasClass("rounded"))&&(h+=" fasc-rounded-medium"),o.find("#fasc-popup-button-type option").prop("selected",!1),o.find('#fasc-popup-button-type option[value="'+h+'"]').prop("selected",!0),o.find("#fasc-popup-button-type").val(h)}else if("fasc-style"==l[v].substring(0,10))"fasc-style-bold"==l[v]?o.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active","1"):"fasc-style-italic"==l[v]?o.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active","1"):"fasc-style-strikethrough"==l[v]&&o.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active","1");else if("fasc-size"==l[v].substring(0,9)){var b=l[v];o.find("#fasc-popup-button-size option").prop("selected",!1),o.find('#fasc-popup-button-size option[value="'+b+'"]').prop("selected",!0),o.find("#fasc-popup-button-size").val(b)}else if("dashicons"==l[v].substring(0,9)){u.find(".ico-grid .grid-container").removeClass("ico-screen-active"),u.find("#dashicons-grid").addClass("ico-screen-active"),o.find("#fasc-popup-icon-type-select").val("dashicons-grid"),o.find("#fasc-popup-icon-type-select").trigger("change");var g=l[v];o.find(".ico-grid ."+g).addClass("active")}else if("fa-"==l[v].substring(0,3)){u.find(".ico-grid .grid-container").removeClass("ico-screen-active");var m=u.find(".ico-grid").find("."+l[v]).parent().attr("id");u.find("#"+m).addClass("ico-screen-active"),o.find("#fasc-popup-icon-type-select").val(m),o.find("#fasc-popup-icon-type-select").trigger("change"),o.find(".ico-grid ."+l[v]).addClass("active")}c.hasClass("fasc-ico-before")||c.hasClass("fasc-ico-after")?c.hasClass("fasc-ico-before")?(u.find(".fasc-ico-position").prop("checked",!1),u.find('.fasc-ico-position[value="before"]').prop("checked",!0)):c.hasClass("fasc-ico-after")&&(u.find(".fasc-ico-position").prop("checked",!1),u.find('.fasc-ico-position[value="after"]').prop("checked",!0)):(u.find(".fasc-ico-position").prop("checked",!1),u.find('.fasc-ico-position[value="none"]').prop("checked",!0))}},wp.mce.fascpopup={open:function(a,o,n,c,i){this.type=o,this.templateID=o,this.is_editing=c;var s=e[o].content_id,r=jQuery("<div/>",{class:"fasc-thickbox-overlay"}).appendTo("body"),f=t("#fasc-popup-template").clone();f.removeAttr("id"),f.addClass(s);var d=t("#"+s),p=d.clone();d.remove();var u=f.find(".fasc-thickbox-content"),l=f.find(".fasc-thickbox-title-inner"),v=f.find(".fasc-thickbox-action-right");this.initTemplate(f,p,u,l,v),f.insertAfter(r),e[o].init(a,f,this.is_editing,i),f.show(),this.initEvents(a,f,v,u,p,n)},initTemplate:function(t,a,e,o,n){e.html(a.html());var c=a.attr("data-fasc-title"),i=a.attr("data-fasc-submit-label"),s=a.attr("data-fasc-width"),r=a.attr("data-fasc-height");o.text(c),n.text(i),t.css("max-width",s),t.css("max-height",r)},initEvents:function(a,o,n,c,i,s){var r=this;o.find("label").click(function(){}),o.find(".fasc-close-ajax-window").click(function(){r.removePopup(o,i)}),t(".fasc-thickbox-overlay").on("click",function(t){r.removePopup(o,i)}),n.click(function(t){t.preventDefault(),t.stopImmediatePropagation();var a=e[r.type].createButtonHtml({isSaving:!1,hasID:!0}),n=jQuery(a).attr("data-fasc-id");return s(a,n),r.removePopup(o,i),!1});var f=i.attr("data-fasc-width"),d=i.attr("data-fasc-height");t(window).resize(_.debounce(function(){r.centerPopup(o)},100)),r.centerPopup(o,f,d)},removePopup:function(a,o){var n=this;t(".fasc-thickbox-overlay").remove(),a.remove(),t("body").append(o),o.attr("id",e[n.type].content_id)},centerPopup:function(a,e,o){var n=a.find(".fasc-thickbox-header"),c=a.find(".fasc-thickbox-footer"),i=a.find(".fasc-thickbox-content"),s=(t(window),-a.height()/2),r=-a.width()/2;a.css("position","fixed").css({"margin-left":r+"px","margin-top":s+"px",left:"50%",top:"50%"}),i.hide();var f=a.outerHeight();f-=n.outerHeight(),f-=c.outerHeight(),i.height(f),i.show()}}}(jQuery);
|
1 |
+
function addFascToEditor(t){function e(t){t.stopPropagation()}function n(){var e=tinymce.activeEditor.dom.select(".fasc-button"),n=!1;jQuery(e).each(function(){if(jQuery(this).is("[data-fasc-style]")){var e=jQuery(this).attr("data-fasc-style").replace(/\s+/,""),o="";jQuery(this).is("[style]")&&(o=jQuery(this).attr("style").replace(/\s+/,"")),e!=o&&(jQuery(this).attr("style",jQuery(this).attr("data-fasc-style")),t.nodeChanged(),n=!0)}})}function o(e){t.undoManager.transact(function(){t.dom.remove(e),c(),t.focus()})}function a(e){var n=t.dom;e&&(e!==r&&(t.getBody().focus(),c(),r=e,n.setAttrib(e,"data-mce-selected",1)),t.nodeChanged())}function c(){var n=t.dom;r&&(n.unbind(r,"beforedeactivate focusin focusout click mouseup",e),n.setAttrib(r,"data-mce-selected",null)),r=null}function s(e){var n=m(e),o=n.find(".fasc-button");o.attr("data-fasc-temp",null),o.attr("data-fasc-style",null);var a=1;return m(o).each(function(){var t=m(this);a++;var e=t.attr("data-fasc-href");t.attr("href",e),t.attr("data-fasc-href",null),t.attr("data-fasc-id",null)}),t.dom.getOuterHTML(n)}function i(){for(var e=t.dom.select(".fasc-button"),n=0;n<e.length;n++){var o=e[n],a=t.dom.getAttrib(o,"href"),c=t.dom.getAttrib(o,"data-fasc-href"),s=t.dom.getAttrib(o,"style");""==c&&""!=a&&(t.dom.setAttrib(o,"data-fasc-href",a),t.dom.setAttrib(o,"href",null)),t.dom.setAttrib(o,"data-fasc-style",s)}}function d(t,e,n,o,s){if(void 0===s)var s="";"function"!=typeof o&&(o=function(o,s){var i=t.$(o);n?t.$(e).replaceWith(i):t.selection.setContent(o);t.$("[data-fasc-id='"+s+"']");c(),t.focus(),t.nodeChanged(),a(t.dom.select("a[data-fasc-id='"+s+"']")[0]),t.undoManager.add()}),wp.mce.fascpopup.open(e,"button",o,n,s)}var r,u,f,l,m=t.$,p=(tinymce.Env,tinymce.util.VK,tinymce.dom.TreeWalker,!0),b=function(){return!1};/iPad|iPod|iPhone/.test(navigator.userAgent);if(t.addButton("button_fasc_insert_button",{title:"Insert Button",icon:"fascbutton-ico",onclick:function(){t.execCommand("popup_insert_fasc_button",0,0)}}),t.addCommand("popup_insert_fasc_button",function(e,n){var o=!1;t.dom.hasClass(t.selection.getNode(),"fasc-button")&&(o=!0);var a=t.selection.getContent({format:"text"});d(t,t.selection.getNode(),o,{},a)}),"undefined"==typeof wp||!wp.mce)return{getView:b};t.on("SetContent",function(){i()}),t.on("init",function(){t.on("dblClick",function(e){if(t.dom.hasClass(e.target,"fasc-button"))return e.preventDefault(),d(t,e.target,!0),!1},!0),t.addCommand("popup_insert_fasc_button",function(e,n){var o=!1;t.dom.hasClass(t.selection.getNode(),"fasc-button")&&(o=!0);var a=t.selection.getContent({format:"text"});d(t,t.selection.getNode(),o,{},a)});var e=!1;t.selection,window.MutationObserver||window.WebKitMutationObserver;t.dom.bind(t.getDoc(),"touchmove",function(){e=!0}),t.on("mousedown mouseup click touchend",function(n){p=!1,t.dom.hasClass(n.target,"fasc-button")?"touchend"===n.type&&e?e=!1:a(n.target):"touchend"!==n.type&&"mousedown"!==n.type||c(),"touchend"===n.type&&e&&(e=!1)},!0)}),t.on("PreProcess",function(t){},!0),t.on("hide",function(){c()}),t.on("PostProcess",function(e){e.content&&t.$("<div>"+e.content+"</div>").clone().find(".fasc-button").length>0&&(e.content=s(e.content))}),t.on("keydown",function(e){if(c(),32==e.keyCode&&t.dom.hasClass(t.selection.getNode(),"fasc-button")&&t.selection.getRng().startOffset==m(t.selection.getNode()).text().length){var n=tinymce.DOM.uniqueId(),o=t.dom.create("span",{id:n}," ");t.dom.insertAfter(o,t.selection.getNode());var a=t.dom.select("span#"+n);return t.selection.select(a[0]),t.selection.collapse(0),t.dom.setAttrib(n,"id",""),!1}}),t.on("focus",function(){f=!0,p=!1}),t.on("blur",function(){f=!1}),t.on("NodeChange",function(e){t.dom,t.dom.select(".fascview-wrap"),e.element.className;u=!1,clearInterval(void 0)}),t.on("BeforeExecCommand",function(){t.selection.getNode()}),t.on("ExecCommand",function(){}),t.on("ResolveName",function(t){}),t.on("PastePostProcess",function(){n()}),t.addButton("fasc_view_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",onclick:function(){r&&d(t,r,!0)}}),t.addButton("fasc_view_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",onclick:function(){r&&o(r)}}),t.once("preinit",function(){t.wp&&t.wp._createToolbar&&(l=t.wp._createToolbar(["fasc_view_edit","fasc_view_remove"]))}),t.on("wptoolbar",function(t){r&&(t.element=r,t.toolbar=l)}),t.wp=t.wp||{}}!function(t){"use strict";jQuery(document).on("tinymce-editor-setup",function(t,e){-1===e.settings.plugins.indexOf("fascbutton")&&(e.settings.toolbar1+=",button_fasc_insert_button",e.on("PreInit",function(t){e.dom.loadCSS(Fasc.plugin_url+"css/forget-about-shortcode-buttons-mce.css")}),Fasc.load_js&&addFascToEditor(e))})}(jQuery);
|
admin/js/forget-about-shortcode-buttons-editor.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){"use strict";function a(t){if(-1==t.search("rgb"))return t;function a(t){return("0"+parseInt(t).toString(16)).slice(-2)}return"#"+a((t=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/))[1])+a(t[2])+a(t[3])}wp.mce=wp.mce||{};var e={};e.button={content_id:"fasc-popup-edit-button",is_editing:!1,$node:{},init:function(t,a,e,i){this.$popup=a,this.$preview_area=a.find(".preview-button-area .centered-button"),this.is_editing=e,this.$node=jQuery(t),this.setupControls(a),this.setupIcons(t,a),this.setupTabs(a),this.is_editing?this.setSettingsFromNode(t,a,!0):this.initEmptyTemplate(t,a,i),this.updatePreview()},setupIcons:function(a,e){var i=this,c=(t(a),e.find('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"]'));c.find("#fasc-popup-icon-type-select").change(function(a){t(this).val();c.find(".ico-grid .grid-container").removeClass("ico-screen-active").hide(),c.find("#"+t(this).val()).addClass("ico-screen-active").show()}),c.find(".ico-grid div").click(function(a){a.preventDefault();var e=c.find(".fasc-ico-position:checked").val();return c.find(".ico-grid div").removeClass("active"),t(this).addClass("active"),"none"!=e&&""!=e||(e="before"),c.find(".fasc-ico-position").removeAttr("checked"),c.find(".fasc-ico-position").prop("checked",!1),c.find('.fasc-ico-position[value="'+e+'"]').prop("checked",!0),i.updatePreview(),!1}),c.find(".fasc-ico-position").change(function(a){if(c.find(".fasc-ico-position").removeAttr("checked"),c.find(".fasc-ico-position").prop("checked",!1),t(this).prop("checked",!0),"none"==t(this).val())c.find(".ico-grid div div:not(.clear)").removeClass("active");else if(c.find(".ico-grid div.active").length<1){c.find(".ico-grid .grid-container.ico-screen-active").length>0?t(c.find(".ico-grid .grid-container.ico-screen-active div:not(.clear)").get(0)).addClass("active"):t(c.find(".ico-grid .grid-container:first-child div:not(.clear)").get(0)).addClass("active")}i.updatePreview()}),t('.fasc-ajax-content select, .fasc-ajax-content input[type="checkbox"]').change(function(){i.updatePreview()}),t('.fasc-ajax-content input[type="text"]').keyup(function(){i.updatePreview()}),t('.fasc-ajax-content input[type="text"]').keyup(function(){i.updatePreview()}),t.get(Fasc.ajax_url+"?action=fasc_buttons&load=get_buttons",function(t){i.parseTemplateButtons(t)},"json"),t(".fasc-save-btn").click(function(){var a={};return a.button=i.createButtonHtml({isSaving:!0}),t.post(Fasc.ajax_url+"?action=fasc_buttons&load=save_button",a,function(t){i.parseTemplateButtons(t)},"json"),i.$tabs.find("li").removeClass("active"),i.$tabs.find("li[data-fasc-tab='3']").addClass("active"),i.loadTab(3,e),!1}),i.updatePreview()},parseTemplateButtons:function(a){var e=this,i=t(".saved-buttons-tab .container-grid ul");i.empty();var c="",o=0;t.each(a,function(e){c="";var n=t(a[e].html),s=n.css("background-color"),r=n.css("color");c+="<li data-index='"+o+"'>",c+='<div class="wrap">',c+='<div class="full_button">'+a[e].html+"</div>",c+='<div class="name"><span>'+a[e].name+'</span> <a class="dashicons dashicons-edit fasc-button-edit"></a><a class="fa fa-check fasc-button-update" data-action="update"></a><a class="dashicons dashicons-no-alt fasc-button-update" data-action="remove"></a></div>',c+='<div class="col fasc-button-remove dashicons dashicons-no-alt"></div>',c+='<div class="col" style="background-color:'+s+';"></div>',c+='<div class="col" style="background-color:'+r+';"></div>',c+='<div class="clear"></div>',c+="</div>",c+="</li>",i.append(c),o++});var n=function(a){var e=a.text(),i=t("<input>",{val:e,type:"text",width:"170px","data-orig-text":e});a.replaceWith(i),i.select()},s=function(a){var e=t("<span>",{text:a.attr("data-orig-text")});a.replaceWith(e),e.on("click",n)},r=function(a){var e=t("<span>",{text:a.val()});a.replaceWith(e),e.on("click",n)};t(".fasc-button-edit").click(function(){return t(this).hide(),t(this).parent().find(".fasc-button-update").show().css("display","inline-block"),n(t(this).parent().find("span")),!1}),t(".fasc-button-remove").click(function(a){a.preventDefault();var i=t(this).closest("li").attr("data-index");return t.get(Fasc.ajax_url+"?action=fasc_buttons&load=remove_button&index="+i,function(t){e.parseTemplateButtons(t)},"json"),!1}),t(".fasc-button-update").click(function(){var a=t(this);if(t(this).parent().find(".fasc-button-update").hide(),t(this).parent().find(".fasc-button-edit").show(),"remove"==a.attr("data-action"))s(t(this).parent().find("input"));else{var i=t(this).closest("li").attr("data-index"),c=encodeURIComponent(t(this).parent().find("input").val());t.get(Fasc.ajax_url+"?action=fasc_buttons&load=update_button&index="+i+"&name="+c,function(t){e.parseTemplateButtons(t)},"json"),r(t(this).parent().find("input"))}return!1});var p=t(".saved-buttons-tab .container-grid li .wrap");p.on("click",function(){p.removeClass("active"),t(this).addClass("active");var a=t(this).find(".full_button a.fasc-button");e.loadButtonTemplate(a,!0),e.updatePreview()})},loadButtonTemplate:function(e,i){var c=this,o=e.attr("target");jQuery(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!1),void 0!==o&&"_blank"==o&&jQuery(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!0);var n=e.attr("rel");if(jQuery(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!1),void 0!==n&&-1!==n.indexOf("nofollow")&&jQuery(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!0),void 0===i){var s=e.text();jQuery(".fasc-ajax-content input#fasc-popup-button-text").val(s)}var r=a(e.css("color"));jQuery("#fasc-popup-text-color").val(r),c.refreshMiniColors(jQuery("#fasc-popup-text-color"),r,c.$popup);var p=a(e.css("background-color"));jQuery("#fasc-popup-button-color").val(p),c.refreshMiniColors(jQuery("#fasc-popup-button-color"),p,c.$popup);var f=c.$popup.find('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"]');f.find(".ico-grid > div > div").removeClass("active");var d=e.attr("class").split(/\s+/);c.$popup.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active","0"),c.$popup.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active","0"),c.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active","0");for(var u=0;u<d.length;u++)if("fasc-type"==d[u].substring(0,9)){var l=d[u];(e.hasClass("fasc-rounded-medium")||e.hasClass("rounded"))&&(l+=" fasc-rounded-medium"),jQuery("#fasc-popup-button-type option").prop("selected",!1),jQuery('#fasc-popup-button-type option[value="'+l+'"]').prop("selected",!0),t("#fasc-popup-button-type").val(l)}else if("fasc-style"==d[u].substring(0,10))"fasc-style-bold"==d[u]?c.$popup.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active","1"):"fasc-style-italic"==d[u]?c.$popup.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active","1"):"fasc-style-strikethrough"==d[u]&&c.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active","1");else if("fasc-size"==d[u].substring(0,9)){var v=d[u];jQuery("#fasc-popup-button-size option").prop("selected",!1),jQuery('#fasc-popup-button-size option[value="'+v+'"]').prop("selected",!0),t("#button-size").val(v)}else if("dashicons"==d[u].substring(0,9)){f.find(".ico-grid .grid-container").removeClass("ico-screen-active"),f.find("#dashicons-grid").addClass("ico-screen-active"),c.$popup.find("#fasc-popup-icon-type-select").val("dashicons-grid"),c.$popup.find("#fasc-popup-icon-type-select").trigger("change");var h=d[u];c.$popup.find(".ico-grid ."+h).addClass("active")}else if("fa-"==d[u].substring(0,3)){f.find(".ico-grid .grid-container").removeClass("ico-screen-active");var b=f.find(".ico-grid").find("."+d[u]).parent().attr("id");f.find("#"+b).addClass("ico-screen-active"),c.$popup.find("#fasc-popup-icon-type-select").val(b),c.$popup.find("#fasc-popup-icon-type-select").trigger("change"),c.$popup.find(".ico-grid ."+d[u]).addClass("active")}e.hasClass("fasc-ico-before")||e.hasClass("fasc-ico-after")?e.hasClass("fasc-ico-before")?(f.find(".fasc-ico-position").prop("checked",!1),f.find('.fasc-ico-position[value="before"]').prop("checked",!0)):e.hasClass("fasc-ico-after")&&(f.find(".fasc-ico-position").prop("checked",!1),f.find('.fasc-ico-position[value="after"]').prop("checked",!0)):(f.find(".fasc-ico-position").prop("checked",!1),f.find('.fasc-ico-position[value="none"]').prop("checked",!0))},setupControls:function(a){var e=this;a.find('.fasc-ajax-content select, .fasc-ajax-content input[type="checkbox"]').change(function(){e.updatePreview()}),a.find('.fasc-ajax-content input[type="text"]').keyup(function(){e.updatePreview()}),a.find('.fasc-ajax-content input[type="text"]').keyup(function(){e.updatePreview()});var i=a.find("[data-fasc-action='popup-colorpicker']");i.click(function(e){var c=t(this),o=c.attr("data-fasc-button-active");i.attr("data-fasc-button-active","");var n=1-o;c.attr("data-fasc-button-active",n);var s=c.data("fasc-action-target"),r=a.find('[data-fasc-colorpicker-name="'+s+'"]'),p=a.find("[data-fasc-colorpicker-name]").not('[data-fasc-colorpicker-name="'+s+'"]'),f=c.position();p.stop(!0,!0).hide(),r.stop(!0,!0).fadeToggle(100),r.css("left",Math.round(f.left)+"px"),r.css("top",Math.round(f.top+c.parent().outerHeight())+"px")}),a.on("click",function(e){0==t(e.target).closest("[data-fasc-action='popup-colorpicker'], .fasc-popup-colorpicker-container").length&&(a.find("[data-fasc-colorpicker-name]").hide(),i.attr("data-fasc-button-active",""))}),a.find(".fasc-mce-button-toggle").on("click",function(){var a=t(this),i=1-a.attr("data-fasc-button-active");a.attr("data-fasc-button-active",i),e.updatePreview()}),e.updatePreview()},updatePreview:function(){this.$preview_area.html(this.createButtonHtml()),this.$preview_area.find(".fasc-button").off(),this.$preview_area.find(".fasc-button").click(function(t){t.preventDefault(),t.stopPropagation()})},createButtonHtml:function(a){var e={content:"",isSaving:!1,hasID:!1};t.extend(e,a);var i=jQuery(".fasc-ajax-content input#fasc-popup-button-url").val(),c=jQuery(".fasc-ajax-content input#fasc-popup-button-text").val(),o=jQuery(".fasc-ajax-content select#fasc-popup-button-size").val(),n=jQuery(".fasc-ajax-content input#fasc-popup-button-color").val(),s=jQuery(".fasc-ajax-content input#fasc-popup-text-color").val(),r=jQuery(".fasc-ajax-content select#fasc-popup-button-type").val(),p=(jQuery(".fasc-ajax-content select#fasc-popup-button-align").val(),jQuery(".fasc-ajax-content input#fasc-popup-new-window").prop("checked")),f=jQuery(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked"),d="",u="",l="",v="";1==p&&(l=' target="_blank"'),1==f&&(v=' rel="nofollow"'),r&&""!=r&&(d=" "+r),o&&""!=o&&(u=" "+o);var h=t(t('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"] .ico-grid div.active').get(0)),b=t('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"] .fasc-ico-position:checked').val(),g="";if(1==h.length){var m=h.attr("class").split(" "),k=0,x="dashicons";for(k=0;k<m.length;k++)"active"!=m[k]&&"fa"!=m[k]&&"dashicons"!=m[k]&&(g+=" "+m[k]),"fa"==m[k]&&(x="fontawesome");k>0&&("before"!=b&&"after"!=b||(g="fontawesome"==x?" ico-fa fasc-ico-"+b+g:" fasc-ico-"+b+g))}var y="";1==this.$popup.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active")&&(y+=" fasc-style-bold"),1==this.$popup.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active")&&(y+=" fasc-style-italic");var j=this.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active");1==j&&(y+=" fasc-style-strikethrough");this.$popup.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active");1==j&&(y+=" fasc-style-strikethrough");var w="";e.hasID&&(w=' data-fasc-id="fasc-button-tid-'+(new Date).getTime()+'"');return e.isSaving?'<a class="fasc-button'+u+d+g+y+'"'+l+v+' style="background-color:'+n+";color:"+s+';" data-fasc-style="background-color:'+n+";color:"+s+';"'+w+"></a>":'<a data-fasc-href="'+i+'" class="fasc-button'+u+d+g+y+'"'+l+v+' style="background-color:'+n+";color:"+s+';" data-fasc-style="background-color:'+n+";color:"+s+';"'+w+">"+c+"</a>"},setupTabs:function(a){var e=this;this.$tabs=a.find(".tab-header");var i=this.$tabs.find("li");this.$tabs.find("li a");i.click(function(){var c=t(this),o=c.attr("data-fasc-tab");return i.removeClass("active"),c.addClass("active"),e.loadTab(o,a),!1})},loadTab:function(a,e){e.find(".fasc-ajax-content .fasc-tab-content").hide(),e.find(".fasc-ajax-content .fasc-tab-content[data-fasc-tab="+a+"]").show(),this.loadTabContent(a),t(".ico-grid .grid-container div.active").length>0&&t(".ico-grid").scrollTop(t(".ico-grid .grid-container div.active").position().top-5)},loadTabContent:function(t,a){},refreshMiniColors:function(a,e,i){var c=this;jQuery(".preview-button-area .centered-button");a.is_text_input=!1,a.minicolors({inline:!0,opacity:!1,showSpeed:0,hideSpeed:0,textfield:!0,change:function(e,o){var n=a.val(),s=a.parent().parent().find(".fasc-popup-color-input");1==a.is_text_input?a.is_text_input=!1:s.val(n),s.off("input"),s.on("input",function(){var e=t(this).val();a.is_text_input=!0,a.minicolors("value",e)});var r=t("#fasc-popup-button-color").val(),p=t("#fasc-popup-text-color").val();i.find(".fasc-ico-fg .fg-panel").css("background-color",p),i.find(".fasc-ico-bg .bg-panel").css("background-color",r),c.updatePreview()}}),void 0!==e&&a.minicolors("value",e)},initEmptyTemplate:function(t,e,i){jQuery("#fasc-popup-button-text").val(i);var c=e.find(".preview-button-area .centered-button .fasc-button");this.refreshMiniColors(e.find("#fasc-popup-text-color"),a(c.css("color")),e),this.refreshMiniColors(e.find("#fasc-popup-button-color"),a(c.css("background-color")),e)},setSettingsFromNode:function(e,i,c){var o=t(e),n=o.attr("data-fasc-href");i.find(".fasc-ajax-content input#fasc-popup-button-url").val(n);var s=o.attr("target");i.find(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!1),void 0!==s&&"_blank"==s&&i.find(".fasc-ajax-content input#fasc-popup-new-window").prop("checked",!0);var r=o.attr("rel");i.find(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!1),void 0!==r&&-1!==r.indexOf("nofollow")&&i.find(".fasc-ajax-content input#fasc-popup-nofollow").prop("checked",!0);var p=o.text();i.find(".fasc-ajax-content input#fasc-popup-button-text").val(p);var f=a(o.css("color"));i.find("#fasc-popup-text-color").val(f),i.find(".fasc-ico-fg .fg-panel").css("background-color",f),this.refreshMiniColors(i.find("#fasc-popup-text-color"),f,i);var d=a(o.css("background-color"));i.find("#fasc-popup-button-color").val(d),i.find(".fasc-ico-bg .bg-panel").css("background-color",d),this.refreshMiniColors(i.find("#fasc-popup-button-color"),d,i);var u=i.find('.fasc-ajax-content .fasc-tab-content[data-fasc-tab="2"]'),l=o.attr("class").split(/\s+/);u.find(".ico-grid > div > div").removeClass("active");for(var v=0;v<l.length;v++)if("fasc-type"==l[v].substring(0,9)){var h=l[v];(o.hasClass("fasc-rounded-medium")||o.hasClass("rounded"))&&(h+=" fasc-rounded-medium"),i.find("#fasc-popup-button-type option").prop("selected",!1),i.find('#fasc-popup-button-type option[value="'+h+'"]').prop("selected",!0),i.find("#fasc-popup-button-type").val(h)}else if("fasc-style"==l[v].substring(0,10))"fasc-style-bold"==l[v]?i.find(".fasc-mce-button[data-fasc-action='bold']").attr("data-fasc-button-active","1"):"fasc-style-italic"==l[v]?i.find(".fasc-mce-button[data-fasc-action='italic']").attr("data-fasc-button-active","1"):"fasc-style-strikethrough"==l[v]&&i.find(".fasc-mce-button[data-fasc-action='strikethrough']").attr("data-fasc-button-active","1");else if("fasc-size"==l[v].substring(0,9)){var b=l[v];i.find("#fasc-popup-button-size option").prop("selected",!1),i.find('#fasc-popup-button-size option[value="'+b+'"]').prop("selected",!0),i.find("#fasc-popup-button-size").val(b)}else if("dashicons"==l[v].substring(0,9)){u.find(".ico-grid .grid-container").removeClass("ico-screen-active"),u.find("#dashicons-grid").addClass("ico-screen-active"),i.find("#fasc-popup-icon-type-select").val("dashicons-grid"),i.find("#fasc-popup-icon-type-select").trigger("change");var g=l[v];i.find(".ico-grid ."+g).addClass("active")}else if("fa-"==l[v].substring(0,3)){u.find(".ico-grid .grid-container").removeClass("ico-screen-active");var m=u.find(".ico-grid").find("."+l[v]).parent().attr("id");u.find("#"+m).addClass("ico-screen-active"),i.find("#fasc-popup-icon-type-select").val(m),i.find("#fasc-popup-icon-type-select").trigger("change"),i.find(".ico-grid ."+l[v]).addClass("active")}o.hasClass("fasc-ico-before")||o.hasClass("fasc-ico-after")?o.hasClass("fasc-ico-before")?(u.find(".fasc-ico-position").prop("checked",!1),u.find('.fasc-ico-position[value="before"]').prop("checked",!0)):o.hasClass("fasc-ico-after")&&(u.find(".fasc-ico-position").prop("checked",!1),u.find('.fasc-ico-position[value="after"]').prop("checked",!0)):(u.find(".fasc-ico-position").prop("checked",!1),u.find('.fasc-ico-position[value="none"]').prop("checked",!0))}},wp.mce.fascpopup={open:function(a,i,c,o,n){this.type=i,this.templateID=i,this.is_editing=o;var s=e[i].content_id,r=jQuery("<div/>",{class:"fasc-thickbox-overlay"}).appendTo("body"),p=t("#fasc-popup-template").clone();p.removeAttr("id"),p.addClass(s);var f=t("#"+s),d=f.clone();f.remove();var u=p.find(".fasc-thickbox-content"),l=p.find(".fasc-thickbox-title-inner"),v=p.find(".fasc-thickbox-action-right");this.initTemplate(p,d,u,l,v),p.insertAfter(r),e[i].init(a,p,this.is_editing,n),p.show(),this.initEvents(a,p,v,u,d,c)},initTemplate:function(t,a,e,i,c){e.html(a.html());var o=a.attr("data-fasc-title"),n=a.attr("data-fasc-submit-label"),s=a.attr("data-fasc-width"),r=a.attr("data-fasc-height");i.text(o),c.text(n),t.css("max-width",s),t.css("max-height",r)},initEvents:function(a,i,c,o,n,s){var r=this;i.find("label").click(function(){}),i.find(".fasc-close-ajax-window").click(function(){r.removePopup(i,n)}),t(".fasc-thickbox-overlay").on("click",function(t){r.removePopup(i,n)}),c.click(function(t){t.preventDefault(),t.stopImmediatePropagation();var a=e[r.type].createButtonHtml({isSaving:!1,hasID:!0}),c=jQuery(a).attr("data-fasc-id");return s(a,c),r.removePopup(i,n),!1});var p=n.attr("data-fasc-width"),f=n.attr("data-fasc-height");t(window).resize(_.debounce(function(){r.centerPopup(i)},100)),r.centerPopup(i,p,f)},removePopup:function(a,i){var c=this;t(".fasc-thickbox-overlay").remove(),a.remove(),t("body").append(i),i.attr("id",e[c.type].content_id)},centerPopup:function(a,e,i){var c=a.find(".fasc-thickbox-header"),o=a.find(".fasc-thickbox-footer"),n=a.find(".fasc-thickbox-content"),s=(t(window),-a.height()/2),r=-a.width()/2;a.css("position","fixed").css({"margin-left":r+"px","margin-top":s+"px",left:"50%",top:"50%"}),n.hide();var p=a.outerHeight();p-=c.outerHeight(),p-=o.outerHeight(),n.height(p),n.show()}}}(jQuery);
|
forget-about-shortcode-buttons.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: Forget About Shortcode Buttons
|
17 |
* Plugin URI: http://www.designsandcode.com/wordpress-plugins/forget-about-shortcode-buttons-plugin/
|
18 |
* Description: A visual way to add CSS buttons in the rich text editor and to your themes.
|
19 |
-
* Version: 2.1.
|
20 |
* Author: Designs & Code
|
21 |
* Author URI: http://designsandcode.com
|
22 |
* License: GPL-2.0+
|
16 |
* Plugin Name: Forget About Shortcode Buttons
|
17 |
* Plugin URI: http://www.designsandcode.com/wordpress-plugins/forget-about-shortcode-buttons-plugin/
|
18 |
* Description: A visual way to add CSS buttons in the rich text editor and to your themes.
|
19 |
+
* Version: 2.1.2
|
20 |
* Author: Designs & Code
|
21 |
* Author URI: http://designsandcode.com
|
22 |
* License: GPL-2.0+
|
includes/class-forget-about-shortcode-buttons.php
CHANGED
@@ -69,7 +69,7 @@ class Forget_About_Shortcode_Buttons {
|
|
69 |
public function __construct() {
|
70 |
|
71 |
$this->plugin_name = 'forget-about-shortcode-buttons';
|
72 |
-
$this->version = '2.1.
|
73 |
|
74 |
$this->load_dependencies();
|
75 |
$this->set_locale();
|
@@ -152,12 +152,20 @@ class Forget_About_Shortcode_Buttons {
|
|
152 |
|
153 |
$plugin_admin = new Forget_About_Shortcode_Buttons_Admin( $this->get_plugin_name(), $this->get_version() );
|
154 |
|
155 |
-
|
156 |
-
|
|
|
|
|
157 |
$this->loader->add_action( 'admin_footer', $plugin_admin, 'admin_footer', 100 );
|
158 |
-
$this->loader->add_action( 'admin_init', $plugin_admin, 'mce_add_editor_style', 100 );
|
159 |
|
|
|
|
|
|
|
160 |
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
|
163 |
/**
|
69 |
public function __construct() {
|
70 |
|
71 |
$this->plugin_name = 'forget-about-shortcode-buttons';
|
72 |
+
$this->version = '2.1.2';
|
73 |
|
74 |
$this->load_dependencies();
|
75 |
$this->set_locale();
|
152 |
|
153 |
$plugin_admin = new Forget_About_Shortcode_Buttons_Admin( $this->get_plugin_name(), $this->get_version() );
|
154 |
|
155 |
+
//$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
|
156 |
+
|
157 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts_editor_styles', 1000 );
|
158 |
+
$this->loader->add_action( 'admin_footer', $plugin_admin, 'enqueue_scripts', 1000 );
|
159 |
$this->loader->add_action( 'admin_footer', $plugin_admin, 'admin_footer', 100 );
|
|
|
160 |
|
161 |
+
//customiser
|
162 |
+
//$this->loader->add_action( 'customize_controls_print_footer_scripts', $plugin_admin, 'enqueue_scripts', 1000 );
|
163 |
+
//$this->loader->add_action( 'customize_controls_print_footer_scripts', $plugin_admin, 'admin_footer', 1000 );
|
164 |
|
165 |
+
//styles
|
166 |
+
//$this->loader->add_action( 'customize_controls_print_footer_scripts', $plugin_admin, 'enqueue_styles', 1000 );
|
167 |
+
|
168 |
+
$this->loader->add_action( 'admin_init', $plugin_admin, 'mce_add_editor_style', 100 );
|
169 |
}
|
170 |
|
171 |
/**
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: DesignsAndCode
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZAHPNUHNUBQJY&lc=GB&item_name=Ross%20Morsali&item_number=wordpress%2dplugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
|
4 |
Tags: css, button, shortcode, edit, visual editor, buttons, wysiwyg, post editor, tinymce, shortcodes, button editor, wysiwyg
|
5 |
Requires at least: 4.2
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -31,6 +31,10 @@ Ask me some questions!
|
|
31 |
|
32 |
== Changelog ==
|
33 |
|
|
|
|
|
|
|
|
|
34 |
= 2.1.1 =
|
35 |
* Fix - various issues with loading & the TinyMCE Editor
|
36 |
|
@@ -105,8 +109,6 @@ FASC Buttons tries to be as clean as possible with the html, only using data att
|
|
105 |
|
106 |
* New - add FASC buttons to widgets in WP 4.8 :)
|
107 |
|
108 |
-
* New - works with Visual Composer!
|
109 |
-
|
110 |
* Editing a button couldn't be easier - just double click a button and an options panel appears allowing you to completely reconfigure the current button - beats tedious shortcodes and using precise syntax!
|
111 |
|
112 |
* Utilises the latest CSS properties for styling
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZAHPNUHNUBQJY&lc=GB&item_name=Ross%20Morsali&item_number=wordpress%2dplugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
|
4 |
Tags: css, button, shortcode, edit, visual editor, buttons, wysiwyg, post editor, tinymce, shortcodes, button editor, wysiwyg
|
5 |
Requires at least: 4.2
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 2.1.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
31 |
|
32 |
== Changelog ==
|
33 |
|
34 |
+
= 2.1.2 =
|
35 |
+
* Fix - JS issues when no TinyMCE instance is loaded on the page
|
36 |
+
* Fix - better conditional loading of CSS and JS
|
37 |
+
|
38 |
= 2.1.1 =
|
39 |
* Fix - various issues with loading & the TinyMCE Editor
|
40 |
|
109 |
|
110 |
* New - add FASC buttons to widgets in WP 4.8 :)
|
111 |
|
|
|
|
|
112 |
* Editing a button couldn't be easier - just double click a button and an options panel appears allowing you to completely reconfigure the current button - beats tedious shortcodes and using precise syntax!
|
113 |
|
114 |
* Utilises the latest CSS properties for styling
|