-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from AppleBlox/dev
Fix update popup and DiscordRPC on x64 versions of the app
- Loading branch information
Showing
6 changed files
with
54 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
frontend/src/windows/main/components/markdown-viewer.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
import { marked } from 'marked'; | ||
import DOMPurify from 'dompurify'; | ||
import { os } from '@neutralinojs/lib'; | ||
import { cn } from '$lib/utils'; | ||
export let content: string = ''; | ||
let className: string = ''; | ||
export { className as class }; | ||
function handleLinkClick(e: MouseEvent) { | ||
const target = e.target as HTMLElement; | ||
if (target.tagName === 'A') { | ||
e.preventDefault(); | ||
e.stopImmediatePropagation() | ||
const href = target.getAttribute('href'); | ||
if (href) { | ||
os.open(href); | ||
} | ||
} | ||
} | ||
$: parsedContent = marked.parse(content, { async: false }) as string; | ||
$: sanitizedHtml = DOMPurify.sanitize(parsedContent); | ||
</script> | ||
|
||
<article | ||
class={cn('markdown-content prose dark:prose-invert max-w-none prose-headings:text-primary prose-a:text-secondary', className)} | ||
on:click={handleLinkClick} | ||
aria-hidden="true" | ||
> | ||
{@html sanitizedHtml} | ||
</article> | ||
|
||
<style lang="postcss"> | ||
:global(.markdown-content blockquote) { | ||
@apply border-l-4 border-primary pl-4; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters