Closed jnnkB closed 3 years ago
Can you provide an example please.
I created a tool to upload files like PDF's and create a link for them. The link looks like this:
<a class="uploaded-file" href="/url/of/file.pdf">Name of File</a>
If I than edit the link by making it external, the class disappears. Unfortunately this breaks my website because I use the class to than check which documents can be deleted and which I have to keep and because the class is missing the document gets deleted.
https://github.com/GetmeUK/ContentTools/blob/master/build/content-tools.js#L9740
You must change these lines of code: content-tools.js
FROM
if (detail.href) {
a = new HTMLString.Tag('a', detail);
element.content = element.content.format(from, to, a);
element.content.optimize();
}
TO
if (detail.href) {
a = new HTMLString.Tag('a', detail);
a.attr("class",$(".ct--pseudo-select").parent().attr("class"))
element.content = element.content.format(from, to, a);
element.content.optimize();
}
This issue is addressed in the latest release: https://github.com/GetmeUK/ContentTools/releases/tag/1.6.13
@tokpl thanks for pointing me at the code that needed addressing, I took a different approach but it was really helpful to have a starting point.
@jnnkB thanks fort the error report.
I recently discoverd, that if I have a link with a certain class and I change the link or make it external, the class gets lost. Is this intended behavior?