Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/fix bugs #2835

Closed
wants to merge 2 commits into from
Closed
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
110 changes: 88 additions & 22 deletions apps/documenteditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,68 @@ class MainController extends Component {
this.LoadingDocument = -256;
this.ApplyEditRights = -255;
this.boxSdk = $$('#editor_sdk');
this.fallbackSdkTranslations = {
" -Section ": " -Section ",
"above": "above",
"below": "below",
"Caption": "Caption",
"Choose an item": "Choose an item",
"Click to load image": "Click to load image",
"Current Document": "Current Document",
"Diagram Title": "Chart Title",
"endnote text": "Endnote Text",
"Enter a date": "Enter a date",
"Error! Bookmark not defined": "Error! Bookmark not defined.",
"Error! Main Document Only": "Error! Main Document Only.",
"Error! No text of specified style in document": "Error! No text of specified style in document.",
"Error! Not a valid bookmark self-reference": "Error! Not a valid bookmark self-reference.",
"Even Page ": "Even Page ",
"First Page ": "First Page ",
"Footer": "Footer",
"footnote text": "Footnote Text",
"Header": "Header",
"Heading 1": "Heading 1",
"Heading 2": "Heading 2",
"Heading 3": "Heading 3",
"Heading 4": "Heading 4",
"Heading 5": "Heading 5",
"Heading 6": "Heading 6",
"Heading 7": "Heading 7",
"Heading 8": "Heading 8",
"Heading 9": "Heading 9",
"Hyperlink": "Hyperlink",
"Index Too Large": "Index Too Large",
"Intense Quote": "Intense Quote",
"Is Not In Table": "Is Not In Table",
"List Paragraph": "List Paragraph",
"Missing Argument": "Missing Argument",
"Missing Operator": "Missing Operator",
"No Spacing": "No Spacing",
"No table of contents entries found": "There are no headings in the document. Apply a heading style to the text so that it appears in the table of contents.",
"No table of figures entries found": "No table of figures entries found.",
"None": "None",
"Normal": "Normal",
"Number Too Large To Format": "Number Too Large To Format",
"Odd Page ": "Odd Page ",
"Quote": "Quote",
"Same as Previous": "Same as Previous",
"Series": "Series",
"Subtitle": "Subtitle",
"Syntax Error": "Syntax Error",
"Table Index Cannot be Zero": "Table Index Cannot be Zero",
"Table of Contents": "Table of Contents",
"table of figures": "Table of figures",
"The Formula Not In Table": "The Formula Not In Table",
"Title": "Title",
"TOC Heading": "TOC Heading",
"Type equation here": "Type equation here",
"Undefined Bookmark": "Undefined Bookmark",
"Unexpected End of Formula": "Unexpected End of Formula",
"X Axis": "X Axis XAS",
"Y Axis": "Y Axis",
"Your text here": "Your text here",
"Zero Divide": "Zero Divide"
}

this._state = {
licenseType: false,
Expand Down Expand Up @@ -344,30 +406,34 @@ class MainController extends Component {
.then(() => {
window["flat_desine"] = true;
const { t } = this.props;
const _translate = t('Main.SDK', { returnObjects: true });

Object.entries(_translate).forEach(([key, value]) => {
if (key.endsWith(' ') && !value.endsWith(' ')) {
_translate[key] = value + ' ';
}
});
let _translate = t('Main.SDK', { returnObjects: true });

const errorMessages = [
"Error! Bookmark not defined",
"No table of contents entries found",
"No table of figures entries found",
"Error! Main Document Only",
"Error! Not a valid bookmark self-reference",
"Error! No text of specified style in document"
];

for (const item of errorMessages) {
const newItem = item + '.';

if (_translate[item]) {
_translate[newItem] = _translate[item];
delete _translate[item];
if (typeof _translate === 'object') {
Object.entries(_translate).forEach(([key, value]) => {
if (key.endsWith(' ') && !value.endsWith(' ')) {
_translate[key] = value + ' ';
}
});

const errorMessages = [
"Error! Bookmark not defined",
"No table of contents entries found",
"No table of figures entries found",
"Error! Main Document Only",
"Error! Not a valid bookmark self-reference",
"Error! No text of specified style in document"
];

for (const item of errorMessages) {
const newItem = item + '.';

if (_translate[item]) {
_translate[newItem] = _translate[item];
delete _translate[item];
}
}
} else {
_translate = this.fallbackSdkTranslations
}

let result = /[\?\&]fileType=\b(pdf)|(djvu|xps|oxps)\b&?/i.exec(window.location.search),
Expand Down
9 changes: 6 additions & 3 deletions apps/documenteditor/mobile/src/controller/Toolbar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { Device } from '../../../../common/mobile/utils/device';
import { inject, observer } from 'mobx-react';
import { f7 } from 'framework7-react';
Expand Down Expand Up @@ -34,6 +34,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
const storeDocumentInfo = props.storeDocumentInfo;
const docExt = storeDocumentInfo.dataDoc ? storeDocumentInfo.dataDoc.fileType : '';
const docTitle = storeDocumentInfo.dataDoc ? storeDocumentInfo.dataDoc.title : '';
const scrollOffsetRef = useRef(0);

const getNavbarTotalHeight = useCallback(() => {
const navbarBg = document.querySelector('.navbar-bg');
Expand Down Expand Up @@ -102,15 +103,17 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
const isSearchbarEnabled = document.querySelector('.subnavbar .searchbar')?.classList.contains('searchbar-enabled');

if(!isSearchbarEnabled && navbarHeight) {
if(offset > 0) {
if(offset > scrollOffsetRef.current) {
props.closeOptions('fab');
f7.navbar.hide('.main-navbar');
api.SetMobileTopOffset(undefined, 0);
} else if(offset <= 0) {
} else if(offset <= scrollOffsetRef.current) {
props.openOptions('fab');
f7.navbar.show('.main-navbar');
api.SetMobileTopOffset(undefined, navbarHeight);
}

scrollOffsetRef.current = offset;
}
}

Expand Down
Loading