代码之家  ›  专栏  ›  技术社区  ›  Al Katawazi

使用tinymce剥离的HTML标记

  •  4
  • Al Katawazi  · 技术社区  · 17 年前

    Tinymce的最新版本正在剥离我的嵌入标记,以及使用它时的javascript。我尝试将verify_html标志设置为false,但没有任何运气。这是我的Tinymce配置JS,有人能看到我做错了什么吗?

    更新 :我肯定这不是服务器端的问题。我使用了一个没有Tinymce加载的简单文本区域,它工作得很好。正在剥离。

    tinyMCE.init({
        // General options
        mode: "textareas",
        theme: "advanced",
        plugins:
    safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,
    insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,
    fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
        valid_elements: "*[*]",
        verify_html : false,
    
    
        // Theme options
        theme_advanced_buttons1:     
        bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,
    justifyfull,|,formatselect,fontselect,fontsizeselect|,ltr,rtl,|,fullscreen|,forecolor,
    backcolor,code",
        theme_advanced_buttons2: 
        "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,
    outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,advhr",
        theme_advanced_buttons3: 
    "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,
        height: "500px",
    
        // Example word content CSS (should be your site CSS) this one removes paragraph
       // margins
        content_css: "content/word.css",
    
        // Drop lists for link/image/media/template dialogs
        template_external_list_url: "lists/template_list.js",
        external_link_list_url: "lists/link_list.js",
        external_image_list_url: "lists/image_list.js",
        media_external_list_url: "lists/media_list.js",
    
        // Replace values for the template plugin
        template_replace_values: {
            username: "Some User",
            staffid: "991234"
        }
    });
    
    1 回复  |  直到 9 年前
        1
  •  3
  •   Daniel Dewhurst    9 年前

    更新第2号 :

    再挖几次以后,你应该试试下面的方法。

    设置:

    media_strict: false
    

    并设置 <embed> 标签:

    +'embed[width|height|name|flashvars|src|bgcolor|align|play|loop|quality|allowscriptaccess|type|pluginspage]'
    

    来源( MoxieCode Forum )


    更新 :

    你在设置 extended_valid_elements ,但不设置 valid_elements ?:

    valid_elements: "*[*]"
    

    扩展有效元素 用于当前规则集。但是 valid_elements 允许您实际创建该规则集。


    旧答案 :

    您确定它正在进行,而不是解析服务器端请求的任何操作吗?

    如果您使用的是ASP.NET,请确保 ValidateRequest="False" 为该页设置。如果使用的是ASP.NET MVC,则需要将以下内容置于控制器操作之上:

    [ValidateInput(false)]
    

    确保您至少使用 whitelist to keep bad stuff out 但是。