Skip to content

Commit 4f993f1

Browse files
committed
Use the deprecated icon rendering for the rich text icon
rich text icons require raw HTML
1 parent a9b151e commit 4f993f1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

block-editor/src/deprecated/deprecatedSaveV1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function save({ attributes }) {
1717
return deprecatedRenderIconV1(attributes, { extraProps })
1818
}
1919

20-
function deprecatedRenderIconV1(attributes, options = {}) {
20+
export function deprecatedRenderIconV1(attributes, options = {}) {
2121
const { wrapperProps = {}, classNamesByLayer } = options?.extraProps || {}
2222
const elementType = options?.wrapperElement?.toLowerCase() || 'div'
2323
const iconLayers = attributes?.iconLayers

block-editor/src/richTextIcon.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { renderIconForEditor } from './rendering'
1313
import IconModifier from './iconModifier'
1414
import { ANIMATIONS, FONT_AWESOME_COMMON_BLOCK_WRAPPER_CLASS } from './constants'
1515
import { toIconDefinition } from './iconDefinitions'
16+
import { deprecatedRenderIconV1 } from './deprecated/deprecatedSaveV1'
1617
export const ZERO_WIDTH_SPACE = '\u200b'
1718
const FONT_AWESOME_RICH_TEXT_ICON_CLASS = 'wp-rich-text-font-awesome-icon'
1819
const FONT_AWESOME_RICH_TEXT_ICON_TRANSFORM_ATTR = 'data-transform'
@@ -237,13 +238,13 @@ function Edit(props) {
237238
}
238239

239240
const changeValue = (attributes) => {
240-
const blockProps = {
241+
const wrapperProps = {
241242
className: classnames(FONT_AWESOME_RICH_TEXT_ICON_CLASS, FONT_AWESOME_COMMON_BLOCK_WRAPPER_CLASS)
242243
}
243244

244-
const element = renderIconForEditor(attributes, {
245-
blockWrapperTag: 'span',
246-
blockProps
245+
const element = deprecatedRenderIconV1(attributes, {
246+
wrapperElement: 'span',
247+
extraProps: { wrapperProps }
247248
})
248249

249250
const html = renderToString(element)

0 commit comments

Comments
 (0)