Move to new Uppy handling in discourse/discourse
Dieser Commit ist enthalten in:
Ursprung
0e70a5a221
Commit
6a4063951e
1 geänderte Dateien mit 5 neuen und 17 gelöschten Zeilen
|
@ -29,6 +29,7 @@ export default ComposerEditor.extend({
|
|||
draftStatus: "null",
|
||||
replyPlaceholder: alias("field.translatedPlaceholder"),
|
||||
wizardEventFieldId: null,
|
||||
composerEventPrefix: "wizard-editor",
|
||||
|
||||
@on("didInsertElement")
|
||||
_composerEditorInit() {
|
||||
|
@ -77,24 +78,11 @@ export default ComposerEditor.extend({
|
|||
$input.on("scroll", this._throttledSyncEditorAndPreviewScroll);
|
||||
this._bindUploadTarget();
|
||||
|
||||
const wizardEventNames = ["insert-text", "replace-text"];
|
||||
const eventPrefix = this.eventPrefix;
|
||||
this.appEvents.reopen({
|
||||
trigger(name, ...args) {
|
||||
let eventParts = name.split(":");
|
||||
let currentEventPrefix = eventParts[0];
|
||||
let currentEventName = eventParts[1];
|
||||
const field = this.field;
|
||||
this.editorInputClass = `.${dasherize(field.type)}-${dasherize(field.id)} .d-editor-input`;
|
||||
|
||||
if (
|
||||
currentEventPrefix !== "wizard-editor" &&
|
||||
wizardEventNames.some((wen) => wen === currentEventName)
|
||||
) {
|
||||
let wizardEventName = name.replace(eventPrefix, "wizard-editor");
|
||||
return this._super(wizardEventName, ...args);
|
||||
} else {
|
||||
return this._super(name, ...args);
|
||||
}
|
||||
},
|
||||
this._uppyInstance.on('file-added', (file) => {
|
||||
this.session.set("wizardEventFieldId", field.id);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Laden …
In neuem Issue referenzieren