From 234b795f89657c6b25da6101a9fc878e3297c301 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Fri, 31 Aug 2018 09:02:17 +1200 Subject: [PATCH] BUG Use classes for TinyMCE alignment buttons --- src/Forms/HTMLEditor/TinyMCEConfig.php | 42 ++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/Forms/HTMLEditor/TinyMCEConfig.php b/src/Forms/HTMLEditor/TinyMCEConfig.php index c1d7d95a7..1a93241f8 100644 --- a/src/Forms/HTMLEditor/TinyMCEConfig.php +++ b/src/Forms/HTMLEditor/TinyMCEConfig.php @@ -216,8 +216,46 @@ class TinyMCEConfig extends HTMLEditorConfig * * @var array */ - protected $settings = array( + protected $settings = [ 'fix_list_elements' => true, // https://www.tinymce.com/docs/configure/content-filtering/#fix_list_elements + 'formats' => [ + 'alignleft' => [ + [ + 'selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,li', + 'classes' =>'text-left' + ], + [ + 'selector' => 'div,ul,ol,table,img,figure', + 'classes' =>'left' + ] + ], + 'aligncenter' => [ + [ + 'selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,li', + 'classes' =>'text-center' + ], + [ + 'selector' => 'div,ul,ol,table,img,figure', + 'classes' =>'center' + ] + ], + 'alignright' => [ + [ + 'selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,li', + 'classes' =>'text-right' + ], + [ + 'selector' => 'div,ul,ol,table,img,figure', + 'classes' =>'right' + ] + ], + 'alignjustify' => [ + [ + 'selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,li', + 'classes' =>'text-justify' + ], + ], + ], 'friendly_name' => '(Please set a friendly name for this config)', 'priority' => 0, // used for Per-member config override 'browser_spellcheck' => true, @@ -230,7 +268,7 @@ class TinyMCEConfig extends HTMLEditorConfig 'menubar' => false, 'language' => 'en', 'branding' => false, - ); + ]; /** * Holder list of enabled plugins