Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Icons #747

Closed
warmwhisky opened this issue Jun 7, 2021 · 2 comments
Closed

Disable Icons #747

warmwhisky opened this issue Jun 7, 2021 · 2 comments

Comments

@warmwhisky
Copy link

Is there a way to disable icons?

I have tried using fontawesome but cannot get that to work. The documentation says you simply add the fontawesome css and you're ready to go. But that does not work. I don't want to import context-menu-icons.woff2 fonts as I do not use them.

Ultimately I need to use HTML Hex codes for music notation like this "𝅘𝅥𝅮" I have tried to add that in with the title but alas it just renders the Hex code and not the icon.

Any help would be appreciated.

Thanks

@brunoinds
Copy link

Did you ever tried to do not pass the icon property to the items?

Passing only the name, the icon will not be rendered.

const data = {
  firstItem: {name: 'First item text'},
  secondItem: {name: 'Second item text'},
  thirdItem: {name: 'Third item text'}
}
$.contextMenu({
    selector: 'path > to > element',
    build: ($triggerElement, e) => {
        const data = {
            firstItem: {name: 'First item text'},
            secondItem: {name: 'Second item text'},
            thirdItem: {name: 'Third item text'}
        }
        return {
            callback: (key, options) => {},
            items: data
        };
    }
});

@warmwhisky
Copy link
Author

@brunoinds Hey thanks for the pointer. I had not actually tried that until yesterday. and then figured out how to get my own html icon using the following.

items: {
    "whole": {name: "Whole Note", icon: function (opt, itemElement, itemKey, item) {
            itemElement.html(`<span class="context_menu_icon active" aria-hidden="true">&#119133;</span> ${item.name}`);
            return 'context-menu-icon-updated';
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants