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

Add plugin method updateProtyleToolbar #24

Closed
Achuan-2 opened this issue Nov 6, 2024 · 7 comments
Closed

Add plugin method updateProtyleToolbar #24

Achuan-2 opened this issue Nov 6, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@Achuan-2
Copy link
Member

Achuan-2 commented Nov 6, 2024

目前需要罗列所有的工具栏元素,然后再在最后添加插件按钮
会造成两个问题

  1. 两个插件如果都要往工具栏添加按钮,就会只显示一个插件的
  2. 插件的toolbar如果没有罗列全,工具栏的按钮就会不全,存在一定风险(因此会造成问题1)
  3. 关闭插件,toolbar不会自动删除,需要用开发者工具刷新下
        this.protyleOptions = {
            toolbar: ["block-ref",
                "a",
                "|",
                "text",
                "strong",
                "em",
                "u",
                "s",
                "mark",
                "sup",
                "sub",
                "clear",
                "|",
                "code",
                "kbd",
                "tag",
                "inline-math",
                "inline-memo",
                "|",
                {
                    name: "insert-smail-emoji",
                    icon: "iconEmoji",
                    hotkey: "⇧⌘I",
                    tipPosition: "n",
                    tip: this.i18n.insertEmoji,
                    click(protyle: Protyle) {
                        protyle.insert("😊");
                    }
                }],
        };
@Vanessa219
Copy link
Member

添加一个相关的 add 和 remove 方法可否够用?

@Achuan-2
Copy link
Member Author

Achuan-2 commented Nov 7, 2024

添加一个相关的 add 和 remove 方法可否够用?

够用的,之后有需求再说

Vanessa219 added a commit that referenced this issue Nov 7, 2024
@Vanessa219 Vanessa219 changed the title 工具栏添加插件按钮的示例存在问题 Add plugin method updateProtyleToolbar Nov 7, 2024
Vanessa219 added a commit that referenced this issue Nov 7, 2024
Vanessa219 added a commit to siyuan-note/petal that referenced this issue Nov 7, 2024
Vanessa219 added a commit to siyuan-note/siyuan that referenced this issue Nov 7, 2024
@Vanessa219
Copy link
Member

更改为,你试试看

 public updateProtyleToolbar(toolbar: Array<string | IMenuItem>) {
        return toolbar;
    }

@Achuan-2
Copy link
Member Author

Achuan-2 commented Nov 8, 2024

可以了,辛苦🙇‍♂️

@Achuan-2
Copy link
Member Author

Achuan-2 commented Nov 8, 2024

@Vanessa219
发现启动插件时,工具栏不会及时添加按钮,需要在开发者工具刷新下才添加成功添加
关闭插件也是,关闭后需要在开发者工具刷新
这个能解决下吗

Vanessa219 added a commit to siyuan-note/siyuan that referenced this issue Nov 11, 2024
@Vanessa219
Copy link
Member

再试试看

@Achuan-2
Copy link
Member Author

再试试看

@Vanessa219 可以了,辛苦V姐

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

No branches or pull requests

2 participants