Magento - 如何在 Magento 的 CMS 编辑器中允许某些标签(iframe、嵌入)?

发布于 2024-10-19 20:39:43 字数 118 浏览 1 评论 0原文

我想允许输入某些 html 标签,例如 iframe 并嵌入到 Magento 的 CMS 编辑器中。 Magento 不允许使用这些标签。

是否有一个模型或控制器可以编辑以允许 iframe 和嵌入标签?

I would like to allow to enter certain html tags such as iframe and embed in Magento's CMS editor. Magento does not allow those tags.

Is there a model or controller that I can edit to allow iframe and embed tags?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

错々过的事 2024-10-26 20:39:43

查看此文件:js/mage/adminhtml/wysiwyg/tiny_mce/setup.js

找到此代码块:

    var settings = {
        mode : (mode != undefined ? mode : 'none'),
        elements : this.id,
        theme : 'advanced',
        plugins : plugins,
        theme_advanced_buttons1 : magentoPlugins + 'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
        theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
        theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
        theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
        theme_advanced_toolbar_location : 'top',
        theme_advanced_toolbar_align : 'left',
        theme_advanced_statusbar_location : 'bottom',
        theme_advanced_resizing : true,

并在其后添加以下内容:

        extended_valid_elements : 'iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],style,script',

这是一个简单的逗号分隔的您想要允许的标签列表。

Look in this file: js/mage/adminhtml/wysiwyg/tiny_mce/setup.js

Find this block of code:

    var settings = {
        mode : (mode != undefined ? mode : 'none'),
        elements : this.id,
        theme : 'advanced',
        plugins : plugins,
        theme_advanced_buttons1 : magentoPlugins + 'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
        theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
        theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
        theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
        theme_advanced_toolbar_location : 'top',
        theme_advanced_toolbar_align : 'left',
        theme_advanced_statusbar_location : 'bottom',
        theme_advanced_resizing : true,

and add this after it:

        extended_valid_elements : 'iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],style,script',

It's a simple comma delimited list of tags you want to allow.

落花浅忆 2024-10-26 20:39:43

Josh 是正确的目标,我添加了这一行来接受“在 Faceb 上找到我们...”-iframe:

extended_valid_elements : 'iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder|allowTransparency],style,script',

它有一个额外的属性,位于自动生成的 FB-iframe 中。

Josh is right on target, I added this row to accept a "Find us on Faceb..."-iframe:

extended_valid_elements : 'iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder|allowTransparency],style,script',

It has an extra attribute that's within the autogenerated FB-iframe.

☆獨立☆ 2024-10-26 20:39:43

编辑 CMS 页面时,您可以切换到 html 视图。

在此处输入图像描述

按 html 按钮
在此处输入图像描述

您可以在 html 中将 iframe 添加到页面上

When editing a CMS page, you can switch to an html view.

enter image description here

By pressing the html button
enter image description here

There you are able to add the iframe onto the page right in the html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文