Skip to content

Commit

Permalink
feat: Config,Locale组件暴露方式变更
Browse files Browse the repository at this point in the history
  • Loading branch information
SummerOverture committed Jan 5, 2021
1 parent 66f42ca commit cf8f7f0
Showing 5 changed files with 37 additions and 30 deletions.
8 changes: 6 additions & 2 deletions site/docs/zh-CN/configProvider.md
Original file line number Diff line number Diff line change
@@ -7,8 +7,10 @@
ConfigProvider 使用 React 的 [Context](https://reactjs.org/docs/context.html) 特性,只需在应用外围包裹一次即可全局生效。

```js
import { ConfigProvider } from 'ppfish';
import zh_CN from 'ppfish/components/Locale/zh_CN';
import { Config, Locale } from 'ppfish';

const ConfigProvider = Config.Provider;
const { zh_CN } = Locale;

export default () => (
<ConfigProvider Locale={zh_CN}>
@@ -75,6 +77,8 @@ export default () => (
}
render() {
const {currentLocale} = this.state;
const ConfigProvider = Config.Provider;

return (
<div className="configProviderDemo">
<ConfigProvider Locale={currentLocale}>
6 changes: 4 additions & 2 deletions site/docs/zh-CN/i18n.md
Original file line number Diff line number Diff line change
@@ -6,8 +6,10 @@ ppfish 提供了一个 React 组件 ConfigProvider 用于全局配置国际化


```js
import { ConfigProvider } from 'ppfish';
import zh_CN from 'ppfish/components/Locale/zh_CN';
import { Config, Locale } from 'ppfish';

const { zh_CN } = Locale;
const ConfigProvider = Config.Provider;

return (
<ConfigProvider Locale={zh_CN}>
24 changes: 24 additions & 0 deletions source/components/RichEditor/src/interface.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,30 @@ export interface RichEditorState {
showAttachmentModal?: boolean;
}

export interface QuillComponentProps {
id?: string,
className?: string,
theme?: string,
style?: object,
readOnly?: boolean,
value?: string | {opts: any[]},
defaultValue?: string | {opts: any[]},
placeholder?: string,
tabIndex?:number,
bounds?: string|React.ReactElement<any>|object,
scrollingContainer?: React.ReactElement<any>,
onChange?: Function,
onSelectionChange?: Function,
onFocus?: Function,
onBlur?: Function,
onKeyPress?: Function,
onKeyDown?: Function,
onKeyUp?: Function,
modules?: {
toolbar?: any[],
}
}

export interface RichEditorProps {
className?: string;
customEmoji?: any[];
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
import * as React from 'react';

/* eslint-disable react/prefer-es6-class */
let React = require('react');
let ReactDOM = require('react-dom');
let createClass = require('create-react-class');
let QuillMixin = require('./mixin');
@@ -22,30 +22,6 @@ const quillDirtyProps = [
'children',
];

export interface QuillComponentProps {
id?: string,
className?: string,
theme?: string,
style?: object,
readOnly?: boolean,
value?: string | {opts: any[]},
defaultValue?: string | {opts: any[]},
placeholder?: string,
tabIndex?:number,
bounds?: string|React.ReactElement<any>|object,
scrollingContainer?: React.ReactElement<any>,
onChange?: Function,
onSelectionChange?: Function,
onFocus?: Function,
onBlur?: Function,
onKeyPress?: Function,
onKeyDown?: Function,
onKeyUp?: Function,
modules?: {
toolbar?: any[],
}
}

let QuillComponent = createClass({

displayName: 'Quill',
3 changes: 2 additions & 1 deletion source/components/index.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ export { default as Button } from './Button';
export { default as Cascader } from './Cascader';
export { default as Carousel } from './Carousel';
export { default as Checkbox } from './Checkbox';
export { default as Config } from './Config';
export { default as Locale } from './Locale';
export { default as Col } from './Col';
export { default as Collapse } from './Collapse';
export { default as ColorPicker } from './ColorPicker';
@@ -62,4 +64,3 @@ export { default as Trend } from './Trend';
export { default as Upload } from './Upload';
export { default as VideoViewer } from './VideoViewer';
export { default as Guide } from './Guide';
export { ConfigProvider } from './Config';

0 comments on commit cf8f7f0

Please sign in to comment.