Draft: Add underline/strikethrough buttons to text tool
This MR wires up the existing underline/strikethrough rendering and style processing code to two buttons in the text toolbar. Thanks @doctormo for some tips!
Partial fix for inbox#4983
What works:
- Reading files that have
text-decoration
set, both as shorthand and individual properties (text-decoration-line
etc.) - Editing those files, the state of the new buttons is correct
- Adding underline in new texts (all text types)
What could be improved in this MR:
- Better icons for hicolor and tango (I just copied the multicolor one). @adam.belis , would you want to help me here?
- Can we edit the
SPITextDecorationLine
instead of recreating a CSS string inTextToolbar::decoration_changed
? I didn't figure this out.
What is out of scope for this MR:
- Adding UI support for the other CSS3 decoration attributes (overline, linestyle, line color)
- There is currently a bug with the rendering that incorrectly "inherits" the text-decoration attribute. For
<text style="text-decoration:red underline">Hello<tspan style="text-decoration:font-size:20px; text-decoration: blue line-through">World</tspan></text>
, there should be a red (thinner) underline everywhere and a thicker blue strike-through for "World" due to the higher font size.text-decoration
is never inherited. This MR exploits the bug to "un-underline" a part of an underlined text, by settingtext-decoration-line: none
on the newly-created child. With a proper rendering implementation, this would not work, and the file we created using this MR would not be "forward-compatible", and it would anyway not render correctly in browsers for this specific case. - Text decoration is not taken into account for
The last two toplevel bullet points imo need to be fixed before releasing this (and @Tavmjong 's help would be much appreciated). If it's not fixed for 1.3, we should disable the feature (hide the buttons).