Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichText: add min width to show caret for empty inline container #30224

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/rich-text/src/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,18 @@ const INSERTION_INPUT_TYPES_TO_IGNORE = new Set( [
*/
const whiteSpace = 'pre-wrap';

/**
* A minimum width of 1px will prevent the rich text container from collapsing
* to 0 width and hiding the caret. This is useful for inline containers.
*/
const minWidth = '1px';

/**
* Default style object for the editable element.
*
* @type {Object<string,string>}
*/
const defaultStyle = { whiteSpace };
const defaultStyle = { whiteSpace, minWidth };

const EMPTY_ACTIVE_FORMATS = [];

Expand Down