sindresorhus/refined-github

`copy-file` appears on rendered markdown files (and fails) #2957

fregante posted onGitHub

There used to be a condition/events that made the Copy button appear only when showing the source code.

  1. Visit https://github.com/DrewML/GifHub/blob/master/LICENSE.md
  2. Notice Copy button (it shouldn't be there)
  3. Switch to see the source (it works now)

<img width="749" alt="" src="https://user-images.githubusercontent.com/1402241/77974217-bf95ac80-72f6-11ea-82d7-612677479b5f.png">


Looked into the issue The following line is failing. https://github.com/sindresorhus/refined-github/blob/7acf404e09a0fc36d555f32a9a3cef07207b4f3c/source/features/copy-file.tsx#L45

I looked back to see what the was added for (Thanks deep-reblame)

https://github.com/sindresorhus/refined-github/blob/798e21ee06ea18286c456e585f053397c66e423b/source/features/copy-file.tsx#L17

@fregante if this is loaded after the markdown buttons I think it should be safe to remove the entire exists no?

posted by yakov116 about 5 years ago

I don’t think so. That condition means: if there’s markdown currently on the page, wait for the other feature to show the code and THEN add the button.

The condition is probably failing because it’s not finding the rendered markdown body, so it thinks there’s already source code on the page, which means that the Copy button works.

posted by fregante about 5 years ago

Fund this Issue

$0.00
Funded

Pull requests