swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

Seeking an official way to change context menu items style #753

Closed Paper-Folding closed 2 years ago

Paper-Folding commented 2 years ago

I was passing style and customized icon class via icon properties like this (fw-bold and fs-4 are Bootstrap style classes):

$('.playlist').contextMenu({
    selector: 'li',
    build: function (target, e) {
         // some code unrelated to this issue
    },
    callback: function (key, options) {
          // some code unrelated to this issue
    },
    items: {
        "info": { name: "乐正绫 - 返夏", disabled: true , icon:" pi-right-arrow fw-bold fs-4"},
        "play": { name: "Play Instantly", icon: " pi-file-play-fill" },
        "play-next": { name: "Play Next", icon: " pi-plus" }
    }
})

And it actually do the trick as shown below:

image

I wonder if there is an official way to achieve this.