summaryrefslogtreecommitdiff
path: root/source/features/upload-button.tsx
diff options
context:
space:
mode:
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
-});