Skip to content

Conversation

@nathan-castlehow
Copy link
Contributor

@nathan-castlehow nathan-castlehow commented Jun 9, 2019

image

Description

Apologies in advance if i have missed steps here. First time contributing to this repo.
This adds a context menu to the Markdown Preview mode with the usual options + the new Copy Url option when right clicking a hyperlink.

Issue fixed

#3058

Type of changes

  • ⚪ Bug fix (Change that fixed an issue)
  • ⚪ Breaking change (Change that can cause existing functionality to change)
  • ⚪ Improvement (Change that improves the code. Maybe performance or development improvement)
  • 🔘 Feature (Change that adds new functionality)
  • ⚪ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • 🔘 My code follows the project code style
  • 🔘 I have written test for my code and it has been tested
  • 🔘 All existing tests have been passed
  • 🔘 I have attached a screenshot/video to visualize my change if possible

@ZeroX-DG ZeroX-DG added the awaiting review ❇️ Pull request is awaiting a review. label Jun 10, 2019
@evanpetridis
Copy link

I was wondering why there was no 'Copy Url' on that context menu. Great addition. Hope it makes it through review.

}
const menu = buildMarkdownPreviewContextMenu(this, event)
if (menu != null) {
setTimeout(() => menu.popup(remote.getCurrentWindow()), 30)
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need setTimeout here?

Copy link
Contributor Author

@nathan-castlehow nathan-castlehow Jun 15, 2019

Choose a reason for hiding this comment

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

Hmm great question. Copied this from the Code editor context menu, it has the same behaviour. Do we know why it was added in there? Might be worth just removing it in both places?

Copy link
Member

Choose a reason for hiding this comment

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

That code was added in this PR: #2338. @ehhc can you explain why you need setTimeout there?

Copy link
Contributor

Choose a reason for hiding this comment

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

To be honest, i can't remember.
Only thing i might imagine is, that setTimeout forces it to be in a separated thread --> not blocking the main gui...
But: there is a good chance, that that's bullshit...

Does it work without the timeout? If yes, feel free to remove it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ZeroX-DG thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

You heard from the master himself:

Does it work without the timeout? If yes, feel free to remove it :)
@ehhc - 2019

Choose a reason for hiding this comment

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

I have been hoping that this feature would be merged into the base branch. The fact that the original author can not remember why setTimeout was used is in itself a worry. If setTimeout is removed, the code may work in whatever preliminary testing that it gets, but may fail in some rare timing case in the future. 30ms is not a long time to wait for a menu to appear. I'd say leave it in and move on.

Copy link
Contributor

Choose a reason for hiding this comment

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

@evanpetridis you're right, it is a worry. unfortunately, i cannot do anything about it anymore. Cannot force my way to remember things, i forgot. Nonetheless, at that time i worked with a lot of already existing code, modified it, deleted it, and added new code. All in all i did a lot of work concerning the attachment management of boostnote. I fear, in that context, it's possible to forget the reasons for some things. Even moren, when it's not even clear whether i added it or reused code, i found at other locations in the code base.
And i have to admit, that i, at that point in time and still, am not the expert concerning the technolgies used in boostnote. I hoped for a good codereview to find potential bugs but there is nothing more, i could do about it..

sorry if that's not what you wannted to hear.

Choose a reason for hiding this comment

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

@ehhc Hi ehhc, my message wasn't very clear. I think that you did the correct thing leaving that code where you did. Well done for actively contributing to open source software :). My point was that because we don't know why it is there, it's an unnecessary danger to remove it. It has no effect leaving it there but we have no idea what the effect of removing it is. I just hope that if the changes that @nathan-castlehow added get sufficiently commented before the changes get merged into the base branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ZeroX-DG i removed it from the preview context menu and it seems ok. I also removed the cut and paste options from the preview context menu as they aren't relevant.

@ZeroX-DG ZeroX-DG added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. approved 👍 Pull request has been approved by sufficient reviewers. and removed awaiting review ❇️ Pull request is awaiting a review. awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. labels Jul 20, 2019
Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@ZeroX-DG ZeroX-DG requested a review from Rokt33r July 20, 2019 00:36
@Rokt33r Rokt33r removed the approved 👍 Pull request has been approved by sufficient reviewers. label Jul 22, 2019
@Rokt33r Rokt33r added this to the v0.12.0 milestone Jul 22, 2019
@Rokt33r Rokt33r merged commit f88fc23 into BoostIO:master Jul 22, 2019
@nathan-castlehow nathan-castlehow deleted the feat-add-copy-url-option-in-markdown-preview branch July 22, 2019 23:54
@Flexo013
Copy link
Contributor

Flexo013 commented Jul 24, 2019

This PR conflicts with the switch preview setting 'on right click'. See #3144.

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.

6 participants