-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lib): provide more properties to selected asset #395
Changes from 3 commits
f74ed34
9a855d8
1fd7f28
39e6f92
7c79fef
52ca8f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,9 +231,29 @@ describe('createPluginActions', () => { | |
field: 'dummy', | ||
callbackId: TEST_CALLBACK_ID, | ||
filename, | ||
fieldtype: 'asset', | ||
name: '', | ||
meta_data: {}, | ||
title: '', | ||
copyright: '', | ||
focus: '', | ||
alt: '', | ||
source: '', | ||
is_private: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @eunjae-lee 👋 I don't know how feasible it would be but would be possible to also have the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm 🤔 I actually don't know about external asset. Do you know @Dawntraoz maybe? I want to test a situation where is_external_url is true. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed @eunjae-lee, you need to go to the image field definition in the Block and check the Allow External URL, then when creating the story, instead of selecting an asset from the Assets Library, you should click on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you @Dawntraoz! I've followed your instruction, and I was able to upload an external asset. But, in asset selector, I don't see that. I feel like this should be normal, right? (It's just attached to the story as an external URL, but not really uploaded to my space). So, if I understand this correctly, the selected asset can never be external. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have a point since the message sent only involves Asset Manager iteration in the field plugin. It will always be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that's why is_external_url even doesn't exist on storyfront right before it's passed down to field plugin. |
||
}) | ||
const result = await promise | ||
expect(result).toEqual({ filename }) | ||
expect(result).toEqual({ | ||
filename, | ||
fieldtype: 'asset', | ||
name: '', | ||
meta_data: {}, | ||
title: '', | ||
copyright: '', | ||
focus: '', | ||
alt: '', | ||
source: '', | ||
is_private: false, | ||
}) | ||
}) | ||
it('does not call the callack function when callbackId does not match', async () => { | ||
const WRONG_CALLBACK_ID = TEST_CALLBACK_ID + '_wrong' | ||
|
@@ -255,6 +275,15 @@ describe('createPluginActions', () => { | |
field: 'dummy', | ||
callbackId: WRONG_CALLBACK_ID, | ||
filename, | ||
fieldtype: 'asset', | ||
name: '', | ||
meta_data: {}, | ||
title: '', | ||
copyright: '', | ||
focus: '', | ||
alt: '', | ||
source: '', | ||
is_private: false, | ||
}) | ||
const resolvedFn = jest.fn() | ||
const rejectedFn = jest.fn() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question: Since metadata has already title, source, and such, why do we need the properties twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but I think it can contain more than that.
https://www.storyblok.com/docs/api/management/core-resources/assets/the-asset-object