Skip to content

嵌套的第三层toolbar不能正常显示 #1778

@lyidle

Description

@lyidle

你在什么场景下需要该功能?

嵌套的toolbar不能正常显示,只能第一层点击打开,然后第二层点击时打不开第三层的菜单
或者有办法能够修改导出的html的样式和信息么

描述最优的解决方案

能够显示第三层的子菜单,或者开放导出对应的文件的处理接口

描述候选解决方案

其他信息

示例代码:

      // 工具栏
      toolbar: [
        // more
        {
          name: "mores",
          tip: "更多",
          tipPosition: "n",
          icon: '<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M5 10c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2m14 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2m-7 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2"/></svg>',
          click: () => {},//这里的click省略也会报错,Uncaught TypeError: menuItem.click is not a function
    at HTMLButtonElement.<anonymous> (vditor.js?v=16444e99:11747:30)
          toolbar: [
            {
              name: "exports",
              tip: "导出",
              icon: "导出",
              click: (event, vditor) => {
                console.log(event, vditor)
                // 怎么处理 才能够 打开 下方的 菜单
              },
              toolbar: [
                {
                  name: "export-html",
                  icon: "HTML",
                  click: () => {
                    const htmlContent = vditor.value?.getHTML()
                    console.log(htmlContent) // 输出 HTML 内容
                  },
                },
                {
                  name: "export-pdf",
                  icon: "PDF",
                  click: () => {
                    // console.log(pdfContent) // 输出 PDF 内容
                  },
                },
                {
                  name: "export-md",
                  icon: "MARKDOM",
                  click: () => {
                    const markdownContent = vditor.value?.getValue() // 获取当前内容
                    console.log(markdownContent) // 输出 Markdown 内容
                  },
                },
              ],
            },
            "outline",
            "help",
          ],
        },
      ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions