Closed (outdated)
Project:
TinyMCE
Version:
master
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Jun 2005 at 03:28 UTC
Updated:
14 Jan 2021 at 19:34 UTC
Jump to comment: Most recent
I may be putting this in the totally wrong place, but I think it should go somewhere.
I have made a patch for tinyMCE to use the included advimage plugin instead of the the drupalimage plugin/img_assist.
It creates a new image list that is used instead of img_assist.
In tinymce.module make these changes
Add into tinymce_menu around line 19
$items[] = array('path' => 'tinymce_advimg', 'title' => t('tinymce Advanced Image List'), 'callback' => 'tinymce_advimg_list', 'access' => user_access('access content'), 'type' => MENU_CALLBACK);
Then add this function to the end of the file
function tinymce_advimg_list() {
$result = db_query("SELECT n.nid, n.title FROM {node} n WHERE n.type='image' ORDER BY n.title ASC");
$content = "var tinyMCEImageList = new Array(\n";
$aContent = array();
while ($node = db_fetch_object($result)) {
$aContent[]= " [\"".$node->title."\", \"?q=image/view/".$node->nid."\"]";
}
$content .= implode(",\n",$aContent).");";
echo $content;
}
Also the phptemplate/template.php needs the configuration set in the phptemplate_tinymce_theme. Here is mine.
switch ($theme_name) {
case 'advanced':
$init['extended_valid_elements'] = 'a[href|target|name|title|onclick]';
$init['theme_advanced_buttons3_add_before'] = 'tablecontrols,separator';
$init['plugins'] = 'table,emotions,print,advimage';
$init['external_image_list_url'] = "?q=tinymce_advimg";
break;
}
You may need to clear your cache in order to get the new file to register.
If someone with CVS access wants to make this a patch that would be fine with me.
Comments
Comment #1
matt westgate commentedWhat's the advantage of using this plugin over the other one?
Does the advimage plugin ship with TinyMCE?
Comment #2
code rader commentedYes, advimage does come with the tinyMCE download. The big advantage I needed it for was I was getting the warning in MSIE that the window had lost communication with the parent. Then it no longer worked. I think it also makes a simpler integration without having to rely on img_assist.
Comment #3
matt westgate commentedI'd like to get some feedback from others about this as well.
Folks, does it meet your needs better than the img_assist integration?
Comment #4
RobRoy commentedI tried this and advimage doesn't have any upload functionality. That is the big part of img_assist that I need.
Comment #5
code rader commentedI suppose you could still use img_assist for image uploading. I am using just image for that part. I don't think this would keep you from using img_assist, it would just use adimage for the image insert in the editor itself.
Comment #6
bomarmonk commentedYes, I'm still getting the message that my browser window has lost communication with the parent. This only happens with the camera/toolbar button for image assist. If I don't upload the image_asst plugin to tinymce, I can just use the other image assist button at the bottom of my text editor (no errors-- everything works great). However, if I edit in full screen mode, my image assist button isn't there. So there's a definite need to get that image assist camera button/plugin working correctly, or to have the advimage plugin working along side image assist.
Comment #7
bomarmonk commentedI tried the advimage patch, but I'm not sure about where to make the template changes. I'm using a theme that runs on phptemplate, but do I just need to add the advimage change to my page.tpl.php file, or do I need to create a seperate template file for tinymce? Sorry if this is already documented somewhere...
Comment #8
code rader commentedThere should be a engines/phptemplate/template.php
Add that code at the end of the function phptemplate_tinymce_theme.
I hope it works for you.
Comment #9
m3avrck commentedWhat about an option to include default behavior? Using img_assist or advimage?
Comment #10
code rader commentedI like the suggestion of having a default behavior. I just think this is a simpler way, but I am biased since it is my code :)
Comment #11
m3avrck commentedIncluding either of these plugins with the next 4.7 release is much easier. The issue with dropped communication between windows has been fixed (it was an img_assist) issue.
Comment #12
urbanfalcon commentedThis can be used as an aid to help users insert images from their attachments list without touching a line of html. However, like all things in the 4.7 build, revisions have to be taken into account:
and
Comment #13
urbanfalcon commentedIf you're using comment_upload.module, you'll need to make a few adjustments...note the additions/changes in the following:
...and...
Comment #14
urbanfalcon commentedBeyond comment_upload, if you want to be able to use recently cached/attached images (before you've actually submitted the edit), then you need to include the references from the session into the array. Notice the changes I made...
Comment #15
CJCJ24 commentedWow Cool
thanks for the post and the comment
It will be a big help to all who are using drupal
Keep it up
You can buy youtube likes
Comment #16
nicoloye commented