Commit b6231d0a authored by Erdem Karakus's avatar Erdem Karakus

CMS-11435 Reintegrate branch feature/CMS-11435 into release/11.2

parents 512b3240 6fede36d
......@@ -130,7 +130,7 @@
<hippo.ckeditor.version>4.5.11-h2</hippo.ckeditor.version>
<jslint.plugin.version>1.0.1</jslint.plugin.version>
<sf.htmlcleaner.version>2.16</sf.htmlcleaner.version>
<sf.htmlcleaner.version>2.22</sf.htmlcleaner.version>
</properties>
......
/*
* Copyright 2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2015-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -89,8 +89,8 @@ public class UuidConverterBuilder implements IDetachable {
final String uuid = RichTextFacetHelper.getChildDocBaseOrNull(node, name);
if (uuid != null) {
tag.addAttribute(ATTRIBUTE_HREF, RichTextProcessor.INTERNAL_LINK_DEFAULT_HREF);
tag.addAttribute(ATTRIBUTE_DATA_UUID, uuid);
addTagNodeAttribute(tag, ATTRIBUTE_HREF, RichTextProcessor.INTERNAL_LINK_DEFAULT_HREF);
addTagNodeAttribute(tag, ATTRIBUTE_DATA_UUID, uuid);
}
}
......@@ -126,10 +126,10 @@ public class UuidConverterBuilder implements IDetachable {
}
if (uuid != null) {
tag.addAttribute(ATTRIBUTE_SRC, url);
tag.addAttribute(ATTRIBUTE_DATA_UUID, uuid);
addTagNodeAttribute(tag, ATTRIBUTE_SRC, url);
addTagNodeAttribute(tag, ATTRIBUTE_DATA_UUID, uuid);
if (type != null) {
tag.addAttribute(ATTRIBUTE_DATA_TYPE, type);
addTagNodeAttribute(tag, ATTRIBUTE_DATA_TYPE, type);
}
}
}
......@@ -175,7 +175,7 @@ public class UuidConverterBuilder implements IDetachable {
final String name = findOrCreateFacetNode(uuid);
if (name != null) {
tag.addAttribute(ATTRIBUTE_HREF, name);
addTagNodeAttribute(tag, ATTRIBUTE_HREF, name);
} else {
tag.removeAttribute(ATTRIBUTE_HREF);
}
......@@ -205,7 +205,14 @@ public class UuidConverterBuilder implements IDetachable {
if (type != null) {
src += IMAGE_SEPARATOR + IMAGE_DOCUMENT + IMAGE_SEPARATOR + type;
}
tag.addAttribute(ATTRIBUTE_SRC, src);
addTagNodeAttribute(tag, ATTRIBUTE_SRC, src);
}
private void addTagNodeAttribute(TagNode tagNode, String name, String value) {
if (tagNode.hasAttribute(name)) {
tagNode.removeAttribute(name);
}
tagNode.addAttribute(name, value);
}
private String findOrCreateFacetNode(String uuid) throws RepositoryException {
......
/*
* Copyright 2015-2016 Hippo B.V. (http://www.onehippo.com)
* Copyright 2015-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -512,7 +512,7 @@ public class RichTextModelTest {
Node image = rootNode.addNode("image.jpg", "nt:unstructured");
addChildFacetNode("image.jpg", image.getIdentifier());
richTextModel.setObject("<img src=\"/binaries/image.jpg/{_document}/hippogallery:original\" data-uuid=\"" + image.getIdentifier() + " \" data-type=\"hippogallery:original\" align=\"right\" />");
assertEquals("<img src=\"/binaries/image.jpg/{_document}/hippogallery:original\" align=\"right\" data-uuid=\"" + image.getIdentifier() + "\" data-type=\"hippogallery:original\" />", richTextModel.getObject());
assertEquals("<img align=\"right\" src=\"/binaries/image.jpg/{_document}/hippogallery:original\" data-uuid=\"" + image.getIdentifier() + "\" data-type=\"hippogallery:original\" />", richTextModel.getObject());
}
@Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment