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
add placeholder widget option #3897
add placeholder widget option #3897
Conversation
initialModal: true, | ||
placeholder: false, | ||
placeholderClass: 'apos-placeholder' |
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.
Add these by default, so a developer is aware they exist just by checking the widget-type
module options
@@ -2,7 +2,7 @@ module.exports = { | |||
extend: '@apostrophecms/widget-type', | |||
options: { | |||
label: 'Placeholder Test Widget', | |||
initialModal: false | |||
placeholder: true |
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.
no impact on the tests because this options is used by Vue on front-end.
but does no harm to add it for clarity
return {}; | ||
} | ||
|
||
const className = placeholderClass || 'apos-placeholder'; |
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.
now 'apos-placeholder' is added to the widget-type
module by default
Summary
Add
placeholder
option to widget modules.If truthy, it will automatically disable the initial modal (by setting
initialModal
to false) and render widgets that do not have data yet with their placeholder(s).Placeholder for image, video and rich text widgets are enabled by default in core.
What are the specific steps to test this change?
In testbed, add
placeholder: true
to a widget of your choice.placeholderUrl
for image and video widgets,placeholderText
for rich text widget, andplaceholderClass
for any other widget)initialModal
can be set tofalse
, even withplaceholder: false
--> the widget is inserted without having the initial modal displayed, and without placeholder(s)What kind of change does this PR introduce?
(Check at least one)
Make sure the PR fulfills these requirements:
If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.
Other information: