-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Desktop: add button to About box to copy Joplin's information to the clipboard #2711
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
Conversation
On certain OS it is not possible to copy the text in the About window. This change allows to copy that info to the Clipboard. Due to some shortfalls in Electron, it is not possible to set `defaultId` and `cancelId` to 0. (Actually one can set them to 0, but the result is not what one would expect.) Thus I had to move the default `OK` button to the left. I also added a hack to position the `OK` button approximately in the middle of the dialog box (if the copyLabel is not longer than 14 characters).
Sounds good, but how does it look if you don't add spacing hack? If it looks good enough, I'd prefer if we could avoid the hack. |
ElectronClient/app.js
Outdated
const copyToClipboard = bridge().showConfirmMessageBox(text, { | ||
icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`, | ||
buttons: [spacer + copyLabel + spacer, _('OK')], | ||
defaultId: 1, | ||
}); | ||
if (copyToClipboard) { | ||
clipboard.writeText(text); | ||
} |
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.
Rather than overriding the behaviour of the showConfirmMessageBox
, could you create a new bridge function showMessageBox
, which calls showMessageBox_
and that can be used for special cases like this one, and that would return the exact buttonId that was clicked on?
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.
Sure, will do. I'll do this in the afternoon.
I think it looks good enough without the hack. I'm worry that a future upgrade of Electron would break the hack, or that it works on macOS but not on Windows or Linux, so if you could remove it that would be great. |
Not sure why Electron would break the hack, since it has nothing to do with Electron. It just makes the |
The function returns the index of the clicked button.
Done. |
Ready to merge. |
Anything still missing? |
Looks good, thanks @tessus! |
Thanks, I try to get a few PRs merged, since I am only allowed to merge doc and translation PRs. They are piling up and at one point it becomes unmanageable. |
Well GSoC is making the project busy, but it doesn't matter, the pull requests will be reviewed eventually. It will take the time it will take. |
As long as you are not overwhelmed with all these PRs I agree. |
On certain OS it is not possible to copy the text in the About window.
This change allows to copy that info to the Clipboard.
Due to some shortfalls in Electron, it is not possible to set
defaultId
andcancelId
to 0.(Actually one can set them to 0, but the result is not what one would expect.)
Thus I had to move the default
OK
button to the left.I also added a hack to position the
OK
button approximately in the middle of the dialog box (if the copyLabel is not longer than 14 characters).