将参数传递给tinyMCE AdvImage

时间:2011-06-20 17:09:45

标签: tinymce

我的网站上有一个简单的TinyMCE编辑器设置。我还有一个简单的图像库,每个图像下都有一个链接。我已经知道如何在按下链接时打开高级图像对话框,但我想将图像的URL作为图像的源传递给它。我知道这是可能的,我在TinyMCE论坛上看到了很多链接,但他们都指向Wiki,并且出于某种原因被打破了。我总是在这里结束:http://tinymce.moxiecode.com/wiki.php

这就是我配置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
});

我用它来打开对话框:

tinyMCE.activeEditor.execCommand('mceAdvImage');

我知道这是一个愚蠢的问题,但请帮助我。

1 个答案:

答案 0 :(得分:1)

您可以在编辑器实例下存储自定义变量。如果您知道编辑器实例,则可以从任何地方访问此变量。例如:

tinyMCE.activeEditor.my_var = "abc";