mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
Allow to unset a paragraph style with OpSetParagraph
This commit is contained in:
@@ -61,7 +61,11 @@ ops.OpSetParagraphStyle = function OpSetParagraphStyle() {
|
||||
if (domPosition) {
|
||||
paragraphNode = odtDocument.getParagraphElement(domPosition.textNode);
|
||||
if (paragraphNode) {
|
||||
paragraphNode.setAttributeNS(textns, 'text:style-name', styleNameAfter);
|
||||
if (styleNameAfter !== "") {
|
||||
paragraphNode.setAttributeNS(textns, 'text:style-name', styleNameAfter);
|
||||
} else {
|
||||
paragraphNode.removeAttributeNS(textns, 'style-name');
|
||||
}
|
||||
|
||||
odtDocument.getOdfCanvas().refreshSize();
|
||||
odtDocument.emit(ops.OdtDocument.signalParagraphChanged, {
|
||||
|
||||
@@ -566,4 +566,44 @@
|
||||
<office:text><text:p/></office:text>
|
||||
</after>
|
||||
</test>
|
||||
|
||||
<test name="SetParagraphStyle_unset_set">
|
||||
<before>
|
||||
<office:styles><style:style style:name="S" style:family="paragraph" style:class="text"/></office:styles>
|
||||
<office:text><text:p/></office:text>
|
||||
</before>
|
||||
<ops>
|
||||
<op optype="SetParagraphStyle" position="0" styleNameAfter="S"/>
|
||||
</ops>
|
||||
<after>
|
||||
<office:styles><style:style style:name="S" style:family="paragraph" style:class="text"/></office:styles>
|
||||
<office:text><text:p text:style-name="S"/></office:text>
|
||||
</after>
|
||||
</test>
|
||||
<test name="SetParagraphStyle_set_set">
|
||||
<before>
|
||||
<office:styles><style:style style:name="S" style:family="paragraph" style:class="text"/><style:style style:name="SB" style:family="paragraph" style:class="text"/></office:styles>
|
||||
<office:text><text:p text:style-name="SB"/></office:text>
|
||||
</before>
|
||||
<ops>
|
||||
<op optype="SetParagraphStyle" position="0" styleNameAfter="S"/>
|
||||
</ops>
|
||||
<after>
|
||||
<office:styles><style:style style:name="S" style:family="paragraph" style:class="text"/><style:style style:name="SB" style:family="paragraph" style:class="text"/></office:styles>
|
||||
<office:text><text:p text:style-name="S"/></office:text>
|
||||
</after>
|
||||
</test>
|
||||
<test name="SetParagraphStyle_set_unset">
|
||||
<before>
|
||||
<office:styles><style:style style:name="S" style:family="paragraph" style:class="text"/></office:styles>
|
||||
<office:text><text:p text:style-name="S"/></office:text>
|
||||
</before>
|
||||
<ops>
|
||||
<op optype="SetParagraphStyle" position="0" styleNameAfter=""/>
|
||||
</ops>
|
||||
<after>
|
||||
<office:styles><style:style style:name="S" style:family="paragraph" style:class="text"/></office:styles>
|
||||
<office:text><text:p/></office:text>
|
||||
</after>
|
||||
</test>
|
||||
</tests>
|
||||
|
||||
Reference in New Issue
Block a user