2010-11-10 11 views
12

मैंने tinymce textarea की चौड़ाई निर्धारित करने के लिए कई विधियों का प्रयास किया।tinymce का उपयोग कर textarea की चौड़ाई कैसे सेट करें?

मेरे 1st प्रयास:

height: '200px', 
width: '220px' // inside tinyMCE.init({ 

2 की कोशिश में:

<textarea name="editorial" cols="40" rows="20" id="editorial" style="width: 40em; height: 20em"><?=$row['editorial']?></textarea> 

लेकिन फिर भी, मैं अपने आवश्यकता के अनुसार चौड़ाई प्राप्त करने में सक्षम नहीं हूँ।

कोई विचार कृपया?

+0

क्या आप पहले से प्रयास किए गए उदाहरणों के उदाहरण दे सकते हैं –

उत्तर

20

मुझे लगता है कि समस्या अपने TinyMCE init समारोह में उपकरण पट्टियों के साथ हो सकता है:

क्या मैं अपने init सेटिंग के अनुसार मेरी चौड़ाई सेट करने के लिए क्या iframe की शैली की संपत्ति को संशोधित करने के लिए है।

इस उदाहरण का प्रयास करें, और मुझे बताएं कि यह आपके लिए काम करता है या नहीं?

अपने HTML में:

<textarea name="editorial" class="test" cols="40" rows="20" id="editorial" > editorial</textarea> 

फिर अपने जावास्क्रिप्ट में इस tinyMCE.init का उपयोग करें:

tinyMCE.init({ 
     // General options 
     mode: "textareas", 
     theme: "advanced", 
     width: "300", 
     height: "200", 

     // Theme options 
     theme_advanced_buttons1: "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull", 
     theme_advanced_buttons2: "", 
     theme_advanced_buttons3: "", 
     theme_advanced_buttons4: "", 
     theme_advanced_toolbar_location: "top", 
     theme_advanced_toolbar_align: "left", 
     theme_advanced_resizing: false, 

    // Selector 
     editor_selector: "test", 

}); 

आप के लिए यह काम करता है?

1

मजाकिया बात चौड़ाई है और हेगथ ​​आईफ्रेम की शैली संपत्ति में सेट हो रही है।

// ed is the editor instance 
var frameid = frameid ? frameid : ed.id+'_ifr'; 

// get iframe 
var current_iframe = document.getElementById(frameid); 

if (current_iframe && !window.opera){ 

    styles = current_iframe.getAttribute('style').split(';'); //width and heigth 
    for (var i=0; i<styles.length; i++) { 
    // case width setting is found - remove it 
    if (styles[i].search('width:') == 1){ 
     styles.splice(i,1); 
     break; 
    } 
    current_iframe.setAttribute('style', styles.join(';')); // write styles back to the iframe 
    current_iframe.width = ed.getParam('width'); // set the width i already set in the configuration 
} 
11

आप इस तरह से उपयोग कर सकते हैं ..

tinymce.init({ 
selector: "textarea", 
plugins: [ 
      "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker", 
      "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", 
      "table contextmenu directionality emoticons template textcolor paste fullpage textcolor" 
    ], 

    toolbar1: "bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect", 
    toolbar2: "cut copy paste | bullist numlist | outdent indent blockquote | undo redo | anchor | forecolor backcolor", 


    menubar: false, 
    toolbar_items_size: 'small', 

    height: "100", 
    width:500, 

}); 

तुम सिर्फ जोड़ने चौड़ाई तो सेट करना चाहते हैं चौड़ाई: 300

नोट: चौड़ाई की तरह एकल या डबल qoutes का उपयोग न करें: '300' या चौड़ाई: "300"

+0

आपको अपनी पोस्ट में हस्ताक्षर के रूप में अपना नाम शामिल करने की आवश्यकता नहीं है। यह पहले से ही है। –

+0

सुझाव संजीव के लिए धन्यवाद .. –

+1

आपके द्वारा जोड़े गए नोट के लिए धन्यवाद, यह मुझे समाधान देता है –

संबंधित मुद्दे