From 7a1f69190df78d500f700624b212ceacd8f4bc86 Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:39:02 +0100 Subject: [PATCH] [8.13] revert change to shared UX markdown component for dashboard vis (#180906) (#181517) # Backport This will backport the following commits from `main` to `8.13`: - [revert change to shared UX markdown component for dashboard vis (#180906)](https://github.com/elastic/kibana/pull/180906) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) \n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n\n\nCo-authored-by: Eyo O. Eyo <7893459+eokoneyo@users.noreply.github.com>"}},{"branch":"main","label":"v8.15.0","labelRegex":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/180906","number":180906,"mergeCommit":{"message":"revert change to shared UX markdown component for dashboard vis (#180906)\n\n## Summary\r\n\r\nThis PR reverts the change to the shared UX markdown component that\r\nhappened here https://github.com/elastic/kibana/pull/176478. The\r\naforementioned PR introduced couple of visual issues that were uncaught\r\nduring the migration.\r\n\r\nThe known issues that have been brought up that informed the decision to\r\nrevert this change, are itemised below;\r\n\r\n- https://github.com/elastic/kibana/issues/180576\r\n- https://github.com/elastic/kibana/issues/180452\r\n- https://github.com/elastic/sdh-kibana/issues/4608\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n\r\n### For maintainers\r\n\r\n- [x] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4127163bd913dccfbd17badbb9ce1a7a5b2afadc"}}]}] BACKPORT--> --- 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 () {