-
Notifications
You must be signed in to change notification settings - Fork 21
fix(PM-3398): qa feedbacks and added rich text support for description field #1408
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ff918dd
fix: qa feedbacks and added rich text support for description field
hentrymartin 920aa84
fix: lint
hentrymartin d457c60
fix: strikethrough not showing properly in work card
hentrymartin a6d9739
fix: styling
hentrymartin f3e7b02
fix: styling
hentrymartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
8 changes: 8 additions & 0 deletions
8
src/libs/shared/lib/components/field-html-editor/BundledEditor/BundledEditor.module.scss
This file contains hidden or 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,8 @@ | ||
| .container { | ||
| :global { | ||
| .tox-tinymce { | ||
| border-radius: 0; | ||
| border: none; | ||
| } | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/libs/shared/lib/components/field-html-editor/BundledEditor/BundledEditor.tsx
This file contains hidden or 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,26 @@ | ||
| /** | ||
| * Bundled Editor. | ||
| */ | ||
| import { FC } from 'react' | ||
| import classNames from 'classnames' | ||
| import 'tinymce/tinymce' | ||
| import 'tinymce/models/dom/model.min.js' | ||
| import 'tinymce/themes/silver/theme.min.js' | ||
| import 'tinymce/icons/default/icons.min.js' | ||
| import 'tinymce/skins/ui/oxide/skin' | ||
| import 'tinymce/skins/content/default/content' | ||
| import 'tinymce/skins/ui/oxide/content' | ||
| import 'tinymce/plugins/table/plugin.min.js' | ||
| import 'tinymce/plugins/link/plugin.min.js' | ||
|
|
||
| import { Editor } from '@tinymce/tinymce-react' | ||
|
|
||
| import styles from './BundledEditor.module.scss' | ||
|
|
||
| export const BundledEditor: FC<any> = (props: any) => ( | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <div className={classNames(styles.container, props.className)}> | ||
| <Editor {...props} /> | ||
| </div> | ||
| ) | ||
|
|
||
| export default BundledEditor | ||
1 change: 1 addition & 0 deletions
1
src/libs/shared/lib/components/field-html-editor/BundledEditor/index.ts
This file contains hidden or 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 @@ | ||
| export { default as BundledEditor } from './BundledEditor' |
80 changes: 80 additions & 0 deletions
80
src/libs/shared/lib/components/field-html-editor/FieldHtmlEditor.tsx
This file contains hidden or 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,80 @@ | ||
| import { FC, FocusEvent, useEffect, useRef, useState } from 'react' | ||
|
|
||
| import { FormInputAutocompleteOption, InputWrapper } from '~/libs/ui' | ||
|
|
||
| import { BundledEditor } from './BundledEditor' | ||
|
|
||
| interface FieldHtmlEditorProps { | ||
| readonly className?: string | ||
| readonly autocomplete?: FormInputAutocompleteOption | ||
| readonly dirty?: boolean | ||
| readonly disabled?: boolean | ||
| readonly error?: string | ||
| readonly hideInlineErrors?: boolean | ||
| readonly hint?: string | ||
| readonly label?: string | ||
| readonly name: string | ||
| readonly onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void | ||
| readonly onChange: (event: string) => void | ||
| readonly placeholder?: string | ||
| readonly spellCheck?: boolean | ||
| readonly tabIndex?: number | ||
| readonly value?: string | number | ||
| readonly classNameWrapper?: string | ||
| readonly toolbar?: string | ||
| } | ||
|
|
||
| const FieldHtmlEditor: FC<FieldHtmlEditorProps> = ( | ||
| props: FieldHtmlEditorProps, | ||
| ) => { | ||
| const editorRef = useRef<any>(null) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const [initValue, setInitValue] = useState('') | ||
|
|
||
| useEffect(() => { | ||
| if (!initValue) { | ||
| setInitValue(props.value as string) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| }, [props.value]) | ||
|
|
||
| const defaultToolbar = 'undo redo | formatselect | bold italic underline strikethrough |' | ||
| + ' forecolor backcolor | link | alignleft aligncenter alignright alignjustify |' | ||
| + ' numlist bullist outdent indent | table | removeformat' | ||
|
|
||
| return ( | ||
| <InputWrapper | ||
| {...props} | ||
| dirty={!!props.dirty} | ||
| disabled={!!props.disabled} | ||
| label={props.label || props.name} | ||
| type='textarea' | ||
| hideInlineErrors={props.hideInlineErrors} | ||
| > | ||
| <BundledEditor | ||
| onInit={function onInit(_evt: any, editor: any) { | ||
| (editorRef.current = editor) | ||
| }} | ||
| onChange={function onChange() { | ||
| props.onChange(editorRef.current.getContent()) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }} | ||
| onBlur={props.onBlur} | ||
| initialValue={initValue} | ||
| init={{ | ||
| browser_spellcheck: true, | ||
| content_style: | ||
| 'body {' | ||
| + 'font-family: "Roboto", Arial, Helvetica, sans-serif;' | ||
| + 'font-size: 14px; line-height: 22px;' | ||
| + '}', | ||
| height: 400, | ||
| menubar: false, | ||
| plugins: ['table', 'link', 'textcolor', 'contextmenu'], | ||
| source_view: true, | ||
| statusbar: false, | ||
| toolbar: props.toolbar || defaultToolbar, | ||
| }} | ||
| /> | ||
| </InputWrapper> | ||
| ) | ||
| } | ||
|
|
||
| export default FieldHtmlEditor | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[❗❗
security]The
handleDescriptionChangefunction directly updates theformValuesstate with the new description value. Ensure that this function is only called with sanitized input to prevent potential XSS vulnerabilities, especially since the input is rich text.