From 4127163bd913dccfbd17badbb9ce1a7a5b2afadc Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:01:18 +0100 Subject: [PATCH] revert change to shared UX markdown component for dashboard vis (#180906) ## Summary This PR reverts the change to the shared UX markdown component that happened here https://github.com/elastic/kibana/pull/176478. The aforementioned PR introduced couple of visual issues that were uncaught during the migration. The known issues that have been brought up that informed the decision to revert this change, are itemised below; - https://github.com/elastic/kibana/issues/180576 - https://github.com/elastic/kibana/issues/180452 - https://github.com/elastic/sdh-kibana/issues/4608 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/vis_type_markdown/kibana.jsonc | 1 + .../public/markdown_vis_controller.test.tsx | 5 +---- .../vis_type_markdown/public/markdown_vis_controller.tsx | 5 ++--- src/plugins/vis_type_markdown/tsconfig.json | 2 +- .../apps/dashboard_elements/markdown/_markdown_vis.ts | 7 +++++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/vis_type_markdown/kibana.jsonc b/src/plugins/vis_type_markdown/kibana.jsonc index d3d1d3bd9f29b..476dcc0605ad4 100644 --- a/src/plugins/vis_type_markdown/kibana.jsonc +++ b/src/plugins/vis_type_markdown/kibana.jsonc @@ -13,6 +13,7 @@ ], "requiredBundles": [ "expressions", + "kibanaReact", "visDefaultEditor", "visualizations" ] diff --git a/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx b/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx index 04f86e815e841..963f3b0ecbbb2 100644 --- a/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx +++ b/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx @@ -29,9 +29,7 @@ describe('markdown vis controller', () => { expect(getByText('markdown')).toMatchInlineSnapshot(` markdown @@ -55,8 +53,7 @@ describe('markdown vis controller', () => { expect(getByText(/testing/i)).toMatchInlineSnapshot(`

- Testing - html + Testing <a>html</a>

`); }); diff --git a/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx b/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx index 7c0b44d24860d..d941adf573591 100644 --- a/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx +++ b/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx @@ -7,7 +7,7 @@ */ import React, { useEffect } from 'react'; -import { Markdown } from '@kbn/shared-ux-markdown'; +import { Markdown } from '@kbn/kibana-react-plugin/public'; import { MarkdownVisParams } from './types'; import './markdown_vis.scss'; @@ -29,8 +29,7 @@ const MarkdownVisComponent = ({ ); diff --git a/src/plugins/vis_type_markdown/tsconfig.json b/src/plugins/vis_type_markdown/tsconfig.json index 833dc7404cc0f..5b9639787e12c 100644 --- a/src/plugins/vis_type_markdown/tsconfig.json +++ b/src/plugins/vis_type_markdown/tsconfig.json @@ -16,7 +16,7 @@ "@kbn/i18n", "@kbn/i18n-react", "@kbn/config-schema", - "@kbn/shared-ux-markdown", + "@kbn/kibana-react-plugin", ], "exclude": [ "target/**/*", diff --git a/test/functional/apps/dashboard_elements/markdown/_markdown_vis.ts b/test/functional/apps/dashboard_elements/markdown/_markdown_vis.ts index d524fd23e0393..e440cdddc77c7 100644 --- a/test/functional/apps/dashboard_elements/markdown/_markdown_vis.ts +++ b/test/functional/apps/dashboard_elements/markdown/_markdown_vis.ts @@ -39,9 +39,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(h1Txt).to.equal('Heading 1'); }); - it('should not render html in markdown', async function () { + it('should not render html in markdown as html', async function () { const actual = await PageObjects.visChart.getMarkdownText(); - expect(actual).to.equal('Heading 1'); + + expect(actual).to.equal( + 'Heading 1\n

Inline HTML that should not be rendered as html

' + ); }); it('should auto apply changes if auto mode is turned on', async function () {