将数据添加到TinyMCE中的自定义菜单按钮

时间:2015-07-10 02:26:28

标签: tinymce tinymce-4

如何在TinyMCE中添加数据或将数据关联到自定义菜单按钮?我的代码是这样的:

meetsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            Meet meet = new Meet();
            meet = meetList.get(position); // meet is not null here
            communicator.changeToolbarTitle(meet.getName());

            ****** Sends Meet object to main activity ********
            communicator.sendMeetToMeetProfile(meet);
        }
    });

2 个答案:

答案 0 :(得分:1)

解决方案是在菜单对象中使用'value',如:

editor.addButton( 'gavickpro_tc_button', {
    title: 'My test button',
    type: 'menubutton',
    icon: 'icon gavickpro-own-icon',
    menu: [
        {
            text: 'Menu item I',
            value: 'Text from menu item I',
            onclick: function() {
                editor.insertContent(this.value());
            }
        }
   ]
});

答案 1 :(得分:0)

  menu:[[object1],[object2],[object3]] 

在自定义按钮菜单

中显示object1,object2,object3