Skip to content

Commit

Permalink
Allow more formatting in onPaste: lists, paragraphs, headings
Browse files Browse the repository at this point in the history
  • Loading branch information
raimohanska committed Feb 18, 2021
1 parent cca9b99 commit 733f393
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
32 changes: 12 additions & 20 deletions frontend/src/app.scss
Expand Up @@ -32,26 +32,6 @@ html {
color: $black;
}

ul {
list-style-type: none;
padding: 0;
margin: 0;
.templates {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
}
}

li.create-template {
> button {
padding: 0.1em;
}
margin-bottom: 0.2em;
font-size: 0.8em;
}

h2 {
font-size: 1.3em;
}
Expand Down Expand Up @@ -646,6 +626,18 @@ a {

#root.dashboard {
padding-left: $left-padding;
ul {
list-style-type: none;
padding: 0;
margin: 0;
.templates {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
}
}

.recent-boards {
.remove {
margin-left: 0.5em;
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/HTMLEditableSpan.tsx
Expand Up @@ -102,9 +102,7 @@ export const HTMLEditableSpan = (props: EditableSpanProps) => {
const onPaste = (e: JSX.ClipboardEvent<HTMLSpanElement>) => {
e.preventDefault()
// Paste as plain text, remove formatting.
var htmlText = e.clipboardData.getData("text/plain")
if (isURL(htmlText)) {
}
var htmlText = e.clipboardData.getData("text/html") || e.clipboardData.getData("text/plain")
const sanitized = isURL(htmlText)
? createLinkHTML(htmlText, window.getSelection()!.toString() || undefined)
: sanitizeHTML(htmlText)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/sanitizeHTML.ts
@@ -1,7 +1,7 @@
import sh, { Attributes } from "sanitize-html"

const sanitizeConfig = {
allowedTags: ["b", "i", "em", "strong", "a", "br"],
allowedTags: ["b", "i", "em", "strong", "a", "br", "p", "ul", "li", "ol", "h1", "h2", "h3", "h4", "h5"],
allowedAttributes: {
a: ["href", "target"],
},
Expand Down

0 comments on commit 733f393

Please sign in to comment.