-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
🎨 Improve tooltip #13476
base: dev
Are you sure you want to change the base?
🎨 Improve tooltip #13476
Conversation
- 优化元素更新 - 改变 hideTooltip() 的方式为添加类名 .fn__none - 增加 .tooltip--tab_header
另外还需要在页面加载出来之后就添加 #tooltip 元素,然后 |
改了一下 |
@@ -170,7 +170,7 @@ ${unicode2Emoji(item.unicode, undefined, false, true)}</button>`; | |||
window.siyuan.config.editor.emoji.forEach(emojiUnicode => { | |||
const emoji = recentEmojis.filter((item) => item.unicode === emojiUnicode); | |||
if (emoji[0]) { | |||
recentHTML += `<button data-unicode="${emoji[0].unicode}" class="emojis__item ariaLabel" aria-label="${getEmojiDesc(emoji[0])}"> | |||
recentHTML += `<button data-unicode="${emoji[0].unicode}" class="emojis__item ariaLabel" data-tooltipclass="emoji" aria-label="${getEmojiDesc(emoji[0])}"> |
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.
data-tooltipclass="emoji"
的作用是给 tooltip 元素添加一个 .tooltip--emoji 的类名,思源没有对应的样式,因为这个是我做主题需要用的。
冲突我解决了。
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.
<div class="fn__hr"></div>
.fn__none 的用途是配合 CSS 和 JS 实现这样的效果:
video.webm
顺便分享一下主题用的对应代码片段:
更新:发现纯 CSS 就能实现,不过需要 tooltip 元素一开始就存在