From b8ea19c4067a22943c1160af321d0e36a1e243ae Mon Sep 17 00:00:00 2001
From: David Daza <03dazal@gmail.com>
Date: Thu, 8 Dec 2022 21:25:41 -0500
Subject: [PATCH 1/2] Add support to pdf files selected via MediaLib
---
admin/src/components/CKEditor/index.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/admin/src/components/CKEditor/index.js b/admin/src/components/CKEditor/index.js
index 5c0a8f5..4cc40d4 100644
--- a/admin/src/components/CKEditor/index.js
+++ b/admin/src/components/CKEditor/index.js
@@ -55,6 +55,9 @@ const Editor = ({ onChange, name, value, disabled }) => {
const imgTag = ``;
newValue = `${newValue}${imgTag}`;
}
+ } else if (asset.mime.includes("application/pdf")) {
+ const downloadTag = `${asset.alt || 'Download PDF'}`
+ newValue = `${newValue}${downloadTag}`
}
// Handle videos and other type of files by adding some code
});
From 936f6ef1d5dc81de7de36f418e71bcd51f25a466 Mon Sep 17 00:00:00 2001
From: David Daza <03dazal@gmail.com>
Date: Fri, 9 Dec 2022 11:51:27 -0500
Subject: [PATCH 2/2] Prefix asset URL with backend URL
---
admin/src/components/CKEditor/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/admin/src/components/CKEditor/index.js b/admin/src/components/CKEditor/index.js
index 4cc40d4..f23565e 100644
--- a/admin/src/components/CKEditor/index.js
+++ b/admin/src/components/CKEditor/index.js
@@ -56,7 +56,7 @@ const Editor = ({ onChange, name, value, disabled }) => {
newValue = `${newValue}${imgTag}`;
}
} else if (asset.mime.includes("application/pdf")) {
- const downloadTag = `${asset.alt || 'Download PDF'}`
+ const downloadTag = `${asset.alt || 'Download PDF'}`
newValue = `${newValue}${downloadTag}`
}
// Handle videos and other type of files by adding some code