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

挺好用的,但是有两个问题 #16

Closed
qjp88995 opened this issue Dec 16, 2017 · 5 comments
Closed

挺好用的,但是有两个问题 #16

qjp88995 opened this issue Dec 16, 2017 · 5 comments

Comments

@qjp88995
Copy link

1.不能缩进,即使使用空格,也不会生效
2.换行后保存,并没有生效
ps:我是直接使用html的

@margox
Copy link
Owner

margox commented Dec 18, 2017

第一点是因为我这边没有把空格抓换成  ,后面会改进,第二点,麻烦能贴下你的使用代码么?

@qjp88995
Copy link
Author

qjp88995 commented Dec 18, 2017

render() {
        const editorProps = {
            height: 600,
            contentFormat: 'html',
            initialContent: this.props.content,
            // onChange: this.handleChange,
            onHTMLChange: this.props.onChange,
            controls: [
                'undo', 'redo', 'split', 'font-size', 'font-family', 'text-color',
                'bold', 'italic', 'underline', 'strike-through', 'superscript',
                'subscript', 'text-align', 'split', 'headings', 'list_ul', 'list_ol',
                'blockquote', 'code', 'split', 'link', 'split', 'media'
            ],
            colors:[
                '#000000', '#333333', '#666666', '#999999', '#cccccc', '#ffffff',
                '#61a951', '#16a085', '#07a9fe', '#003ba5', '#8e44ad', '#f32784',
                '#c0392b', '#d35400', '#f39c12', '#fdda00', '#7f8c8d', '#2c3e50'
            ],
            fontSizes:[
                12, 14, 16, 18, 20, 24,
                28, 30, 32, 36, 40, 48,
                56, 64, 72, 96, 120, 144
            ],
            fontFamilies:[
                {
                    name: 'Araial',
                    family: 'Arial, Helvetica, sans-serif'
                }, {
                    name: 'Georgia',
                    family: 'Georgia, serif'
                }, {
                    name: 'Impact',
                    family: 'Impact, serif'
                }, {
                    name: 'Monospace',
                    family: '"Courier New", Courier, monospace'
                }, {
                    name: 'Tahoma',
                    family: "tahoma, arial, 'Hiragino Sans GB', 宋体, sans-serif"
                }
            ],
            media:{
                image: true, // 开启图片插入功能
                video: false, // 开启视频插入功能
                audio: false, // 开启音频插入功能
                validateFn: null, // 指定本地校验函数,说明见下文
                uploadFn: this.uploadFn // 指定上传函数,说明见下文
            }
        }
        if(this.props.ready){
            return (
                <div style={{background:'#fff'}}>
                    <BraftEditor {...editorProps}/>
                </div>
            )
        }else{
            return <div></div>
        }
}

@qjp88995
Copy link
Author

qjp88995 commented Dec 18, 2017

应该是转换的时候没有转换一个
,存在数据库里的是

<p></p>
<p></p>
<p></p>
<p></p>

一个空的p标签,但是我在网页上把p标签的默认margin设为0了
所以应该是这样:

<p></p>
<p>
    <br/>
</p>
<p></p>
<p></p>

@margox
Copy link
Owner

margox commented Jan 17, 2018

抽空做了软换行的功能,现在按Ctrl或者Shift + Enter,就能生成br而非p了,至于空格的问题,估计要再等等了😂😭🙄

@margox
Copy link
Owner

margox commented Jan 22, 2018

感觉我这边把空格转成&nbsp;来实现缩进,会伤及无辜,还是建议用css来控制段落的缩进吧

@margox margox closed this as completed Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants