BibleGet-I-O / bibleget-wordpress

Plugin for WordPress that let's you insert Bible quotes into your posts or pages from a variety of Bible versions in different languages. This is a mirror of the SVN repo where the plugin gets published to the WordPress plugins store. Kudos to @kas-catholic for helping import the repo from SVN.
https://www.bibleget.io
Apache License 2.0
0 stars 2 forks source link

add a fonts picker in the block options #1

Closed JohnRDOrazio closed 3 years ago

JohnRDOrazio commented 3 years ago

Currently, the block options allow for all of the same styling as in the WordPress Customizer, except for setting the font.

In the WordPress Customizer, we created a custom component which will let the user choose from a basic set of common fonts, but if they activate a Google Fonts API key in the Settings area, the component will let them choose not only from the basic set of fonts but from any Google Font.

There is no such component for the Block editor, so a custom component will probably need to be built to accomplish the same functionality.

JohnRDOrazio commented 3 years ago

Well this is a start: 00240faa6b0408a90aad85e9952c29e5b189c0c6 It just has a few basic options, which need to be expanded to allow for Google Fonts and all, and perhaps allow for font previews.

JohnRDOrazio commented 3 years ago

Making progress. If Google Fonts have been updated from the API, they will be loaded into the Font Combobox.

Fixed font styling not updating on font select, at least for websafe fonts. For Google fonts we will have to detect if they are Google fonts, and in that case update a with the Google Font.

JohnRDOrazio commented 3 years ago

pretty much completed with commit 448f7d30691b43c04354aa16a0996c6914d8de60 and db1626879dc621e77bb0fa930d77d002cbc35164 . This last commit is not very efficient at all, it's a hackish way of getting the font previews, by forcing the styling on each of the children of the dropdown when the dropdown is opened. This dropdown from the Combobox element (which in turn uses the Suggestions list component) does not seem to use virtualization. Which means that for 1000 available fonts, there will be effectively 1000 elements in the list, and the forced styling will be applied to each of those elements one at a time when the dropdown in opened. Not very efficient at all. But until we have better components, it's better than nothing I guess...