0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00

COMPATIBILITY: composer upload and text manipulation has been refactored again

Dieser Commit ist enthalten in:
Angus McLeod 2024-10-28 09:52:04 +01:00
Ursprung 4e4a9c751b
Commit 90e4036364
4 geänderte Dateien mit 14 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -26,10 +26,13 @@ export default class CustomWizardComposerEditor extends ComposerEditor {
init() { init() {
super.init(...arguments); super.init(...arguments);
this.fileUploadElementId = `file-uploader-${dasherize(this.field.id)}`; this.uppyComposerUpload.fileUploadElementId = `file-uploader-${dasherize(
this.editorInputClass = `.${dasherize(this.field.type)}-${dasherize(
this.field.id 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 @discourseComputed
@ -92,7 +95,9 @@ export default class CustomWizardComposerEditor extends ComposerEditor {
@action @action
showUploadModal() { showUploadModal() {
this.session.set("wizardEventFieldId", this.field.id); this.session.set("wizardEventFieldId", this.field.id);
document.getElementById(this.fileUploadElementId).click(); document
.getElementById(this.uppyComposerUpload.fileUploadElementId)
.click();
} }
_uploadDropTargetOptions() { _uploadDropTargetOptions() {

Datei anzeigen

@ -12,7 +12,8 @@ export default Component.extend({
"showPreview:show-preview:hide-preview", "showPreview:show-preview:hide-preview",
], ],
didInsertElement() { init() {
this._super(...arguments);
this.set( this.set(
"composer", "composer",
EmberObject.create({ EmberObject.create({

Datei anzeigen

@ -75,13 +75,13 @@ export default {
this.session.wizardEventFieldId === this.fieldId && this.session.wizardEventFieldId === this.fieldId &&
this.element this.element
) { ) {
this.insertText(text, options); this.textManipulation.insertText(text, options);
} }
}, },
_wizardReplaceText(oldVal, newVal, opts = {}) { _wizardReplaceText(oldVal, newVal, opts = {}) {
if (this.session.wizardEventFieldId === this.fieldId) { if (this.session.wizardEventFieldId === this.fieldId) {
this.replaceText(oldVal, newVal, opts); this.textManipulation.replaceText(oldVal, newVal, opts);
} }
}, },
}); });

Datei anzeigen

@ -20,7 +20,7 @@
<input <input
type="file" type="file"
id={{this.fileUploadElementId}} id={{this.uppyComposerUpload.fileUploadElementId}}
class="wizard-composer-upload" class="wizard-composer-upload"
accept={{this.allowedFileTypes}} accept={{this.allowedFileTypes}}
multiple multiple