plone - 如何让模式小部件在 iframe 叠加层中工作

标签 plone plone-4.x

我在 Plone 4.3.6 站点上有一些“经典”图 block ,其中包含一个 richtext 字段和两个使用 plone.formwidget.contenttree 的 RelationChoice 字段 小部件。 我已经安装了 plone.app.widgets 1.8.0(连同 p.a.contenttypes),但我无法让新的 TinyMCE 和新的 relateditems 模式小部件正常工作.如果我直接加载平铺 View URL(在 @@edit-tile/.... URL),小部件实际上会显示并正常工作。但在 iframe/overlay 中,它们没有。

prep-overlay 看起来像这样:

  jQuery('.tile-editable').each(function () {
      jQuery(this).find('a.tile-edit-link, a.tile-delete-link').
          prepOverlay({
          subtype: 'iframe',
          config: {
              onLoad: function (e) {
                jQuery('body').addClass('noscroll');
                return true;
              },
              onClose: function() {
                jQuery('body').removeClass('noscroll');
                location.reload();
              }
          }
      });
  });

iframe在header中加载了++resource++plone.app.widgets.js,字段被赋予了pat-relateditemspat -tinymce 类如预期。但是永远不会调用 relateditems 模式中的 init 方法。我想 iframe DOM 没有针对模式进行解析,但我不知道在哪里寻找原因。 FWIW,控制台出现错误:

Uncaught Error: Mismatched anonymous define() module: function (){return eb}
http://requirejs.org/docs/errors.html#mismatch

在 plone.app.widgets.js:166 中,但我不知道它来自哪里,或者它是否重要。

是否有任何技巧可以让模型小部件在 ifram 覆盖层中工作?

最佳答案

要重新初始化所有模式,您可以执行以下操作:

var registry = require("pat-registry");
registry.scan(SELECTOR);  // document or iframe or wherever you want to rescan all patterns. 

恕我直言,您可以在 onLoad 方法上执行此操作。

关于plone - 如何让模式小部件在 iframe 叠加层中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32821687/

相关文章:

plone - 较旧的 Plone 站点缺少许多样式表

tinymce - Plone 4.0.2,TinyMCE选择的内部链接不粘

python - 覆盖敏捷类型中的标题值

html - Plone 中 getBaseTag() 和 <base> 的用途

plone - 返回没有重氮的页面模板

Plone 4 dexterity viewform - 将 css 类添加到字段集 X 中的小部件

plone - Plone 用户注册表中的验证码字段

plone - 如何为图像 content_type 注册 View ?

非站点管理员用户的 Ploneboard 管理员角色