Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion block-editor/build/index-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion block-editor/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '987f5e49022d05fb19a8');
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '17f5c0bec291cb2ddb3f');
2 changes: 1 addition & 1 deletion block-editor/build/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion block-editor/build/index.js

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions block-editor/src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,21 @@ export function Edit(props) {

if (!iconDefinition) return

const layer = {
iconDefinition,
...defaultStylingParams
}
const { replace, append } = layerParams

const newIconLayers = [...iconLayers]
const { replace, append } = layerParams

if (append) {
const layer = {
iconDefinition,
...defaultStylingParams
}

newIconLayers.push(layer)
} else if (Number.isInteger(replace) && replace < iconLayers.length) {
newIconLayers[replace] = layer
const oldLayer = iconLayers[replace] || {}
const newLayer = {...oldLayer, iconDefinition }
newIconLayers[replace] = newLayer
}

setAttributes({ iconLayers: newIconLayers })
Expand Down Expand Up @@ -119,6 +122,7 @@ export function Edit(props) {
setAttributes={setAttributes}
IconChooserModal={IconChooserModal}
prepareHandleSelect={prepareHandleSelect}
iconChooserOpenEvent={openIconChooserForAddLayerEvent}
/>
</Modal>
)}
Expand Down
23 changes: 18 additions & 5 deletions block-editor/src/iconModifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ const SettingsTabPanel = ({ onSelect, onSizeChange, setColor, setAnimation, upda
if ('object' !== typeof currentIconLayer) return
const currentTransform = currentIconLayer?.transform
const currentRotate = currentTransform?.rotate
const currentSize = currentIconLayer?.style?.fontSize
const [size, setSize] = useState(currentSize || DEFAULT_SIZE)
const currentSize = currentIconLayer?.style?.fontSize || DEFAULT_SIZE

const updateSize = (size) => {
const newSize = size || DEFAULT_SIZE
setSize(newSize)
onSizeChange(newSize)
}

Expand Down Expand Up @@ -195,7 +193,7 @@ const SettingsTabPanel = ({ onSelect, onSizeChange, setColor, setAnimation, upda
<div className="fawp-icon-styling-tab-content fawp-icon-styling-size fawp-tab-content">
<div className="">
<FontSizePicker
value={size}
value={currentSize}
fontSizes={[
{
name: 'tiny',
Expand Down Expand Up @@ -374,7 +372,16 @@ const SettingsTabPanel = ({ onSelect, onSizeChange, setColor, setAnimation, upda
)
}

export default function ({ attributes, setAttributes, context }) {
export default function (params) {
const {
attributes,
setAttributes,
context,
iconChooserOpenEvent,
IconChooserModal,
prepareHandleSelect
} = params

const iconLayers = attributes.iconLayers || []

const updateSize = (size) => {
Expand Down Expand Up @@ -459,6 +466,7 @@ export default function ({ attributes, setAttributes, context }) {
<div
className="fawp-icon-modifier-preview"
style={contextStyle}
onClick={() => document.dispatchEvent(iconChooserOpenEvent)}
>
{renderIcon(attributes)}
</div>
Expand All @@ -473,6 +481,11 @@ export default function ({ attributes, setAttributes, context }) {
setAnimation={setAnimation}
/>
</div>
<IconChooserModal
title={__('Change Font Awesome Icon', 'font-awesome')}
onSubmit={prepareHandleSelect({ replace: 0 })}
openEvent={iconChooserOpenEvent}
/>
</div>
)
}
6 changes: 6 additions & 0 deletions block-editor/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
padding: var(--spacing-md-fa);
}

.fawp-icon-modifier-preview:hover {
background: var(--gray7-fa);
cursor: pointer;
border-radius: var(--border-radius-fa);
}

.fawp-icon-modifier-preview div {
display: flex;
margin: auto;
Expand Down
2 changes: 1 addition & 1 deletion icon-chooser/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-i18n'), 'version' => '9291d79bfa031a0e70d7');
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-i18n'), 'version' => '1ffd38231f1a41762e04');
2 changes: 1 addition & 1 deletion icon-chooser/build/index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion icon-chooser/src/IconChooserModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ export default function (params) {

const isProCdn = !!pro && !kitToken;

const title = props.title || __("Add a Font Awesome Icon", "font-awesome")

return (
<>
{isOpen && (
<Modal title="Add a Font Awesome Icon" onRequestClose={closeModal}>
<Modal title={title} onRequestClose={closeModal}>
{isProCdn && (
<div
style={{
Expand Down
Loading