Web: Shared: FilesSelector: fixed title
This commit is contained in:
parent
b52e7af32c
commit
16350b4d50
@ -33,11 +33,15 @@ import {
|
||||
ShareAccessRights,
|
||||
} from "@docspace/shared/enums";
|
||||
//import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { getCorrectDate, getCookie } from "@docspace/shared/utils";
|
||||
import {
|
||||
getCorrectDate,
|
||||
getCookie,
|
||||
getTitleWithoutExtension,
|
||||
} from "@docspace/shared/utils";
|
||||
import { LANGUAGE } from "@docspace/shared/constants";
|
||||
import config from "PACKAGE_FILE";
|
||||
//import EditingWrapperComponent from "../components/EditingWrapperComponent";
|
||||
import { getTitleWithoutExtension } from "SRC_DIR/helpers/filesUtils";
|
||||
|
||||
//import { getDefaultFileName } from "@docspace/client/src/helpers/filesUtils";
|
||||
//import ItemIcon from "../components/ItemIcon";
|
||||
|
||||
|
@ -34,10 +34,10 @@ import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { setEncryptionAccess } from "SRC_DIR/helpers/desktop";
|
||||
import config from "PACKAGE_FILE";
|
||||
|
||||
import { getTitleWithoutExtension } from "SRC_DIR/helpers/filesUtils";
|
||||
import { getDefaultFileName } from "@docspace/client/src/helpers/filesUtils";
|
||||
|
||||
import Dialog from "./sub-components/Dialog";
|
||||
import { getTitleWithoutExtension } from "@docspace/shared/utils";
|
||||
|
||||
const CreateEvent = ({
|
||||
id,
|
||||
|
@ -29,7 +29,7 @@ import { inject, observer } from "mobx-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import Dialog from "./sub-components/Dialog";
|
||||
import { getTitleWithoutExtension } from "SRC_DIR/helpers/filesUtils";
|
||||
import { getTitleWithoutExtension } from "@docspace/shared/utils";
|
||||
|
||||
const RenameEvent = ({
|
||||
type,
|
||||
|
@ -226,10 +226,3 @@ export const connectedCloudsTypeIcon = (key) => {
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
export const getTitleWithoutExtension = (item, fromTemplate) => {
|
||||
const titleWithoutExst = item.title.split(".").slice(0, -1).join(".");
|
||||
return titleWithoutExst && item.fileExst && !fromTemplate
|
||||
? titleWithoutExst
|
||||
: item.title;
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ import { TRoom } from "../../api/rooms/types";
|
||||
import { getIconPathByFolderType } from "../../utils/common";
|
||||
import { iconSize32 } from "../../utils/image-helpers";
|
||||
import { DEFAULT_FILE_EXTS } from "./FilesSelector.constants";
|
||||
import { getTitleWithoutExtension } from "../../utils";
|
||||
|
||||
export const convertFoldersToItems: (
|
||||
folders: TFolder[],
|
||||
@ -87,7 +88,7 @@ export const convertFilesToItems: (
|
||||
const { id, title, security, folderId, rootFolderType, fileExst } = file;
|
||||
|
||||
const icon = getIcon(fileExst || DEFAULT_FILE_EXTS);
|
||||
const label = title.replace(fileExst, "") || fileExst;
|
||||
const label = getTitleWithoutExtension(file, false);
|
||||
|
||||
return {
|
||||
id,
|
||||
|
@ -76,6 +76,7 @@ import {
|
||||
getLogoUrl,
|
||||
} from "./common";
|
||||
import { DeviceType } from "../enums";
|
||||
import { TFile } from "../api/files/types";
|
||||
|
||||
export {
|
||||
isBetaLanguage,
|
||||
@ -153,3 +154,13 @@ export const getDeviceTypeByWidth = (width: number): DeviceType => {
|
||||
|
||||
return DeviceType.desktop;
|
||||
};
|
||||
|
||||
export const getTitleWithoutExtension = (
|
||||
item: TFile,
|
||||
fromTemplate: boolean,
|
||||
) => {
|
||||
const titleWithoutExst = item.title.split(".").slice(0, -1).join(".");
|
||||
return titleWithoutExst && item.fileExst && !fromTemplate
|
||||
? titleWithoutExst
|
||||
: item.title;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user