【问题标题】:Is is Possible to have nested Context Menus in Sublime Text 2/3?Sublime Text 2/3 中是否可以嵌套上下文菜单?
【发布时间】:2014-10-13 18:02:14
【问题描述】:

Sublime Text 的上下文菜单有一些默认项目,如复制、剪切、粘贴、全选等...我知道我们可以通过配置添加/删除项目,但我们可以有嵌套菜单(菜单中的菜单),如我们有 chrome 或 notepad++。

【问题讨论】:

    标签: contextmenu sublimetext


    【解决方案1】:

    我可能不完全理解您的问题,我们当然可以使用嵌套菜单(菜单中的菜单)自定义上下文菜单,我们需要做的就是在“Packages\User”文件夹下创建一个“Context.sublime-menu”文件, 像这样创建自定义菜单项:

    [
        {
            "caption": "-",
            "id": "separator"
        },
        {
            "caption": "First Level Menu",
            // "mnemonic": "f",
            "id": "firstlevelmenu",
            "children":
            [
                {
                    "command": "Command1",
                    "caption": "command1"
                },
                {
                    "command": "Command2",
                    "caption": "command2"
                },
                {
                    "caption": "Second Level Menu",
                    "children":
                    [
                        {
                            "command": "Command3",
                            "caption": "command3"
                        },
                        {
                            "command": "Command4",
                            "caption": "command4"
                        }
                    ]
                },            
            ]
        },
        {
            "caption": "-",
            "id": "separator"
        }
    ]
    

    关键字“children”是创建子菜单的关键字。

    希望对你有帮助。

    【讨论】:

    • 谢谢,默认菜单是平面菜单,我没有足够的 json 知识来了解“children”关键字。
    猜你喜欢
    • 1970-01-01
    • 2023-03-12
    • 2019-05-03
    • 2013-08-20
    • 2014-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多