CKEditor: Submenu (drop downlist) not appearing

送分小仙女□ 提交于 2019-12-10 17:06:21

问题


I need a drop down submenu list within the drop down menu list in plugin. but problem is, that menu shows that It has drop down submenu list but contents of list are not being loaded. empty submenu is shown.

Snap shot:

code :

CKEDITOR.plugins.add( 'microdata',
{
   requires : [ 'styles', 'button' ],
   init : function( editor )
    {
        var  markup= editor.config.languages,
                items = {};
        for ( var i = 0 ; i < markup.length ; i++ )
        {
            var parts = markup[i].split( '=' );
            var name= parts[1].split('org/');
            items[ parts[ 0 ] ] =
                {
                    label : parts[ 0 ],
                    group : 'microdata',
                    icon: this.path + 'icon1.png' ,
                    order : i,
                    getItems: function()
                        {
                            var selection = editor.getSelection();
                            return {
                                name: CKEDITOR.TRISTATE_OFF,
                                friend: CKEDITOR.TRISTATE_OFF
                            };
                        }

        };
             var  name=
                {
                  label: 'name',
                  group: 'microdata',
                  //command: 'nameCmd',
                  order: 5
                }
        editor.addMenuGroup( 'microdata' );
        editor.addMenuItems( items,name);/*,
                friend:
                {
                  label: 'friend',
                  group: 'microdata',
                  //command: 'friendCmd',
                  order: 10
                }
                );*/
        editor.ui.add( 'Microdata', CKEDITOR.UI_MENUBUTTON,
        {
            label: 'Microdata',
            command: 'Microdata',
            modes : { wysiwyg:1 },
            className : 'cke_button_microdata',
            icon: this.path + 'icon1.png' ,
                    onMenu : function()
                {
                    var activeItems = {};

                    for ( var prop in items )
                    {
                        if ( items.hasOwnProperty( prop ) )
                            activeItems[ prop ] = CKEDITOR.TRISTATE_ON;
                    }

                    return  activeItems;
                }
        } );
      }
} );
CKEDITOR.config.languages = [ 'Place=http://schema.org/Place'];

Commands are not added yet.

Any help is greatly appreciated.

来源:https://stackoverflow.com/questions/16197948/ckeditor-submenu-drop-downlist-not-appearing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!