From 7d22275458feaf0d7b09722a6a08a16bc6870cd2 Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Fri, 7 Jun 2024 15:54:59 +0200 Subject: [PATCH] refactor: use rich text component from analytics (#2474) --- i18n/en.pot | 7 +- package.json | 3 +- src/components/Item/TextItem/Item.js | 28 ++-- src/components/styles/ItemGrid.css | 4 + src/pages/edit/ItemGrid.js | 2 +- yarn.lock | 206 ++++++--------------------- 6 files changed, 58 insertions(+), 192 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index 4df501053..c5f2aef0b 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -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" @@ -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" diff --git a/package.json b/package.json index 8c61ae00d..3e3561954 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/Item/TextItem/Item.js b/src/components/Item/TextItem/Item.js index 3d5165937..1668c274f 100644 --- a/src/components/Item/TextItem/Item.js +++ b/src/components/Item/TextItem/Item.js @@ -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' @@ -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', @@ -63,22 +58,19 @@ const TextItem = (props) => { return ( <>
onChangeText(event.target.value)} - > -