style: fix linting issues met Prettier
This commit is contained in:
parent
aa1a85e64e
commit
2a2881ec30
84 changed files with 846 additions and 1013 deletions
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
import DOMPurify from 'isomorphic-dompurify';
|
||||
import {ProcessingError} from "../processing-error";
|
||||
import {isValidHttpUrl} from "../../../../util/links";
|
||||
import {DwengoContentType} from "../content-type";
|
||||
import {StringProcessor} from "../string-processor";
|
||||
import { ProcessingError } from '../processing-error';
|
||||
import { isValidHttpUrl } from '../../../../util/links';
|
||||
import { DwengoContentType } from '../content-type';
|
||||
import { StringProcessor } from '../string-processor';
|
||||
|
||||
class ExternProcessor extends StringProcessor {
|
||||
constructor() {
|
||||
|
@ -17,23 +17,23 @@ class ExternProcessor extends StringProcessor {
|
|||
|
||||
override renderFn(externURL: string) {
|
||||
if (!isValidHttpUrl(externURL)) {
|
||||
throw new ProcessingError("The url is not valid: " + externURL);
|
||||
throw new ProcessingError('The url is not valid: ' + externURL);
|
||||
}
|
||||
|
||||
// If a seperate youtube-processor would be added, this code would need to move to that processor
|
||||
// Converts youtube urls to youtube-embed urls
|
||||
const match = /(.*youtube.com\/)watch\?v=(.*)/.exec(externURL)
|
||||
const match = /(.*youtube.com\/)watch\?v=(.*)/.exec(externURL);
|
||||
if (match) {
|
||||
externURL = match[1] + "embed/" + match[2];
|
||||
externURL = match[1] + 'embed/' + match[2];
|
||||
}
|
||||
|
||||
return DOMPurify.sanitize(`
|
||||
return DOMPurify.sanitize(
|
||||
`
|
||||
<div class="iframe-container">
|
||||
<iframe src="${externURL}" allowfullscreen></iframe>
|
||||
</div>`,
|
||||
{ ADD_TAGS: ["iframe"], ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling']}
|
||||
{ ADD_TAGS: ['iframe'], ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling'] }
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue