CKEditor 3.0 插件 - 获取选定的文本/HTML

发布于 2024-08-07 10:03:32 字数 302 浏览 1 评论 0原文

我在旧的 FCKEditor 中有一个插件,我想重建。我看到了一个利用 iFrame 代码的示例。我已经定义了按钮并正常工作,我得到了对话框,但我不知道如何将选定的文本/html 放入对话框中,以便我可以操纵它。

我的插件类似于 MS 文件对话框。当用户单击列出的文件(或列表中的 html 页面)时,我的代码会使用要在 HREF 属性中使用的 URL 更新链接文本框...我找不到任何可以告诉我如何获取从编辑器中选择文本,并在我的对话框正常工作后将其替换为编辑后的代码...有什么建议吗?我对此处于中间状态,因此如果您发布代码,请评论正在发生的事情,以便我能够理解。谢谢。

I have a plug in in the old FCKEditor I would like to rebuild. I saw an example that leveraged the iFrame code. The I've got the button defined and working, I get the dialog, but I cannot figure out how to get the selected text/html into the dialog so I can manipulate it.

My plug in is an approximaiton of the MS File dialog box. When the user clicks on a file that is listed (or an html page in the list) my code updates the link text box with the URL to be used in the HREF property... I cannot find anything that will tell me how to get selected text from the editor and replace it with the edited code once my dialog does it's work... Any suggestions? I am intermediate with this so if you post code please comment on what's happening so I can understand. Thanks.

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

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

发布评论

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

评论(1

£烟消云散 2024-08-14 10:03:32

看来我的 cookie 已被清除......这是更新。我使用以下代码:

CKEDITOR.instances.editor1.insertHtml('<a href=\x22www.google.com\x22>'
CKEDITOR.instances.editor1.getSelection().getNative() + '</a>');

我将适当的代码粘贴到 FireFox 上的 CKEditor 实例中,但在 IE(办公室中的 6.0)上,它发布 [object Object] 并显示源 URL

<a href="www.google.com">[object Object]</a>

:我缺少一些问题吗?我使用的是 CKE3.0,并将下载 3.01,但他们的更新日志似乎没有与此相关的任何内容,所以我不确定这是否是一个错误。

Seems my cookies got cleared.... Here is an update. I use the following code:

CKEDITOR.instances.editor1.insertHtml('<a href=\x22www.google.com\x22>'
CKEDITOR.instances.editor1.getSelection().getNative() + '</a>');

I get the appropriate code pasted into the CKEditor instance on FireFox, but on IE (6.0 here at the office) it posts [object Object] and the source URL displays:

<a href="www.google.com">[object Object]</a>

Is there some issue i am missing? I am on CKE3.0 and will be downloading 3.01 but their changelog did not seem to have anything related to this so I am not sure if this is a bug or not.

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