我正在使用jiny與TinyMCE。我試圖在TinyMCE編輯器對焦時改變邊框顏色,然後在模糊處改變顏色。更改邊框顏色的TinyMCE的焦點和模糊
在ui.css,我添加/更改了這些:
.defaultSkin table.mceLayout {border:0; border-left:1px solid #93a6e1; border-right:1px solid #93a6e1;}
.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #93a6e1;}
.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #93a6e1;}
我設法在本作中的init腳本到達:
$().ready(function() {
function tinymce_focus(){
$('.defaultSkin table.mceLayout').css({'border-color' : '#6478D7'});
$('.defaultSkin table.mceLayout tr.mceFirst td').css({'border-top-color' : '#6478D7'});
$('.defaultSkin table.mceLayout tr.mceLast td').css({'border-bottom-color' : '#6478D7'});
}
function tinymce_blur(){
$('.defaultSkin table.mceLayout').css({'border-color' : '#93a6e1'});
$('.defaultSkin table.mceLayout tr.mceFirst td').css({'border-top-color' : '#93a6e1'});
$('.defaultSkin table.mceLayout tr.mceLast td').css({'border-bottom-color' : '#93a6e1'});
}
$('textarea.tinymce').tinymce({
script_url : 'JS/tinymce/tiny_mce.js',
theme : "advanced",
mode : "exact",
theme : "advanced",
invalid_elements : "b,i,iframe,font,input,textarea,select,button,form,fieldset,legend,script,noscript,object,embed,table,img,a,h1,h2,h3,h4,h5,h6",
//theme options
theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,selectall,|,undo,redo,|,cleanup,removeformat,|",
theme_advanced_buttons2 : "bold,italic,underline,|,bullist,numlist,|,forecolor,backcolor,|",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "none",
theme_advanced_resizing : false,
//plugins
plugins : "inlinepopups,paste",
dialog_type : "modal",
paste_auto_cleanup_on_paste : true,
setup : function(ed) {
ed.onClick.add(function(ed, evt) {
tinymce_focus();
});
}
});
});
...但是這(的onclick ,改變,邊框顏色)是我設法得到工作的唯一的事情。我所有其他的嘗試要麼阻止TinyMCE加載,要麼完全沒有做任何事情。我瀏覽了TinyMCE wiki頁面和他們的論壇,但還沒有能夠從零散的信息小塊中整理出一幅完整的圖片。
實際上有辦法做到這一點嗎?這是簡單的,我只是俯視,還是它實際上是一個非常複雜的實現?
有幾個錯誤(缺少一個右大括號和缺少點擊監聽器上的「false」),但我最終解決了這個問題。但是,這隻適用於Firefox。有其他瀏覽器可以使用嗎? – 2010-12-23 20:16:08
是的,應該有。你可以使用jquery:$(ed.getDoc())。bind('click',function(){......}); – Thariama 2011-01-03 11:16:11