Przeglądaj źródła

feat:新建公告的富文本支持选择字体

zhubo 2 lat temu
rodzic
commit
0471c341a2
1 zmienionych plików z 25 dodań i 0 usunięć
  1. 25 0
      src/pages/notice/modal.tsx

+ 25 - 0
src/pages/notice/modal.tsx

@@ -133,6 +133,7 @@ class EditorDemo extends React.Component<EditorDemoProps> {
       'blockquote',
       'font-size',
       'line-height',
+      'font-family',
     ];
 
     const extendControls: ExtendControlType[] = [
@@ -195,6 +196,29 @@ class EditorDemo extends React.Component<EditorDemoProps> {
 
     const { editorState } = this.state;
 
+    const 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',
+      },
+    ];
+
     return (
       <div className="my-component">
         <BraftEditor
@@ -202,6 +226,7 @@ class EditorDemo extends React.Component<EditorDemoProps> {
           imageResizable={false}
           style={{ border: '1px solid #d9d9d9', width: '375px' }}
           controls={controls}
+          fontFamilies={fontFamilies}
           imageControls={imageControls}
           ref={(instance) => (this.state.editorInstance = instance)}
           extendControls={extendControls}