Skip to content

Commit

Permalink
fix tinymce popups
Browse files Browse the repository at this point in the history
  • Loading branch information
pryley committed Sep 14, 2018
1 parent 3056a30 commit c33bca8
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 4 deletions.
3 changes: 2 additions & 1 deletion +/scripts/admin/shortcode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** global: editor, GLSR, jQuery, tinymce */
/** global: editor, GLSR, jQuery, tinymce, tinyMCEPreInit */
;(function( $ ) {

'use strict';
Expand Down Expand Up @@ -50,6 +50,7 @@
$( 'body' ).append( '<textarea id="scTemp" style="display:none!important;"/>' );
tinymce.init({
elements: 'scTemp',
external_plugins: GLSR.tinymce,
mode: 'exact',
plugins: ['glsr_shortcode', 'wplink'],
});
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.*
!.gitattributes
!.gitignore
!.jshintrc
!.scrutinizer.yml
!.travis.yml
*.log
Expand Down
49 changes: 49 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
// Define globals exposed by modern browsers.
"browser": true,
// Define globals exposed by jQuery.
"jquery": true,
// Define globals exposed by Node.js.
"node": true,
// Allow ES6.
"esversion": 6,
// Force all variable names to use either camelCase style or UPPER_CASE with underscores.
// "camelcase": true,
// Prohibit use of == and != in favor of === and !==.
"eqeqeq": true,
// Enforce tab width of 4 spaces.
"indent": 4,
// Prohibit use of a variable before it is defined.
"latedef": true,
// Enforce line length to 100 characters
// "maxlen": 120,
// Require capitalized names for constructor functions.
"newcap": true,
// Enforce use of single quotation marks for strings.
"quotmark": "single",
// Enforce placing 'use strict' at the top function scope
"strict": false,
// Prohibit use of explicitly undeclared variables.
"undef": true,
// Warn when variables are defined but never used.
"unused": true,
// Suppress warnings about == null comparisons.
// "eqnull": true,
"devel": true,
// Define globals used for debugging: console, alert, etc.
"globals": {
"_": false,
"ActiveXObject": false,
"ajaxurl": false,
"CustomEvent": false,
"GLSR": true,
"grecaptcha": false,
"HTMLFormElement": false,
"StarRating": false,
"tinymce": false,
"tinyMCEPreInit": false,
"wp": false,
"x": false,
"XMLHttpRequest": false
}
}
2 changes: 1 addition & 1 deletion assets/scripts/site-reviews-admin.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions plugin/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public function filterDashboardGlanceItems( array $items )
*/
public function filterTinymcePlugins( array $plugins )
{
if( user_can_richedit()
&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) {
$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
}
return $plugins;
Expand Down
3 changes: 3 additions & 0 deletions plugin/Handlers/EnqueueAdminAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public function localizeAssets()
],
'pointers' => $this->pointers,
'shortcodes' => [],
'tinymce' => [
'glsr_shortcode' => glsr()->url( 'assets/scripts/mce-plugin.js' ),
],
];
if( user_can_richedit() ) {
$variables['shortcodes'] = $this->localizeShortcodes();
Expand Down

0 comments on commit c33bca8

Please sign in to comment.