diff options
-rw-r--r-- | readme.md | 2 | ||||
-rw-r--r-- | source/features/minimize-upload-bar.css | 8 | ||||
-rw-r--r-- | source/features/minimize-upload-bar.tsx | 25 |
3 files changed, 10 insertions, 25 deletions
@@ -135,7 +135,7 @@ Thanks for contributing! π¦π - [](# "edit-comments-faster") [Lets you edit any comment with one click instead of having to open a dropdown.](https://user-images.githubusercontent.com/1402241/54864831-92372a00-4d97-11e9-8c29-efba2dde1baa.png) - [](# "comment-fields-keyboard-shortcuts") [Adds a shortcut to edit your last comment: <kbd>β</kbd>.](https://github.com/sindresorhus/refined-github/pull/961) (Only works in the following comment field, if itβs empty.) - [](# "one-key-formatting") [Wraps selected text when pressing one of Markdown symbols instead of replacing it:](https://user-images.githubusercontent.com/1402241/65020298-1f2dfb00-d957-11e9-9a2a-1c0ceab8d9e0.gif) `[` `` ` `` `'` `"` `*` `~` `_` -- [](# "minimize-upload-bar") [Reduces the upload bar to a small button.](https://user-images.githubusercontent.com/55841/59802383-3d994180-92e9-11e9-835d-60de67611c30.png) +- [](# "minimize-upload-bar") [Reduces the upload bar to a small button.](https://user-images.githubusercontent.com/17612510/99140148-205dd380-2693-11eb-9a61-9c228f8f9e36.png) - [](# "clean-rich-text-editor") [Hides unnecessary comment field tooltips and toolbar items](https://user-images.githubusercontent.com/1402241/53629083-a4fe8900-3c47-11e9-8211-bfe2d254ffcb.png) (each one has a keyboard shortcut.) - [](# "monospace-textareas") Uses a monospace font for all textareas. - [](# "quick-mention") [Adds a button to `@mention` a user in conversations.](https://user-images.githubusercontent.com/1402241/70406615-f445d580-1a73-11ea-9ab1-bf6bd9aa70a3.gif) diff --git a/source/features/minimize-upload-bar.css b/source/features/minimize-upload-bar.css index d320347a..e046dbbd 100644 --- a/source/features/minimize-upload-bar.css +++ b/source/features/minimize-upload-bar.css @@ -7,3 +7,11 @@ border-bottom-style: solid; border-radius: 6px; } + +/* Show upload image button in PR minimized upload bar for desktop */ +@media (min-width: 768px) { + .rgh-minimize-upload-bar .js-previewable-comment-form label[aria-label='Attach an image'] { + display: block !important; + padding: 4px !important; + } +} diff --git a/source/features/minimize-upload-bar.tsx b/source/features/minimize-upload-bar.tsx index a8d51bd3..73dc8cd9 100644 --- a/source/features/minimize-upload-bar.tsx +++ b/source/features/minimize-upload-bar.tsx @@ -1,33 +1,10 @@ import './minimize-upload-bar.css'; -import React from 'dom-chef'; -import select from 'select-dom'; -import delegate from 'delegate-it'; -import UploadIcon from 'octicon/upload.svg'; import * as pageDetect from 'github-url-detection'; import features from '.'; -function addButton(): void { - for (const toolbarButton of select.all('md-ref')) { - toolbarButton.after( - <button type="button" className="toolbar-item tooltipped tooltipped-n rgh-upload-btn" aria-label="Attach files"> - <UploadIcon/> - </button> - ); - toolbarButton.closest('form')!.classList.add('rgh-minimize-upload-bar'); - } -} - -function triggerUpload(event: delegate.Event<Event, HTMLButtonElement>): void { - event.delegateTarget - .form! - .querySelector<HTMLInputElement>('[type="file"]')! - .click(); // Open UI -} - function init(): void { - addButton(); - delegate(document, '.rgh-upload-btn', 'click', triggerUpload); + document.body.classList.add('rgh-minimize-upload-bar'); } void features.add(__filebasename, { |