AztecEditor-iOS icon indicating copy to clipboard operation
AztecEditor-iOS copied to clipboard

captionStyler not used

Open benpackard opened this issue 6 years ago • 2 comments

According to the comment here, the captionStyler is a closure that "will be executed whenever the TextView needs to set the base style for a caption". We are told we can "Override this to customize the caption styling."

However, overriding the captionStyler appears to have no effect. In fact, I couldn't find anywhere in the TextView class where captionStyler is even accessed again.

To Reproduce

  1. Set the captionStyler on a TextView.
  2. Add an attachment with a caption.

Expected behavior The caption is styled according to the captionStyler.

Actual Behavior The caption uses the default style.

benpackard avatar Mar 30 '19 15:03 benpackard

Also interested to know if there is a different working way to style captions?

benpackard avatar Mar 30 '19 15:03 benpackard

After some more looking around, it appears that the caption format is set by the FigcaptionFormatter in apply(to attributes: [NSAttributedStringKey: Any], andStore representation: HTMLRepresentation?), where it is hardcoded to color .gray and size defaultSize - 2.

I can create a custom FigcaptionFormatter subclass and override this function, but I don't see a way use this subclass in the TextView since singleLineParagraphFormatters is private and constant.

benpackard avatar Mar 31 '19 13:03 benpackard