【发布时间】:2019-03-06 11:41:48
【问题描述】:
我正在尝试为 TinyMCE (4.7.0) 创建自己的图像处理插件。我想在右键 > 上下文菜单 > imageplugin 时设置表单中的当前图像属性。
要复制我需要访问我右键单击的元素的属性。但是我找不到目标。
我 console.log() 事件但它的目标是上下文菜单项而不是右键单击目标...
editor.addMenuItem('imageplugin', {
text: 'imageplugin',
context: 'tools',
onclick: function(e) {
console.log(e); //target is incorrect...
editor.windowManager.open({
title: 'Afbeelding instellingen',
body: [
{
type: 'textbox',
name: 'title',
label: 'Title',
value: e.src
},
{
type : 'listbox',
name : 'width',
label : 'Breedte',
values : [
{ text: '100%', value: '100' },
{ text: '50%', value: '50' },
{ text: '33%', value: '33' },
{ text: '25%', value: '25' },
],
value : 'test2'
},
{
type : 'listbox',
name : 'float',
label : 'Uitlijnen',
values : [
{ text: 'Geen', value: 'none' },
{ text: 'Links', value: 'left' },
{ text: 'Rechts', value: 'right' },
],
value : 'test2',
},
],
onsubmit: function(e) {
editor.insertContent('Title: ' + e.data.title);
}
});
}
});
【问题讨论】:
标签: javascript tinymce target tinymce-4