From 64c009ae4e41d37a65913b486d0ecbcb00cd8490 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Mon, 1 Jul 2013 15:33:26 +0200 Subject: [PATCH] Allow to unset a paragraph style with OpSetParagraph --- webodf/lib/ops/OpSetParagraphStyle.js | 6 +++- webodf/tests/ops/operationtests.xml | 40 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OpSetParagraphStyle.js b/webodf/lib/ops/OpSetParagraphStyle.js index b80b5914..dee7c2f7 100644 --- a/webodf/lib/ops/OpSetParagraphStyle.js +++ b/webodf/lib/ops/OpSetParagraphStyle.js @@ -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, { diff --git a/webodf/tests/ops/operationtests.xml b/webodf/tests/ops/operationtests.xml index 3efb154c..a7166e37 100644 --- a/webodf/tests/ops/operationtests.xml +++ b/webodf/tests/ops/operationtests.xml @@ -566,4 +566,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +