【问题标题】:TINYMCE not picking up preferencesTINYMCE 没有选择偏好
【发布时间】:2012-12-13 13:26:58
【问题描述】:

我使用的答案来自:

TinyMCE not grabbing content from textarea before hiding that 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>';

【问题讨论】:

    标签: tinymce


    【解决方案1】:

    你需要执行

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

    tinymce.init...之后

    【讨论】:

    • 但是它没有从 IE7/8 的文本区域抓取内容
    • 您需要使用正确的 ID。而不是 'article' 使用你的 textarea id
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多