diff --git a/lib/client/menu/menu-io.css b/lib/client/menu/menu-io.css index 9e030876..2d590402 100644 --- a/lib/client/menu/menu-io.css +++ b/lib/client/menu/menu-io.css @@ -40,6 +40,11 @@ white-space: pre; } +.menu-item::after { + content: attr(data-key); + float: right; +} + .menu-item:hover { background-color: #e3f2ff; } diff --git a/lib/client/menu/menu-io.js b/lib/client/menu/menu-io.js index 74064a7c..6234c032 100644 --- a/lib/client/menu/menu-io.js +++ b/lib/client/menu/menu-io.js @@ -59,6 +59,7 @@ var MenuIO, Util; items = '', buildItems = function(menuData, path) { var DATA_MENU = 'data-menu="js-submenu"', + Data_KEY = 'data-key=', items = ''; if (path) @@ -68,6 +69,7 @@ var MenuIO, Util; Object.keys(menuData).forEach(function(name) { var nameIcon, + key = '', subitems = '', className = '', attribute = '', @@ -92,6 +94,13 @@ var MenuIO, Util; className += ' icon icon-' + nameIcon; } + if (Options.keys) { + key = Options.keys[name]; + + if (key) + attribute = ' ' + Data_KEY + key; + } + items += Util.render(TEMPLATE.ITEM, { name : name, subitems : subitems, diff --git a/lib/client/menu/package.json b/lib/client/menu/package.json index a21d3194..c7ffcd8a 100644 --- a/lib/client/menu/package.json +++ b/lib/client/menu/package.json @@ -1,6 +1,6 @@ { "name": "menu", - "version": "0.6.4", + "version": "0.7.0", "author": "coderaiser (https://github.com/coderaiser)", "description": "Simple css-based multillevel context menu", "homepage": "http://coderaiser.github.io/menu",