All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Fixed bug where calls to
DomElement::appendChild(childNode)
while iterating overDomElement::childNodes
would mutate the node list being iterated. This could sometimes cause the remaining dom elements in the original child node list to be skipped. This had the potential to resulting in lost content. We now callcloneNode()
on thechildNode
reference, inside the loop, prior to processing it.
- Updated plugin meta data for Craft 4.0 support / requirements.
- Now requires Craft 4.0+ and PHP 8.0.2+
- Fixed a bug where redactor (and possibly other field types) were passing in an object as the
$content
rather than the expected text/html string. The code now will attempt to cast any non-string$content
passed in to a string. As long as the field object has a good__toString()
implementation then it works correctly. Unexpected results may occur if you use this with a field type that does not provide the desired output when cast to a string. Note that redactor field type does work correcly with this implementation now.
- Fixed a bug where a
<body>
tag was wrapping the output when processing HTML strings.
- Fixed internal method naming of the
addInline()
andrmInline()
methods as they are routed asaddElement()
andremElement()
in the twig function declarations. This bug would have prevented a user from using theremarryAddELement()
andremarryRemElement()
twig functions as described in the documentation. This fixes that issue.
- Fixed a bug where applying filter to an empty field would cause a template error to be thrown. Removed string parameter requirement and added code to ensure the
$content
parameter is a string by setting it to an empty string if is not a string.
- Complete rework of the plugin.
- Filter parameter for
numWords
now also accepts a settings object. - Works with basic text and html documents.
- Works with complex HTML and fully traverses the dom try applying widow protections not just to individual text nodes, but intelligently builds collections of text nodes and inline elements to smartly add non-breaking spaces everywhere you want them and nowhere that you don't.
- See README for full feature list and documentation.
- Filter parameter for
- Updated plugin icon.
- Fixed a bug where not checking if a node had childNodes before appending it to the parent which could cause an error.
- Fixed a bug when filtering HTML nodes where DOMText elements would be present causing an error.
- Added a .gitignore file.
- Fix to attribute handling for HTML tags where $attr was not being set in some scenarios causing an error.
- Initial release