Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
moqui
/
moqui-mjml
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f0694f89
authored
2024-10-25 14:56:48 -0600
by
acetousk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix formatting issue
1 parent
7e2aa82e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletions
screen/emails/GrapesJsEmail.xml
service/mjml/MjmlServices.xml
screen/emails/GrapesJsEmail.xml
View file @
f0694f8
...
...
@@ -24,6 +24,40 @@ along with this software (see the LICENSE.md file). If not, see
<if
condition=
"dataPre == null"
>
<return
error=
"true"
message=
"Email Template does not exist at ${emailTemplate.htmlLocation} with version ${emailTemplate.htmlPublishedVersionName}"
/>
</if>
<set
field=
"doc"
from=
"org.jsoup.Jsoup.parse(dataPre)"
/>
<script>
<![CDATA[
doc.outputSettings().escapeMode(org.jsoup.nodes.Entities.EscapeMode.xhtml).prettyPrint(false);
doc.traverse(new org.jsoup.select.NodeVisitor() {
public void head(org.jsoup.nodes.Node node, int depth) {
if (node instanceof org.jsoup.nodes.TextNode) {
def text = node.getWholeText();
if(text.trim().length() >
0) {
def newText = "";
def lines = text.split("\n");
for (line in lines) {
if (line.startsWith("
<br>
")) {
line = line.replaceFirst(/^
<br>
/, "");
}
if (line.endsWith("
<br>
")) {
newText += line;
} else {
newText += line + "
<br>
";
}
}
if (newText.startsWith("
<br>
")) {
newText = newText.replaceFirst(/^
<br>
/, "");
}
node = org.jsoup.nodes.TextNode.createFromEncoded(newText);
}
}
}
public void tail(org.jsoup.nodes.Node node, int depth) {
// No action needed on tail
}
});
]]>
</script>
<set
field=
"dataPre"
from=
"doc.html()"
/>
<script>
<![CDATA[
String location = emailTemplate?.htmlLocation ?: "template.ftl";
...
...
service/mjml/MjmlServices.xml
View file @
f0694f8
...
...
@@ -385,13 +385,15 @@ along with this software (see the LICENSE.md file). If not, see
<entity-find-one
entity-name=
"moqui.resource.DbResourceFileHistory"
value-field=
"usedResourceHistory"
auto-field-map=
"[resourceId:resource.resourceId,previousVersionName:resourceHistory.versionName]"
for-update=
"true"
>
<select-field
field-name=
"resourceId,versionName,versionDate,previousVersionName,userId"
/></entity-find-one>
<!-- <log level="warn" message="set versionName ${usedResourceHistory.versionName} of previousVersionName ${usedResourceHistory.previousVersionName} to ${resourceHistory.previousVersionName}"/>-->
<set
field=
"usedResourceHistory.previousVersionName"
from=
"resourceHistory.previousVersionName"
/>
<if
condition=
"usedResourceHistory"
>
<set
field=
"usedResourceHistory.previousVersionName"
from=
"resourceHistory?.previousVersionName"
/>
<log
level=
"info"
message=
"Removed resource history ${resourceHistory.resourceId} version ${resourceHistory.versionName}"
/>
<set
field=
"removedHistoryList"
from=
"removedHistoryList + [resourceId:resource.resourceId, versionName:resourceHistory.versionName,versionDate:resourceHistory.versionDate,userId:resourceHistory.userId]"
/>
<entity-update
value-field=
"usedResourceHistory"
/>
<entity-delete
value-field=
"resourceHistory"
/>
</if>
</iterate>
</iterate>
...
...
Please
register
or
sign in
to post a comment