美文网首页
tinymce中initialValue属性的值中如果有换行,显

tinymce中initialValue属性的值中如果有换行,显

作者: magic_pill | 来源:发表于2022-01-17 16:40 被阅读0次
    import { Editor } from '@tinymce/tinymce-react';
    
    // 若干代码
    // ...
    
    const text = `
    1. major
    
    2. Africa
    
    3. neighbor
    
    4. snacks
    
    5. themes
    
    6. now
    
    7. thousand
    
    8. thought
    
    9. question
    
    10. expression
    `;
    
    <Editor 
      initialValue={text}
    />
    
    image.png
    • 通过 <pre></pre> 来解决
      <Editor
        initialValue={
      `<pre>
      ${text}
      </pre>`
        }
        onEditorChange={e => {
          this.valuesChange('text', e);
        }}
      />
      
    image.png

    相关文章

      网友评论

          本文标题:tinymce中initialValue属性的值中如果有换行,显

          本文链接:https://www.haomeiwen.com/subject/kdbchrtx.html