2012-04-24 10 views
5

मैं आधिकारिक दस्तावेज़ और ब्लॉग पोस्ट और SO घंटे के लिए पढ़ रहा हूं, कुछ निश्चित रूप से उत्तर पहले ही पोस्ट किया जाएगा .. लेकिन कोई भाग्य नहीं है।इनपुट तत्व से 'शैली' विशेषता को अलग करने से टिनिमस को कैसे रोकें?

ऐसा लगता है कि किसी भी कॉन्फ़िगरेशन के साथ झुकाव की कोई मात्रा नहीं है। मेरे इनपुट/सबमिट <p> तत्व पर इनलाइन 'शैली' विशेषता को अलग करने से tinymce रोकता है। मुझे सभी इनपुट तत्वों के लिए 'शैली' विशेषता की आवश्यकता है .. लेकिन मैं इसे काम करने के लिए यहां तक ​​कि <p> के साथ परीक्षण करके शुरू कर रहा हूं।

  • TinyMCE संस्करण 3.5b3

यहाँ मेरी config के नवीनतम यात्रा है। (कई बदलावों/प्रयासों में से):

tinyMCE.init({ 
    mode : "textareas", 
    theme : "advanced", 

    plugins : "emotions,spellchecker,advhr,insertdatetime,preview,paste,table,media,directionality,style,xhtmlxtras,nonbreaking,pagebreak", 

    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect", 
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl", 
    theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,|,nonbreaking,pagebreak", 

    theme_advanced_toolbar_location : "top", 
    theme_advanced_toolbar_align : "left", 
    theme_advanced_statusbar_location : "bottom", 
    theme_advanced_resizing : true, 

    doctype : "<!DOCTYPE html>", 

    convert_urls : false, 

    //template_external_list_url : "gen4tinymce/lists/template_list.js", 
    external_link_list_url : "gen4tinymce/lists/link_list.js", 
    //media_external_list_url : "gen4tinymce/lists/media_list.js", 

    valid_elements : "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang]," 
    + "a[rel|rev|charset|hreflang|tabindex|accesskey|type|" 
    + "name|href|target|title|class],strong/b,em/i,strike,u," 
    + "#p[style],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|" 
    + "src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup," 
    + "-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|" 
    + "height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|" 
    + "height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot," 
    + "#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor" 
    + "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div," 
    + "-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face" 
    + "|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite]," 
    + "object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width" 
    + "|height|src|*],map[name],area[shape|coords|href|alt|target],bdo," 
    + "button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|" 
    + "valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method]," 
    + "input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value]," 
    + "kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value]," 
    + "q[cite],samp,select[disabled|multiple|name|size],small," 
    + "textarea[cols|rows|disabled|name|readonly],tt,var,big", 

    extended_valid_elements : "p[style]", 
    inline_styles : true, 
    verify_html : false 
}); 

किसी भी सुझाव के लिए धन्यवाद!

उत्तर

3

This fiddle दिखाता है कि टिनिमस की आपकी कॉन्फ़िगरेशन बिल्कुल सही है: सभी तत्वों के लिए स्टाइल-एट्रिब्यूट की अनुमति है, यह छीन नहीं जाता है।

+1

हाँ, मैं नीचे पूरी बात एक परीक्षण के रूप छीन .. बस TinyMCE अलग और यह उम्मीद के रूप में काम करता है, जैसा कि आप कहते हैं कि और शो। इसलिए मुझे यह पता लगाने की ज़रूरत है कि स्टाइल एट्रिब्यूट क्या है ... PHP फ्रेमवर्क जो मैं उपयोग कर रहा हूं, कोडइग्निटर, या क्या। मैं आपके जवाब को स्वीकार करने के लिए यहां वापस आऊंगा .. मैं बस इस पल के लिए इसे छोड़ देता हूं अगर कोई ऐसी चीज पोस्ट करता है जो मुझे बचाता है और यह पता लगाता है कि अपराधी कहां है। ;-) – govinda

12

जैसा थिर्यामा ने बताया, टिनिमस गलती नहीं थी .. लेकिन यह जानने की मेरी कमी थी कि सभी कोडइग्निटर $config['global_xss_filtering'] = TRUE; क्या कर रहा था। यदि आपको लगता है कि आप एक ही समस्या का सामना कर रहे हैं, तो यहां बताया गया है कि मैंने इसे कैसे संबोधित किया; कृपया यहां देखें: Codeigniter - Disable XSS filtering on a post basis

+0

+1 एक समाधान समाधान और बुराई के स्रोत के लिए +1 – Thariama

+0

कोडइग्निटर का उपयोग न करें यह सबसे खराब PHP ढांचे में से एक है;) –

0

आप इस

$("#submit").click(function(e) { 
    ie8SafePreventEvent(e); 
    var form_data = $("#form").serialize(); 
    var content = $.base64.encode(tinyMCE.activeEditor.getContent()); 
    $.ajax({ 
     type: "POST", 
     url: "/your/post/processor", 
     data: form_data + "&coded_content=" + content, 
     success: function(return_msg){ 
      do_something 
      }, 
     error: function(){ 
      alert("Sorry, we got an error, try later"); 
      } 
     }); 
    }); 
जाहिर है अपने नियंत्रक आप base64decode करने के लिए है में

की तरह, एक ajax अनुरोध के साथ की कोशिश कर सकते हैं ...

0

मैं भी CodeIgniter उपयोग कर रहा हूँ और जब मैं $config['global_xss_filtering'] = false; स्थापित किया था मैं अभी भी था शैली विशेषता के साथ मुद्दा। इस तरह से आप मूल स्ट्रिंग बनाए रखने

$('#hiddenField').val(window.btoa(tinyMCE.get('tinyMCEtextareaID').getContent())); 

और यह आसानी से किया जा सकता है: तो अगर समाधान से कोई भी आप के लिए काम किया है, तो आप सबमिट करें और का उपयोग कर एक छिपी हुई फ़ील्ड में रखें जावास्क्रिप्ट पर बेस 64 में tinyMCE डेटा एन्कोडिंग कोशिश कर सकते हैं PHP में डीकोड का उपयोग कर:

$htmlstring = base64_decode($_POST['hiddenField']); 
संबंधित मुद्दे