Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 34 additions & 70 deletions nextgen-tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Plugin Name: NextGen TinyMCE Picture Description
Plugin URI: http://marbu.org/wordpress-plugin-tinymce-in-nextgen/
Description: add TinyCME to NextGEN gallery picture description
Author: Marco Buttarini & Giorgio Martello & Andrea Brugnolo
Version: 1.4
Author: Marco Buttarini & Giorgio Martello & Andrea Brugnolo & Berend Dekens
Version: 1.5
Author URI: http://marbu.org
*/

Expand All @@ -18,84 +18,48 @@
function load_nextgen_tinymce(){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
var newnextgen = false;
var elements=[];

jQuery(document).ready(function(){
var newnextgen = false;
var elements=[];

jQuery('textarea').filter(function() {

if(jQuery(this).attr('name').match(/\[[0-9]{1,}\]+\[description\]/))
{
newnextgen = true;
return jQuery(this).attr('name').match(/\[[0-9]{1,}\]+\[description\]/)
}
else
{
newnextgen = false;
return jQuery(this).attr('name').match(/description\[[0-9]{1,}\]+/)
}

}).each(function(k){

if(newnextgen = false)
{
var elem_id = 'description-'+jQuery(this).parent().parent().attr('id');
} else {
var elem_id = 'description-'+jQuery(this).parent().parent().find('.column-2').text();
}

jQuery(this).attr('id', elem_id );
elements.push(elem_id);
});



tinyMCE.init({
mode : "exact",
elements: elements.join(','),
width:"100%",
height:"200",
theme:"advanced",
skin:"default",
language: tinyMCE.settings.language, // get setting from WP tinymce
plugins : "fullscreen,inlinepopups,spellchecker",
theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,link,unlink",
theme_advanced_buttons2 : "bullist,numlist,justifyleft,justifycenter,justifyright,undo,redo,fullscreen",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true

});

jQuery('textarea').filter(function() {
if(jQuery(this).attr('name').match(/\[[0-9]{1,}\]+\[description\]/)) {
newnextgen = true;
return jQuery(this).attr('name').match(/\[[0-9]{1,}\]+\[description\]/)
} else {
newnextgen = false;
return jQuery(this).attr('name').match(/description\[[0-9]{1,}\]+/)
}
}).each(function(k){
if(newnextgen = false) {
var elem_id = 'description-'+jQuery(this).parent().parent().attr('id');
} else {
var elem_id = 'description-'+jQuery(this).parent().parent().find('.column-2').text();
}

jQuery(this).attr('class', 'nextgen_description');
});

tinymce.init({
selector: 'textarea.nextgen_description',
width:"100%",
height:"200",
browser_spellcheck: true,
toolbar:'undo redo | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | nonbreaking | link unlink',
menubar: false
});
});
</script>
<?php
}

/**
* load tinymce javascript files
*
* thanks to http://stackoverflow.com/users/148174/marty
* http://stackoverflow.com/questions/2855890/add-tinymce-to-wordpress-plugin
* Load TinyMCE, without using wp_editor() as we don't want to actualy print the editor here
*
* http://wordpress.stackexchange.com/a/219800
*/
function load_tiny_mce_editor() {
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
wp_print_scripts('editor');
if (function_exists('add_thickbox')) add_thickbox();
wp_print_scripts('media-upload');
if (function_exists('wp_tiny_mce')) wp_tiny_mce();
wp_admin_css();
wp_enqueue_script('utils');
do_action("admin_print_styles-post-php");
do_action('admin_print_styles');
wp_enqueue_script( 'tinymce_js', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array( 'jquery' ), false, true );
}



}
8 changes: 5 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: Marco Buttarini
Donate link: http://marbu.org/marbu/donate/
Tags: nextgen, tinymce, wysiwyg, admin,pictures,nextgen-gallery,nextgen gallery
Requires at least: 2.8
Tested up to: 3.7
Tested up to: 4.7.2
Stable tag: 1.4

NextGEN TinyMce Description add native tinymce to nextgen gallery picture description.
Expand All @@ -13,7 +13,7 @@ NextGEN TinyMce Description add native tinymce to nextgen gallery picture descri
NextGEN TinyMce Description simply integrate tinymce wysiwyg to the description of the picture in a NextGEN gallery.

== Credits ==
Developed with the help of Andrea Brugnolo & Giorgio Martello
Developed with the help of Andrea Brugnolo & Giorgio Martello & Berend Dekens

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -44,14 +44,16 @@ That's it ... Have fun

= It was broken for a long time, is it working now? =

Thanks to Giorgio Martello now is working!
Thanks to Berend Dekens now is working!

== Screenshots ==

1. Screenshot TinyMCE in Gallery

== Changelog ==

= 1.5 =
* Rewrote to be compatible with WordPress 4.7+

= 1.4 =
* Fixed problems with new nextgen version
Expand Down