1

我使用的答案来自:

TinyMCE 在隐藏 textarea 之前没有从 textarea 抓取内容

让 TINYMCE 从 IE7/8 的文本区域获取内容。

现在的问题是它已经取消了我所有的偏好、css、按钮偏好等。我怎样才能让它们回来?

tinyMCE.execCommand('mceAddControl', false, 'article');
    tinyMCE.init({
        mode : "exact",
        theme : "advanced",
        content_css: "/static/css/tinymce.css",
        editor_selector : "article",
        plugins : "imagemanager, filemanager",
        setup: function(ed) {

            // Add TypeKit script to the iframe header
            ed.onPreInit.add(function(ed) {

                 // Get the DOM document object for the IFRAME
                 var doc = ed.getDoc();

                 // Create the script we will add to the header asynchronously
                 var jscript = "var TypekitConfig = {\n\
                    kitId: 'qkc2pmz'\n\
                    };\n\
                    (function() {\n\
                    var tk = document.createElement('script');\n\
                    tk.src = '//use.typekit.com/' + TypekitConfig.kitId + '.js';\n\
                    tk.type = 'text/javascript';\n\
                    tk.async = 'true';\n\
                    tk.onload = tk.onreadystatechange = function() {\n\
                    var rs = this.readyState;\n\
                    if (rs && rs != 'complete' && rs != 'loaded') return;\n\
                    try { Typekit.load(TypekitConfig); } catch (e) {}\n\
                    };\n\
                    var s = document.getElementsByTagName('script')[0];\n\
                    s.parentNode.insertBefore(tk, s);\n\
                 })();";

                 // Create a script element and insert the TypeKit code into it
                 var script = doc.createElement("script");
                 script.type = "text/javascript";
                 script.appendChild(doc.createTextNode(jscript));

                 // Add the script to the header
                 doc.getElementsByTagName("head")[0].appendChild(script);

            });

        },
        width : "600",
        height : "300",
        theme_advanced_buttons1 : "formatselect,bold,italic,underline,strikethrough,sup,sub,link,unlink,removeformat,separator,bullist,numlist,blockquote,separator,charmap,separator,insertimage,insertfile",
        theme_advanced_statusbar_location : "none",
        force_br_newlines : false,
        force_p_newlines : false,
        forced_root_block : ''

    });

文字区:

$buffer .= '<div class="control-group">';
        $buffer .= '<label class="control-label">Article:</label>';
        $buffer .= '<div class="controls">';
            $buffer .= '<textarea rows="4" cols="100" id="article" class="article" name="article">';
            $buffer .= $this->registry->article['content'];
            $buffer .= '</textarea>';
        $buffer .= '</div>';
    $buffer .= '</div>';
4

1 回答 1

0

你需要执行

tinyMCE.execCommand('mceAddControl', false, 'article');

之后tinymce.init...

于 2012-12-13T13:32:34.777 回答