-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Button tooltips in the demo #650
Comments
Even having title tags to get a label on hover would help quite a bit |
Is it actually possible to get tooltips?? We've had the same request, it would be great to be able to attach tooltips to each of the tools in the toolbar. |
There is now an example using bootstrap. I'm hesitant to add this Quill core since users are likely to be opinionated with UI and want to customize, which would add a lot of complexity and weight into Quill, and so is better handled by other libraries. |
@jhchen You were right. This example tripped me up a bit when learning about quill. I just realized that the data-toggle is a bootstrap thing and you're passing in the html (with the tooltip data-toggle) rather than making quill generate it in the html. To deal with not having to write custom html for the toolbar buttons, I did this:
|
It would be nice to have it included. Even basic accessibility is better than nothing. let toolbarOptions = [
[
{ 'bold': { tooltip: "Bold (Ctrl+B)" } }, 'italic', 'underline', 'strike'
]
]; Generated via options: <button type="button" class="ql-bold" data-tooltip="Bold (Ctrl+B)"></button> User style sheet: [data-tooltip] {
content: attr(data-tooltip);
display: none;
// however people wanna style it..
}
[data-tooltip]:hover {
display: block; // or something..
} There's already an issue #1084 that touches on this, though that proposition is more generic. |
Any way to make Angular's transclusion and Angular Material (present in my project/component) work instead of Bootstrap?
|
Try adding like this
|
Modified the previous suggestion to allow tooltips also for button with values and also pickers..
|
|
Modified previous to work with angular 9 and multi language
|
Is there any good solution for react? |
Working in my case, Tooltip without HTML Toolbar. |
didn't want to match all controls with a text, so I used class names to add a title attribute to all of them: editor.previousSibling.querySelectorAll('select,button').forEach((el) => {
let title = el.className.replace(/^ql|-/g, ' ').trim();
if (el.value) title += ' ' + el.value;
if (el.tagName === 'SELECT') el = el.previousSibling;
el.setAttribute('title', title.charAt(0).toUpperCase() + title.slice(1));
});
// class="ql-bold" => "Bold"
// class="ql-script" value="super" => "Script super" This way you'll have, at least, a default value for all of them. I guess you could use then a map to fix some of them you don't like. Like so:
And then insert after value = map[value] || map; |
For the react devs who Lazy Load their editors and use react-quill:
Just import it where you want and use it as if you're using I believe this to be a good dynamic solution that does not require me to do much manual labor and maintenance. At least for my use case. Hope it helps. |
const buttons = document.querySelectorAll('.ql-toolbar button');
|
It'll be nice to have tooltips for the buttons in the new demos.
http://quilljs.com/
http://beta.quilljs.com/docs/formats/
http://beta.quilljs.com/docs/themes/snow/
Version: [version]
1.0-Beta.0
The text was updated successfully, but these errors were encountered: