将 CKFinder 与 InnovaStudio 所见即所得编辑器集成

发布于 2024-08-27 21:42:58 字数 793 浏览 8 评论 0原文

我使用 InnovaStudio WYSIWYG Editor,并且我尝试用 CKFinder。编辑器配置中有一行用于指定资产管理器使用的 URL。我已将其指向 CKFinder。我无法开始工作的部分是使用 CKFinder 中双击文件的路径填充该字段。

它似乎使用“func”参数来指定回调函数。我调用的 URL 为:/common/ckfinder/ckfinder.html?action=js&func=setAssetValue

InnovaStudio WYSIWYG 编辑器提供 setAssetValue(v) 回调函数用于设置字段值。 v 参数应包含 URL。

CKFinder 在调用时会按预期弹出,但双击缩略图或使用上下文菜单中的“选择”选项都不起作用。正常/预期的行为是 CKFinder 关闭,并且目标字段将填充所选资产的 URL。


其他信息:InnovaStudio WYSIWYG 编辑器有一个“弹出窗口”,用于将图像或 Flash 文件添加到内容中。该弹出窗口位于 iframe 中。当它调用 CKFinder(或其自己的资产管理器)时,它也在 iframe 中。看起来 CKFinder 正在主窗口的范围内查找,而不是实际包含需要填充的字段的图像/flash iframe。

I use InnovaStudio WYSIWYG Editor, and I am trying to replace InnovaStudio's Asset Manager with CKFinder. There's a line in the editor configuration for what URL to use for the asset manager. I have pointed it at CKFinder. The part I can't get to work is getting the field to populate with the double-clicked file's path from CKFinder.

It appears to use the 'func' parameter to specify the callback function. The URL I'm calling is: /common/ckfinder/ckfinder.html?action=js&func=setAssetValue

The InnovaStudio WYSIWYG Editor provides the setAssetValue(v) callback function for setting the field value. The v parameter should hold the URL.

CKFinder pops up as expected when it's invoked, but neither double-clicking the thumbnails nor using the "select" option in the context menu works. The normal/expected behavior is that CKFinder closes and the target field is populated with the URL for the selected asset.


Additional Info: The InnovaStudio WYSIWYG Editor has a "popup" for adding an image or flash file to the content. This pop-up is in an iframe. When it calls CKFinder (or it's own asset manager), that is also in an iframe. It appears that CKFinder is looking in the scope of the main window rather than the image/flash iframe that actually contains the field that needs to be populated.

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

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

发布评论

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

评论(1

被你宠の有点坏 2024-09-03 21:42:58

(某种)解决方案

通过使用 Firebug 挖掘 DOM,我发现 InnovaStudio 创建了一个 ISWindow 对象,在其中放置对其生成的窗口的引用。我修改了回调函数以循环该对象并为适当的 iframe 调用 setAssetValue() 函数。这有效,但 CKEditor 仍然没有自行关闭。我认为这是因为它不“知道”如何关闭它所在的 iframe。 有没有办法告诉 CKFinder 如何关闭它所在的窗口?我可以想象使用 iframe 会很有用的其他情况。

我更喜欢让 CKFinder 使用 iframe 显示,但我最终使用标准 CKFinder 弹出窗口开始工作。

编辑器配置行: oEdit1.cmdAssetManager = "parent.BrowseServerIS();";

支持功能:

// InnovaStudio WYSIWYG Editor version
function BrowseServerIS()
{
   // You can use the "CKFinder" class to render CKFinder in a page:
   var finder = new CKFinder();
   // The path for the installation of CKFinder (default = "/ckfinder/").
   finder.BasePath = '/common/ckfinder/';
   // Name of a function which is called when a file is selected in CKFinder.
   finder.SelectFunction = SetFileFieldIS;
   // Launch CKFinder
   finder.Popup();
}

// InnovaStudio WYSIWYG Editor version
function SetFileFieldIS(fileUrl, data)
{
   for (var i in ISWindow.objs) {
      if ((null != ISWindow.objs[i].rt.frm.contentWindow)
            && ('function' == typeof ISWindow.objs[i].rt.frm.contentWindow.setAssetValue)) {
         ISWindow.objs[i].rt.frm.contentWindow.setAssetValue(fileUrl);
      }
   }
}

(Sort of) Solution

I discovered, by digging through the DOM with Firebug, that InnovaStudio creates an ISWindow object where it places references to the windows that it spawns. I modified my callback function to loop over that object and call the setAssetValue() function for the appropriate iframe. This worked, but CKEditor still did not close itself. I assume that's because it didn't "know" how to close the iframe that it was inside. Is there a way to tell CKFinder how to close the window it's inside of? I can envision other cases where using an iframe would be useful.

I would prefer to have CKFinder to use the iframe display, but I finally got things working using the standard CKFinder popup.

Editor config line: oEdit1.cmdAssetManager = "parent.BrowseServerIS();";

Supporting functions:

// InnovaStudio WYSIWYG Editor version
function BrowseServerIS()
{
   // You can use the "CKFinder" class to render CKFinder in a page:
   var finder = new CKFinder();
   // The path for the installation of CKFinder (default = "/ckfinder/").
   finder.BasePath = '/common/ckfinder/';
   // Name of a function which is called when a file is selected in CKFinder.
   finder.SelectFunction = SetFileFieldIS;
   // Launch CKFinder
   finder.Popup();
}

// InnovaStudio WYSIWYG Editor version
function SetFileFieldIS(fileUrl, data)
{
   for (var i in ISWindow.objs) {
      if ((null != ISWindow.objs[i].rt.frm.contentWindow)
            && ('function' == typeof ISWindow.objs[i].rt.frm.contentWindow.setAssetValue)) {
         ISWindow.objs[i].rt.frm.contentWindow.setAssetValue(fileUrl);
      }
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文