jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.41k stars 1.16k forks source link

Placeholder still shows when creating list #421

Open ljowen opened 7 years ago

ljowen commented 7 years ago

If a ordered or unordered list is started before typing any text the placeholder text still displays which looks weird as the bullet point or number are rendered on top.

jpuri commented 7 years ago

@ljowen : thanks for reporting this issue. I will soon check.

jpuri commented 7 years ago

@ljowen : I could not replicate this: screen shot 2017-08-12 at 10 53 01 pm

ljowen commented 7 years ago

@jpuri : see attached, showing the number before anything has been typed. screenshot from 2017-08-14 10-45-42

jpuri commented 7 years ago

@ljowen : do you also see some errors in console ?

ljowen commented 7 years ago

Just two failed GET's: GET https://jpuri.github.io/react-draft-wysiwyg/static/bundle.js jpuri.github.io/:1 GET https://jpuri.github.io/react-draft-wysiwyg/static/main.css jpuri.github.io/:1

This is Chrome and Firefox on Ubuntu btw

rawris commented 6 years ago

@jpuri Hi! I'm facing this issue too. Do you have any solution for this? Thanks.

Frozzy6 commented 6 years ago

Hi there! That's the problem of js-draft. Link to issue If you inspect the code you can check the placeholder component. image The placeholder is still here but was hidden by css (link to docs) image

`

const {editorState} = this.state;

// If the user changes block type before entering any text, we can
// either style the placeholder or hide it. Let's just hide it now.
let className = 'RichEditor-editor';
var contentState = editorState.getCurrentContent();
if (!contentState.hasText()) {
  if (contentState.getBlockMap().first().getType() !== 'unstyled') {
    className += ' RichEditor-hidePlaceholder';
  }
}

return (
  <div className="RichEditor-root">
    <div className={className}>
      <Editor  placeholder="Tell a story..."  />
    </div>
  </div>
);

`

jpuri commented 6 years ago

@Frozzy6 : good finding 👍 I will add this to the editor also.

MeSanti commented 6 years ago

Hello, I'm having the same issue, have you guys solved the problem? it happens even in you live demo here: https://jpuri.github.io/react-draft-wysiwyg/#/

Thanks! and thank you for the work you are doing

Frozzy6 commented 6 years ago

@MeSanti, I described the solution in my previous message.

in a nutshell use css to hide the placeholder