Comments (16)
have you included the css for medium-draft
?
from medium-draft.
We could better help if you showed us some code @riccardolorenzon.
from medium-draft.
@brijeshb42 Yes i included the css by using import 'medium-draft/lib/index.css';
.
I see the style is applied to the component.
@method-x the code of the render
method is pretty straightforward, but maybe is worth to report:
return (
<Editor
sideButtons={{}}
ref='editor'
editorState={editorState}
inlineButtons={inlineButtons}
onChange={this.onChange}
placeholder='Type your text' />);
Obviously i'm expecting the placeholder 'Type your text' when the text area is empty, but i don't get any text.
from medium-draft.
Just FYI, the value of sideButtons
should be an empty array, not an empty object.
Are you getting any message on console?
from medium-draft.
i changed the value of sidebuttons
to {[]}
.
Still no placeholder displayed, and no message on console as well.
from medium-draft.
Is there a demo you can share?
from medium-draft.
@brijeshb42 a demo not quickly, but i can share my whole React class:
const React = require('react');
import { Editor, createEditorState } from 'medium-draft';
import 'medium-draft/lib/index.css';
const CustomEditor = React.createClass({
getInitialState: function() {
return {
editorState: createEditorState(),
}
},
componentDidMount() {
this.refs.editor.focus();
},
onChange: function(editorState) {
this.setState({editorState: editorState});
},
render: function() {
const {editorState} = this.state;
var inlineButtons = [{
label: 'B',
style: 'BOLD',
icon: 'bold',
description: 'Bold',
}, {
label: 'I',
style: 'ITALIC',
icon: 'italic',
description: 'Italic',
}, {
label: 'U',
style: 'UNDERLINE',
icon: 'underline',
description: 'Underline',
}, {
label: 'S',
style: 'STRIKETHROUGH',
icon: 'strikethrough',
description: 'Strikethrough',
}, {
label: '#',
style: 'hyperlink',
icon: 'link',
description: 'Add a link',
}];
return (
<Editor
sideButtons={[]}
ref='editor'
editorState={editorState}
inlineButtons={inlineButtons}
onChange={this.onChange}
placeholder='Type your text' />);
}
});
module.exports = CustomEditor;
from medium-draft.
The above code is working fine for me. I only had to change the export
statement. Are you able to perform other editing operations except the placeholder ?
from medium-draft.
All the other operations are working fine.. Can you see the placeholder then?
from medium-draft.
Yes. The Placeholder was working fine.
Now, all I can think of the error may be something to do with the CSS. z-index
or position
from medium-draft.
If i check the HTML i see a #placeholder-23s09
div:
<div class="DraftEditor-root">
<div class="public-DraftEditorPlaceholder-root">
<div class="public-DraftEditorPlaceholder-inner" id="placeholder-23s09">Type your text</div>
</div>
[...]
</div>
I don't see any particular style of RichEditor from overridden by my CSS though...
from medium-draft.
UPDATE: if i remove position:absolute
from the style of the class public-DraftEditorPlaceholder-root
i see the placeholder.
from medium-draft.
I think this is a CSS issue, wondering how come it works on your environment.
from medium-draft.
You can use inspect element to check if anything is overriding the default style.
On Nov 1, 2016 6:14 PM, riccardo lorenzon [email protected] wrote:I think this is a CSS issue, wondering how come it works on your environment.
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
from medium-draft.
I don't see any overrides for that class.
from medium-draft.
After some investigation i found out that he problem is due to my custom css stylesheet.
from medium-draft.
Related Issues (20)
- Uncaught TypeError: props.getEditorState is not a function while using the separatorButton HOT 1
- ReadMe needs update HOT 1
- regarding images uploaded via editor HOT 1
- ToolbarComponent prop implemented?
- Is this library compatible with React Native? HOT 2
- Typescript support HOT 1
- Warning in the developer tools
- How can I close the floating styles-widget when clicking outside editable area?
- 5 high vulnerabilities HOT 1
- How to delete the image (from database) after using backspace in editor? HOT 1
- Getting medium like title text field at the top then the content HOT 1
- How to resize the image once added to the editor? HOT 1
- Any pointers on how to start implementing image block alignment
- Is it possible to add the Image resize/ alignment feature?
- Is this maintained anymore? Possible outdated draftjs causing block is not a BlockNode error HOT 4
- editorState.getSelection is not a function in functional component HOT 1
- My app crash HOT 3
- How to add style BLOCK_BUTTONS HOT 1
- Set style for Image HOT 2
- Typescript Version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from medium-draft.