Merge pull request #1001 from ONLYOFFICE/feature/fix-bug-reactjs

Feature/fix bug reactjs
This commit is contained in:
maxkadushkin 2021-07-22 22:32:53 +03:00 committed by GitHub
commit f06ee2f5db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 26 deletions

View file

@ -45,7 +45,7 @@ const StandartColors = ({ options, standartColors, onColorClick, curColor }) =>
)
};
const CustomColors = ({ options, customColors, onColorClick, curColor }) => {
const CustomColors = ({ options, customColors, isTypeColors, onColorClick, curColor }) => {
const colors = customColors.length > 0 ? customColors : [];
const emptyItems = [];
if (colors.length < options.customcolors) {
@ -64,7 +64,7 @@ const CustomColors = ({ options, customColors, onColorClick, curColor }) => {
{colors && colors.length > 0 && colors.map((color, index) => {
return(
<a key={`dc-${index}`}
className={curColor && curColor === color && index === indexCurColor ? 'active' : ''}
className={curColor && curColor === color && index === indexCurColor && !isTypeColors ? 'active' : ''}
style={{background: `#${color}`}}
onClick={() => {onColorClick(color)}}
></a>
@ -100,6 +100,7 @@ const ThemeColorPalette = props => {
themeColors[row].push(effect);
});
const standartColors = Common.Utils.ThemeColor.getStandartColors();
let isTypeColors = standartColors.some( value => value === curColor );
// custom color
let customColors = props.customColors;
if (customColors.length < 1) {
@ -120,7 +121,7 @@ const ThemeColorPalette = props => {
</ListItem>
<ListItem className='dynamic-colors'>
<div>{ _t.textCustomColors }</div>
<CustomColors options={options} customColors={customColors} onColorClick={props.changeColor} curColor={curColor}/>
<CustomColors options={options} isTypeColors={isTypeColors} customColors={customColors} onColorClick={props.changeColor} curColor={curColor}/>
</ListItem>
</List>
</div>

View file

@ -239,6 +239,7 @@ const EditImage = props => {
const storeFocusObjects = props.storeFocusObjects;
const imageObject = storeFocusObjects.imageObject;
const pluginGuid = imageObject.asc_getPluginGuid();
const wrapType = props.storeImageSettings.getWrapType(imageObject);
return (
<Fragment>
@ -254,9 +255,9 @@ const EditImage = props => {
onReplaceByFile: props.onReplaceByFile,
onReplaceByUrl: props.onReplaceByUrl
}}></ListItem>
<ListItem title={_t.textReorder} link='/edit-image-reorder/' routeProps={{
{ wrapType !== 'inline' && <ListItem title={_t.textReorder} link='/edit-image-reorder/' routeProps={{
onReorder: props.onReorder
}}></ListItem>
}}></ListItem> }
</List>
<List className="buttons-list">
<ListButton className='button-fill button-raised' title={_t.textActualSize} onClick={() => {props.onDefaulSize()}}/>
@ -266,7 +267,7 @@ const EditImage = props => {
)
};
const EditImageContainer = inject("storeFocusObjects")(observer(EditImage));
const EditImageContainer = inject("storeFocusObjects", "storeImageSettings")(observer(EditImage));
const PageWrapContainer = inject("storeFocusObjects", "storeImageSettings")(observer(PageWrap));
const PageReplaceContainer = inject("storeFocusObjects")(observer(PageReplace));
const PageReorderContainer = inject("storeFocusObjects")(observer(PageReorder));

View file

@ -506,9 +506,8 @@ const EditShape = props => {
const { t } = useTranslation();
const _t = t('Edit', {returnObjects: true});
const canFill = props.storeFocusObjects.shapeObject.get_ShapeProperties().get_CanFill();
const storeShapeSettings = props.storeShapeSettings;
const shapeObject = props.storeFocusObjects.shapeObject;
const wrapType = storeShapeSettings.getWrapType(shapeObject);
const wrapType = props.storeShapeSettings.getWrapType(shapeObject);
let disableRemove = !!props.storeFocusObjects.paragraphObject;
@ -537,9 +536,9 @@ const EditShape = props => {
<ListItem title={_t.textReplace} link='/edit-shape-replace/' routeProps={{
onReplace: props.onReplace
}}></ListItem>
<ListItem disabled={wrapType === 'inline' ? true : false } title={_t.textReorder} link='/edit-shape-reorder/' routeProps={{
{ wrapType !== 'inline' && <ListItem title={_t.textReorder} link='/edit-shape-reorder/' routeProps={{
onReorder: props.onReorder
}}></ListItem>
}}></ListItem> }
</List>
<List className="buttons-list">
<ListButton title={_t.textRemoveShape} onClick={() => {props.onRemoveShape()}} className={`button-red button-fill button-raised${disableRemove ? ' disabled' : ''}`} />

View file

@ -119,13 +119,13 @@ const PageAdditionalFormatting = props => {
</List>
<List>
<ListItem title={t('Edit.textLetterSpacing')}>
{!isAndroid && <div slot='after-start'>{letterSpacing + ' ' + Common.Utils.Metric.getCurrentMetricName()}</div>}
{!isAndroid && <div slot='after-start'>{(Number.isInteger(letterSpacing) ? letterSpacing : letterSpacing.toFixed(2)) + ' ' + Common.Utils.Metric.getCurrentMetricName()}</div>}
<div slot='after'>
<Segmented>
<Button outline className='decrement item-link' onClick={() => {props.changeLetterSpacing(letterSpacing, true)}}>
{isAndroid ? <Icon icon="icon-expand-down"></Icon> : ' - '}
</Button>
{isAndroid && <label>{letterSpacing + ' ' + Common.Utils.Metric.getCurrentMetricName()}</label>}
{isAndroid && <label>{(Number.isInteger(letterSpacing) ? letterSpacing : letterSpacing.toFixed(2)) + ' ' + Common.Utils.Metric.getCurrentMetricName()}</label>}
<Button outline className='increment item-link' onClick={() => {props.changeLetterSpacing(letterSpacing, false)}}>
{isAndroid ? <Icon icon="icon-expand-up"></Icon> : ' + '}
</Button>

View file

@ -377,13 +377,13 @@ const PageAdditionalFormatting = props => {
</List>
<List>
<ListItem title={_t.textLetterSpacing}>
{!isAndroid && <div slot='after-start'>{Number(letterSpacing).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()}</div>}
{!isAndroid && <div slot='after-start'>{(Number.isInteger(letterSpacing) ? letterSpacing : letterSpacing.toFixed(2)) + ' ' + Common.Utils.Metric.getCurrentMetricName()}</div>}
<div slot='after'>
<Segmented>
<Button outline className='decrement item-link' onClick={() => {props.changeLetterSpacing(letterSpacing, true)}}>
{isAndroid ? <Icon icon="icon-expand-down"></Icon> : ' - '}
</Button>
{isAndroid && <label>{Number(letterSpacing).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()}</label>}
{isAndroid && <label>{(Number.isInteger(letterSpacing) ? letterSpacing : letterSpacing.toFixed(2)) + ' ' + Common.Utils.Metric.getCurrentMetricName()}</label>}
<Button outline className='increment item-link' onClick={() => {props.changeLetterSpacing(letterSpacing, false)}}>
{isAndroid ? <Icon icon="icon-expand-up"></Icon> : ' + '}
</Button>

View file

@ -63,6 +63,7 @@ const FilterOptionsController = () => {
const onClearFilter = () => {
const api = Common.EditorApi.get();
if(api) api.asc_clearFilter();
setCheckSort('');
};
const onDeleteFilter = () => {
@ -79,21 +80,17 @@ const FilterOptionsController = () => {
const setClearDisable = (config) => {
let arr = config.asc_getValues();
let lenCheck = arr.filter((item) => item.visible == true).length;
lenCheck == arr.length ? setIsValid(true) : setIsValid(false)
lenCheck == arr.length ? setIsValid(true) : setIsValid(false);
};
const setDataFilterCells = (config) => {
function isNumeric(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
let value = null,
isnumber = null,
arrCells = [];
config.asc_getValues().forEach((item, index) => {
value = item.asc_getText();
isnumber = isNumeric(value);
isnumber = !isNaN(parseFloat(value)) && isFinite(value);
arrCells.push({
id : index,
@ -111,12 +108,7 @@ const FilterOptionsController = () => {
const onUpdateCell = (id, state) => {
const api = Common.EditorApi.get();
if ( id == 'all' ) {
listVal.forEach(item => item.check = state);
} else {
listVal[id].check = state;
}
id == 'all' ? listVal.forEach(item => item.check = state) : listVal[id].check = state;
setListValue([...listVal]);
if ( listVal.some(item => item.check) ) {

View file

@ -84,3 +84,9 @@
}
}
}
.item-input-wrap {
input[type = number] {
-moz-appearance: textfield;
}
}