Skip to content
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: rich text and user mention components (DHIS2-15522) #1525

Merged
merged 35 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
12217ef
feat: add rich text editor/parser components
edoardo Jun 23, 2023
e83d954
refactor: use rich text parser/editor components from analytics
edoardo Jun 23, 2023
9b06ca7
refactor: convert to functional component
edoardo Jun 23, 2023
bb62385
fix: attempt to fix issue with rebase
edoardo Feb 6, 2024
903adea
feat: moved RichText and UserMention out of Intepretation components
edoardo Jun 28, 2023
d8c5e1c
chore: remove duplicated "renamed" folder
edoardo Jun 28, 2023
6375637
feat: add inputHeight prop to control textarea rows
edoardo Jun 28, 2023
469edef
test: add data-test attribute for testing
edoardo Jul 4, 2023
64c6aff
test: use testing-library in place of enzyme
edoardo Jul 4, 2023
41a1c3a
chore: remove unused default export
edoardo Jul 4, 2023
513ecdd
fix: respect new lines in preview mode DHIS2-15536
edoardo Jul 5, 2023
53055e8
fix: use same styles for text in edit and preview mode DHIS2-15537
edoardo Jul 5, 2023
167aead
fix: add prop for controlling autofocus DHIS2-15541
edoardo Jul 10, 2023
286c87c
fix: keep toolbar fixed in edit/preview mode DHIS2-15539
edoardo Jul 10, 2023
320add3
fix: add prop for controlling resizable textarea DHIS2-15540
edoardo Jul 10, 2023
6354c8b
fix: make textarea resize according to parent DHIS2-15535
edoardo Jul 11, 2023
be0f20e
fix: show search results for the same query (DHIS2-15542)
edoardo Jul 14, 2023
cf1b6df
test: fix tests
edoardo Jul 14, 2023
1f7d9dd
fix: port help text in the rich text editor fix (DHIS2-15781)
edoardo Feb 7, 2024
feca769
fix: avoid error with false being returned in useEffect
edoardo Feb 7, 2024
fcccbbc
fix: add cosmetic fixes to rich text textarea
edoardo Feb 7, 2024
aac2588
fix: fix issue with focus shadow
edoardo Feb 8, 2024
95c4a82
Merge remote-tracking branch 'origin/master' into feat/rich-text-user…
edoardo Mar 18, 2024
2d156c7
Merge branch 'master' into feat/rich-text-user-mention-components
jenniferarnesen Apr 3, 2024
e42b903
Merge branch 'master' into feat/rich-text-user-mention-components
edoardo May 2, 2024
45c0a5c
fix: position caret between bold/italic markers DHIS2-17344
edoardo May 7, 2024
6d65877
feat(rich-text): enable heading and lists (DHIS2-17357)
edoardo May 13, 2024
d1e833e
fix: fix user list positioning with wrapping text (DHIS2-17347)
edoardo May 14, 2024
6946377
fix: close user list when clicking outside of it (DHIS2-17345)
edoardo May 14, 2024
57fe99b
Merge branch 'master' into feat/rich-text-user-mention-components
edoardo May 15, 2024
0b56bb5
fix: add a space and put caret after smileys
edoardo May 21, 2024
989a763
fix: close user list when clicking outside (DHIS2-17345)
edoardo May 23, 2024
c5ec619
fix: position the caret between bold/italic markers (DHIS2-17344)
edoardo May 23, 2024
d864d49
fix: avoid sending \n in the user search (DHIS2-17523)
edoardo Jun 5, 2024
23a5c9e
Merge branch 'master' into feat/rich-text-user-mention-components
edoardo Jun 6, 2024
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
66 changes: 33 additions & 33 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -427,39 +427,6 @@ msgstr "Could not update interpretation"
msgid "Enter interpretation text"
msgstr "Enter interpretation text"

msgid "Bold text"
msgstr "Bold text"

msgid "Italic text"
msgstr "Italic text"

msgid "Link to a URL"
msgstr "Link to a URL"

msgid "Mention a user"
msgstr "Mention a user"

msgid "Add emoji"
msgstr "Add emoji"

msgid "Preview"
msgstr "Preview"

msgid "Back to write mode"
msgstr "Back to write mode"

msgid "Too many results. Try refining the search."
msgstr "Too many results. Try refining the search."

msgid "Search for a user"
msgstr "Search for a user"

msgid "Searching for \"{{- searchText}}\""
msgstr "Searching for \"{{- searchText}}\""

msgid "No results found"
msgstr "No results found"

msgid "Not available offline"
msgstr "Not available offline"

Expand Down Expand Up @@ -882,6 +849,27 @@ msgstr "Financial Years"
msgid "Years"
msgstr "Years"

msgid "Bold text"
msgstr "Bold text"

msgid "Italic text"
msgstr "Italic text"

msgid "Link to a URL"
msgstr "Link to a URL"

msgid "Mention a user"
msgstr "Mention a user"

msgid "Add emoji"
msgstr "Add emoji"

msgid "Preview"
msgstr "Preview"

msgid "Back to write mode"
msgstr "Back to write mode"

msgid "Interpretations and details"
msgstr "Interpretations and details"

Expand Down Expand Up @@ -912,6 +900,18 @@ msgstr "Could not load translations"
msgid "Retry"
msgstr "Retry"

msgid "Too many results. Try refining the search."
msgstr "Too many results. Try refining the search."

msgid "Search for a user"
msgstr "Search for a user"

msgid "Searching for \"{{- searchText}}\""
msgstr "Searching for \"{{- searchText}}\""

msgid "No results found"
msgstr "No results found"

msgid "Series"
msgstr "Series"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"styled-jsx": "^4.0.1"
},
"dependencies": {
"@dhis2/d2-ui-rich-text": "^7.4.1",
"@dhis2/multi-calendar-dates": "1.0.0",
"@dnd-kit/core": "^6.0.7",
"@dnd-kit/sortable": "^7.0.2",
Expand All @@ -71,6 +70,7 @@
"d3-color": "^1.2.3",
"highcharts": "^10.3.3",
"lodash": "^4.17.21",
"markdown-it": "^13.0.1",
"mathjs": "^9.4.2",
"react-beautiful-dnd": "^10.1.1",
"resize-observer-polyfill": "^1.5.1"
Expand Down
8 changes: 4 additions & 4 deletions src/components/AboutAOUnit/AboutAOUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
useTimeZoneConversion,
} from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text'
import {
Button,
CircularLoader,
Expand All @@ -29,6 +28,7 @@ import React, {
useImperativeHandle,
} from 'react'
import { formatList } from '../../modules/list.js'
import { RichTextParser } from '../RichText/index.js'
import styles from './styles/AboutAOUnit.style.js'
import { getTranslatedString, AOTypeMap } from './utils.js'

Expand Down Expand Up @@ -191,7 +191,7 @@ const AboutAOUnit = forwardRef(({ type, id, renderId }, ref) => {
)}
{data && (
<div className="content">
<p
<div
className={cx('detailLine', {
description: true,
noDescription: !data.ao.displayDescription,
Expand All @@ -202,9 +202,9 @@ const AboutAOUnit = forwardRef(({ type, id, renderId }, ref) => {
{data.ao.displayDescription}
</RichTextParser>
) : (
i18n.t('No description')
<p>{i18n.t('No description')}</p>
)}
</p>
</div>
<div>
<p className="detailLine">
<IconShare16 color={colors.grey700} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import i18n from '@dhis2/d2-i18n'
import { Button } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useRef, useState } from 'react'
import { RichTextEditor } from '../../RichText/index.js'
import {
RichTextEditor,
MessageEditorContainer,
MessageButtonStrip,
MessageInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import i18n from '@dhis2/d2-i18n'
import { Button, spacers, colors } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useState, useRef } from 'react'
import {
MessageEditorContainer,
RichTextEditor,
MessageButtonStrip,
} from '../common/index.js'
import { RichTextEditor } from '../../RichText/index.js'
import { MessageEditorContainer, MessageButtonStrip } from '../common/index.js'

export const CommentUpdateForm = ({
interpretationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import i18n from '@dhis2/d2-i18n'
import { Button, Input } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useRef, useState } from 'react'
import {
RichTextEditor,
MessageEditorContainer,
MessageButtonStrip,
} from '../common/index.js'
import { RichTextEditor } from '../../RichText/index.js'
import { MessageEditorContainer, MessageButtonStrip } from '../common/index.js'

export const InterpretationForm = ({
type,
Expand Down Expand Up @@ -46,7 +43,7 @@ export const InterpretationForm = ({
dataTest="interpretation-form"
>
{showRichTextEditor ? (
<div>
<>
<RichTextEditor
disabled={saveMutationInProgress}
inputPlaceholder={inputPlaceholder}
Expand Down Expand Up @@ -81,7 +78,7 @@ export const InterpretationForm = ({
{i18n.t('Cancel')}
</Button>
</MessageButtonStrip>
</div>
</>
) : (
<Input
onFocus={() => setShowRichTextEditor(true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import i18n from '@dhis2/d2-i18n'
import { Button, spacers, colors } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
import { RichTextEditor } from '../../../RichText/index.js'
import {
MessageEditorContainer,
RichTextEditor,
MessageButtonStrip,
InterpretationSharingLink,
} from '../index.js'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Interpretations/common/Message/Message.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useTimeZoneConversion } from '@dhis2/app-runtime'
import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text'
import { UserAvatar, spacers, colors } from '@dhis2/ui'
import moment from 'moment'
import PropTypes from 'prop-types'
import React from 'react'
import { RichTextParser } from '../../../RichText/index.js'

const Message = ({ children, text, created, username }) => {
const { fromServerDate } = useTimeZoneConversion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const MessageEditorContainer = ({ children, currentUser, dataTest }) => (
}
.editor {
flex-grow: 1;
height: 100%;
}
`}</style>
</div>
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Interpretations/common/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './Interpretation/index.js'
export * from './Message/index.js'
export * from './RichTextEditor/index.js'
export * from './getInterpretationAccess.js'
Loading
Loading