The next generation of widgets in core, embracing JS for UI and powering the Widgets REST API.
Author: | XWP (profile at wordpress.org) |
WordPress version required: | 4.7.0 |
WordPress version tested: | 4.9.0 |
Plugin version: | 0.4.3 |
Added to WordPress repository: | 25-08-2016 |
Last updated: | 12-11-2017
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 0 |
Rated by: | 0 |
Plugin URI: | https://github.com/xwp/wp-js-widgets/ |
Total downloads: | 2 902 |
Active installs: | 10+ |
Click to start download |
ChangeLog
0.4.3 – 2017-11-11
Fix compatibility with WordPress 4.9.
0.4.2 – 2017-07-15
- Update compatibility for WordPress 4.8.
- Remove Text widget from being implemented as JS Widget since core widget now incorporates concepts from JS Widgets.
- Prevent attempting to use array as placeholder input attribute value.
- Ensure JS Widget is initialized on admin screen on first click.
0.4.1 – 2017-02-20
- Fix undefined index warning in Pages widget. See #40.
- Disable the “Add” button for the page selector field as provided by the Customize Object Selector plugin when Customize Posts is also active.
See issues and PRs in milestone and full release commit log.
0.4.0 – 2017-02-17
- Integrate with Shortcake (Shortcode UI) to allow any JS widget to be used inside the editor as a Post Element. See #11, #32.
- Refactor of
Form
along with introduction of JS unit tests. See #35. Props sirbrillig! - Use
item
relation in resource links instead of ad hocwp:post
,wp:page
, andwp:comment
relations. See #36, #38.
See issues and PRs in milestone and full release commit log.
Props Payton Swick (@sirbrillig), Weston Ruter (@westonruter), Piotr Delawski (@delawski).
0.3.0 – 2017-01-11
Added:
- Allow widget forms to be constructed standalone, outside the customizer. This allows forms to appear on widgets admin screen, and will allow Shortcake (see #11) and frontend integrations. Removes forms dependency on
customize-widgets.js
. PR #26. - Render widget forms on widgets admin screen instead of directing the widgets to be edited in the customizer. PR #27.
- Improve UX of Save button on for a widget on the widgets admin screen to show as disabled and “Saved” if setting is not dirty. See wpcore#23120 (There should be indication that widget settings have been saved).
- Introduce
field
arg forWP_JS_Widget::render_form_field_template()
which connects a rendered field template to the field in the item schema, allowing the field attributes to be automatically derived from the schema. PR #28 and #31. - Add
Form.notifications
, copying fromprops.model.notifications
if it exists.
Changed (Breaking!):
- Remove the passing of the
WidgetControl
as acontrol
property when constructing aForm
; instead pass themodel
which can be aSetting
or a plainValue
. - Replace
wp.customize.Widgets.formConstructor
withwp.widgets.formConstructor
. - Replace
wp.customize.Widgets.Form
withwp.widgets.Form
. - Eliminate exporting all form configs to
CustomizeJSWidgets.data.form_configs
and instead attach toFrom
prototypes onwp.widgets.formConstructor
. - Rename script handles to be more appropriate.
- Reduce duplicated code for rendering form templates; converts/renames
WP_JS_Widget::form_template()
into wrapper methodWP_JS_Widget::render_form_template_scripts()
which outputs the script tags. Splits out form template contents intoWP_JS_Widget::render_form_template()
. - Eliminates extraneous
id_base
property for JSForm
class, addingtemplate_id
form config which is then sourced from a newWP_JS_Widget::get_form_template_id()
, which in turn is used byWP_JS_Widget::render_form_template_scripts()
and is used in the JSForm#getTemplate
method. - Replace
name
arg withfield
arg in calls toWP_JS_Widget::render_form_field_template()
. Ensure that rendered field templates use a randomname
for eachinput
to prevent collisions with other widgets. Storefield
indata-field
attribute. - Deprecated
WP_JS_Widget::get_form_args()
in favor ofWP_JS_Widget::get_form_config()
.
Fixed:
- Fix initialization of Pages widget in how it amends the default config.
- Fix PHP warning for array to string conversion in Pages widget.
- Prevent RSS widget from showing error when feed URL is empty.
- Ensure exclude object selector is initialized with array for Pages widgets.
See issues and PRs in milestone and full release commit log.
See also updated Customizer Object Selector and Next Recent Posts Widget plugins.
0.2.0 – 2017-01-02
- Important: Update minimum WordPress core version to 4.7.0.
- Eliminate
Form#embed
JS method in favor of justForm#render
. IntroduceForm#destruct
to handle unmounting a rendered form. - Implement ability for sanitize to return error/notification and display in control’s notifications.
- Show warning when attempting to add HTML to widget titles and when adding illegal HTML to Text widget content. This is a UX improvement over silently failing.
- Add adapters for all of the core widgets (aside from Links). Include as much raw data as possible in the REST responses so that JS clients can construct widgets using client-side templates.
- Add integration between the Pages widget’s
exclude
param and the Customize Object Selector plugin to provide a Select2 UI for selecting pages to exclude instead of listing out page IDs. - Ensure old encoded instance data setting value format is supported (such as in starter content).
- Move Post Collection widget into separate embedded plugin so that it is not active by default.
- Inject rest_controller object dependency on
WP_JS_Widget
uponrest_api_init
. - Ensure that default instance values populate forms for newly-added widgets.
- Remove React/Redux for implementing the Recent Posts widget.
- Reorganize core adapter widgets and introduce
WP_Adapter_JS_Widget
class. - Eliminate uglification and CSS minification.
- Use widget number as integer ID for widgets of a given type.
- Update integration with REST API to take advantage of sanitization callbacks being able to do validation.
- Replace Backbone implementation for Text widget with Customize
Element
implementation. - Reduce duplication by moving methods to base classes.
- Add form field template generator helper methods.
- Implement WP Core Trac #39389: Scroll widget partial into view when control expanded.
- Allow widget instances to be patched without providing full instance.
- Remove prototype strict validity for REST item updates.
- Add support for validating schemas with type arrays and object types; allow strings or objects with
raw
/rendered
properties for titles & Text widget’s text field. - Eliminate returning data from
WP_JS_Widget::render()
for client templates to render until a clear use case and pattern can be derived.
0.1.1 – 2016-10-03
- Add 100% width to object-selector.
- Fix typo in sanitizing Post Collection input.
- Fix PHP issue when attempting to assign an undefined array index to another undefined array index.
- Fix styling of post collection widget select2 component.
- Fix accounting for parse_widget_setting_id returning WP_Error not false.
0.1.0 – 2016-08-24
Initial release.