Passing parameters to tinyMCE AdvImage
I have a simple TinyMCE editor setup on my website. I also have a simple image gallery whit a link under each image. I already figured out how to open the Advanced Image Dialog when the link is pressed, but I'd like to pass the url of the image to it as the image's source. I know it's possible and I've seen a lot of links on the TinyMCE forums but they all point to the Wiki and for some reason are broken. I always end up here: http://tinymce.moxiecode.com/wiki.php.
This is how I configured TinyMCE:
tinyMCE.init({
theme : "advanced",
skin : "cirkuit",
mode : "textareas",
language : 'sl',
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1 : "newdocument,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,cut,copy,paste,pastetext,pasteword,|,search,replace",
theme_advanced_buttons3 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,cleanup,code,|,forecolor,backcolor",
theme_advanced_buttons4 : "image,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,|,fullscreen",
开发者_开发问答 theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
width : 520,
height: 500
});
and I use this to open the dialog:
tinyMCE.activeEditor.execCommand('mceAdvImage');
I know this is a stupid question but please help me.
You could store custom variables under the editor instance. You can access this variable from everywhere if you know your editor instance. Example:
tinyMCE.activeEditor.my_var = "abc";
精彩评论