mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
* dev: private bucket implementation (#1339) * chore: migrations and backmigration to move attachments to file asset * chore: move attachments to file assets * chore: update migration file to include created by and updated by and size * chore: remove uninmport errors * chore: make size as float field * fix: file asset uploads * chore: asset uploads migration changes * chore: v2 assets endpoint * chore: remove unused imports * chore: issue attachments * chore: issue attachments * chore: workspace logo endpoints * chore: private bucket changes * chore: user asset endpoint * chore: add logo_url validation * chore: cover image urlk * chore: change asset max length * chore: pages endpoint * chore: store the storage_metadata only when none * chore: attachment asset apis * chore: update create private bucket * chore: make bucket private * chore: fix response of user uploads * fix: response of user uploads * fix: job to fix file asset uploads * fix: user asset endpoints * chore: avatar for user profile * chore: external apis user url endpoint * chore: upload workspace and user asset actions updated * chore: analytics endpoint * fix: analytics export * chore: avatar urls * chore: update user avatar instances * chore: avatar urls for assignees and creators * chore: bucket permission script * fix: all user avatr instances in the web app * chore: update project cover image logic * fix: issue attachment endpoint * chore: patch endpoint for issue attachment * chore: attachments * chore: change attachment storage class * chore: update issue attachment endpoints * fix: issue attachment * chore: update issue attachment implementation * chore: page asset endpoints * fix: web build errors * chore: attachments * chore: page asset urls * chore: comment and issue asset endpoints * chore: asset endpoints * chore: attachment endpoints * chore: bulk asset endpoint * chore: restore endpoint * chore: project assets endpoints * chore: asset url * chore: add delete asset endpoints * chore: fix asset upload endpoint * chore: update patch endpoints * chore: update patch endpoint * chore: update editor image handling * chore: asset restore endpoints * chore: avatar url for space assets * chore: space app assets migration * fix: space app urls * chore: space endpoints * fix: old editor images rendering logic * fix: issue archive and attachment activity * chore: asset deletes * chore: update images * chore: attachment delete * fix: issue attachment * fix: issue attachment get * chore: cover image url for projects * chore: remove duplicate py file * fix: url check function * chore: chore project cover asset delete * fix: migrations * chore: delete migration files --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> * fix: private bucket build errors (#1347) * fix: private bucket build errors * fix: build errors * revert: issue type select changes. (#1355) * chore: private bucket implementation for workspace level pages (#1371) * chore: update project modal * chore: update rich-text read-only editor * chore: update workspace pages' components * chore: remove entity identifier in favour of multiple columns of entities (#1405) * fix: issue attachments (#1411) * fix: issue attachments (#1422) * chore: file size limit for pro workspaces (#1437) * chore: file size limit for pro * chore: update maximum file size logic * chore: update editor max file size logic * chore: update max file size limit logic * chore: add comments * fix: close modal after removing workspace logo * chore: update uploaded asstes' status post issue creation * chore: memoize max file size var * chore: check for pro file size limits * chore: added file size limit to the space app --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> * chore: add max file size limit to workspace pages (#1440) * fix: remove old workspace logo and user avatar (#1445) * fix: intake exception error (#5810) * chore: filtered active cycles for guest (#1468) * fix: build error --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
119 lines
4.3 KiB
TypeScript
119 lines
4.3 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import { useParams } from "next/navigation";
|
|
// plane editor
|
|
import { DocumentReadOnlyEditorWithRef, TDisplayConfig } from "@plane/editor";
|
|
// plane types
|
|
import { IUserLite } from "@plane/types";
|
|
// plane ui
|
|
import { Loader } from "@plane/ui";
|
|
// components
|
|
import { TVersionEditorProps } from "@/components/pages";
|
|
// helpers
|
|
import { getReadOnlyEditorFileHandlers } from "@/helpers/editor.helper";
|
|
// hooks
|
|
import { useMember, useUser } from "@/hooks/store";
|
|
import { usePageFilters } from "@/hooks/use-page-filters";
|
|
// plane web components
|
|
import { IssueEmbedCard } from "@/plane-web/components/pages";
|
|
// plane web hooks
|
|
import { useWorkspaceMention } from "@/plane-web/hooks/use-workspace-mention";
|
|
|
|
export const WorkspacePagesVersionEditor: React.FC<TVersionEditorProps> = observer((props) => {
|
|
const { activeVersion, currentVersionDescription, isCurrentVersionActive, versionDetails } = props;
|
|
// params
|
|
const { workspaceSlug } = useParams();
|
|
// store hooks
|
|
const { data: currentUser } = useUser();
|
|
const {
|
|
getUserDetails,
|
|
workspace: { workspaceMemberIds },
|
|
} = useMember();
|
|
// derived values
|
|
const workspaceMemberDetails = workspaceMemberIds?.map((id) => getUserDetails(id) as IUserLite);
|
|
// use-mention
|
|
const { mentionHighlights } = useWorkspaceMention({
|
|
workspaceSlug: workspaceSlug?.toString() ?? "",
|
|
members: workspaceMemberDetails,
|
|
user: currentUser,
|
|
});
|
|
// page filters
|
|
const { fontSize, fontStyle } = usePageFilters();
|
|
|
|
const displayConfig: TDisplayConfig = {
|
|
fontSize,
|
|
fontStyle,
|
|
};
|
|
|
|
if (!isCurrentVersionActive && !versionDetails)
|
|
return (
|
|
<div className="size-full px-5">
|
|
<Loader className="relative space-y-4">
|
|
<Loader.Item width="50%" height="36px" />
|
|
<div className="space-y-2">
|
|
<div className="py-2">
|
|
<Loader.Item width="100%" height="36px" />
|
|
</div>
|
|
<Loader.Item width="80%" height="22px" />
|
|
<div className="relative flex items-center gap-2">
|
|
<Loader.Item width="30px" height="30px" />
|
|
<Loader.Item width="30%" height="22px" />
|
|
</div>
|
|
<div className="py-2">
|
|
<Loader.Item width="60%" height="36px" />
|
|
</div>
|
|
<Loader.Item width="70%" height="22px" />
|
|
<Loader.Item width="30%" height="22px" />
|
|
<div className="relative flex items-center gap-2">
|
|
<Loader.Item width="30px" height="30px" />
|
|
<Loader.Item width="30%" height="22px" />
|
|
</div>
|
|
<div className="py-2">
|
|
<Loader.Item width="50%" height="30px" />
|
|
</div>
|
|
<Loader.Item width="100%" height="22px" />
|
|
<div className="py-2">
|
|
<Loader.Item width="30%" height="30px" />
|
|
</div>
|
|
<Loader.Item width="30%" height="22px" />
|
|
<div className="relative flex items-center gap-2">
|
|
<div className="py-2">
|
|
<Loader.Item width="30px" height="30px" />
|
|
</div>
|
|
<Loader.Item width="30%" height="22px" />
|
|
</div>
|
|
</div>
|
|
</Loader>
|
|
</div>
|
|
);
|
|
|
|
const description = isCurrentVersionActive ? currentVersionDescription : versionDetails?.description_html;
|
|
if (description === undefined || description?.trim() === "") return null;
|
|
|
|
return (
|
|
<DocumentReadOnlyEditorWithRef
|
|
id={activeVersion ?? ""}
|
|
initialValue={description ?? "<p></p>"}
|
|
containerClassName="p-0 pb-64 border-none"
|
|
displayConfig={displayConfig}
|
|
editorClassName="pl-10"
|
|
fileHandler={getReadOnlyEditorFileHandlers({
|
|
workspaceSlug: workspaceSlug?.toString() ?? "",
|
|
})}
|
|
mentionHandler={{
|
|
highlights: mentionHighlights,
|
|
}}
|
|
embedHandler={{
|
|
issue: {
|
|
widgetCallback: ({ issueId, projectId: projectIdFromEmbed, workspaceSlug: workspaceSlugFromEmbed }) => {
|
|
const resolvedProjectId = projectIdFromEmbed ?? "";
|
|
const resolvedWorkspaceSlug = workspaceSlugFromEmbed ?? workspaceSlug?.toString() ?? "";
|
|
return (
|
|
<IssueEmbedCard issueId={issueId} projectId={resolvedProjectId} workspaceSlug={resolvedWorkspaceSlug} />
|
|
);
|
|
},
|
|
},
|
|
}}
|
|
/>
|
|
);
|
|
});
|