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

refactor: use rich text component from analytics #2474

Merged
merged 42 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0b0c7cf
fix(translations): sync translations from transifex (dev)
dhis2-bot Nov 26, 2023
6a22f08
chore: analytics (#2856)
janhenrikoverland Dec 14, 2023
9d83c09
chore(deps): bump @adobe/css-tools from 4.3.1 to 4.3.2
dependabot[bot] Dec 14, 2023
db5128a
fix(translations): sync translations from transifex (dev)
dhis2-bot Dec 17, 2023
678edc2
Merge branch 'dev' into dependabot/npm_and_yarn/adobe/css-tools-4.3.2
jenniferarnesen Jan 22, 2024
fbcf30c
Merge pull request #2836 from dhis2/dependabot/npm_and_yarn/adobe/css…
jenniferarnesen Jan 23, 2024
4d43b23
chore(deps): bump browserify-sign from 4.2.1 to 4.2.2 (#2807)
dependabot[bot] Jan 23, 2024
3518e64
chore(deps): bump crypto-js from 4.1.1 to 4.2.0 (#2806)
dependabot[bot] Jan 23, 2024
166186b
chore(deps): bump get-func-name from 2.0.0 to 2.0.2 (#2748)
dependabot[bot] Jan 23, 2024
34bf16e
chore: use the repo default branch for dependabot (#2887)
jenniferarnesen Jan 23, 2024
252a0cf
chore: include patch packages in cache-key (#2855)
jenniferarnesen Jan 23, 2024
b99c5ac
chore(deps): bump react-redux from 7.2.4 to 7.2.9 (#2893)
dependabot[bot] Jan 23, 2024
56fcaa4
chore(deps): bump moment from 2.29.4 to 2.30.1 (#2892)
dependabot[bot] Jan 23, 2024
06e0eb3
chore(deps): bump @dhis2/d2-i18n from 1.1.1 to 1.1.3 (#2896)
dependabot[bot] Jan 23, 2024
201d673
chore(deps): bump @babel/traverse from 7.18.13 to 7.23.2 (#2796)
dependabot[bot] Jan 23, 2024
7a12d98
chore(deps): bump @dhis2/app-runtime from 3.9.4 to 3.10.2 (#2890)
dependabot[bot] Jan 24, 2024
39bf03d
chore(deps): bump @dhis2/ui from 8.13.6 to 8.13.11 (#2462)
dependabot[bot] Jun 28, 2023
8801ed2
refactor: use rich text components from analytics
edoardo Jun 23, 2023
ed51640
fix: pass textarea height to RichTextEditor
edoardo Jun 28, 2023
82a17b4
chore: remove obsolete d2-ui dependencies
edoardo Jun 28, 2023
9d74879
chore: remove unused import
edoardo Jun 29, 2023
e95484b
fix: use same text styles as in edit/preview mode DHIS2-15537
edoardo Jul 6, 2023
b47e3fa
fix: use same title for text item (Text box)
edoardo Jul 7, 2023
5c76e22
fix: make textarea resize according to parent
edoardo Jul 11, 2023
0c12d10
fix: use same label for Text box
edoardo Jul 11, 2023
3166d0c
chore: deduplicate yarn.lock
edoardo Oct 25, 2023
cf1348c
Merge branch 'dev' into refactor/use-analytics-rich-text
jenniferarnesen Apr 3, 2024
8953b00
fix: remove @dhis2/d2-ui-rich-text dependency
jenniferarnesen Apr 3, 2024
7b7d924
fix: upgrade to analytics alpha
jenniferarnesen Apr 4, 2024
d7196c9
Merge branch 'dev' into refactor/use-analytics-rich-text
jenniferarnesen Apr 25, 2024
e87120d
Merge branch 'dev' into refactor/use-analytics-rich-text
edoardo May 2, 2024
1e40988
chore: use latest alpha of analytics
edoardo May 2, 2024
764d2ac
chore: bump analytics to alpha for testing
edoardo May 15, 2024
f1ee20e
fix: avoid vertical scrollbar for TEXT items (DHIS2-17355)
edoardo May 16, 2024
97256f5
fix(translations): sync translations from transifex (dev)
dhis2-bot May 19, 2024
727112f
fix: disable drag n' drop when interacting with buttons (DHIS2-17346)
edoardo May 21, 2024
e1df3d3
chore: bump analytics to alpha for testing
edoardo May 23, 2024
d22bfd3
Merge remote-tracking branch 'origin/dev' into refactor/use-analytics…
edoardo May 23, 2024
f054f12
chore: bump analytics to alpha for testing
edoardo May 23, 2024
3ae4df7
chore: bump analytics to alpha for testing
edoardo Jun 5, 2024
468e5c0
chore: bump analytics dependency
edoardo Jun 7, 2024
4ec6134
Merge branch 'dev' into refactor/use-analytics-rich-text
jenniferarnesen Jun 7, 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
7 changes: 2 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ msgstr "Spacer"
msgid "Use a spacer to create empty vertical space between other dashboard items."
msgstr "Use a spacer to create empty vertical space between other dashboard items."

msgid "Text item"
msgstr "Text item"
msgid "Text box"
msgstr "Text box"

msgid "Add text here"
msgstr "Add text here"
Expand Down Expand Up @@ -337,9 +337,6 @@ msgstr "Cannot search for dashboard items while offline"
msgid "Additional items"
msgstr "Additional items"

msgid "Text box"
msgstr "Text box"

msgid "Dashboard layout"
msgstr "Dashboard layout"

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"private": true,
"license": "BSD-3-Clause",
"dependencies": {
"@dhis2/analytics": "^26.6.10",
"@dhis2/analytics": "^26.7.0",
"@dhis2/app-runtime": "^3.10.2",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/d2-i18n": "^1.1.3",
"@dhis2/d2-ui-rich-text": "^7.4.3",
"@dhis2/ui": "^9.2.0",
"@krakenjs/post-robot": "^11.0.0",
"classnames": "^2.3.2",
Expand Down
28 changes: 10 additions & 18 deletions src/components/Item/TextItem/Item.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { RichTextParser, RichTextEditor } from '@dhis2/analytics'
import i18n from '@dhis2/d2-i18n'
import {
Parser as RichTextParser,
Editor as RichTextEditor,
} from '@dhis2/d2-ui-rich-text'
import { Divider, TextArea, spacers } from '@dhis2/ui'
import { Divider, spacers } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import { connect } from 'react-redux'
Expand All @@ -21,13 +18,11 @@ import PrintItemInfo from '../ItemHeader/PrintItemInfo.js'
const style = {
textDiv: {
padding: '10px',
whiteSpace: 'pre-line',
lineHeight: '20px',
lineHeight: '16px',
},
textField: {
fontSize: '14px',
fontStretch: 'normal',
width: '90%',
margin: '0 auto',
display: 'block',
lineHeight: '24px',
Expand Down Expand Up @@ -63,22 +58,19 @@ const TextItem = (props) => {
return (
<>
<ItemHeader
title={i18n.t('Text item')}
title={i18n.t('Text box')}
itemId={item.id}
dashboardMode={dashboardMode}
/>
<Divider margin={`0 0 ${spacers.dp4} 0`} />
<div className="dashboard-item-content">
<RichTextEditor
onEdit={(event) => onChangeText(event.target.value)}
>
<TextArea
rows={30}
value={text}
placeholder={i18n.t('Add text here')}
onChange={({ value }) => onChangeText(value)}
/>
</RichTextEditor>
onChange={onChangeText}
inputPlaceholder={i18n.t('Add text here')}
value={text}
initialFocus={false}
resizable={false}
/>
</div>
</>
)
Expand Down
4 changes: 4 additions & 0 deletions src/components/styles/ItemGrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
overflow: auto;
}

.TEXT .dashboard-item-content {
padding-bottom: var(--item-content-padding);
}

.EVENT_REPORT .dashboard-item-content {
position: relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/edit/ItemGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const EditItemGrid = ({
onWidthChange={onWidthChanged}
isDraggable={!hasLayout}
isResizable={!hasLayout}
draggableCancel="input,textarea"
draggableCancel="button,input,textarea"
>
{getItemComponents(dashboardItems)}
</ResponsiveReactGridLayout>
Expand Down
Loading
Loading