-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui) Add documentation to term/node creation modal #6294
feat(ui) Add documentation to term/node creation modal #6294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the Edit Description text to be blue?
@aditya-radhakrishnan I thought it was nice in order to make it pop and make it clear that it's user input (not just more form info). What were you thinking? |
const [createButtonDisabled, setCreateButtonDisabled] = useState(true); | ||
const refetch = useRefetch(); | ||
|
||
const [createGlossaryTermMutation] = useCreateGlossaryTermMutation(); | ||
const [createGlossaryNodeMutation] = useCreateGlossaryNodeMutation(); | ||
|
||
const sanitizedDocumentation = DOMPurify.sanitize(documentation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is cool! what is this DOMPurify thing doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's protecting against something like a XSS attack by preventing us from sending back and rendering unsafe html! DOMPurify has a built in list of do-not-allow tags and what not so that users can't try to submit a <script>{do_something}</script>
that could then get rendered and be no bueno. So we sanitize markdown before sending to the backend, but just as importantly, before rendering the markdown on the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm realizing now that I don't really need this sanitization here though, as I'm no longer rendering this rich text in the modal like I was before (when I demo'd) so I can remove! however I still want it before sending to backend. and we use this bad boy elsewhere when we actually render rich text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When creating Terms and Nodes, now allow users to input their desired documentation so they don't have to immediately do and add it afterwords. All the backend/graphql stuff is already in place for this so it's just adding this piece to the modal.
Here we are:
When clicking add documentation:
After adding it, it now says "Edit Documentation" which you can click to see your documentation or edit it
Checklist