Skip to content

Commit 50d6610

Browse files
authored
fix: mce external plugins not loading (#1437)
1 parent 0464130 commit 50d6610

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

library/Admin/TinyMce/PluginClass.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,35 @@ public function __construct()
4343
* Check if the current user can edit Posts or Pages, and is using the Visual Editor
4444
* If so, add some filters so we can register our plugin
4545
*/
46-
public function setupTinymcePlugin()
46+
public function setupTinyMcePlugin()
4747
{
4848
if (! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
4949
return;
5050
}
51-
51+
5252
// Check if the logged in WordPress User has the Visual Editor enabled
5353
// If not, don't register our TinyMCE plugin
5454
if (get_user_option('rich_editing') !== 'true') {
5555
return;
5656
}
57-
57+
5858
$this->init();
59-
60-
if (!$this->pluginSlug || !$this->pluginSlug) {
59+
60+
if (!$this->pluginSlug) {
6161
return;
6262
}
63-
63+
6464
//Change button row placement if buttonRow is defined
6565
if (isset($this->buttonRow) && is_numeric($this->buttonRow) && $this->buttonRow > 1) {
6666
$this->buttonFilter .= '_' . $this->buttonRow;
6767
}
68-
68+
6969
//LocalizeData (if any)
7070
if (is_array($this->data) && !empty($this->data)) {
7171
add_action('admin_head', array($this, 'localizeScript'));
7272
}
7373

74-
add_filter('mce_external_plugins', array($this, 'addTinyMcePlugin'));
74+
add_filter('mce_external_plugins', array($this, 'addTinyMcePlugin'), 20, 1);
7575
add_filter($this->buttonFilter, array($this, 'addTinymceToolbarButton' ));
7676
}
7777

@@ -84,7 +84,7 @@ public function setupTinymcePlugin()
8484
public function addTinyMcePlugin($plugins)
8585
{
8686
$plugins[$this->pluginSlug] = get_template_directory_uri() . '/assets/dist/' .
87-
\Municipio\Helper\CacheBust::name('js/mce.js');
87+
\Municipio\Helper\CacheBust::name('js/mce-buttons.js');
8888

8989
return $plugins;
9090
}
@@ -98,13 +98,14 @@ public function addTinyMcePlugin($plugins)
9898
*/
9999
public function addTinymceToolbarButton($buttons)
100100
{
101-
array_push($buttons, '', $this->pluginSlug);
101+
array_push($buttons, $this->pluginSlug);
102+
102103
return $buttons;
103104
}
104105

105106
public function localizeScript()
106107
{
107-
$output = '<script type="text/javascript" atr="lol">';
108+
$output = '<script type="text/javascript">';
108109
$output .= 'var ' . $this->pluginSlug . ' = {';
109110

110111
foreach ($this->data as $key => $value) {

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
'css/municipio': './assets/source/3.0/sass/main.scss',
1717
'js/municipio': './assets/source/3.0/js/municipio.js',
1818
'js/instantpage': './node_modules/instant.page/instantpage.js',
19-
'js/mce': './assets/source/3.0/mce-js/mce-buttons.js',
19+
'js/mce-buttons': './assets/source/3.0/mce-js/mce-buttons.js',
2020
'js/mce-table': './assets/source/3.0/mce-js/mce-table.js',
2121
'css/mce': './assets/source/3.0/sass/mce.scss',
2222
'css/blockeditor': './assets/source/3.0/sass/blockeditor.scss',

0 commit comments

Comments
 (0)