mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 13:03:45 +08:00
8eabbdae5c
This PR moves all the upload related functions into a new ComposerUpload mixin that is extended by the composer-editor component. This is being done so I can introduce a ComposerUploadUppy mixin that overrides functions in the regular ComposerUpload mixin, via a new composer-editor-uppy component that inherits from ComposerEditor. The proposed structure, which will be in the next PR, looks like this: composer-editor-uppy ```javascript import ComposerEditor from "discourse/components/composer-editor" import ComposerUploadUppy from "discourse/mixins/composer-upload-uppy" export default ComposerEditor.extend(ComposerUploadUppy, { layoutName: "components/composer-editor" }); ``` This way the new composer-editor is a dumb component purely used for testing uppy safely, and within the template for composer.hbs we do this: ```javascript @discourseComputed composerComponent() { return this.siteSettings.enable_experimental_composer_uploader ? "composer-editor-uppy" : "composer-editor"; }, ``` ```handlebars {{component composerComponent ...}} ``` This is the only way I can think to do it, because it is not possible to access the site settings when the component is first declared I can't do something like: ```javascript const uploaderMixin = this.siteSettings.use_experimental_uploader? ComposerUploaderUppy : ComposerUploader; Component.extend(uploaderMixin, {}); ``` An additional change in this PR is explicitly passing in these four plugin data structures to the composer-editor Component, rather than relying on JS closures which the mixin cannot do: * uploadMarkdownResolvers * uploadProcessorActions * uploadProcessorQueue * uploadHandlers |
||
---|---|---|
.. | ||
images | ||
javascripts | ||
stylesheets |