diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 951442bbe..b28e01693 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -21,8 +21,9 @@ import ImageBlot from './ImageBlot'; import FillBlot from './FillBlot'; const Size = Quill.import('attributors/style/size'); const Font = Quill.import('formats/font'); -Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false]; -Font.whitelist = ['SimSun', 'SimHei', 'Microsoft-YaHei', 'KaiTi', 'FangSong', 'Arial', 'Times-New-Roman', 'sans-serif']; +// const Color = Quill.import('attributes/style/color'); +Size.whitelist = ['14px', '16px', '18px', '20px', false]; +Font.whitelist = ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; window.Quill = Quill; window.katex = katex; @@ -52,11 +53,12 @@ function QuillForEditor({ // toolbar 默认值 const defaultConfig = [ 'bold', 'italic', 'underline', - { size: ['12px', '14px', '16px', '18px', '20px'] }, - { align: [] }, { list: 'ordered' }, { list: 'bullet' }, // 列表 - { script: 'sub' }, { script: 'super' }, + {size: ['14px', '16px', '18px', '20px']}, + {align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表 + {script: 'sub'}, {script: 'super'}, { 'color': [] }, { 'background': [] }, - { header: [1, 2, 3, 4, 5, false] }, + { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']}, + {header: [1,2,3,4,5,false]}, 'blockquote', 'code-block', 'link', 'image', 'video', 'formula', @@ -96,7 +98,7 @@ function QuillForEditor({ */ handler: function (range, context) { /** - * index: 删除元素的位置 + * index: 删除元素的位置 * length: 删除元素的个数 */ const { index, length } = range; diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index c96b8a6b7..b1c6f3899 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -267,7 +267,7 @@ class ChoquesEditor extends Component { } onContentChange=(value,quill)=>{ - debugger + // debugger const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; if (!reg.test(_text)) { @@ -371,8 +371,11 @@ class ChoquesEditor extends Component { // //////console.log("xuanzheshijuan"); // //////console.log(answerTagArray); // //////console.log(!exerciseIsPublish); - - return ( + const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']}, + { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']}, + { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']} + ] + return(
{/* {!question_id ? '新建' : '编辑'} */} @@ -404,7 +413,7 @@ class ChoquesEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '155px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={question_title} onContentChange={this.onContentChange} @@ -438,7 +447,7 @@ class ChoquesEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '166px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={item} onContentChange={(value, quill) => this.onOptionContentChange(value, quill, index)} /> @@ -448,7 +457,7 @@ class ChoquesEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '166px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={JSON.parse(item)} onContentChange={(value, quill) => this.onOptionContentChange(value, quill, index)} /> @@ -487,7 +496,7 @@ class ChoquesEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '166px' }} placeholder="请您输入题目解析" - options={['code-block', 'image', 'formula']} + options={options} value={question_titles} onContentChange={this.onContentChanges} /> diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index c82088105..8e4977500 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -384,8 +384,12 @@ class JudquestionEditor extends Component { // ////////console.log("xuanzheshijuan"); // ////////console.log(answerTagArray); // ////////console.log(!exerciseIsPublish); - const params = this.props && this.props.match && this.props.match.params; - return ( + const params= this.props&&this.props.match&&this.props.match.params; + const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']}, + { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']}, + { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']} + ] + return(
{/* {!question_id ? '新建' : '编辑'} */} @@ -417,7 +427,7 @@ class JudquestionEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '155px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={question_title} onContentChange={this.onContentChange} @@ -456,23 +466,23 @@ class JudquestionEditor extends Component {
- {/* {!question_id ? '新建' : '编辑'} */} - - 题目解析: -
- -+ {/* {!question_id ? '新建' : '编辑'} */} + + 题目解析: +
+ +{/* {!question_id ? '新建' : '编辑'} */} @@ -487,7 +501,7 @@ class SingleEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '155px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={question_title} onContentChange={this.onContentChange} /> @@ -519,7 +533,7 @@ class SingleEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '166px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={item} onContentChange={(value, quill) => this.onOptionContentChange(value, quill, index)} /> @@ -529,7 +543,7 @@ class SingleEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '166px' }} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={JSON.parse(item)} onContentChange={(value, quill) => this.onOptionContentChange(value, quill, index)} /> @@ -570,7 +584,7 @@ class SingleEditor extends Component { imgAttrs={{ width: '146px', height: '136px' }} style={{ height: '166px' }} placeholder="请您输入题目解析" - options={['code-block', 'image', 'formula']} + options={options} value={question_titles} onContentChange={this.onContentChanges} />