Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
dd5ff73
remirror instances commented out to avoid prosemirror conflicts
Palanikannan1437 Aug 2, 2023
d62ac26
styles migrated for remirror to tiptap transition
Palanikannan1437 Aug 2, 2023
b078e24
added bubblemenu support with extensions
Palanikannan1437 Aug 2, 2023
727570e
fixed css for task lists and code with syntax highlighting
Palanikannan1437 Aug 4, 2023
60f1b73
added support for slash command
Palanikannan1437 Aug 4, 2023
50e7c59
fixed bubble menu to match styles and added better seperation in UI
Palanikannan1437 Aug 4, 2023
a6ae849
saving with debounce logic added and it's stored in backend
Palanikannan1437 Aug 4, 2023
63c7bc2
added migration support by updating to html
Palanikannan1437 Aug 7, 2023
c078d59
Image uploads done
Palanikannan1437 Aug 8, 2023
5228ab8
improved file structure and delete image function implemented
Palanikannan1437 Aug 8, 2023
5c290e1
Integrated tiptap with Issue Modal
Palanikannan1437 Aug 9, 2023
0b6d510
added additional props and Tiptap Integration with Comments
Palanikannan1437 Aug 9, 2023
b1dc5f3
added tiptap integration with user activity feeds
Palanikannan1437 Aug 9, 2023
9535850
added ref control support and bubble menu support for readonly editor
Palanikannan1437 Aug 9, 2023
c2a4cdf
added tiptap support for plane pages
Palanikannan1437 Aug 9, 2023
579051d
added tiptap support to gpt assistant modal (yet to be tested)
Palanikannan1437 Aug 9, 2023
96ef0a1
removed remirror instances and cleaned up code
Palanikannan1437 Aug 9, 2023
78a77cf
improved code structure for extracting props in Tiptap
Palanikannan1437 Aug 9, 2023
a96514d
fixing ts errors for next build
Palanikannan1437 Aug 9, 2023
ee6a6ec
fixing node ts error for Horizontal Rule
Palanikannan1437 Aug 9, 2023
2329abe
added ts fix for node types
Palanikannan1437 Aug 9, 2023
1c08ad5
temp fix
Palanikannan1437 Aug 9, 2023
6c9b31a
temp fix
Palanikannan1437 Aug 9, 2023
b86081d
added min height for issue description in modal
Palanikannan1437 Aug 9, 2023
c1d2b41
added resolutions to prosemirror-model version
Palanikannan1437 Aug 10, 2023
7b3862a
trying pnpm overrides
Palanikannan1437 Aug 10, 2023
124383e
explicitly added prosemirror deps
Palanikannan1437 Aug 10, 2023
dfba092
merge conflict resolved
sriramveeraghanta Aug 10, 2023
675d21c
Merge branch 'develop' of github.com:makeplane/plane into tip-tap-int…
sriramveeraghanta Aug 10, 2023
be5bc76
bugfixes
sriramveeraghanta Aug 10, 2023
e325dc5
command pallet fixes and removing logs
sriramveeraghanta Aug 10, 2023
6112a4a
removed extra gap at top and moved saved indicator to bottom
Palanikannan1437 Aug 11, 2023
bcc1131
fix: merge conflicts
aaryan610 Aug 14, 2023
78bb308
fix: slash command scroll posiiton
aaryan610 Aug 14, 2023
b1c6eaf
chore: update custom css variables
aaryan610 Aug 14, 2023
70955b4
build fixes
sriramveeraghanta Aug 14, 2023
b2e6dc3
type fixes
sriramveeraghanta Aug 14, 2023
e03c448
type fixes
sriramveeraghanta Aug 14, 2023
b885f14
type fixes
sriramveeraghanta Aug 14, 2023
b590cb6
matched theme colors
Palanikannan1437 Aug 14, 2023
cd2c632
fixed gpt-assistant modal
Palanikannan1437 Aug 14, 2023
b6329da
updated yarn lock
Palanikannan1437 Aug 14, 2023
8b02f58
added debounced updates for title and removed saved state after timout
Palanikannan1437 Aug 14, 2023
cdb07fc
added css animations for saved state
Palanikannan1437 Aug 14, 2023
92cc66e
build fixes and removing remirror instances
sriramveeraghanta Aug 15, 2023
9e001ff
merge conflicts resolved.
sriramveeraghanta Aug 15, 2023
48e6ac4
minor commenting fixes
sriramveeraghanta Aug 15, 2023
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,6 @@ package-lock.json
# lock files
package-lock.json
pnpm-lock.yaml
pnpm-workspace.yaml
pnpm-workspace.yaml

.npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export const ChangeInterfaceTheme: React.FC<Props> = ({ setIsPaletteOpen }) => {

setTheme(newTheme);

mutateUser((prevData) => {
mutateUser((prevData: any) => {
if (!prevData) return prevData;

return {
...prevData,
theme: {
...prevData.theme,
...prevData?.theme,
theme: newTheme,
},
};
Expand Down
89 changes: 42 additions & 47 deletions apps/app/components/command-palette/command-pallette.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React, { useCallback, useEffect, useState } from "react";

import { useRouter } from "next/router";

import useSWR from "swr";

// hooks
import useTheme from "hooks/use-theme";
import useToast from "hooks/use-toast";
import useUser from "hooks/use-user";
// components
Expand All @@ -26,8 +23,10 @@ import inboxService from "services/inbox.service";
import { INBOX_LIST, ISSUE_DETAILS } from "constants/fetch-keys";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
import { observable } from "mobx";
import { observer } from "mobx-react-lite";

export const CommandPalette: React.FC = () => {
export const CommandPalette: React.FC = observer(() => {
const store: any = useMobxStore();

const [isPaletteOpen, setIsPaletteOpen] = useState(false);
Expand All @@ -47,13 +46,12 @@ export const CommandPalette: React.FC = () => {
const { user } = useUser();

const { setToastAlert } = useToast();
const { toggleCollapsed } = useTheme();

const { data: issueDetails } = useSWR(
workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId as string) : null,
workspaceSlug && projectId && issueId
? () =>
issuesService.retrieve(workspaceSlug as string, projectId as string, issueId as string)
issuesService.retrieve(workspaceSlug as string, projectId as string, issueId as string)
: null
);

Expand All @@ -78,55 +76,52 @@ export const CommandPalette: React.FC = () => {

const handleKeyDown = useCallback(
(e: KeyboardEvent) => {
const { key, ctrlKey, metaKey, altKey, shiftKey } = e;
if (!key) return;

const keyPressed = key.toLowerCase();
const cmdClicked = ctrlKey || metaKey;
// if on input, textarea or editor, don't do anything
if (
e.target instanceof HTMLTextAreaElement ||
e.target instanceof HTMLInputElement ||
(e.target as Element).classList?.contains("remirror-editor")
(e.target as Element).classList?.contains("ProseMirror")
)
return;

const { key, ctrlKey, metaKey, altKey, shiftKey } = e;

if (!key) return;

const keyPressed = key.toLowerCase();

const cmdClicked = ctrlKey || metaKey;

if (cmdClicked) {
if (keyPressed === "k") {
e.preventDefault();
setIsPaletteOpen(true);
} else if (keyPressed === "c" && altKey) {
e.preventDefault();
copyIssueUrlToClipboard();
} else if (keyPressed === "b") {
e.preventDefault();
toggleCollapsed();
}
} else {
if (keyPressed === "c") {
setIsIssueModalOpen(true);
} else if (keyPressed === "p") {
setIsProjectModalOpen(true);
} else if (keyPressed === "v") {
setIsCreateViewModalOpen(true);
} else if (keyPressed === "d") {
setIsCreateUpdatePageModalOpen(true);
} else if (keyPressed === "h") {
setIsShortcutsModalOpen(true);
} else if (keyPressed === "q") {
setIsCreateCycleModalOpen(true);
} else if (keyPressed === "m") {
setIsCreateModuleModalOpen(true);
} else if (keyPressed === "backspace" || keyPressed === "delete") {
e.preventDefault();
setIsBulkDeleteIssuesModalOpen(true);
if (cmdClicked) {
if (keyPressed === "k") {
e.preventDefault();
setIsPaletteOpen(true);
} else if (keyPressed === "c" && altKey) {
e.preventDefault();
copyIssueUrlToClipboard();
} else if (keyPressed === "b") {
e.preventDefault();
store.theme.setSidebarCollapsed(!store?.theme?.sidebarCollapsed);
}
} else {
if (keyPressed === "c") {
setIsIssueModalOpen(true);
} else if (keyPressed === "p") {
setIsProjectModalOpen(true);
} else if (keyPressed === "v") {
setIsCreateViewModalOpen(true);
} else if (keyPressed === "d") {
setIsCreateUpdatePageModalOpen(true);
} else if (keyPressed === "h") {
setIsShortcutsModalOpen(true);
} else if (keyPressed === "q") {
setIsCreateCycleModalOpen(true);
} else if (keyPressed === "m") {
setIsCreateModuleModalOpen(true);
} else if (keyPressed === "backspace" || keyPressed === "delete") {
e.preventDefault();
setIsBulkDeleteIssuesModalOpen(true);
}
}
}
},
[copyIssueUrlToClipboard, toggleCollapsed]
[copyIssueUrlToClipboard]
);

useEffect(() => {
Expand Down Expand Up @@ -201,4 +196,4 @@ export const CommandPalette: React.FC = () => {
/>
</>
);
};
})
24 changes: 9 additions & 15 deletions apps/app/components/core/modals/gpt-assistant-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useState, forwardRef, useRef } from "react";
import React, { useEffect, useState, forwardRef, useRef } from "react";

import { useRouter } from "next/router";
import dynamic from "next/dynamic";

// react-hook-form
import { useForm } from "react-hook-form";
Expand All @@ -15,6 +14,7 @@ import useUserAuth from "hooks/use-user-auth";
import { Input, PrimaryButton, SecondaryButton } from "components/ui";

import { IIssue, IPageBlock } from "types";
import Tiptap, { ITiptapRichTextEditor } from "components/tiptap";
type Props = {
isOpen: boolean;
handleClose: () => void;
Expand All @@ -32,17 +32,11 @@ type FormData = {
task: string;
};

const RemirrorRichTextEditor = dynamic(() => import("components/rich-text-editor"), {
ssr: false,
});

import { IRemirrorRichTextEditor } from "components/rich-text-editor";

const WrappedRemirrorRichTextEditor = forwardRef<IRemirrorRichTextEditor, IRemirrorRichTextEditor>(
(props, ref) => <RemirrorRichTextEditor {...props} forwardedRef={ref} />
const TiptapEditor = React.forwardRef<ITiptapRichTextEditor, ITiptapRichTextEditor>(
(props, ref) => <Tiptap {...props} forwardedRef={ref} />
);

WrappedRemirrorRichTextEditor.displayName = "WrappedRemirrorRichTextEditor";
TiptapEditor.displayName = "TiptapEditor";

export const GptAssistantModal: React.FC<Props> = ({
isOpen,
Expand Down Expand Up @@ -151,10 +145,10 @@ export const GptAssistantModal: React.FC<Props> = ({
}`}
>
{((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && (
<div className="remirror-section text-sm">
<div id="tiptap-container" className="text-sm">
Content:
<WrappedRemirrorRichTextEditor
value={htmlContent ?? <p>{content}</p>}
<TiptapEditor
value={htmlContent ?? `<p>${content}</p>`}
customClassName="-m-3"
noBorder
borderOnFocus={false}
Expand All @@ -166,7 +160,7 @@ export const GptAssistantModal: React.FC<Props> = ({
{response !== "" && (
<div className="page-block-section text-sm">
Response:
<RemirrorRichTextEditor
<Tiptap
value={`<p>${response}</p>`}
customClassName="-mx-3 -my-3"
noBorder
Expand Down
2 changes: 1 addition & 1 deletion apps/app/components/core/views/board-view/single-issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
);
} else {
mutateIssues(
(prevData) =>
(prevData: any) =>
handleIssuesMutation(
formData,
groupTitle ?? "",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/components/core/views/list-view/single-issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const SingleListIssue: React.FC<Props> = ({
);
} else {
mutateIssues(
(prevData) =>
(prevData: any) =>
handleIssuesMutation(
formData,
groupTitle ?? "",
Expand Down
4 changes: 2 additions & 2 deletions apps/app/components/cycles/cycles-list-gantt-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export const CyclesListGanttChartView: FC<Props> = ({ cycles, mutateCycles }) =>
const handleCycleUpdate = (cycle: ICycle, payload: IBlockUpdateData) => {
if (!workspaceSlug || !user) return;

mutateCycles((prevData) => {
mutateCycles((prevData: any) => {
if (!prevData) return prevData;

const newList = prevData.map((p) => ({
const newList = prevData.map((p: any) => ({
...p,
...(p.id === cycle.id
? {
Expand Down
2 changes: 1 addition & 1 deletion apps/app/components/estimates/single-estimate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const SingleEstimate: React.FC<Props> = ({
estimate: estimate.id,
};

mutateProjectDetails((prevData) => {
mutateProjectDetails((prevData: any) => {
if (!prevData) return prevData;

return { ...prevData, estimate: estimate.id };
Expand Down
4 changes: 2 additions & 2 deletions apps/app/components/gantt-chart/hooks/block-update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export const updateGanttIssue = (
) => {
if (!issue || !workspaceSlug || !user) return;

mutate((prevData: IIssue[]) => {
mutate((prevData: any) => {
if (!prevData) return prevData;

const newList = prevData.map((p) => ({
const newList = prevData.map((p: any) => ({
...p,
...(p.id === issue.id ? payload : {}),
}));
Expand Down
4 changes: 2 additions & 2 deletions apps/app/components/inbox/inbox-action-headers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export const InboxActionHeader = () => {
false
);
mutateInboxIssues(
(prevData) =>
(prevData ?? []).map((i) =>
(prevData: any) =>
(prevData ?? []).map((i: any) =>
i.bridge_id === inboxIssueId
? { ...i, issue_inbox: [{ ...i.issue_inbox[0], ...data }] }
: i
Expand Down
5 changes: 4 additions & 1 deletion apps/app/components/issues/activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const IssueActivitySection: React.FC<Props> = ({ issueId, user }) => {
const handleCommentDelete = async (commentId: string) => {
if (!workspaceSlug || !projectId || !issueId) return;

mutateIssueActivities((prevData) => prevData?.filter((p) => p.id !== commentId), false);
mutateIssueActivities(
(prevData: any) => prevData?.filter((p: any) => p.id !== commentId),
false
);

await issuesService
.deleteIssueComment(
Expand Down
49 changes: 24 additions & 25 deletions apps/app/components/issues/comment/add-comment.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";

import { useRouter } from "next/router";
import dynamic from "next/dynamic";

import { mutate } from "swr";

Expand All @@ -12,28 +11,18 @@ import issuesServices from "services/issues.service";
// hooks
import useToast from "hooks/use-toast";
// ui
import { Loader, SecondaryButton } from "components/ui";
import { SecondaryButton } from "components/ui";
// types
import type { ICurrentUserResponse, IIssueComment } from "types";
// fetch-keys
import { PROJECT_ISSUES_ACTIVITY } from "constants/fetch-keys";
import Tiptap, { ITiptapRichTextEditor } from "components/tiptap";

const RemirrorRichTextEditor = dynamic(() => import("components/rich-text-editor"), {
ssr: false,
loading: () => (
<Loader className="mb-5">
<Loader.Item height="12rem" width="100%" />
</Loader>
),
});
import { IRemirrorRichTextEditor } from "components/rich-text-editor";
const TiptapEditor = React.forwardRef<ITiptapRichTextEditor, ITiptapRichTextEditor>(
(props, ref) => <Tiptap {...props} forwardedRef={ref} />
);

const WrappedRemirrorRichTextEditor = React.forwardRef<
IRemirrorRichTextEditor,
IRemirrorRichTextEditor
>((props, ref) => <RemirrorRichTextEditor {...props} forwardedRef={ref} />);

WrappedRemirrorRichTextEditor.displayName = "WrappedRemirrorRichTextEditor";
TiptapEditor.displayName = "TiptapEditor";

const defaultValues: Partial<IIssueComment> = {
comment_json: "",
Expand All @@ -51,6 +40,7 @@ export const AddComment: React.FC<Props> = ({ issueId, user, disabled = false })
handleSubmit,
control,
setValue,
watch,
formState: { isSubmitting },
reset,
} = useForm<IIssueComment>({ defaultValues });
Expand Down Expand Up @@ -97,17 +87,26 @@ export const AddComment: React.FC<Props> = ({ issueId, user, disabled = false })
return (
<div>
<form onSubmit={handleSubmit(onSubmit)}>
<div className="issue-comments-section">
<div id="tiptap-container" className="issue-comments-section">
<Controller
name="comment_json"
name="comment_html"
control={control}
render={({ field: { value } }) => (
<WrappedRemirrorRichTextEditor
value={value}
onJSONChange={(jsonValue) => setValue("comment_json", jsonValue)}
onHTMLChange={(htmlValue) => setValue("comment_html", htmlValue)}
placeholder="Enter your comment..."
render={({ field: { value, onChange } }) => (
<TiptapEditor
ref={editorRef}
value={
!value ||
value === "" ||
(typeof value === "object" && Object.keys(value).length === 0)
? watch("comment_html")
: value
}
customClassName="p-3 min-h-[50px]"
debouncedUpdatesEnabled={false}
onChange={(comment_json: Object, comment_html: string) => {
onChange(comment_html);
setValue("comment_json", comment_json);
}}
/>
)}
/>
Expand Down
Loading