Refined-github: `copy-file` appears on rendered markdown files (and fails)

Created on 31 Mar 2020  路  2Comments  路  Source: sindresorhus/refined-github

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)

bug help wanted

All 2 comments

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?

I don鈥檛 think so. That condition means: if there鈥檚 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鈥檚 not finding the rendered markdown body, so it thinks there鈥檚 already source code on the page, which means that the Copy button works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

supremebeing7 picture supremebeing7  路  3Comments

juliocanares picture juliocanares  路  3Comments

sompylasar picture sompylasar  路  3Comments

vanniktech picture vanniktech  路  3Comments

MilesBHuff picture MilesBHuff  路  3Comments