1- import React , { PureComponent } from 'react' ;
1+ import React , { PureComponent } from 'react' ;
22import PropTypes from 'prop-types' ;
3- import { Button } from '@neos-project/react-ui-components' ;
4- import { neos } from '@neos-project/neos-ui-decorators' ;
5- import { themr } from '@friendsofreactjs/react-css-themr' ;
3+ import { Button } from '@neos-project/react-ui-components' ;
4+ import { neos } from '@neos-project/neos-ui-decorators' ;
65
7- import buttonTheme from './hyphensButtonTheme .css' ;
6+ import style from './editorButton.module .css' ;
87
98const BUTTON_PROPS = [ 'formattingRule' , 'inlineEditorOptions' , 'i18nRegistry' , 'tooltip' , 'isActive' , 'label' ] ;
109
11- @ neos ( globalRegistry => ( {
12- i18nRegistry : globalRegistry . get ( 'i18n' )
13- } ) )
14- @ themr ( 'HyphensButton' , buttonTheme )
10+ const mapGlobalRegistryToProps = neos ( ( globalRegistry ) => ( {
11+ i18nRegistry : globalRegistry . get ( 'i18n' ) ,
12+ } ) ) ;
13+
1514class HyphenButtonComponent extends PureComponent {
1615 static propTypes = {
1716 i18nRegistry : PropTypes . object ,
18- tooltip : PropTypes . string
17+ tooltip : PropTypes . string ,
1918 } ;
2019
2120 render ( ) {
@@ -24,28 +23,30 @@ class HyphenButtonComponent extends PureComponent {
2423 return carry ;
2524 } , { } ) ;
2625 return (
27- < Button { ...finalProps } isActive = { Boolean ( this . props . isActive ) } className = { buttonTheme [ 'btn--no-padding' ] }
28- title = { this . props . i18nRegistry . translate ( this . props . tooltip ) } >
26+ < Button
27+ { ...finalProps }
28+ isActive = { Boolean ( this . props . isActive ) }
29+ className = { style . btnWithoutPadding }
30+ title = { this . props . i18nRegistry . translate ( this . props . tooltip ) }
31+ >
2932 < svg xmlns = "http://www.w3.org/2000/svg" width = "18.109" height = "9.697" viewBox = "0, 0, 18.109, 9.697" >
3033 < g stroke = "currentColor" strokeMiterlimit = "3.864" fill = "none" >
31- < path d = "M2.596 1a5.44 5.44 0 0 0 0 7.697m12.918 0a5.44 5.44 0 0 0 0-7.697" strokeWidth = ".907" />
32- < path d = "M4.52 4.848h9.07" strokeWidth = "1.814" />
34+ < path
35+ d = "M2.596 1a5.44 5.44 0 0 0 0 7.697m12.918 0a5.44 5.44 0 0 0 0-7.697"
36+ strokeWidth = ".907"
37+ />
38+ < path d = "M4.52 4.848h9.07" strokeWidth = "1.814" />
3339 </ g >
3440 </ svg >
3541 </ Button >
3642 ) ;
3743 }
3844}
3945
40-
41- @neos ( globalRegistry => ( {
42- i18nRegistry : globalRegistry . get ( 'i18n' )
43- } ) )
44- @themr ( 'NbspButton' , buttonTheme )
4546class NbspButtonComponent extends PureComponent {
4647 static propTypes = {
4748 i18nRegistry : PropTypes . object ,
48- tooltip : PropTypes . string
49+ tooltip : PropTypes . string ,
4950 } ;
5051
5152 render ( ) {
@@ -54,11 +55,20 @@ class NbspButtonComponent extends PureComponent {
5455 return carry ;
5556 } , { } ) ;
5657 return (
57- < Button { ...finalProps } isActive = { Boolean ( this . props . isActive ) } className = { buttonTheme [ 'btn--no-padding' ] }
58- title = { this . props . i18nRegistry . translate ( this . props . tooltip ) } >
58+ < Button
59+ { ...finalProps }
60+ isActive = { Boolean ( this . props . isActive ) }
61+ className = { style . btnWithoutPadding }
62+ title = { this . props . i18nRegistry . translate ( this . props . tooltip ) }
63+ >
5964 < svg width = "18px" height = "9px" viewBox = "0 0 18 9" version = "1.1" xmlns = "http://www.w3.org/2000/svg" >
6065 < g stroke = "none" strokeWidth = "1" fill = "none" fillRule = "evenodd" strokeLinecap = "square" >
61- < path d = "M16.3846154,2.61538462 L16.3846154,7.53846154 M16.3846154,7.53846154 L1.61538462,7.53846154 M1.61538462,2.61538462 L1.61538462,7.53846154" id = "Combined-Shape" stroke = "#FFFFFF" strokeWidth = "1.8" > </ path >
66+ < path
67+ d = "M16.3846154,2.61538462 L16.3846154,7.53846154 M16.3846154,7.53846154 L1.61538462,7.53846154 M1.61538462,2.61538462 L1.61538462,7.53846154"
68+ id = "Combined-Shape"
69+ stroke = "#FFFFFF"
70+ strokeWidth = "1.8"
71+ > </ path >
6272 </ g >
6373 </ svg >
6474 </ Button >
@@ -69,13 +79,13 @@ class NbspButtonComponent extends PureComponent {
6979//
7080// Modify richtext editing toolbar registry
7181//
72- export default ckEditorRegistry => {
82+ export default ( ckEditorRegistry ) => {
7383 const richtextToolbar = ckEditorRegistry . get ( 'richtextToolbar' ) ;
7484
7585 richtextToolbar . set ( 'shy' , {
7686 label : 'Shy' ,
7787 commandName : 'insertShyEntity' ,
78- component : HyphenButtonComponent ,
88+ component : mapGlobalRegistryToProps ( HyphenButtonComponent ) ,
7989 callbackPropName : 'onClick' ,
8090 style : 'transparent' ,
8191 hoverStyle : 'brand' ,
@@ -87,7 +97,7 @@ export default ckEditorRegistry => {
8797 richtextToolbar . set ( 'nbsp' , {
8898 label : 'Nbsp' ,
8999 commandName : 'insertNbspEntity' ,
90- component : NbspButtonComponent ,
100+ component : mapGlobalRegistryToProps ( NbspButtonComponent ) ,
91101 callbackPropName : 'onClick' ,
92102 style : 'transparent' ,
93103 hoverStyle : 'brand' ,
0 commit comments