I’m trying to insert onedrive video embed in blogs/news articles from editor (@kolkov/angular-editor). it works, but throws too mush errors like one in photo. I researched and read that it’s content security policy, but can’t find how to fix it.
note that I already tried using this safe pipe
here is code snippet:
insertVideoURL() {
const urlOrEmbed = prompt("Please enter the video URL or iframe embed code:");
if (urlOrEmbed) {
try {
let content = '';
try {
// working on youtube urls
} catch (error) {
if (/^<iframe[^>]*src="https://[a-zA-Z0-9.-]+.sharepoint.com[^"]+"[^>]*></iframe>$/.test(urlOrEmbed)) {
content = urlOrEmbed;
} else {
throw new Error('Only YouTube URLs and OneDrive iframe embeds are supported.');
}
}
const currentContent = this.form.get('description')?.value || '';
const updatedContent = currentContent + content;
this.form.get('description')?.setValue(updatedContent);
} catch (error) {
// console.log(error.message);
alert(`Error: ${error.message}`);
}
} else {
console.log("No URL or embed code provided.");
}
}