mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
migrated all components to use the common package
This commit is contained in:
parent
f0e246ccfd
commit
fa01dfc652
@ -11,7 +11,9 @@ import { SecondaryButton } from "components/ui";
|
|||||||
// types
|
// types
|
||||||
import { Comment } from "types/issue";
|
import { Comment } from "types/issue";
|
||||||
// components
|
// components
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
|
// service
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const defaultValues: Partial<Comment> = {
|
const defaultValues: Partial<Comment> = {
|
||||||
comment_html: "",
|
comment_html: "",
|
||||||
@ -69,7 +71,9 @@ export const AddComment: React.FC<Props> = observer((props) => {
|
|||||||
name="comment_html"
|
name="comment_html"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { value, onChange } }) => (
|
render={({ field: { value, onChange } }) => (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspace_slug as string}
|
workspaceSlug={workspace_slug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
value={
|
value={
|
||||||
|
@ -9,7 +9,8 @@ import { Menu, Transition } from "@headlessui/react";
|
|||||||
// lib
|
// lib
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// components
|
// components
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
|
|
||||||
import { CommentReactions } from "components/issues/peek-overview";
|
import { CommentReactions } from "components/issues/peek-overview";
|
||||||
// icons
|
// icons
|
||||||
import { ChatBubbleLeftEllipsisIcon, CheckIcon, XMarkIcon, EllipsisVerticalIcon } from "@heroicons/react/24/outline";
|
import { ChatBubbleLeftEllipsisIcon, CheckIcon, XMarkIcon, EllipsisVerticalIcon } from "@heroicons/react/24/outline";
|
||||||
@ -17,6 +18,8 @@ import { ChatBubbleLeftEllipsisIcon, CheckIcon, XMarkIcon, EllipsisVerticalIcon
|
|||||||
import { timeAgo } from "helpers/date-time.helper";
|
import { timeAgo } from "helpers/date-time.helper";
|
||||||
// types
|
// types
|
||||||
import { Comment } from "types/issue";
|
import { Comment } from "types/issue";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
@ -100,7 +103,9 @@ export const CommentCard: React.FC<Props> = observer((props) => {
|
|||||||
control={control}
|
control={control}
|
||||||
name="comment_html"
|
name="comment_html"
|
||||||
render={({ field: { onChange, value } }) => (
|
render={({ field: { onChange, value } }) => (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
value={value}
|
value={value}
|
||||||
@ -131,7 +136,9 @@ export const CommentCard: React.FC<Props> = observer((props) => {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div className={`${isEditing ? "hidden" : ""}`}>
|
<div className={`${isEditing ? "hidden" : ""}`}>
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={showEditorRef}
|
ref={showEditorRef}
|
||||||
value={comment.comment_html}
|
value={comment.comment_html}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { IssueReactions } from "components/issues/peek-overview";
|
import { IssueReactions } from "components/issues/peek-overview";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditor } from "@plane/editor";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// types
|
// types
|
||||||
import { IIssue } from "types/issue";
|
import { IIssue } from "types/issue";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
issueDetails: IIssue;
|
issueDetails: IIssue;
|
||||||
@ -19,7 +21,9 @@ export const PeekOverviewIssueDetails: React.FC<Props> = ({ issueDetails }) => {
|
|||||||
</h6>
|
</h6>
|
||||||
<h4 className="break-words text-2xl font-semibold">{issueDetails.name}</h4>
|
<h4 className="break-words text-2xl font-semibold">{issueDetails.name}</h4>
|
||||||
{issueDetails.description_html !== "" && issueDetails.description_html !== "<p></p>" && (
|
{issueDetails.description_html !== "" && issueDetails.description_html !== "<p></p>" && (
|
||||||
<TipTapEditor
|
<TiptapEditor
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspace_slug as string}
|
workspaceSlug={workspace_slug as string}
|
||||||
value={
|
value={
|
||||||
!issueDetails.description_html ||
|
!issueDetails.description_html ||
|
||||||
|
@ -57,7 +57,8 @@
|
|||||||
"tiptap-markdown": "^0.8.2",
|
"tiptap-markdown": "^0.8.2",
|
||||||
"typescript": "4.9.5",
|
"typescript": "4.9.5",
|
||||||
"use-debounce": "^9.0.4",
|
"use-debounce": "^9.0.4",
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0",
|
||||||
|
"@plane/editor": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-cookie": "^3.0.3",
|
"@types/js-cookie": "^3.0.3",
|
||||||
|
@ -25,9 +25,11 @@ interface UnSplashImageUrls {
|
|||||||
small_s3: string;
|
small_s3: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FileServices extends APIService {
|
class FileService extends APIService {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(API_BASE_URL);
|
super(API_BASE_URL);
|
||||||
|
this.uploadFile = this.uploadFile.bind(this);
|
||||||
|
this.deleteImage = this.deleteImage.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadFile(workspaceSlug: string, file: FormData): Promise<any> {
|
async uploadFile(workspaceSlug: string, file: FormData): Promise<any> {
|
||||||
@ -94,6 +96,6 @@ class FileServices extends APIService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileServices = new FileServices();
|
const fileService = new FileService();
|
||||||
|
|
||||||
export default fileServices;
|
export default fileService;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, forwardRef, useRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// react-hook-form
|
// react-hook-form
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
@ -10,9 +10,12 @@ import useToast from "hooks/use-toast";
|
|||||||
import useUserAuth from "hooks/use-user-auth";
|
import useUserAuth from "hooks/use-user-auth";
|
||||||
// ui
|
// ui
|
||||||
import { Input, PrimaryButton, SecondaryButton } from "components/ui";
|
import { Input, PrimaryButton, SecondaryButton } from "components/ui";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
// components
|
||||||
|
import { TiptapEditor, TiptapEditorWithRef } from "@plane/editor";
|
||||||
// types
|
// types
|
||||||
import { IIssue, IPageBlock } from "types";
|
import { IIssue, IPageBlock } from "types";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -140,7 +143,9 @@ export const GptAssistantModal: React.FC<Props> = ({
|
|||||||
{((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && (
|
{((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && (
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
Content:
|
Content:
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
value={htmlContent ?? `<p>${content}</p>`}
|
value={htmlContent ?? `<p>${content}</p>`}
|
||||||
customClassName="-m-3"
|
customClassName="-m-3"
|
||||||
@ -154,7 +159,9 @@ export const GptAssistantModal: React.FC<Props> = ({
|
|||||||
{response !== "" && (
|
{response !== "" && (
|
||||||
<div className="page-block-section text-sm">
|
<div className="page-block-section text-sm">
|
||||||
Response:
|
Response:
|
||||||
<TipTapEditor
|
<TiptapEditor
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
value={`<p>${response}</p>`}
|
value={`<p>${response}</p>`}
|
||||||
customClassName="-mx-3 -my-3"
|
customClassName="-mx-3 -my-3"
|
||||||
|
@ -7,7 +7,7 @@ import { useDropzone } from "react-dropzone";
|
|||||||
// headless ui
|
// headless ui
|
||||||
import { Transition, Dialog } from "@headlessui/react";
|
import { Transition, Dialog } from "@headlessui/react";
|
||||||
// services
|
// services
|
||||||
import fileServices from "services/file.service";
|
import fileService from "services/file.service";
|
||||||
// hooks
|
// hooks
|
||||||
import useWorkspaceDetails from "hooks/use-workspace-details";
|
import useWorkspaceDetails from "hooks/use-workspace-details";
|
||||||
// ui
|
// ui
|
||||||
@ -64,7 +64,7 @@ export const ImageUploadModal: React.FC<Props> = ({
|
|||||||
formData.append("attributes", JSON.stringify({}));
|
formData.append("attributes", JSON.stringify({}));
|
||||||
|
|
||||||
if (userImage) {
|
if (userImage) {
|
||||||
fileServices
|
fileService
|
||||||
.uploadUserFile(formData)
|
.uploadUserFile(formData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const imageUrl = res.asset;
|
const imageUrl = res.asset;
|
||||||
@ -73,13 +73,13 @@ export const ImageUploadModal: React.FC<Props> = ({
|
|||||||
setIsImageUploading(false);
|
setIsImageUploading(false);
|
||||||
setImage(null);
|
setImage(null);
|
||||||
|
|
||||||
if (value) fileServices.deleteUserFile(value);
|
if (value) fileService.deleteUserFile(value);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
fileServices
|
fileService
|
||||||
.uploadFile(workspaceSlug as string, formData)
|
.uploadFile(workspaceSlug as string, formData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const imageUrl = res.asset;
|
const imageUrl = res.asset;
|
||||||
@ -87,7 +87,7 @@ export const ImageUploadModal: React.FC<Props> = ({
|
|||||||
setIsImageUploading(false);
|
setIsImageUploading(false);
|
||||||
setImage(null);
|
setImage(null);
|
||||||
|
|
||||||
if (value && workspaceDetails) fileServices.deleteFile(workspaceDetails.id, value);
|
if (value && workspaceDetails) fileService.deleteFile(workspaceDetails.id, value);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -3,11 +3,13 @@ import { useRouter } from "next/router";
|
|||||||
// react-hook-form
|
// react-hook-form
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
// components
|
// components
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
// ui
|
// ui
|
||||||
import { Icon, SecondaryButton, Tooltip } from "components/ui";
|
import { Icon, SecondaryButton, Tooltip } from "components/ui";
|
||||||
// types
|
// types
|
||||||
import type { IIssueComment } from "types";
|
import type { IIssueComment } from "types";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const defaultValues: Partial<IIssueComment> = {
|
const defaultValues: Partial<IIssueComment> = {
|
||||||
access: "INTERNAL",
|
access: "INTERNAL",
|
||||||
@ -100,7 +102,9 @@ export const AddComment: React.FC<Props> = ({
|
|||||||
name="comment_html"
|
name="comment_html"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { value, onChange } }) => (
|
render={({ field: { value, onChange } }) => (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
value={!value || value === "" ? "<p></p>" : value}
|
value={!value || value === "" ? "<p></p>" : value}
|
||||||
|
@ -9,11 +9,13 @@ import useUser from "hooks/use-user";
|
|||||||
// ui
|
// ui
|
||||||
import { CustomMenu, Icon } from "components/ui";
|
import { CustomMenu, Icon } from "components/ui";
|
||||||
import { CommentReaction } from "components/issues";
|
import { CommentReaction } from "components/issues";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
// helpers
|
// helpers
|
||||||
import { timeAgo } from "helpers/date-time.helper";
|
import { timeAgo } from "helpers/date-time.helper";
|
||||||
// types
|
// types
|
||||||
import type { IIssueComment } from "types";
|
import type { IIssueComment } from "types";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
comment: IIssueComment;
|
comment: IIssueComment;
|
||||||
@ -110,7 +112,9 @@ export const CommentCard: React.FC<Props> = ({
|
|||||||
onSubmit={handleSubmit(onEnter)}
|
onSubmit={handleSubmit(onEnter)}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
value={watch("comment_html")}
|
value={watch("comment_html")}
|
||||||
@ -148,7 +152,9 @@ export const CommentCard: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={showEditorRef}
|
ref={showEditorRef}
|
||||||
value={comment.comment_html}
|
value={comment.comment_html}
|
||||||
|
@ -24,11 +24,14 @@ import { CreateStateModal } from "components/states";
|
|||||||
import { CreateLabelModal } from "components/labels";
|
import { CreateLabelModal } from "components/labels";
|
||||||
// ui
|
// ui
|
||||||
import { CustomMenu, Input, PrimaryButton, SecondaryButton, ToggleSwitch } from "components/ui";
|
import { CustomMenu, Input, PrimaryButton, SecondaryButton, ToggleSwitch } from "components/ui";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
// components
|
||||||
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
// icons
|
// icons
|
||||||
import { SparklesIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
import { SparklesIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
||||||
// types
|
// types
|
||||||
import type { ICurrentUserResponse, IIssue, ISearchIssueResponse } from "types";
|
import type { ICurrentUserResponse, IIssue, ISearchIssueResponse } from "types";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const defaultValues: Partial<IIssue> = {
|
const defaultValues: Partial<IIssue> = {
|
||||||
project: "",
|
project: "",
|
||||||
@ -381,7 +384,9 @@ export const DraftIssueForm: FC<IssueFormProps> = (props) => {
|
|||||||
if (!value && !watch("description_html")) return <></>;
|
if (!value && !watch("description_html")) return <></>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
debouncedUpdatesEnabled={false}
|
debouncedUpdatesEnabled={false}
|
||||||
|
@ -24,11 +24,15 @@ import { CreateStateModal } from "components/states";
|
|||||||
import { CreateLabelModal } from "components/labels";
|
import { CreateLabelModal } from "components/labels";
|
||||||
// ui
|
// ui
|
||||||
import { CustomMenu, Input, PrimaryButton, SecondaryButton, ToggleSwitch } from "components/ui";
|
import { CustomMenu, Input, PrimaryButton, SecondaryButton, ToggleSwitch } from "components/ui";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
// components
|
||||||
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
|
|
||||||
// icons
|
// icons
|
||||||
import { SparklesIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
import { SparklesIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
||||||
// types
|
// types
|
||||||
import type { ICurrentUserResponse, IIssue, ISearchIssueResponse } from "types";
|
import type { ICurrentUserResponse, IIssue, ISearchIssueResponse } from "types";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const defaultValues: Partial<IIssue> = {
|
const defaultValues: Partial<IIssue> = {
|
||||||
project: "",
|
project: "",
|
||||||
@ -380,7 +384,9 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
|
|||||||
if (!value && !watch("description_html")) return <></>;
|
if (!value && !watch("description_html")) return <></>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
debouncedUpdatesEnabled={false}
|
debouncedUpdatesEnabled={false}
|
||||||
|
@ -11,12 +11,14 @@ import aiService from "services/ai.service";
|
|||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
// components
|
// components
|
||||||
import { GptAssistantModal } from "components/core";
|
import { GptAssistantModal } from "components/core";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditorWithRef } from "@plane/editor";
|
||||||
import { PrimaryButton, SecondaryButton, TextArea } from "components/ui";
|
import { PrimaryButton, SecondaryButton, TextArea } from "components/ui";
|
||||||
// types
|
// types
|
||||||
import { ICurrentUserResponse, IPageBlock } from "types";
|
import { ICurrentUserResponse, IPageBlock } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { PAGE_BLOCKS_LIST } from "constants/fetch-keys";
|
import { PAGE_BLOCKS_LIST } from "constants/fetch-keys";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
@ -279,7 +281,9 @@ export const CreateUpdateBlockInline: React.FC<Props> = ({
|
|||||||
render={({ field: { value, onChange } }) => {
|
render={({ field: { value, onChange } }) => {
|
||||||
if (!data)
|
if (!data)
|
||||||
return (
|
return (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
value={"<p></p>"}
|
value={"<p></p>"}
|
||||||
@ -299,7 +303,9 @@ export const CreateUpdateBlockInline: React.FC<Props> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TipTapEditor
|
<TiptapEditorWithRef
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
value={
|
value={
|
||||||
|
@ -19,7 +19,7 @@ import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
|||||||
// components
|
// components
|
||||||
import { GptAssistantModal } from "components/core";
|
import { GptAssistantModal } from "components/core";
|
||||||
import { CreateUpdateBlockInline } from "components/pages";
|
import { CreateUpdateBlockInline } from "components/pages";
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditor } from "@plane/editor";
|
||||||
// ui
|
// ui
|
||||||
import { CustomMenu, TextArea } from "components/ui";
|
import { CustomMenu, TextArea } from "components/ui";
|
||||||
// icons
|
// icons
|
||||||
@ -39,6 +39,7 @@ import { copyTextToClipboard } from "helpers/string.helper";
|
|||||||
import { ICurrentUserResponse, IIssue, IPageBlock, IProject } from "types";
|
import { ICurrentUserResponse, IIssue, IPageBlock, IProject } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { PAGE_BLOCKS_LIST } from "constants/fetch-keys";
|
import { PAGE_BLOCKS_LIST } from "constants/fetch-keys";
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
block: IPageBlock;
|
block: IPageBlock;
|
||||||
@ -451,7 +452,9 @@ export const SinglePageBlock: React.FC<Props> = ({
|
|||||||
|
|
||||||
{showBlockDetails
|
{showBlockDetails
|
||||||
? block.description_html.length > 7 && (
|
? block.description_html.length > 7 && (
|
||||||
<TipTapEditor
|
<TiptapEditor
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
workspaceSlug={workspaceSlug as string}
|
workspaceSlug={workspaceSlug as string}
|
||||||
value={block.description_html}
|
value={block.description_html}
|
||||||
customClassName="text-sm min-h-[150px]"
|
customClassName="text-sm min-h-[150px]"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useImperativeHandle, useRef, forwardRef, useEffect } from "react";
|
import { useImperativeHandle, useRef, forwardRef } from "react";
|
||||||
import { useEditor, EditorContent, Editor } from "@tiptap/react";
|
import { useEditor, EditorContent, Editor } from "@tiptap/react";
|
||||||
import { useDebouncedCallback } from "use-debounce";
|
import { useDebouncedCallback } from "use-debounce";
|
||||||
// components
|
// components
|
||||||
|
@ -16,11 +16,13 @@ import useReloadConfirmations from "hooks/use-reload-confirmation";
|
|||||||
import { TextArea } from "components/ui";
|
import { TextArea } from "components/ui";
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditor } from "@plane/editor";
|
||||||
import { Label } from "components/web-view";
|
import { Label } from "components/web-view";
|
||||||
|
|
||||||
// types
|
// types
|
||||||
import type { IIssue } from "types";
|
import type { IIssue } from "types";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isAllowed: boolean;
|
isAllowed: boolean;
|
||||||
@ -121,7 +123,9 @@ export const IssueWebViewForm: React.FC<Props> = (props) => {
|
|||||||
if (!value) return <></>;
|
if (!value) return <></>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TipTapEditor
|
<TiptapEditor
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
value={
|
value={
|
||||||
!value ||
|
!value ||
|
||||||
value === "" ||
|
value === "" ||
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditor } from "@plane/editor";
|
||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
@ -11,6 +11,7 @@ import DefaultLayout from "layouts/default-layout";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import userService from "services/user.service";
|
import userService from "services/user.service";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const Editor: NextPage = () => {
|
const Editor: NextPage = () => {
|
||||||
const [user, setUser] = useState<ICurrentUserResponse | undefined>();
|
const [user, setUser] = useState<ICurrentUserResponse | undefined>();
|
||||||
@ -134,7 +135,9 @@ const Editor: NextPage = () => {
|
|||||||
name="description_html"
|
name="description_html"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { value, onChange } }) => (
|
render={({ field: { value, onChange } }) => (
|
||||||
<TipTapEditor
|
<TiptapEditor
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
borderOnFocus={false}
|
borderOnFocus={false}
|
||||||
value={
|
value={
|
||||||
!value ||
|
!value ||
|
||||||
|
@ -10,7 +10,6 @@ import { WorkspaceAuthorizationLayout } from "layouts/auth-layout";
|
|||||||
// components
|
// components
|
||||||
import { ActivityIcon, ActivityMessage } from "components/core";
|
import { ActivityIcon, ActivityMessage } from "components/core";
|
||||||
import { TiptapEditor } from "@plane/editor";
|
import { TiptapEditor } from "@plane/editor";
|
||||||
// import { TipTapEditor } from "components/tiptap";
|
|
||||||
// icons
|
// icons
|
||||||
import { ArrowTopRightOnSquareIcon, ChatBubbleLeftEllipsisIcon } from "@heroicons/react/24/outline";
|
import { ArrowTopRightOnSquareIcon, ChatBubbleLeftEllipsisIcon } from "@heroicons/react/24/outline";
|
||||||
// ui
|
// ui
|
||||||
@ -21,6 +20,7 @@ import { USER_ACTIVITY } from "constants/fetch-keys";
|
|||||||
// helper
|
// helper
|
||||||
import { timeAgo } from "helpers/date-time.helper";
|
import { timeAgo } from "helpers/date-time.helper";
|
||||||
import { SettingsSidebar } from "components/project";
|
import { SettingsSidebar } from "components/project";
|
||||||
|
// services
|
||||||
import fileService from "@/services/file.service";
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const ProfileActivity = () => {
|
const ProfileActivity = () => {
|
||||||
|
@ -14,8 +14,10 @@ import { Controller, useForm } from "react-hook-form";
|
|||||||
import WebViewLayout from "layouts/web-view-layout";
|
import WebViewLayout from "layouts/web-view-layout";
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { TipTapEditor } from "components/tiptap";
|
import { TiptapEditor } from "@plane/editor";
|
||||||
import { PrimaryButton, Spinner } from "components/ui";
|
import { PrimaryButton, Spinner } from "components/ui";
|
||||||
|
// services
|
||||||
|
import fileService from "@/services/file.service";
|
||||||
|
|
||||||
const Editor: NextPage = () => {
|
const Editor: NextPage = () => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@ -52,7 +54,9 @@ const Editor: NextPage = () => {
|
|||||||
name="data_html"
|
name="data_html"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { value, onChange } }) => (
|
render={({ field: { value, onChange } }) => (
|
||||||
<TipTapEditor
|
<TiptapEditor
|
||||||
|
uploadFile={fileService.uploadFile}
|
||||||
|
deleteFile={fileService.deleteImage}
|
||||||
borderOnFocus={false}
|
borderOnFocus={false}
|
||||||
value={
|
value={
|
||||||
!value ||
|
!value ||
|
||||||
|
@ -26,7 +26,7 @@ interface UnSplashImageUrls {
|
|||||||
small_s3: string;
|
small_s3: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FileServices extends APIService {
|
class FileService extends APIService {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(API_BASE_URL);
|
super(API_BASE_URL);
|
||||||
this.uploadFile = this.uploadFile.bind(this);
|
this.uploadFile = this.uploadFile.bind(this);
|
||||||
@ -97,4 +97,6 @@ class FileServices extends APIService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new FileServices();
|
const fileService = new FileService();
|
||||||
|
|
||||||
|
export default fileService;
|
||||||
|
Loading…
Reference in New Issue
Block a user