From f6202929b767c3cc6c1cd01f1f389ef29b2bd741 Mon Sep 17 00:00:00 2001 From: i-a-n Date: Thu, 5 Dec 2019 14:54:32 -0800 Subject: [PATCH 01/43] WIP: Add markdown_editor component --- package.json | 2 + .../form_controls/form_controls_example.js | 28 + .../views/form_controls/markdown_editor.js | 10 + src/components/index.js | 2 + src/components/index.scss | 1 + src/components/markdown_editor/_index.scss | 1 + .../markdown_editor/_markdown_editor.scss | 40 ++ src/components/markdown_editor/index.ts | 1 + .../markdown_editor/markdown_actions.ts | 523 ++++++++++++++++++ .../markdown_editor/markdown_editor.test.tsx | 13 + .../markdown_editor/markdown_editor.tsx | 241 ++++++++ yarn.lock | 73 ++- 12 files changed, 932 insertions(+), 3 deletions(-) create mode 100644 src-docs/src/views/form_controls/markdown_editor.js create mode 100644 src/components/markdown_editor/_index.scss create mode 100644 src/components/markdown_editor/_markdown_editor.scss create mode 100644 src/components/markdown_editor/index.ts create mode 100644 src/components/markdown_editor/markdown_actions.ts create mode 100644 src/components/markdown_editor/markdown_editor.test.tsx create mode 100644 src/components/markdown_editor/markdown_editor.tsx diff --git a/package.json b/package.json index 6bbc40b9f68..3f0ee4d7a59 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,8 @@ "react-is": "~16.3.0", "react-virtualized": "^9.21.2", "resize-observer-polyfill": "^1.5.0", + "showdown": "^1.9.1", + "showdown-htmlescape": "^0.1.9", "tabbable": "^3.0.0", "uuid": "^3.1.0" }, diff --git a/src-docs/src/views/form_controls/form_controls_example.js b/src-docs/src/views/form_controls/form_controls_example.js index 65784300e86..3e0168df589 100644 --- a/src-docs/src/views/form_controls/form_controls_example.js +++ b/src-docs/src/views/form_controls/form_controls_example.js @@ -22,6 +22,7 @@ import { EuiFormControlLayout, EuiFormControlLayoutDelimited, EuiLink, + EuiMarkdownEditor, EuiRadio, EuiRadioGroup, EuiSelect, @@ -50,6 +51,10 @@ import TextArea from './text_area'; const textAreaSource = require('!!raw-loader!./text_area'); const textAreaHtml = renderToHtml(TextArea); +import MarkdownEditor from './markdown_editor'; +const markdownEditorSource = require('!!raw-loader!./markdown_editor'); +const markdownEditorHtml = renderToHtml(MarkdownEditor); + import { FilePicker } from './file_picker'; const filePickerSource = require('!!raw-loader!./file_picker'); const filePickerHtml = renderToHtml(FilePicker); @@ -210,6 +215,29 @@ export const FormControlsExample = { }, demo: + ); +}; diff --git a/src/components/markdown_editor/markdown_editor_toolbar.tsx b/src/components/markdown_editor/markdown_editor_toolbar.tsx index 6a4e9fd0756..e894808e029 100644 --- a/src/components/markdown_editor/markdown_editor_toolbar.tsx +++ b/src/components/markdown_editor/markdown_editor_toolbar.tsx @@ -129,7 +129,7 @@ export class EuiMarkdownEditorToolbar extends Component< /> ) } - iconType={viewMarkdownPreview ? 'eye' : 'eyeClosed'} + iconType={viewMarkdownPreview ? 'pencil' : 'eye'} onChange={onTogglePreview} isSelected={viewMarkdownPreview} isEmpty From 7568dfb19c01b57aae6a28c8061fe902e52fa78b Mon Sep 17 00:00:00 2001 From: miukimiu Date: Tue, 11 Feb 2020 18:26:24 +0000 Subject: [PATCH 07/43] Buttons order --- .../markdown_editor.test.tsx.snap | 20 ++++----- .../markdown_editor_toolbar.tsx | 42 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/components/markdown_editor/__snapshots__/markdown_editor.test.tsx.snap b/src/components/markdown_editor/__snapshots__/markdown_editor.test.tsx.snap index bc06c54b741..57d244dddd6 100644 --- a/src/components/markdown_editor/__snapshots__/markdown_editor.test.tsx.snap +++ b/src/components/markdown_editor/__snapshots__/markdown_editor.test.tsx.snap @@ -16,7 +16,7 @@ exports[`EuiMarkdownEditor is rendered 1`] = ` class="euiFlexItem euiFlexItem--flexGrowZero euiMarkdownEditor__toolbar__buttons" > + -