Skip to content

Commit

Permalink
Added check whether callback is specified, and published version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsboogaard-luminis committed Nov 25, 2019
1 parent c3df1d3 commit 0abdc9d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 21 deletions.
18 changes: 12 additions & 6 deletions dist/filepond-plugin-manage-metadata.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,18 @@ const plugin = fpAPI => {
);
const onManageMetadata = root.query('GET_ON_MANAGE_METADATA');

registerManageMetadataComponent(
item,
root.element,
labelButtonManageMetadata,
onManageMetadata
);
if (onManageMetadata) {
registerManageMetadataComponent(
item,
root.element,
labelButtonManageMetadata,
onManageMetadata
);
} else {
console.error(
"No 'onManageMetadata' callback method specified for FilePondPluginManageMetadata! See https://github.com/nielsboogaard/filepond-plugin-manage-metadata for more instructions."
);
}
};

// start writing
Expand Down
2 changes: 1 addition & 1 deletion dist/filepond-plugin-manage-metadata.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions dist/filepond-plugin-manage-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,19 @@
'GET_LABEL_BUTTON_MANAGE_METADATA'
);
const onManageMetadata = root.query('GET_ON_MANAGE_METADATA');
registerManageMetadataComponent(
item,
root.element,
labelButtonManageMetadata,
onManageMetadata
);

if (onManageMetadata) {
registerManageMetadataComponent(
item,
root.element,
labelButtonManageMetadata,
onManageMetadata
);
} else {
console.error(
"No 'onManageMetadata' callback method specified for FilePondPluginManageMetadata! See https://github.com/nielsboogaard/filepond-plugin-manage-metadata for more instructions."
);
}
}; // start writing

view.registerWriter(
Expand Down
2 changes: 1 addition & 1 deletion dist/filepond-plugin-manage-metadata.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ <h3>Manage Metadata plugin for FilePond demo</h3>
FilePond.registerPlugin(FilePondPluginManageMetadata);

// Create the FilePond instance
const pond = FilePond.create(inputElement, {
onManageMetadata: function(item) {
console.log('onManageMetadata hook called', item);
}
});
const pond = FilePond.create(inputElement);
pond.addFile('./nature.jpg');
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filepond-plugin-manage-metadata",
"version": "1.0.0",
"version": "1.0.1",
"description": "Manage Metadata Plugin for FilePond",
"license": "MIT",
"author": {
Expand Down
6 changes: 5 additions & 1 deletion src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ const plugin = fpAPI => {
const labelButtonManageMetadata = root.query('GET_LABEL_BUTTON_MANAGE_METADATA');
const onManageMetadata = root.query('GET_ON_MANAGE_METADATA');

registerManageMetadataComponent(item, root.element, labelButtonManageMetadata, onManageMetadata);
if (onManageMetadata) {
registerManageMetadataComponent(item, root.element, labelButtonManageMetadata, onManageMetadata);
} else {
console.error("No 'onManageMetadata' callback method specified for FilePondPluginManageMetadata! See https://github.com/nielsboogaard/filepond-plugin-manage-metadata for more instructions.");
}
};

// start writing
Expand Down

0 comments on commit 0abdc9d

Please sign in to comment.