You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by th...@apache.org on 2025/05/13 19:45:46 UTC

(incubator-kie-tools) branch main updated: kie-issues#1957: Embed functionality fails due to unescaped apostrophes in the XML (#3130)

This is an automated email from the ASF dual-hosted git repository.

thiagoelg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 6b175e28e82 kie-issues#1957: Embed functionality fails due to unescaped apostrophes in the XML (#3130)
6b175e28e82 is described below

commit 6b175e28e8287da0b94999eb9f435ae37418d485
Author: Kusuma04-dev <ku...@gmail.com>
AuthorDate: Wed May 14 01:15:43 2025 +0530

    kie-issues#1957: Embed functionality fails due to unescaped apostrophes in the XML (#3130)
    
    Co-authored-by: chinnamatli kusumalatha <ch...@chinnamatlis-MacBook-Pro.local>
---
 packages/online-editor/src/editor/Toolbar/Share/EmbedModal.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/packages/online-editor/src/editor/Toolbar/Share/EmbedModal.tsx b/packages/online-editor/src/editor/Toolbar/Share/EmbedModal.tsx
index 2ec3342243d..68a1d9881bf 100644
--- a/packages/online-editor/src/editor/Toolbar/Share/EmbedModal.tsx
+++ b/packages/online-editor/src/editor/Toolbar/Share/EmbedModal.tsx
@@ -94,7 +94,10 @@ export function EmbedModal(props: {
   const isGist = useMemo(() => props.workspace.origin.kind === WorkspaceKind.GITHUB_GIST, [props.workspace]);
 
   const getCurrentContentScript = useCallback((content: string, libraryName: string) => {
-    const fileContent = content.replace(/(\r\n|\n|\r)/gm, "");
+    const fileContent = content
+      .replace(/\\/g, "\\\\")
+      .replace(/'/g, "\\'")
+      .replace(/(\r\n|\n|\r)/gm, "");
     return `
 <script>
   ${libraryName}.open({container: document.body, readOnly: true, initialContent: '${fileContent}', origin: "*" })


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org