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

Feature/fix bug reactjs
This commit is contained in:
maxkadushkin 2021-06-23 16:27:31 +03:00 committed by GitHub
commit ea19e5ff27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 79 additions and 19 deletions

View file

@ -56,12 +56,15 @@ const CustomColors = ({ options, customColors, onColorClick, curColor }) => {
></a>)
}
}
let indexCurColor = colors.indexOf(curColor);
return (
<div className='palette'>
{colors && colors.length > 0 && colors.map((color, index) => {
return(
<a key={`dc-${index}`}
className={curColor && curColor === color ? 'active' : ''}
className={curColor && curColor === color && index === indexCurColor ? 'active' : ''}
style={{background: `#${color}`}}
onClick={() => {onColorClick(color)}}
></a>

View file

@ -56,6 +56,20 @@
}
}
.add-popup {
.view{
.block-title{
margin-bottom: 0;
margin-top: 8px;
}
.inputs-list {
ul:after, :before{
display: none;
}
}
}
}
// Buttons
.segmented {
.decrement, .increment {

View file

@ -330,6 +330,7 @@
"advDRMOptions": "Protected File",
"txtProtected": "Once you enter the password and open the file, the current password to the file will be reset",
"textOpenFile": "Enter a password to open the file",
"txtIncorrectPwd": "Password is incorrect",
"textNoTextFound": "Text not found",
"textReplace": "Replace",
"textReplaceAll": "Replace All",

View file

@ -611,7 +611,8 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => {
const {t} = this.props;
const _t = t("Settings", { returnObjects: true });
onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this._isDocReady, this.props.storeAppOptions.canRequestClose);
onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this._isDocReady, this.props.storeAppOptions.canRequestClose, this.isDRM);
if(type == Asc.c_oAscAdvancedOptionsID.DRM) this.isDRM = true;
});
}

View file

@ -33,7 +33,7 @@ class DownloadController extends Component {
() => {
if (format == Asc.c_oAscFileType.TXT) {
const isDocReady = this.props.storeAppOptions.isDocReady;
onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.TXT, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t, isDocReady);
onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.TXT, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t, isDocReady, isDRM);
}
else {
setTimeout(() => {
@ -60,7 +60,7 @@ class DownloadController extends Component {
const DownloadWithTranslation = inject("storeAppOptions")(observer(withTranslation()(DownloadController)));
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose) => {
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose, isDRM) => {
if ($$('.dlg-adv-options.modal-in').length > 0) return;
const api = Common.EditorApi.get();
@ -137,6 +137,17 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady
}
}
}];
if(isDRM) {
f7.dialog.create({
text: _t.txtIncorrectPwd,
buttons : [{
text: 'OK',
bold: true,
}]
}).open();
}
if (canRequestClose)
buttons.push({
text: _t.closeButtonText,

View file

@ -11,7 +11,7 @@ const PageLinkSettings = props => {
<Page>
<Navbar title={_t.textLinkSettings} backLink={_t.textBack}></Navbar>
<BlockTitle>{_t.textAddress}</BlockTitle>
<List>
<List className='inputs-list'>
<ListInput
type='text'
placeholder={_t.textImageURL}

View file

@ -179,16 +179,15 @@ const AddOther = props => {
<Icon slot="media" icon="icon-pagenumber"></Icon>
</ListItem>
{(isShape || isChart) ? null :
<ListItem title={_t.textBreak} link={'/add-break/'} routeProps={{
[ <ListItem key='break' title={_t.textBreak} link={'/add-break/'} routeProps={{
onPageBreak: props.onPageBreak,
onColumnBreak: props.onColumnBreak,
onInsertSectionBreak: props.onInsertSectionBreak
}}>
<Icon slot="media" icon="icon-sectionbreak"></Icon>
</ListItem>
}
{(isShape || isChart) ? null :
<ListItem title={_t.textFootnote} link={'/add-footnote/'} routeProps={{
</ListItem>,
<ListItem key='footnote' title={_t.textFootnote} link={'/add-footnote/'} routeProps={{
getFootnoteProps: props.getFootnoteProps,
getFootnoteStartAt: props.getFootnoteStartAt,
onFootnoteStartAt: props.onFootnoteStartAt,
@ -196,7 +195,8 @@ const AddOther = props => {
initFootnoteStartAt: props.initFootnoteStartAt
}}>
<Icon slot="media" icon="icon-footnote"></Icon>
</ListItem>}
</ListItem> ]
}
</List>
)
};

View file

@ -29,6 +29,7 @@
"advDRMPassword": "Password",
"txtProtected": "Once you enter the password and open the file, the current password to the file will be reset",
"textOpenFile": "Enter a password to open the file",
"txtIncorrectPwd": "Password is incorrect",
"leavePageText": "You have unsaved changes in this document. Click 'Stay on this Page' to await the autosave of the document. Click 'Leave this Page' to discard all the unsaved changes.",
"titleLicenseExp": "License expired",
"warnLicenseExp": "Your license has expired. Please update your license and refresh the page.",

View file

@ -111,7 +111,7 @@ class ContextMenu extends ContextMenuController {
text: 'OK',
onClick: () => {
const dontShow = $$('input[name="checkbox-show"]').prop('checked');
if (dontShow) LocalStorage.setItem("de-hide-copy-cut-paste-warning", 1);
if (dontShow) LocalStorage.setItem("pe-hide-copy-cut-paste-warning", 1);
}
}]
}).open();

View file

@ -300,7 +300,6 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onDocumentContentReady', this.onDocumentContentReady.bind(this));
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', this.onUpdateVersion.bind(this));
this.api.asc_registerCallback('asc_onServerVersion', this.onServerVersion.bind(this));
this.api.asc_registerCallback('asc_onAdvancedOptions', this.onAdvancedOptions.bind(this));
this.api.asc_registerCallback('asc_onDocumentName', this.onDocumentName.bind(this));
this.api.asc_registerCallback('asc_onPrintUrl', this.onPrintUrl.bind(this));
this.api.asc_registerCallback('asc_onPrint', this.onPrint.bind(this));
@ -310,6 +309,10 @@ class MainController extends Component {
const storePresentationSettings = this.props.storePresentationSettings;
this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions) => {
this.onAdvancedOptions(type, advOptions);
});
this.api.asc_registerCallback('asc_onPresentationSize', (width, height) => {
storePresentationSettings.changeSizeIndex(width, height);
});
@ -604,6 +607,17 @@ class MainController extends Component {
}
}
}];
if(this.isDRM) {
f7.dialog.create({
text: _t.txtIncorrectPwd,
buttons : [{
text: 'OK',
bold: true,
}]
}).open();
}
if (this.props.storeAppOptions.canRequestClose)
buttons.push({
text: _t.closeButtonText,
@ -620,6 +634,7 @@ class MainController extends Component {
buttons: buttons,
cssClass: 'dlg-adv-options'
}).open();
this.isDRM = true;
}
}

View file

@ -11,7 +11,7 @@ const PageLinkSettings = props => {
<Page>
<Navbar title={_t.textLinkSettings} backLink={_t.textBack}></Navbar>
<BlockTitle>{_t.textAddress}</BlockTitle>
<List>
<List className='inputs-list'>
<ListInput
type='text'
placeholder={_t.textImageURL}

View file

@ -164,7 +164,7 @@
"errorFrmlMaxTextLength": "Text values in formulas are limited to 255 characters.<br>Use the CONCATENATE function or concatenation operator (&)",
"errorFrmlMaxLength": "You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.",
"errorFrmlMaxReference": "You cannot enter this formula because it has too many values,<br>cell references, and/or names.",
"errorDataValidate":"The value you entered is not valid.<br>A user has restricted values that can be entered into this cell.",
"errorDataValidate": "The value you entered is not valid.<br>A user has restricted values that can be entered into this cell.",
"errorLockedCellPivot": "You cannot change data inside a pivot table."
},
"ContextMenu": {
@ -460,6 +460,7 @@
"closeButtonText": "Close File",
"txtProtected": "Once you enter the password and open the file, the current password to the file will be reset",
"textOpenFile": "Enter a password to open the file",
"txtIncorrectPwd": "Password is incorrect",
"textCancel": "Cancel",
"textUnitOfMeasurement": "Unit Of Measurement",
"textCentimeter": "Centimeter",

View file

@ -142,7 +142,7 @@ class ContextMenu extends ContextMenuController {
text: 'OK',
onClick: () => {
const dontShow = $$('input[name="checkbox-show"]').prop('checked');
if (dontShow) LocalStorage.setItem("de-hide-copy-cut-paste-warning", 1);
if (dontShow) LocalStorage.setItem("sse-hide-copy-cut-paste-warning", 1);
}
}]
}).open();

View file

@ -52,6 +52,8 @@ const FilterOptionsController = () => {
const onSort = (type) => {
const api = Common.EditorApi.get();
api.asc_sortColFilter(type == 'sortdown' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending, configFilter.asc_getCellId(), configFilter.asc_getDisplayName());
f7.sheet.close('.picker__sheet');
f7.popover.close('#picker-popover');
};
const onClearFilter = () => {

View file

@ -323,7 +323,8 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => {
const {t} = this.props;
const _t = t("View.Settings", { returnObjects: true });
onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this._isDocReady, this.props.storeAppOptions.canRequestClose);
onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this._isDocReady, this.props.storeAppOptions.canRequestClose,this.isDRM);
if(type == Asc.c_oAscAdvancedOptionsID.DRM) this.isDRM = true;
});
}

View file

@ -39,7 +39,7 @@ class DownloadController extends Component {
const DownloadWithTranslation = withTranslation()(DownloadController);
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose) => {
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose, isDRM) => {
const api = Common.EditorApi.get();
if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
@ -137,6 +137,16 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady
}
}];
if(isDRM) {
f7.dialog.create({
text: _t.txtIncorrectPwd,
buttons : [{
text: 'OK',
bold: true,
}]
}).open();
}
if (canRequestClose)
buttons.push({
text: _t.closeButtonText,

View file

@ -27,7 +27,7 @@ const PageLinkSettings = props => {
<Page>
<Navbar title={_t.textLinkSettings} backLink={_t.textBack}></Navbar>
<BlockTitle>{_t.textAddress}</BlockTitle>
<List>
<List className='inputs-list'>
<ListInput
type='text'
placeholder={_t.textImageURL}