summaryrefslogtreecommitdiff
path: root/source/features/upload-button.tsx
diff options
context:
space:
mode:
authorGravatar Federico Brigante <github@bfred.it> 2019-05-24 13:45:07 +0800
committerGravatar GitHub <noreply@github.com> 2019-05-24 13:45:07 +0800
commit347b4e9db675fd404f9e47b4cf7042f9e4c0b556 (patch)
tree42dbdfe791bb2b63eb9fa9d922e15133be009ed0 /source/features/upload-button.tsx
parentf0d023d1c9f1d5171f0ffcfdb79d8d7e10012485 (diff)
downloadrefined-github-347b4e9db675fd404f9e47b4cf7042f9e4c0b556.tar.gz
refined-github-347b4e9db675fd404f9e47b4cf7042f9e4c0b556.tar.zst
refined-github-347b4e9db675fd404f9e47b4cf7042f9e4c0b556.zip
Drop `upload-button` feature and restore hiding of upload bar (#2068)
Diffstat (limited to '')
-rw-r--r--source/features/upload-button.tsx47
1 files changed, 0 insertions, 47 deletions
diff --git a/source/features/upload-button.tsx b/source/features/upload-button.tsx
deleted file mode 100644
index 64f0f3d0..00000000
--- a/source/features/upload-button.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import './upload-button.css';
-import React from 'dom-chef';
-import select from 'select-dom';
-import delegate, {DelegateEvent} from 'delegate-it';
-import features from '../libs/features';
-import * as icons from '../libs/icons';
-
-function addButtons(): void {
- for (const toolbar of select.all('form:not(.rgh-has-upload-field) markdown-toolbar')) {
- const form = toolbar.closest('form')!;
- if (!select.exists('.js-manual-file-chooser[type=file]', form)) {
- continue;
- }
-
- const toolbarGroup = select('.toolbar-group:last-child', toolbar);
- if (toolbarGroup) {
- toolbarGroup.append(
- <button type="button" className="toolbar-item rgh-upload-btn tooltipped tooltipped-nw" aria-label="Upload attachments" data-hotkey="u">
- {icons.cloudUpload()}
- </button>
- );
- form.classList.add('rgh-has-upload-field');
- }
- }
-}
-
-function triggerUploadUI({delegateTarget}: DelegateEvent<Event, HTMLButtonElement>): void {
- delegateTarget
- .form!
- .querySelector<HTMLElement>('.js-manual-file-chooser')! // Find <input [type=file]>
- .click(); // Open UI
-}
-
-function init(): void {
- addButtons();
- delegate('.rgh-upload-btn', 'click', triggerUploadUI);
-}
-
-features.add({
- id: 'upload-button',
- description: 'Add an upload button in comments for uploading attachments',
- include: [
- features.hasRichTextEditor
- ],
- load: features.onAjaxedPages,
- init
-});