File tree 2 files changed +42
-32
lines changed
docs/client/components/pages/StaticToolbar/CustomToolbarEditor
stories/static-toolbar-custom-buttons/src
2 files changed +42
-32
lines changed Original file line number Diff line number Diff line change @@ -64,20 +64,7 @@ class HeadlinesButton extends Component {
64
64
}
65
65
}
66
66
67
- const toolbarPlugin = createToolbarPlugin ( {
68
- structure : [
69
- BoldButton ,
70
- ItalicButton ,
71
- UnderlineButton ,
72
- CodeButton ,
73
- Separator ,
74
- HeadlinesButton ,
75
- UnorderedListButton ,
76
- OrderedListButton ,
77
- BlockquoteButton ,
78
- CodeBlockButton
79
- ]
80
- } ) ;
67
+ const toolbarPlugin = createToolbarPlugin ( ) ;
81
68
const { Toolbar } = toolbarPlugin ;
82
69
const plugins = [ toolbarPlugin ] ;
83
70
const text = 'In this editor a toolbar shows up once you select part of the text …' ;
@@ -108,7 +95,25 @@ export default class CustomToolbarEditor extends Component {
108
95
plugins = { plugins }
109
96
ref = { ( element ) => { this . editor = element ; } }
110
97
/>
111
- < Toolbar />
98
+ < Toolbar >
99
+ {
100
+ // may be use React.Fragment instead of div to improve perfomance after React 16
101
+ ( externalProps ) => (
102
+ < div >
103
+ < BoldButton { ...externalProps } />
104
+ < ItalicButton { ...externalProps } />
105
+ < UnderlineButton { ...externalProps } />
106
+ < CodeButton { ...externalProps } />
107
+ < Separator { ...externalProps } />
108
+ < HeadlinesButton { ...externalProps } />
109
+ < UnorderedListButton { ...externalProps } />
110
+ < OrderedListButton { ...externalProps } />
111
+ < BlockquoteButton { ...externalProps } />
112
+ < CodeBlockButton { ...externalProps } />
113
+ </ div >
114
+ )
115
+ }
116
+ </ Toolbar >
112
117
</ div >
113
118
</ div >
114
119
) ;
Original file line number Diff line number Diff line change @@ -66,22 +66,7 @@ class HeadlinesButton extends Component {
66
66
}
67
67
}
68
68
69
- const toolbarPlugin = createToolbarPlugin ( {
70
- structure : [
71
- BoldButton ,
72
- ItalicButton ,
73
- UnderlineButton ,
74
- CodeButton ,
75
- Separator ,
76
- HeadlinesButton ,
77
- UnorderedListButton ,
78
- OrderedListButton ,
79
- BlockquoteButton ,
80
- CodeBlockButton ,
81
- SubButton ,
82
- SupButton
83
- ]
84
- } ) ;
69
+ const toolbarPlugin = createToolbarPlugin ( ) ;
85
70
const { Toolbar } = toolbarPlugin ;
86
71
const plugins = [ toolbarPlugin ] ;
87
72
const text = 'Remember to place the <Toolbar> component bellow the Editor component …' ;
@@ -116,7 +101,27 @@ export default class CustomToolbarEditor extends Component {
116
101
} }
117
102
ref = { ( element ) => { this . editor = element ; } }
118
103
/>
119
- < Toolbar />
104
+ < Toolbar >
105
+ {
106
+ // may be use React.Fragment instead of div to improve perfomance after React 16
107
+ ( externalProps ) => (
108
+ < div >
109
+ < BoldButton { ...externalProps } />
110
+ < ItalicButton { ...externalProps } />
111
+ < UnderlineButton { ...externalProps } />
112
+ < CodeButton { ...externalProps } />
113
+ < Separator { ...externalProps } />
114
+ < HeadlinesButton { ...externalProps } />
115
+ < UnorderedListButton { ...externalProps } />
116
+ < OrderedListButton { ...externalProps } />
117
+ < BlockquoteButton { ...externalProps } />
118
+ < CodeBlockButton { ...externalProps } />
119
+ < SubButton { ...externalProps } />
120
+ < SupButton { ...externalProps } />
121
+ </ div >
122
+ )
123
+ }
124
+ </ Toolbar >
120
125
</ div >
121
126
</ div >
122
127
) ;
You can’t perform that action at this time.
0 commit comments