feat: add altText and isDecorative persistence for image editing
This commit is contained in:
@@ -70,8 +70,8 @@ export const DimensionControls = ({
|
||||
));
|
||||
DimensionControls.defaultProps = {
|
||||
value: {
|
||||
height: 100,
|
||||
width: 100,
|
||||
height: '100',
|
||||
width: '100',
|
||||
},
|
||||
};
|
||||
DimensionControls.propTypes = ({
|
||||
|
||||
@@ -132,11 +132,16 @@ export const dimensionLockHooks = () => {
|
||||
* {func} setWidthValid - sets isWidthValid to true
|
||||
* {func} setWidthNotValid - sets isWidthValid to false
|
||||
*/
|
||||
export const dimensionHooks = () => {
|
||||
export const dimensionHooks = (altTextHook) => {
|
||||
const [dimensions, setDimensions] = module.state.dimensions(null);
|
||||
const [local, setLocal] = module.state.local(null);
|
||||
|
||||
const setAll = ({ height, width }) => {
|
||||
const setAll = ({ height, width, altText }) => {
|
||||
if (altText === '' || altText) {
|
||||
if (altText === '') {
|
||||
altTextHook.setIsDecorative(true);
|
||||
}
|
||||
altTextHook.setValue(altText);
|
||||
}
|
||||
setDimensions({ height, width });
|
||||
setLocal({ height, width });
|
||||
};
|
||||
|
||||
@@ -32,8 +32,8 @@ export const ImageSettingsModal = ({
|
||||
// inject
|
||||
intl,
|
||||
}) => {
|
||||
const dimensions = hooks.dimensions();
|
||||
const altText = hooks.altText();
|
||||
const altText = hooks.altText(selection.altText);
|
||||
const dimensions = hooks.dimensions(altText);
|
||||
const onSaveClick = hooks.onSaveClick({
|
||||
altText,
|
||||
dimensions: dimensions.value,
|
||||
@@ -94,7 +94,7 @@ ImageSettingsModal.propTypes = {
|
||||
selection: PropTypes.shape({
|
||||
url: PropTypes.string,
|
||||
externalUrl: PropTypes.string,
|
||||
altText: PropTypes.bool,
|
||||
altText: PropTypes.string,
|
||||
}).isRequired,
|
||||
saveToEditor: PropTypes.func.isRequired,
|
||||
returnToSelection: PropTypes.func.isRequired,
|
||||
|
||||
Reference in New Issue
Block a user