From 1d9b5fb4cc05397ae9e79b4236b55c9841362dd4 Mon Sep 17 00:00:00 2001 From: EkoJr Date: Mon, 1 May 2017 08:47:36 -0700 Subject: [PATCH 1/3] Added MCE Button Styling #24 --- classes/admin.php | 6 ++++-- inc/js/shortcode.js | 2 +- inc/styles/shortcode.css | 27 ++++++++++++++++++++++++++- inc/templates/shortcode.php | 14 ++++++++------ 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/classes/admin.php b/classes/admin.php index cf7b59b..865c54d 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -16,11 +16,11 @@ public function __construct() { add_action( 'admin_notices', array( $this, 'admin_notices' ) ); // Add a button to the TinyMCE console - add_action( 'admin_head', array( &$this, 'register_shortcode_button' ) ); + add_action( 'edit_form_after_title', array( &$this, 'register_shortcode_button' ) ); } /** - * This method adds a button that helps the user insert a shortcode intstead of having to memorize it + * This method adds a button that helps the user insert a shortcode instead of having to memorize it * * @since 2.5.1 */ @@ -40,6 +40,7 @@ function register_shortcode_button() { wp_enqueue_style( 'jquery-chosen', SIMPLEMAP_URL . '/inc/styles/chosen.min.css' ); wp_enqueue_style( 'simplemap-admin-shortcode', SIMPLEMAP_URL . '/inc/styles/shortcode.css', array( 'jquery-chosen' ) ); + wp_enqueue_style( 'simplemap-awesome-font', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' ); add_filter( 'mce_external_plugins', array( &$this, 'mce_external_plugins' ) ); add_filter( 'mce_buttons', array( &$this, 'mce_buttons' ) ); @@ -54,6 +55,7 @@ function register_shortcode_button() { 'title_window' => __( 'Add a SimpleMap', 'SimpleMap' ), 'title_insert_button' => __( 'Insert SimpleMap', 'SimpleMap' ), 'title_cancel_button' => __( 'Cancel', 'SimpleMap' ), + 'mce_icon_classes' => __( 'simplemap fa fa-map', 'SimpleMap' ), ), 'html' => esc_js($html), ); diff --git a/inc/js/shortcode.js b/inc/js/shortcode.js index d92176e..afeb6ff 100644 --- a/inc/js/shortcode.js +++ b/inc/js/shortcode.js @@ -4,7 +4,7 @@ (function ($) { tinymce.PluginManager.add('simplemap_button', function(editor, url) { editor.addButton('simplemap_button', { - icon : 'simplemap', + icon : simple_map_js_array.i10n['mce_icon_classes'], tooltip : simple_map_js_array.i10n['title_button'], onclick : function (e) { editor.windowManager.open( { diff --git a/inc/styles/shortcode.css b/inc/styles/shortcode.css index a560181..a9493bc 100644 --- a/inc/styles/shortcode.css +++ b/inc/styles/shortcode.css @@ -1,3 +1,28 @@ i.mce-i-simplemap:before { - content: "\f231"; + content: "\f279"; +} + +.sm-mce-shortcode { + width: 94%; + margin: 2% 3%; +} + +.sm-mce-shortcode fieldset { + margin-bottom: 9px; +} + +.sm-mce-shortcode fieldset > *:first-child { + float: left; + display: block; + width: 25%; +} + +.sm-mce-shortcode fieldset > div { + float: left; + width: 75%; +} + +.sm-mce-shortcode fieldset > div > label { + float: left; + width: 25%; } \ No newline at end of file diff --git a/inc/templates/shortcode.php b/inc/templates/shortcode.php index 2c9ba80..22a7668 100644 --- a/inc/templates/shortcode.php +++ b/inc/templates/shortcode.php @@ -3,7 +3,7 @@ $tags = get_terms( array( 'taxonomy' => 'sm-tag', 'hide_empty' => false, 'fields' => 'id=>name' ) ); ?> -
+
@@ -57,11 +57,13 @@
-
- - - - +
+
+ +
+ + +
\ No newline at end of file From 8e60c9d15a5edacbc4b39e569b9eb84587688d1d Mon Sep 17 00:00:00 2001 From: EkoJr Date: Thu, 4 May 2017 22:40:59 -0700 Subject: [PATCH 2/3] Changed Button Icon to SM Icon --- classes/admin.php | 1 - inc/js/shortcode.js | 2 +- inc/styles/shortcode.css | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/classes/admin.php b/classes/admin.php index 865c54d..9e261e9 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -55,7 +55,6 @@ function register_shortcode_button() { 'title_window' => __( 'Add a SimpleMap', 'SimpleMap' ), 'title_insert_button' => __( 'Insert SimpleMap', 'SimpleMap' ), 'title_cancel_button' => __( 'Cancel', 'SimpleMap' ), - 'mce_icon_classes' => __( 'simplemap fa fa-map', 'SimpleMap' ), ), 'html' => esc_js($html), ); diff --git a/inc/js/shortcode.js b/inc/js/shortcode.js index afeb6ff..3dbbfa7 100644 --- a/inc/js/shortcode.js +++ b/inc/js/shortcode.js @@ -4,7 +4,7 @@ (function ($) { tinymce.PluginManager.add('simplemap_button', function(editor, url) { editor.addButton('simplemap_button', { - icon : simple_map_js_array.i10n['mce_icon_classes'], + icon : 'simplemap dashicons-before dashicons-location-alt', tooltip : simple_map_js_array.i10n['title_button'], onclick : function (e) { editor.windowManager.open( { diff --git a/inc/styles/shortcode.css b/inc/styles/shortcode.css index a9493bc..e67f893 100644 --- a/inc/styles/shortcode.css +++ b/inc/styles/shortcode.css @@ -1,28 +1,28 @@ i.mce-i-simplemap:before { - content: "\f279"; + content: "\f231"; } .sm-mce-shortcode { - width: 94%; - margin: 2% 3%; + width: 94%; + margin: 2% 3%; } .sm-mce-shortcode fieldset { - margin-bottom: 9px; + margin-bottom: 9px; } .sm-mce-shortcode fieldset > *:first-child { - float: left; - display: block; - width: 25%; + float: left; + display: block; + width: 25%; } .sm-mce-shortcode fieldset > div { - float: left; - width: 75%; + float: left; + width: 75%; } .sm-mce-shortcode fieldset > div > label { - float: left; - width: 25%; + float: left; + width: 25%; } \ No newline at end of file From 779ef7202219fe4815bd9c798ac18a007eae8012 Mon Sep 17 00:00:00 2001 From: EkoJr Date: Fri, 5 May 2017 23:26:34 -0700 Subject: [PATCH 3/3] Removed Awesome Font from Enqueue Style --- classes/admin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/classes/admin.php b/classes/admin.php index 9e261e9..b1295a1 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -40,7 +40,6 @@ function register_shortcode_button() { wp_enqueue_style( 'jquery-chosen', SIMPLEMAP_URL . '/inc/styles/chosen.min.css' ); wp_enqueue_style( 'simplemap-admin-shortcode', SIMPLEMAP_URL . '/inc/styles/shortcode.css', array( 'jquery-chosen' ) ); - wp_enqueue_style( 'simplemap-awesome-font', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' ); add_filter( 'mce_external_plugins', array( &$this, 'mce_external_plugins' ) ); add_filter( 'mce_buttons', array( &$this, 'mce_buttons' ) );