鍍金池/ 問答/PHP  HTML/ draft-js怎么重置樣式

draft-js怎么重置樣式

求大神指點(diǎn)
1.draft-js中,怎么重置他的樣式,dom結(jié)構(gòu)太過繁瑣了,主要就是想讓輸入框從塊級元素變成行內(nèi)元素,寬度由內(nèi)容撐大
2.如果想設(shè)置獲取其焦點(diǎn),應(yīng)該怎么寫,試過focus()會報錯
3.placeholder應(yīng)該怎么設(shè)置,寫成屬性會報錯
跪謝

回答
編輯回答
墨染殤

看你問了好幾個 draft-js 的問題,難道你使用之前不看官方文檔嗎?https://draftjs.org/docs/over...

2018年1月1日 19:32
編輯回答
櫻花霓

設(shè)置placeholder,focus;

focus = () => this.editor.focus();
...

<div
    styleName="editor"
    onClick={this.focus}
>
    <Editor
        spellCheck
        onChange={this.onChange}
        editorState={editorState}
        customStyleMap={styleMap}
        placeholder="Enter something..."
        ref={(input) => { this.editor = input; }}
    />
</div>
2018年5月27日 06:40