Skip to content

Commit 0e8e59f

Browse files
committed
accommodate rich text icons in the preview editor
1 parent 4f993f1 commit 0e8e59f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

block-editor/src/iconModifier.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { FontSizePicker, TabPanel, Tooltip } from '@wordpress/components'
99
import { __ } from '@wordpress/i18n'
1010
import Colors from './colors'
1111
import { NO_CUSTOM_VALUE, SELECTED_CLASS, ANIMATIONS, DEFAULT_SIZE } from './constants'
12+
import { deprecatedRenderIconV1 } from './deprecated/deprecatedSaveV1'
1213

1314
const STYLES_TAB_NAME = 'styling'
1415
const ANIMATIONS_TAB_NAME = 'animations'
@@ -379,7 +380,8 @@ export default function (params) {
379380
context,
380381
iconChooserOpenEvent,
381382
IconChooserModal,
382-
handleSelect
383+
handleSelect,
384+
isInlineRichText = false
383385
} = params
384386

385387
const iconLayers = attributes.iconLayers || []
@@ -460,6 +462,8 @@ export default function (params) {
460462
const { color, fontSize, backgroundColor } = context || {}
461463
const contextStyle = { color, fontSize, backgroundColor }
462464

465+
const renderIcon = isInlineRichText ? deprecatedRenderIconV1 : renderIconForEditor
466+
463467
return (
464468
<div className="fawp-icon-modifier">
465469
<div className="fawp-icon-modifier-preview-container">
@@ -468,7 +472,7 @@ export default function (params) {
468472
style={contextStyle}
469473
onClick={() => document.dispatchEvent(iconChooserOpenEvent)}
470474
>
471-
{renderIconForEditor(attributes)}
475+
{renderIcon(attributes)}
472476
</div>
473477
</div>
474478
<div className={classnames('fawp-icon-modifier-preview-controls')}>

block-editor/src/richTextIcon.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ function InlineUI({ value, changeValue, contentRef, handleSelect }) {
211211
context={context}
212212
handleSelect={handleSelect}
213213
iconChooserOpenEvent={modalOpenEvent}
214+
isInlineRichText={true}
214215
/>
215216
</Modal>
216217
)}

0 commit comments

Comments
 (0)