DEV: Pass editor to plugin hook handling composer uploads. (#7673)

This commit is contained in:
Dan Ungureanu 2019-06-03 05:07:25 +03:00 committed by Sam
parent ee1e21b401
commit 28dcf445b7
2 changed files with 3 additions and 3 deletions

View File

@ -694,7 +694,7 @@ export default Ember.Component.extend({
const matchingHandler = uploadHandlers.find(matcher); const matchingHandler = uploadHandlers.find(matcher);
if (data.files.length === 1 && matchingHandler) { if (data.files.length === 1 && matchingHandler) {
if (!matchingHandler.method(data.files[0])) { if (!matchingHandler.method(data.files[0], this)) {
return false; return false;
} }
} }

View File

@ -44,7 +44,7 @@ import { addComposerUploadHandler } from "discourse/components/composer-editor";
import { addCategorySortCriteria } from "discourse/components/edit-category-settings"; import { addCategorySortCriteria } from "discourse/components/edit-category-settings";
// If you add any methods to the API ensure you bump up this number // If you add any methods to the API ensure you bump up this number
const PLUGIN_API_VERSION = "0.8.30"; const PLUGIN_API_VERSION = "0.8.31";
class PluginApi { class PluginApi {
constructor(version, container) { constructor(version, container) {
@ -809,7 +809,7 @@ class PluginApi {
* *
* Example: * Example:
* *
* addComposerUploadHandler(["mp4", "mov"], (file) => { * addComposerUploadHandler(["mp4", "mov"], (file, editor) => {
* console.log("Handling upload for", file.name); * console.log("Handling upload for", file.name);
* }) * })
*/ */