CKEditor - 单击上下文菜单后获取元素 [英] CKEditor - get element after click on context Menu

查看:87
本文介绍了CKEditor - 单击上下文菜单后获取元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ckeditor中添加了img上下文菜单的链接,使用此代码
CKEditor - 将上下文菜单项添加到图像

I added link to context menu of img in ckeditor, using this code CKEditor - Add Context Menu Item to Images

如何获取有关用户单击的图像的信息?
例如图像的id。或者路径。为了处理选定的图像。

How can I get the information about the image, on which user clicked? For example the id of the image. Or the path. In order to process with the selected image.

推荐答案

解决方案非常简单。

$('body').on('contextmenu','img',function(){
var imgid = $(this).attr('id');
alert(imgid);
})

使用jquery要跟踪点击图片,我们可以将它的id保存到全局变量。然后,在插件的命令中,获取我们之前保存的id。

Using jquery to track click on image, we can save it's id to global variable. Then, inside the command of the plugin, to take the id that we saved before.

这篇关于CKEditor - 单击上下文菜单后获取元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆