feat: add Rich Text Editor component (v0) [WIP]#4823
Draft
ernst-dev wants to merge 2 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4823 +/- ##
==========================================
- Coverage 97.61% 97.60% -0.01%
==========================================
Files 952 954 +2
Lines 30816 30904 +88
Branches 11318 11343 +25
==========================================
+ Hits 30081 30164 +83
- Misses 688 693 +5
Partials 47 47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The RichTextEditor renders a contenteditable region with role="textbox", so it requires an accessible name. The permutations dev page rendered the editor without an ariaLabel and outside a FormField, so axe reported a serious aria-input-field-name violation on the a11y shards. Pass a default ariaLabel in the permutations render so every permutation has an accessible name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
[WIP / DRAFT] First-cut (v0) of a Rich Text Editor component for Cloudscape, opened for early feedback. Additive and fully opt-in — no existing components are changed.
This implements a minimal WYSIWYG editor: a formatting toolbar (bold / italic / underline / strikethrough / bulleted list / numbered list / link) over a
contenteditableregion, with a controlledvalue/onChange(HTML string) API built on Cloudscape primitives and design tokens.Related links, issue #, if available: AWSUI-60329 (Cloudscape contribution request: Rich Text Editor)
v0 scope (done in this PR)
RichTextEditor(src/rich-text-editor/) withReact.forwardRef+ imperativefocus().value(HTML string) /onChange, plusonFocus/onBlur.bold,italic,underline,strikethrough,bulleted-list,numbered-list,link; configurable/orderable viatoolbarControls.placeholder,disabled,readOnly(toolbar hidden),ariaLabel,i18nStrings, form-field context integration (invalid/warning/controlId), andBaseComponentProps.styles.scss);role="toolbar"/role="textbox"witharia-multiline.interfaces.ts).findRichTextEditor,findToolbar,findToolbarButton,findContent,getValue).simple.page.tsxandpermutations.page.tsx.Remaining work (follow-ups — intentionally out of scope for v0)
document.execCommand(deprecated) with a Selection-API / lightweight editor core.interfaces.ts).window.promptplaceholder; validate URLs viacheckSafeUrl.aria-pressed,queryCommandState).styleAPI parity with other form controls, RTL review.How has this been tested?
eslint(component, pages, test-utils, build-tools) — pass.stylelinton component SCSS — pass.gulp quick-buildand fullgulp build(production, incl. dev pages + documenter) — pass.src/rich-text-editor— 14/14 pass.Reviewers can explore the component via the
rich-text-editordev pages (simple,permutations).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.