forked from neos/neos-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX: Restore old Placeholder behavior to keep shown when focused (n…
…eos#3864) * BUGFIX: Restore old Placeholder behavior to keep shown when focused In Neos 7.3.17 and before the placeholder in ckeditor would not disappear when focused. And only when typing. By switching to the native placeholder feature of ckeditor in neos#3558 we introduced a regression as that implementation would hide the placeholder while just clicking into. This is especially noticeable for centered texts as the cursor needs one millisecond to adjust and its glitchy. This will eventually be fixed in Ckeditor 24 something. As a hotfix for our version 16 i introduce the patch of ckeditor/ckeditor5#8474 (without the css absolute change as that would make centered text uneditable). The mentioned fix was not merged directly into ckeditor but made way more complicated: ckeditor/ckeditor5#8867 We dont need the more complicated fix as we dont use the mentioned features of the placeholder in a image description and such. * TASK: Move cursor before the placeholer * TASK: Hide break in placeholder context To move the cursor to the first position, the placeholder text is moved backwards. Therefore, a change with a break is disadvantageous. --------- Co-authored-by: Markus Günther <info@unikka.de>
- Loading branch information
1 parent
130f259
commit 177af72
Showing
6 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
Binary file added
BIN
+420 KB
.yarn/cache/@ckeditor-ckeditor5-engine-patch-dfc8c266c9-0ca241d6d2.zip
Binary file not shown.
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
17 changes: 13 additions & 4 deletions
17
packages/neos-ui-ckeditor5-bindings/src/placeholder.vanilla-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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
.ck.ck-placeholder:before, .ck .ck-placeholder:before { | ||
content: attr(data-placeholder); | ||
.ck.ck-placeholder:after, .ck .ck-placeholder { | ||
display: inline-flex; | ||
} | ||
|
||
/* See ckeditor/ckeditor5#469. */ | ||
pointer-events: none; | ||
.ck .ck-placeholder br[data-cke-filler="true"] { | ||
display: none; | ||
} | ||
|
||
.ck.ck-placeholder:after, .ck .ck-placeholder:after { | ||
content: attr(data-placeholder); | ||
pointer-events: none; | ||
color: #999; | ||
} | ||
|
||
.ck.ck-read-only .ck-placeholder:after { | ||
display: none; | ||
} |
22 changes: 22 additions & 0 deletions
22
patches/@ckeditor-ckeditor5-engine-npm-16.0.0-placeholder.patch
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,22 @@ | ||
diff --git a/src/view/placeholder.js b/src/view/placeholder.js | ||
index ec83640d4f7d12d8278c921a3c641917543ca859..09e96933b392f38d079ac3126ead49690e408228 100755 | ||
--- a/src/view/placeholder.js | ||
+++ b/src/view/placeholder.js | ||
@@ -155,16 +155,7 @@ export function needsPlaceholder( element ) { | ||
const isEmptyish = !Array.from( element.getChildren() ) | ||
.some( element => !element.is( 'uiElement' ) ); | ||
|
||
- // If the element is empty and the document is blurred. | ||
- if ( !doc.isFocused && isEmptyish ) { | ||
- return true; | ||
- } | ||
- | ||
- const viewSelection = doc.selection; | ||
- const selectionAnchor = viewSelection.anchor; | ||
- | ||
- // If document is focused and the element is empty but the selection is not anchored inside it. | ||
- if ( isEmptyish && selectionAnchor && selectionAnchor.parent !== element ) { | ||
+ if ( isEmptyish ) { | ||
return true; | ||
} | ||
|
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