-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): placeholders updated (#2758)
* data-empty mark * Update CHANGELOG.md * lint * tests added * Update DataEmpty.cy.ts * lint * fix tests * Update Placeholders.cy.ts * upd paragraph * rm redundant test * lint fix * disable test for firefox
- Loading branch information
Showing
20 changed files
with
329 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ | |
@import './input.css'; | ||
@import './popover.css'; | ||
@import './popover-inline.css'; | ||
@import './placeholders.css'; | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
/** | ||
* We support two types of placeholders for contenteditable: | ||
* | ||
* 1. Regular-like placeholders. Will be visible when element is empty. | ||
-- Best choice for rare-used blocks like Headings. | ||
* 2. Current-block placeholders. Will be visible when element is empty and the block is focused. | ||
-- Best choice for common-used blocks like Paragraphs. | ||
*/ | ||
:root { | ||
--placeholder { | ||
pointer-events: none; | ||
color: var(--grayText); | ||
cursor: text; | ||
} | ||
} | ||
|
||
.codex-editor { | ||
/** | ||
* Use [data-placeholder="..."] to always show a placeholder on empty contenteditable. | ||
*/ | ||
[data-placeholder]:empty, | ||
[data-placeholder][data-empty="true"] { | ||
&::before { | ||
@apply --placeholder; | ||
|
||
content: attr(data-placeholder); | ||
} | ||
} | ||
|
||
/** | ||
* Use [data-placeholder-active="..."] to show a placeholder on empty contenteditable in current block. | ||
*/ | ||
[data-placeholder-active]:empty, | ||
[data-placeholder-active][data-empty="true"] { | ||
/* Paragraph tool shows the placeholder for the first block, event it is not focused, so we need to prepare styles for it */ | ||
&::before { | ||
@apply --placeholder; | ||
} | ||
|
||
&:focus::before { | ||
content: attr(data-placeholder-active); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ describe('ToolsFactory', (): void => { | |
prop1: 'prop1', | ||
prop2: 'prop2', | ||
}; | ||
} | ||
}, | ||
} as any | ||
); | ||
}); | ||
|
This file contains 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
Oops, something went wrong.