mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-25 09:34:29 +08:00
[DE mobile] Fix Bug 63649
This commit is contained in:
@ -391,7 +391,8 @@
|
||||
"textType": "Type",
|
||||
"textWe": "We",
|
||||
"textWrap": "Wrap",
|
||||
"textWrappingStyle": "Wrapping Style"
|
||||
"textWrappingStyle": "Wrapping Style",
|
||||
"textInvalidName": "The file name cannot contain any of the following characters: "
|
||||
},
|
||||
"Error": {
|
||||
"convertationTimeoutText": "Conversion timeout exceeded.",
|
||||
|
||||
@ -105,13 +105,14 @@ class MainController extends Component {
|
||||
value = localStorage.getItem("de-mobile-allow-macros-request");
|
||||
this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0);
|
||||
|
||||
this.props.storeAppOptions.wopi = this.editorConfig.wopi;
|
||||
|
||||
Common.Notifications.trigger('configOptionsFill');
|
||||
};
|
||||
|
||||
const loadDocument = data => {
|
||||
this.permissions = {};
|
||||
this.document = data.doc;
|
||||
|
||||
let docInfo = {};
|
||||
|
||||
if (data.doc) {
|
||||
|
||||
@ -27,9 +27,9 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||
const disabledEditControls = storeToolbarSettings.disabledEditControls;
|
||||
const disabledSettings = storeToolbarSettings.disabledSettings;
|
||||
const showEditDocument = !appOptions.isEdit && appOptions.canEdit && appOptions.canRequestEditRights;
|
||||
const docInfo = props.storeDocumentInfo;
|
||||
const docExt = docInfo.dataDoc ? docInfo.dataDoc.fileType : '';
|
||||
const docTitle = docInfo.dataDoc ? docInfo.dataDoc.title : '';
|
||||
const storeDocumentInfo = props.storeDocumentInfo;
|
||||
const docExt = storeDocumentInfo.dataDoc ? storeDocumentInfo.dataDoc.fileType : '';
|
||||
const docTitle = storeDocumentInfo.dataDoc ? storeDocumentInfo.dataDoc.title : '';
|
||||
|
||||
useEffect(() => {
|
||||
Common.Gateway.on('init', loadConfig);
|
||||
@ -212,7 +212,24 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||
title: t('Toolbar.textRenameFile'),
|
||||
text : t('Toolbar.textEnterNewFileName'),
|
||||
content: Device.ios ?
|
||||
'<div class="input-field"><input type="text" class="modal-text-input" name="modal-title" id="modal-title"></div>' : '<div class="input-field modal-title"><div class="inputs-list list inline-labels"><ul><li><div class="item-content item-input"><div class="item-inner"><div class="item-input-wrap"><input type="text" name="modal-title" id="modal-title"></div></div></div></li></ul></div></div>',
|
||||
`<div class="input-field">
|
||||
<input type="text" class="modal-text-input" name="modal-title" id="modal-title">
|
||||
</div>` :
|
||||
`<div class="input-field modal-title">
|
||||
<div class="inputs-list list inline-labels">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="item-content item-input">
|
||||
<div class="item-inner">
|
||||
<div class="item-input-wrap">
|
||||
<input type="text" name="modal-title" id="modal-title">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>`,
|
||||
cssClass: 'dlg-adv-options',
|
||||
buttons: [
|
||||
{
|
||||
@ -225,6 +242,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||
close: false,
|
||||
onClick: () => {
|
||||
const titleFieldValue = document.querySelector('#modal-title').value;
|
||||
|
||||
if(titleFieldValue.trim().length) {
|
||||
changeTitle(titleFieldValue);
|
||||
f7.dialog.close();
|
||||
@ -254,16 +272,48 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||
}).open();
|
||||
}
|
||||
|
||||
const cutDocName = name => {
|
||||
if(name.length <= docExt.length) return name;
|
||||
const idx = name.length - docExt.length;
|
||||
|
||||
return name.substring(idx) == docExt ? name.substring(0, idx) : name;
|
||||
};
|
||||
|
||||
const changeTitle = (name) => {
|
||||
const api = Common.EditorApi.get();
|
||||
const storeDocumentInfo = props.storeDocumentInfo;
|
||||
const docInfo = storeDocumentInfo.docInfo;
|
||||
const title = `${name}.${docExt}`;
|
||||
const currentTitle = `${name}.${docExt}`;
|
||||
let formatName = name.trim();
|
||||
|
||||
storeDocumentInfo.changeTitle(title);
|
||||
docInfo.put_Title(title);
|
||||
storeDocumentInfo.setDocInfo(docInfo);
|
||||
api.asc_setDocInfo(docInfo);
|
||||
if(formatName.length > 0 && cutDocName(currentTitle) !== formatName) {
|
||||
if(/[\t*\+:\"<>?|\\\\/]/gim.test(formatName)) {
|
||||
f7.dialog.create({
|
||||
title: t('Edit.notcriticalErrorTitle'),
|
||||
text: t('Edit.textInvalidName') + '*+:\"<>?|\/',
|
||||
buttons: [
|
||||
{
|
||||
text: t('Edit.textOk'),
|
||||
close: true
|
||||
}
|
||||
]
|
||||
}).open();
|
||||
} else {
|
||||
const wopi = appOptions.wopi;
|
||||
formatName = cutDocName(formatName);
|
||||
|
||||
if(wopi) {
|
||||
api.asc_wopi_renameFile(formatName);
|
||||
} else {
|
||||
Common.Gateway.requestRename(formatName);
|
||||
}
|
||||
|
||||
const newTitle = `${formatName}.${docExt}`;
|
||||
|
||||
storeDocumentInfo.changeTitle(newTitle);
|
||||
docInfo.put_Title(newTitle);
|
||||
storeDocumentInfo.setDocInfo(docInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const closeHistory = () => {
|
||||
|
||||
Reference in New Issue
Block a user