2011-06-20 60 views
1

我的網站上有一個簡單的TinyMCE編輯器設置。我也有一個簡單的圖像庫白色每個圖像下的鏈接。我已經想出了在按下鏈接時如何打開高級圖像對話框,但我想將圖像的URL作爲圖像的源代碼傳遞給它。我知道這是可能的,而且我在TinyMCE論壇上看到了很多鏈接,但都指向Wiki並因爲某些原因被打破。我總是在這裏結束:http://tinymce.moxiecode.com/wiki.php將參數傳遞給tinyMCE AdvImage

這是我如何配置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'); 

我知道這是一個愚蠢的問題,但請幫助我。

+0

+1清楚的問題 – Thariama

回答

1

您可以在編輯器實例下存儲自定義變量。如果你知道你的編輯器實例,你可以從任何地方訪問這個變量。例如:

tinyMCE.activeEditor.my_var = "abc"; 
+0

其實我已經發現了另一種解決方案,通過添加和調用'tinyMCE.activeEditor.execCommand(「mceAdvImage」)之前選擇的圖像;'但是我測試你也和我設法讓它工作。謝謝! –