doc: changelog

This commit is contained in:
Timothy Jaeryang Baek
2024-11-21 22:45:49 -08:00
parent 20f31b5bc8
commit 5c49740aa5
48 changed files with 117 additions and 10 deletions
+8 -10
View File
@@ -14,7 +14,6 @@ export const replaceTokens = (content, sourceIds, char, user) => {
const videoIdToken = /{{VIDEO_FILE_ID_([a-f0-9-]+)}}/gi; // Regex to capture the video ID
const htmlIdToken = /{{HTML_FILE_ID_([a-f0-9-]+)}}/gi; // Regex to capture the HTML ID
// Replace {{char}} if char is provided
if (char !== undefined && char !== null) {
content = content.replace(charToken, char);
@@ -37,17 +36,16 @@ export const replaceTokens = (content, sourceIds, char, user) => {
return `<iframe src="${htmlUrl}" width="100%" frameborder="0" onload="this.style.height=(this.contentWindow.document.body.scrollHeight+20)+'px';"></iframe>`;
});
// Remove sourceIds from the content and replace them with <source_id>...</source_id>
if (Array.isArray(sourceIds)) {
sourceIds.forEach((sourceId) => {
// Create a token based on the exact `[sourceId]` string
const sourceToken = `\\[${sourceId}\\]`; // Escape special characters for RegExp
const sourceRegex = new RegExp(sourceToken, 'g'); // Match all occurrences of [sourceId]
if (Array.isArray(sourceIds)) {
sourceIds.forEach((sourceId) => {
// Create a token based on the exact `[sourceId]` string
const sourceToken = `\\[${sourceId}\\]`; // Escape special characters for RegExp
const sourceRegex = new RegExp(sourceToken, 'g'); // Match all occurrences of [sourceId]
content = content.replace(sourceRegex, `<source_id data="${sourceId}" />`);
});
}
content = content.replace(sourceRegex, `<source_id data="${sourceId}" />`);
});
}
return content;
};