0
我有兩個鏈接打開fancybox內嵌入的tinyMCE。tinyMCE,根據打開它的鏈接更改內容
現在我想改變內部的內容,取決於用戶點擊的鏈接,我想在tinyMCE內顯示的內容是點擊的鏈接。我試過設置$('。editor')。html($(this).html()),它第一次工作,正確的內容顯示。
但是這裏是我的問題,內容被卡住了,當我關閉我的fancybox並點擊另一個鏈接時,第一個內容仍然存在。
無論如何,我可以重置tinyMCE嗎?我試過設置$('editor')。text('')並刪除內容,但當我點擊按鈕時它不會回來。
它可能有事情做與tinyMCE的產生的iframe,但我不能得到它的工作...
這裏是我當前的代碼...
HTML 「/>
<!--File2-->
<div class="title">
<a href="#mce" class="edit"><h2>Titel</h2></a>
</div>
<div class="content">
<a href="#mce" class="edit">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Ut aliquam diam eget elit tristique sit amet fringilla velit sagittis.
Nam aliquet, nisl eget elementum consectetur, felis arcu feugiat felis, vel fermentum mi ipsum vitae neque.
Suspendisse placerat leo dolor, ut mollis elit. Nullam bibendum posuere risus tempus viverra.
Aliquam in erat dui. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Aenean auctor lacinia erat, ut facilisis lorem scelerisque eu.
Duis vitae ullamcorper felis. Pellentesque blandit tortor quis magna placerat eget iaculis velit commodo.
Nam imperdiet auctor scelerisque. Proin fermentum sem in nulla ornare euismod.
Maecenas faucibus facilisis cursus. Proin tincidunt luctus egestas.
Curabitur vestibulum aliquet viverra.
</p>
</a>
</div>
javascript
$('.editor').html('');
var content = $(this).html();
$('.editor').html(content);
$(this).fancybox(
{
'size' : 'auto',
'onComplete': function()
{
$('.editor').tinymce(
{
script_url : '/media/tiny_mce/tiny_mce.js',
theme : 'advanced',
height: 450,
plugins : 'ecmsimage,pagebreak,style,layer,table,save,advhr,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist',
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,help,|,insertdate,inserttime,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,|,sub,sup,|,charmap,iespell,advhr,|,code,preview,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
});
$('#fancybox-inner').width(550).height(500);
$('#fancybox-wrap').width(550).height(500);
$.fancybox.center();
}
});