-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 data-id
attribute to the button of the block menu
#12525
Conversation
This reverts commit 29db819.
可以 Review 了 |
icon: "iconList", | ||
label: window.siyuan.languages.list, | ||
accelerator: window.siyuan.config.keymap.editor.insert.list.custom, | ||
protyle, | ||
nodeElement, | ||
id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这类地方就不要修改了,以前这么写可能是有用的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和图片这个没有关系,这里不明白你为什么要修改。这个 id 以前这样写肯定是有用到的。你直接用这个id就行了,不要去修改它。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turnsOneInto、turnsIntoOne、turnsInto 我搞不懂,改回去了。
不知道该怎么给子菜单添加 data-id
const breadcrumb = nodeElement.getAttribute("breadcrumb"); | ||
window.siyuan.menus.menu.append(new MenuItem({ | ||
id: "assetSubMenu", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以前写过的不能动,否则其他地方会坏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没搞明白这里的 assetSubMenu 起什么作用。
我看代码感觉好像是用来显示子菜单之后聚焦到输入框,但我实际在思源右键弹出块的菜单之后并没有显示子菜单:
siyuan/app/src/protyle/hint/index.ts
Lines 828 to 831 in 3ba4eb7
const itemElement = window.siyuan.menus.menu.element.querySelector('[data-id="assetSubMenu"]'); | |
itemElement.classList.add("b3-menu__item--show"); | |
window.siyuan.menus.menu.showSubMenu(itemElement.querySelector(".b3-menu__submenu")); | |
window.siyuan.menus.menu.element.querySelector("textarea").focus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
真的是有用的,有个 issue 里面不是和你说了嘛。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但必须要有唯一 id 的话我不知道怎么搞,恢复成 assetSubMenu 的话就没法用 CSS 单独选择了。
你有推荐的方案吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-id
attribute to the button of the block menu
给块标菜单的 button 添加 data-id 属性 #12518
菜单太多了,我已经眼花了...
我自己感觉好像没问题,但不能保证每个添加 id 的地方都是对的,以后有问题的话再改。