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

placeholder text doesnt go away when block-element is inserted #7419

Closed
testbuddy opened this issue Jun 11, 2020 · 4 comments
Closed

placeholder text doesnt go away when block-element is inserted #7419

testbuddy opened this issue Jun 11, 2020 · 4 comments
Labels
type:bug This issue reports a buggy (incorrect) behavior.

Comments

@testbuddy
Copy link

📝 Provide detailed reproduction steps (if any)

  1. Editor-data is set to ''
  2. Set placeholder text in config
  3. Insert block-element like image or custom widget

✔️ Expected result

data-placeholder attribute and ck-placeholder class are not set on the first block-element

❌ Actual result

data-placeholder attribute and ck-placeholder class are set on the first block-element

📃 Other details

  • Browser: tested in chrome
  • OS: windows
  • CKEditor version: 5
  • Installed CKEditor plugins:
    ckeditor5-react'
    inlineeditor'
    essentials'
    heading'
    bold'
    italic'
    underline'
    link'
    table'
    tabletoolbar'
    paragraph'
    image'
    imageupload'
    base64uploadadapter'
    imagetoolbar'
    imagecaption'
    imagestyle'
    imageresize'
@testbuddy testbuddy added the type:bug This issue reports a buggy (incorrect) behavior. label Jun 11, 2020
@Mgsy
Copy link
Member

Mgsy commented Jun 12, 2020

Hi, we're aware of some problems with placeholders, e.g. while inserting a media and UI elements. However, I can't reproduce it with images. Could you describe more detailed steps to reproduce and create a screencast showing the issue?

@Mgsy Mgsy added the pending:feedback This issue is blocked by necessary feedback. label Jun 12, 2020
@testbuddy
Copy link
Author

Hi :)
Unfortunately i cannot showing a screencast cause some private code :(
Instead i try it with cutted screenshoots.

  1. The data of the editor is empty ('') and the config object contains the key placeholder with value 'Type some text....'
    start
  2. Then i click the insert image button. This button is not modified. Just from the lib.
    before_insert
  3. After the insert the figure element has the data-placeholder attribute.
    after_insert
  4. When i insert a custom widget it also contains placeholder css class :(
    custom_element

Hopefully this helps ? This doesnt happend when i add text. Only the first block-element.

@Mgsy
Copy link
Member

Mgsy commented Jun 15, 2020

Thanks for the details. As it goes to data-placeholder attribute, it's added always to the first element in the editor. ck-placeholder class is not added to an image, so the placeholder doesn't display and it works properly.

As it comes to your custom widget, I believe the issue occurs because of problems mentioned in the tickets I've linked above. 

Out of curiosity - can you check if adding a change from ckeditor/ckeditor5-engine#1749 fixes your issue? After migrating to monorepo, this branch might be inaccessible, so you'll need to add a fix manually. Just add this code to ckeditor5-engine/src/view/placeholder.js after this line:

if ( element.getCustomProperty( 'widget' ) ) {
	return false;
}

@testbuddy
Copy link
Author

Yeah this fix did it :)) Thanks for the fast help :)

@FilipTokarski FilipTokarski removed the pending:feedback This issue is blocked by necessary feedback. label Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

3 participants