6

我正在使用 TinyMCE 为用户提供在 textarea 表单字段上进行简单文本格式化(粗体、斜体、列表)的功能。一切正常,除了在 Internet Explorer 中(8 但我读过它发生在早期版本上),当用户键入 URL(例如 www.google.com)时,它会在 TinyMCE 编辑器中自动转换为 HTML 链接,因为他们类型。这在 Firefox (3) 中不会发生。如何防止 IE 这样做?

我已经使用以下内容初始化了 TinyMCE:

tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    convert_urls : false
 });

但我不认为 convert_urls 旨在影响我所描述的行为:http ://wiki.moxiecode.com/index.php/TinyMCE:Configuration/convert_urls

我试过:

function myCustomURLConverter(url, node, on_save) {
    return url;
}

tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    urlconverter_callback : "myCustomURLConverter"
 });

但同样,我认为这只是一种影响 URL 在加载/保存时如何/是否转换的方法,而不是防止它们在用户键入时转换为链接: http ://wiki.moxiecode.com/index.php/TinyMCE :配置/urlconverter_callback

我正在尝试解决的问题至少在几个地方进行了描述: http ://tinymce.moxiecode.com/punbb/viewtopic.php?id=2182&p= 1(第三篇文章,由 tommya 撰写) http:// drupal.org/node/149511

有没有人见过这个或对如何解决它有任何建议?TinyMCE 代码库非常大且难以追踪,所以我希望有人可以帮助我稍微隔离一下这个问题。

4

4 回答 4

3

似乎不是在 IE 中禁用它的方法。它似乎是一个“功能”,它也出现在 FCKEditor 上。几个替代方案,从有效元素中删除元素。http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

或者做一个服务器端标签解析来删除它。

我认为这可能是“功能” http://msdn.microsoft.com/en-us/library/aa769893(VS.85).aspx

这里可能是让它工作的提示,但它看起来像 ActiveX 和 VB,所以我在实验中很快就迷路了 http://www.mindfrost82.com/showpost.php?p=1114381&postcount=2

于 2009-03-27T08:55:57.807 回答
2

我想我是这样解决的:

remove_script_host: "false",
relative_urls: "false",
document_base_url : "http//www.mywebsite.nlhttp://www.mywebsite.nl",
于 2012-09-26T14:35:58.620 回答
1

这是一个可行的解决方法,需要粘贴插件。在您的 TinyMCE 初始化配置中,添加:

paste_preprocess : function(pl, o) {
    // Strip <a> HTML tags from clipboard content (Happens on Internet Explorer)
    o.content = o.content.replace( /(\s[a-z]+=")<a\s[^>]+>([^<]+)<\/a>/gi, '$1$2' );
}
于 2011-03-28T12:52:14.583 回答
0

我已经用这些配置解决了这个问题:

remove_script_host : false,
auto_cleanup_word : false,
relative_urls : false, 
convert_urls : false,
verify_html : false,
convert_newlines_to_brs : false, 
urlconvertor_callback: "convLinkVC",
document_base_url : "",
forced_root_block : '',
于 2015-04-10T13:53:44.677 回答