Skip to content

Commit

Permalink
Fixing conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelrojas committed Mar 15, 2023
2 parents 57dca55 + c7b4a18 commit bda58d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -37,7 +37,7 @@
<%@ page import="com.dotcms.contenttype.model.field.HostFolderField" %>
<%@ page import="com.dotmarketing.beans.Host" %>
<%@ page import="com.dotcms.contenttype.model.field.JSONField" %>

<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>

<%
long defaultLang = APILocator.getLanguageAPI().getDefaultLanguage().getId();
Expand Down Expand Up @@ -172,8 +172,7 @@
JSONValue = new JSONObject(textValue);
} catch(Exception e) {
// Need it in case the value contains Single quote/backtick.
textValue = "`" + textValue.replaceAll("`", "&#96;") + "`";
textValue = "`" + StringEscapeUtils.escapeJavaScript(textValue.replaceAll("`", "&#96;").replaceAll("\\$", "&#36;")) + "`";
}
List<FieldVariable> acceptTypes=APILocator.getFieldAPI().getFieldVariablesForField(field.getInode(), user, false);
Expand All @@ -199,8 +198,8 @@
}
}
%>

<script src="/html/dotcms-block-editor.js"></script>
<script src="/html/showdown.min.js"></script>
<dotcms-block-editor
id="block-editor-<%=field.getVelocityVarName()%>"
allowed-content-types="<%=allowedContentTypes%>"
Expand Down Expand Up @@ -234,7 +233,9 @@
// Otherwise, we try to parse the "textValue".
content = JSONValue || JSON.parse(<%=textValue%>);
} catch (error) {
content = <%=textValue%>;
const text = (<%=textValue%>).replace(/&#96;/g, '`').replace(/&#36;/g, '$');
const converter = new showdown.Converter({tables: true});
content = converter.makeHtml(text);
}
const blockEditor = document.getElementById("block-editor-<%=field.getVelocityVarName()%>");
Expand All @@ -243,6 +244,7 @@
if (content) {
blockEditor.value = content;
field.value = content;
}
blockEditor.addEventListener('valueChange', (event) => {
Expand Down
3 changes: 3 additions & 0 deletions dotCMS/src/main/webapp/html/showdown.min.js

Large diffs are not rendered by default.

0 comments on commit bda58d5

Please sign in to comment.