CKEditor - 添加自定义事件监听器并调用原始

发布于 2024-10-05 04:08:34 字数 447 浏览 0 评论 0原文

我使用标记为“激活缩放”的复选框扩展了默认图像插件。如果用户选中该框,最终将在图像 URL 中添加一个参数。实际上,这发生在复选框的 onChange 事件中。

我认识到每次 url (txtUrl) 更改时,图像都会重新加载。这本身并不是一个问题,但当我通过在 Web 应用程序前端渲染内容来按所选大小调整图像大小时,它就成为一个严重的问题。含义:用户始终拥有完整尺寸的原始图像(默认情况下,实际上在上传过程中将其大小调整为 1024x768),并且该尺寸由脚本获取以进行刷新。

总而言之:我需要一种方法来防止这种情况发生。

第一个想法:不要使用更改事件,而是通过提交表单(即单击“确定”按钮)来更改 url 并添加缩放参数。

第二个想法:覆盖 url 文本字段的原始更改事件处理程序,检查是否通过添加缩放参数引发更改,如果没有引发图像插件中定义的原始事件处理程序。

有人有线索吗?

I extended the default image plugin with a checkbox labelled 'Activate Zoom'. If the user checks the box eventually a parameter is added to the image url. Actually this happens within the onChange event of the checkbox.

I recognized that every time the url (txtUrl) is changed the images gets reloaded. That's not an problem taken by itself, but it becomes a serious issue as I resize the image by its selected size by rendering the contents in the frontend of the web application. What means: the user always has the original image with its full dimensions (by default it is resized to 1024x768 on upload process actually), and that dimensions are taken by the script for the refresh.

The long and the short of it: I need a way to prevent that behaviour for this single case.

First thought: don't use the change event, instead change the url and add the zoom parameter by submitting the form, i.e. by clicking the ok button.

Second thought: overwrite the original change event handler of the url text field, check if the change is raised by adding the zoom parameter and if not raise the original event handler defined within the image plugin.

Has anyone a clue?

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

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

发布评论

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

评论(1

风渺 2024-10-12 04:08:34

没关系,我连接了原始图像插件,所以我无法在 url 文本字段的 onchange 函数中决定是否刷新预览并调整图像大小。

Nevermind, I hooked into the original image plugin so I can't decide within the onchange function of the url text field whether to refresh the preview and resize the image or not.

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