@@ -62,6 +62,11 @@ const DEFAULT_LINK_STATE = {
6262 end : 0 ,
6363} ;
6464
65+ enum HtmlStyleVariant {
66+ Default ,
67+ Another ,
68+ }
69+
6570const DEBUG_SCROLLABLE = false ;
6671
6772// Enabling this prop fixes input flickering while auto growing.
@@ -77,8 +82,8 @@ export default function App() {
7782 const [ isImageModalOpen , setIsImageModalOpen ] = useState ( false ) ;
7883 const [ isValueModalOpen , setIsValueModalOpen ] = useState ( false ) ;
7984 const [ currentHtml , setCurrentHtml ] = useState ( '' ) ;
80- const [ currentHtmlStyle , setCurrentHtmlStyle ] =
81- useState < HtmlStyle > ( htmlStyle ) ;
85+ const [ currentHtmlStyleType , setCurrentHtmlStyleType ] =
86+ useState < HtmlStyleVariant > ( HtmlStyleVariant . Default ) ;
8287
8388 const [ selection , setSelection ] = useState < Selection > ( ) ;
8489 const [ stylesState , setStylesState ] = useState < StylesState > ( DEFAULT_STYLE ) ;
@@ -267,8 +272,10 @@ export default function App() {
267272 } ;
268273
269274 const handleChangeHtmlStyle = ( ) => {
270- setCurrentHtmlStyle ( ( style ) =>
271- style === htmlStyle ? anotherHtmlStyle : htmlStyle
275+ setCurrentHtmlStyleType ( ( style ) =>
276+ style === HtmlStyleVariant . Default
277+ ? HtmlStyleVariant . Another
278+ : HtmlStyleVariant . Default
272279 ) ;
273280 } ;
274281
@@ -301,7 +308,11 @@ export default function App() {
301308 ref = { ref }
302309 mentionIndicators = { [ '@' , '#' ] }
303310 style = { styles . editorInput }
304- htmlStyle = { currentHtmlStyle }
311+ htmlStyle = {
312+ currentHtmlStyleType === HtmlStyleVariant . Default
313+ ? htmlStyle
314+ : anotherHtmlStyle
315+ }
305316 placeholder = "Type something here..."
306317 defaultValue = "<html><h1>test</h1><ul><li>test <a href='test' /></li></ul></html>"
307318 placeholderTextColor = "rgb(0, 26, 114)"
@@ -384,15 +395,15 @@ export default function App() {
384395
385396const anotherHtmlStyle : HtmlStyle = {
386397 h1 : {
387- fontSize : 100 ,
398+ fontSize : 44 ,
388399 bold : false ,
389400 } ,
390401 h2 : {
391- fontSize : 50 ,
402+ fontSize : 36 ,
392403 bold : false ,
393404 } ,
394405 h3 : {
395- fontSize : 30 ,
406+ fontSize : 32 ,
396407 bold : false ,
397408 } ,
398409 blockquote : {
0 commit comments