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

BUGFIX: 3557 placeholder plugin with autoparagraph false #3558

Merged
merged 4 commits into from
Jul 3, 2023

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Jun 30, 2023

resolves: #3557
as the placeholder plugin was a bit hacky and broke in a regression from #3532
Because editor.getData now returned the new internal <neos-inline-wrapper> tags. The preprocessing to strip them is now applied earlier, so other calls to editor.getData now get the expected results.

also a problem is resolved that no placeholder is shown, if one chooses h1 tag when autoparagraph false is enabled

additionally it cleans up the codebase and uses the native ckeditor placeholder plugin instead of our hacky home-brewed solution.

before and after:

Bildschirmaufnahme.2023-07-03.um.10.13.27.mov
Bildschirmaufnahme.2023-07-03.um.10.15.44.mov
Bildschirmaufnahme.2023-07-03.um.10.14.14.mov

What I did

How I did it

How to verify it

@github-actions github-actions bot added Bug Label to mark the change as bugfix 7.3 labels Jun 30, 2023
@mhsdesign
Copy link
Member Author

mhsdesign commented Jul 3, 2023

So i was wondering why we even have our more or less hacky placeholder plugin.

When we initially integrated CKEditor 5 #1942 its latest version was v10. And only with v12 the "ckeditor5-editor-decoupled" had native support for placeholders.
https://github.com/ckeditor/ckeditor5-editor-decoupled/blame/3a6ddfe6644a539f8cff892d19f2d3f7b578317e/src/decouplededitorui.js#L132-L149

see docs: https://ckeditor.com/docs/ckeditor5/16.0.0/api/module_core_editor_editorconfig-EditorConfig.html#member-placeholder and https://ckeditor.com/docs/ckeditor5/16.0.0/features/editor-placeholder.html

luckily we use v12 in 7.3 and v16 in 8.3 so we can utilize this more stable native placeholder support as of right now.

@mhsdesign mhsdesign marked this pull request as ready for review July 3, 2023 08:32
Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works in my tests, just one nitpick regarding a comment.

packages/neos-ui-ckeditor5-bindings/src/manifest.config.js Outdated Show resolved Hide resolved
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me…

@mhsdesign mhsdesign requested a review from Sebobo July 3, 2023 10:40
@mhsdesign mhsdesign force-pushed the bugfix/3557-placeholder-plugin-autoparagraph-false branch from 42030fe to 19402f2 Compare July 3, 2023 10:48
Copy link
Contributor

@grebaldi grebaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm! 👍

@mhsdesign mhsdesign merged commit bb7dd82 into 7.3 Jul 3, 2023
@mhsdesign mhsdesign deleted the bugfix/3557-placeholder-plugin-autoparagraph-false branch July 3, 2023 15:33
mhsdesign added a commit that referenced this pull request Oct 9, 2024
mhsdesign added a commit that referenced this pull request Oct 9, 2024
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 #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.
markusguenther added a commit that referenced this pull request Oct 14, 2024
…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 #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>
laurahaenel pushed a commit to laurahaenel/neos-ui that referenced this pull request Oct 21, 2024
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.3 Bug Label to mark the change as bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants