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

feat : allow dropdown menu on toolbar to group secondary buttons #141

Merged
merged 7 commits into from
Mar 8, 2020

Conversation

firm1
Copy link

@firm1 firm1 commented Jan 22, 2020

This PR allow to groups somes buttons in dropdown menu.

Result give something like screenshot

Capture d’écran de 2020-01-22 22-57-00

Copy link

@Situphen Situphen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the code and here are my two cents. Of course @Ionaru as the last word.

src/js/easymde.js Outdated Show resolved Hide resolved
src/js/easymde.js Outdated Show resolved Hide resolved
src/css/easymde.css Outdated Show resolved Hide resolved
@firm1
Copy link
Author

firm1 commented Jan 23, 2020

Thank you @Situphen for your review, I updated the code with your suggests.

@Ionaru , you can decide now.

@A-312
Copy link

A-312 commented Jan 24, 2020

fix: #129 *

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Owner

@Ionaru Ionaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from testing:

  1. The dropdown toolbar buttons seem to inherit the action of the top-level button, for example
new EasyMDE({
    toolbar: [{
        name: 'bold',
        action: EasyMDE.toggleBold,
        className: 'fa fa-bold',
        title: 'Bold',
        children: [
            {
                name: "italic",
                action: EasyMDE.toggleItalic,
                className: "fa fa-italic",
                title: "Italic",
            }
        ]
    }
});

Using the dropdown and clicking the toggleItalic button will trigger both toggleBold and toggleItalic.

  1. I'd like there to be some indication of a dropdown being present on a button, currently when looking at the toolbar there is no way to know if there are any dropdowns and users will have to test each button.

  2. Dropdowns that open when hovering do not provide a great mobile experience, is there anything we can do to improve that? Having an indicator might solve this as well.

@firm1
Copy link
Author

firm1 commented Jan 27, 2020

Very good remarks, thanks. I'll take care of your suggestions.

@A-312
Copy link

A-312 commented Jan 27, 2020

  1. We can use on ::before or ::after

@firm1
Copy link
Author

firm1 commented Jan 28, 2020

Hi @Ionaru ,
I've considered all your comments, can you check that it corresponds to what is expected ?

Capture d’écran de 2020-01-28 18-58-12

Cheers,

@firm1
Copy link
Author

firm1 commented Jan 28, 2020

Else, if you prefer, i have this style too.

Capture d’écran de 2020-01-28 21-33-12

Capture d’écran de 2020-01-28 21-33-06

@Ionaru
Copy link
Owner

Ionaru commented Jan 29, 2020

A small thing I've noticed is that the noDisable flag doesn't get applied properly, the button is no longer clickable when in preview-mode, but the cursor still turns into a pointer when hovering over the dropdown.
image

@firm1
Copy link
Author

firm1 commented Feb 2, 2020

I @Ionaru i can't reproduce your last problem.

Can you give me your html example file and your browser name and version please ?

@Ionaru
Copy link
Owner

Ionaru commented Feb 6, 2020

    new EasyMDE({
        autoDownloadFontAwesome: false,
        toolbar: [{
            name: 'bold',
            className: 'fa fa-bold',
            title: 'Bold',
            noDisable: true,
            children: [
                {
                    name: "italic",
                    action: EasyMDE.toggleItalic,
                    className: "fa fa-italic",
                    title: "Italic",
                }
            ]
        }]
    });

Then enable preview mode and hover over the italic button.

@A-312
Copy link

A-312 commented Feb 11, 2020

@Ionaru In the master branch, I get the same behavior of this PR
image

@A-312
Copy link

A-312 commented Mar 1, 2020

ping @Ionaru can you explain more that we should get ? because on master branch I got the same behavior

@Ionaru
Copy link
Owner

Ionaru commented Mar 1, 2020

Hmm alright if it's the same on master then it's fine I suppose

@A-312
Copy link

A-312 commented Mar 2, 2020

Hmm alright if it's the same on master then it's fine I suppose

If you want that we fix this issue, we need to understand the behavior of this property. But we are waiting this PR, maybe we can open a ticket ?

@Ionaru Ionaru self-requested a review March 5, 2020 23:44
@Ionaru
Copy link
Owner

Ionaru commented Mar 6, 2020

@A-312 @firm1 I've made a small change to the dropdown code to allow the dropdown to use the built-in button shortcuts.

new EasyMDE({
    toolbar: [{
        name: 'Text tools',
        className: 'fas fa-edit',
        title: 'Common text edit tools',
        noDisable: true,
        children: ['bold', 'italic'],
    }],
});

Please check if the code is also still valid for your use-cases.

@A-312
Copy link

A-312 commented Mar 6, 2020

firm1 has less time to review, I will review this evening.

@A-312
Copy link

A-312 commented Mar 8, 2020

I have forgotten to review this PR, I did, this seem OK for me.

@Ionaru Ionaru merged commit 3096bbe into Ionaru:master Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants