Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
COMPATIBILITY: composer upload and text manipulation has been refactored again
Dieser Commit ist enthalten in:
Ursprung
4e4a9c751b
Commit
90e4036364
4 geänderte Dateien mit 14 neuen und 8 gelöschten Zeilen
|
@ -26,10 +26,13 @@ export default class CustomWizardComposerEditor extends ComposerEditor {
|
|||
|
||||
init() {
|
||||
super.init(...arguments);
|
||||
this.fileUploadElementId = `file-uploader-${dasherize(this.field.id)}`;
|
||||
this.editorInputClass = `.${dasherize(this.field.type)}-${dasherize(
|
||||
this.uppyComposerUpload.fileUploadElementId = `file-uploader-${dasherize(
|
||||
this.field.id
|
||||
)} .d-editor-input`;
|
||||
)}`;
|
||||
this.uppyComposerUpload.editorInputClass = `.${dasherize(
|
||||
this.field.type
|
||||
)}-${dasherize(this.field.id)} .d-editor-input`;
|
||||
this.uppyComposerUpload.composerModel = this.composer;
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
|
@ -92,7 +95,9 @@ export default class CustomWizardComposerEditor extends ComposerEditor {
|
|||
@action
|
||||
showUploadModal() {
|
||||
this.session.set("wizardEventFieldId", this.field.id);
|
||||
document.getElementById(this.fileUploadElementId).click();
|
||||
document
|
||||
.getElementById(this.uppyComposerUpload.fileUploadElementId)
|
||||
.click();
|
||||
}
|
||||
|
||||
_uploadDropTargetOptions() {
|
||||
|
|
|
@ -12,7 +12,8 @@ export default Component.extend({
|
|||
"showPreview:show-preview:hide-preview",
|
||||
],
|
||||
|
||||
didInsertElement() {
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set(
|
||||
"composer",
|
||||
EmberObject.create({
|
||||
|
|
|
@ -75,13 +75,13 @@ export default {
|
|||
this.session.wizardEventFieldId === this.fieldId &&
|
||||
this.element
|
||||
) {
|
||||
this.insertText(text, options);
|
||||
this.textManipulation.insertText(text, options);
|
||||
}
|
||||
},
|
||||
|
||||
_wizardReplaceText(oldVal, newVal, opts = {}) {
|
||||
if (this.session.wizardEventFieldId === this.fieldId) {
|
||||
this.replaceText(oldVal, newVal, opts);
|
||||
this.textManipulation.replaceText(oldVal, newVal, opts);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<input
|
||||
type="file"
|
||||
id={{this.fileUploadElementId}}
|
||||
id={{this.uppyComposerUpload.fileUploadElementId}}
|
||||
class="wizard-composer-upload"
|
||||
accept={{this.allowedFileTypes}}
|
||||
multiple
|
||||
|
|
Laden …
In neuem Issue referenzieren