Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions public/assets/images/heroicons-blockquote.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions public/components/common/form/CommentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import IconOrderedList from "@fider/assets/images/heroicons-orderedlist.svg"
import IconBulletList from "@fider/assets/images/heroicons-bulletlist.svg"
import IconPhotograph from "@fider/assets/images/heroicons-photograph.svg"
import IconLink from "@fider/assets/images/heroicons-link.svg"
import IconBlockquote from "@fider/assets/images/heroicons-blockquote.svg"
import { DisplayError, hasError, Icon, ValidationContext } from "@fider/components"
import { fileToBase64 } from "@fider/services"
import { generateBkey } from "@fider/services/bkey"
Expand Down Expand Up @@ -151,6 +152,15 @@ const MenuBar = ({
>
<Icon sprite={IconCode} />
</button>
<button
disabled={disabled}
type="button"
title="Quote"
onClick={() => editor.chain().focus().toggleBlockquote().run()}
className={`c-editor-button ${editor.isActive("blockquote") ? "is-active" : ""} ${disabled ? "is-disabled" : ""}`}
>
<Icon sprite={IconBlockquote} />
</button>
<button
disabled={disabled}
type="button"
Expand Down
8 changes: 2 additions & 6 deletions public/services/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,9 @@ plainTextRenderer.code = (code) => code
plainTextRenderer.codespan = (code) => code
plainTextRenderer.html = (html) => html
plainTextRenderer.del = (text) => text
plainTextRenderer.blockquote = (quote) => quote

const entities: { [key: string]: string } = {
"<": "&lt;",
">": "&gt;",
}

const encodeHTML = (s: string) => s.replace(/[<>]/g, (tag) => entities[tag] || tag)
const encodeHTML = (s: string) => s.replace(/</g, "&lt;")
const stripTags = (input: string) => input.replace(/<[^>]*>/g, "")
const sanitize = (input: string) => (DOMPurify.isSupported ? DOMPurify.sanitize(input) : stripTags(input))
// Helper function to decode HTML entities back to readable characters
Expand Down
Loading