CKEditor:允许视频嵌入代码

时间:2011-03-07 15:36:16

标签: video embed ckeditor

我正在使用CKEditor并希望允许从YouTube,Vimeo等插入嵌入代码 CKEditor将所有标签转换为HTML Chars等效,这很好,但我希望它能为这种内容制作例外。 iFrames现在似乎已经完成了,所以如何告诉CKEditor单独留下iFrame标签?

谢谢。

5 个答案:

答案 0 :(得分:6)

在搜索相同的解决方案时找到了您的问题。这是我发现的。基本上,它会在工具栏上添加一个按钮,如图像按钮,但它会弹出一个框,供您粘贴来自YouTube,Vimeo等的嵌入代码。似乎工作得很好。

http://www.fluidbyte.net/index.php?view=embed-youtube-vimeo-etc-into-ckeditor

编辑:链接到archive.org: http://web.archive.org/web/20110805213357/http://www.fluidbyte.net/index.php?view=embed-youtube-vimeo-etc-into-ckeditor

答案 1 :(得分:3)

没有。这些答案都不准确。这个插件对你想做的事情来说太过分了。在项目范围内搜索以下文本:extraAllowedContent并将'iframe[!src];'添加到其他任何允许的内容中。然后添加以下内容:allowedContent: true,

答案 2 :(得分:2)

启用“源”按钮无法解决此问题。然后可以粘贴诸如“iframe”之类的嵌入代码,但是如果你再次回来并再次编辑该字段,CKeditor将会剥离它。您需要配置CKeditor以允许首先嵌入iframe。

答案 3 :(得分:0)

简单的方法是启用“来源”按钮。如果您使用完整工具栏(非基本),则它已存在。

答案 4 :(得分:0)

CKEditor附带一个config.js文件。在此文件中,将参数config.allowedContent设置为true

例如,

CKEDITOR.editorConfig = function( config )
{
    config.toolbar_TRiGCustom =
    [
        ['Bold','Italic','Underline','-','JustifyLeft','JustifyCenter','-','Blockquote'],
        ['FontSize'],
        ['Undo','Redo'],
        ['Link','Unlink','Image','Table'],
        ['NumberedList', 'BulletedList'],
        ['Source'],
        ['Maximize']
    ];
    config.toolbar = 'TRiGCustom';
    config.forcePasteAsPlainText = true;
    config.forceSimpleAmpersand = true;
    config.resize_enabled = false;
    config.toolbarCanCollapse = false;
    config.scayt_autoStartup = true;
    config.language = 'en';
    config.uiColor = '#76BC49';
    config.width = '97%';
    config.extraPlugins = 'maximize';
    config.allowedContent = true;
};

我在Amixa Blog上找到了这个解决方案。博客文章似乎是为一个名为ASPMAKER的特定CMS编写的,并且还建议对该CMS中的特定ASP文件进行调整,但是对CKEditor配置的编辑是通用的,并且适用于CKEditor,无论您在哪里使用它。您只需要config.allowedContent = true;行。