matrix-org / matrix-ios-kit

Reusable UI interfaces to ease building of Matrix client apps
http://www.matrix.org
Apache License 2.0
128 stars 71 forks source link

Replace MXKTools's sanitiseHTML with DTCoreText's will flush callback. #954

Closed pixlwave closed 2 years ago

pixlwave commented 2 years ago

Fixes https://github.com/vector-im/element-ios/issues/5165.

The block supplied as the DTWillFlushBlockCallBack option gets called just before the html builder converts the element into an attributed string. This PR modifies the DTHTMLElement whenever a tag is found that isn't part of the allowedHTMLTags array.

Instead of removing h1/h2 tags, they are now simply formatted similarly to h3 tags using the CSS option.

The image handler isn't used in MatrixKit, but instead is used in Element.