Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

DEV: Use UppyUploadMixin for docked-upload #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/javascripts/discourse/components/docked-editor.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default DEditor.extend({
const $element = $(this.element);
const $editorInput = $element.find('.d-editor-input');
this._applyMentionAutocomplete($editorInput);
this._textarea = this.element.querySelector("textarea.d-editor-input");
this._$textarea = $(this._textarea);
this.set("ready", true);
},

_applyMentionAutocomplete($editorInput) {
Expand Down
21 changes: 12 additions & 9 deletions assets/javascripts/discourse/components/docked-upload.js.es6
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import UploadMixin from "discourse/mixins/upload";
import UppyUploadMixin from "discourse/mixins/uppy-upload";
import Component from "@ember/component";

export default Component.extend(UploadMixin, {
tagName: 'button',
classNames: 'docked-upload btn btn-small',
attributeBindings: ['uploading:disabled'],
type: 'PUT',
export default Component.extend(UppyUploadMixin, {
id: "docked-upload",
tagName: "button",
type: "quick_message_upload",
classNames: "docked-upload btn btn-small",
attributeBindings: ["uploading:disabled"],
fileInputSelector: ".docked-upload-file-input",

input() {
return $(this.element).find('input');
return $(this.element).find("input");
},

click(e) {
if (!$(e.target).is('input')) {
this.input().trigger('click');
if (!$(e.target).is("input")) {
this.input().trigger("click");
}
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
</div>
{{else}}
{{d-icon "far-image" class='qm-upload-picture'}}
<input disabled={{uploading}} type="file" multiple/>
<input class="docked-upload-file-input" disabled={{uploading}} type="file" multiple/>
{{/if}}
5 changes: 4 additions & 1 deletion assets/javascripts/discourse/widgets/docked-post.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class QuickPostCooked extends PostCooked {
const $html = $(`<div class='cooked'>${this.attrs.cooked}</div>`);
this._insertQuoteControls($html);
this._showLinkCounts($html);
this._fixImageSizes($html);

// removed inhttps://github.com/discourse/discourse/commit/e305365168528883872d4ce9efd109e41149ef0a
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was broken in main for this repo, I could not do this fix without commenting this out, a further fix will need to be made here (or it could possibly be removed altogether, I didn't look into it)

// this._fixImageSizes($html);

this._applySearchHighlight($html);
return $html[0];
}
Expand Down