Add Custome context menus and options to Right Click Menu App

Hello,

I hope this message finds you well.

I am currently experiencing an issue with the custom context menu in Nextcloud.

Specifically, the custom context menu items do not appear when I right-click on files or folders.

I have followed the necessary steps to implement the custom context menu as per the documentation,

but it seems that the menu is not showing up as expected.

Here are some details about my setup:

  • Nextcloud version: Nextcloud Hub 9 (30.0.0)

  • Steps taken:

(function(OCA) {
    'use strict';

    OCA.Files = OCA.Files || {};

    function addCustomMenuItem() {
        OCA.Files.fileActions.registerAction({
            name: 'myCustomAction',
            displayName: 'My Custom Action',  
            mime: 'all',
            permissions: OC.PERMISSION_READ,
            icon: OC.imagePath('core', 'actions/info'),
            actionHandler: function(fileName, context) {
                var fileInfo = context.fileInfoModel.getFullPath();
                OC.dialogs.info('Selected file: ' + fileInfo, 'My Custom Action');
            }
        });
    }

   
    addCustomMenuItem();

})(OCA);

I would appreciate any guidance or suggestions on how to resolve this issue.

Thank you for your assistance!

Best regards,



鞀ろ伂毽办兎 2024-09-27 074844

Is there anything logged in the browser console? What happens?

If possible share a link to the repository you are working on. This makes it much simpler to give it a try.

Thank you so much for your reply. I鈥檝e spent a week trying to solve this issue.

The code I came up with is a mess, and I鈥檝e decided to start from scratch.

Do you have any examples or references for using a custom context menu in version 30?

I would greatly appreciate any recommendations.

Thank you again for your kind response.

By taking it step by step, I was able to resolve it. :grinning:

https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.html#front-end-changes