File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,12 @@ export default class ModifyTextHelper {
8787 if ( style . isUnderlined !== undefined ) {
8888 ModifyTextHelper . setUnderlined ( style . isUnderlined ) ( element ) ;
8989 }
90+ if ( style . isSuperscript !== undefined ) {
91+ ModifyTextHelper . setSuperscript ( style . isSuperscript ) ( element ) ;
92+ }
93+ if ( style . isSubscript !== undefined ) {
94+ ModifyTextHelper . setSubscript ( style . isSubscript ) ( element ) ;
95+ }
9096 } ;
9197
9298 /**
@@ -137,6 +143,24 @@ export default class ModifyTextHelper {
137143 }
138144 } ;
139145
146+ /**
147+ * Set superscript attribute on text
148+ */
149+ static setSuperscript =
150+ ( isSuperscript : boolean ) =>
151+ ( element : XmlElement ) : void => {
152+ ModifyXmlHelper . attribute ( 'baseline' , isSuperscript ? '30000' : '0' ) ( element ) ;
153+ } ;
154+
155+ /**
156+ * Set subscript attribute on text
157+ */
158+ static setSubscript =
159+ ( isSubscript : boolean ) =>
160+ ( element : XmlElement ) : void => {
161+ ModifyXmlHelper . attribute ( 'baseline' , isSubscript ? '-25000' : '0' ) ( element ) ;
162+ } ;
163+
140164 /**
141165 * Set bullet type (font and character) for bullet points
142166 */
Original file line number Diff line number Diff line change @@ -46,12 +46,15 @@ export type Border = {
4646 weight ?: number ;
4747 color ?: Color ;
4848} ;
49+
4950export type TextStyle = {
5051 size ?: number ;
5152 color ?: Color ;
5253 isBold ?: boolean ;
5354 isItalics ?: boolean ;
5455 isUnderlined ?: boolean ;
56+ isSuperscript ?: boolean ;
57+ isSubscript ?: boolean ;
5558} ;
5659
5760export type ImageStyle = {
You can’t perform that action at this time.
0 commit comments