π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
Revert "[WEB-1435] dev: conflict free issue descriptions (#5912)" (#6000)
Aaryan Khandelwal9408e92e4438
diff --git a/apiserver/plane/app/serializers/draft.py b/apiserver/plane/app/serializers/draft.pyindex b1df79f28e..e07e416a75 100644--- a/apiserver/plane/app/serializers/draft.py+++ b/apiserver/plane/app/serializers/draft.py@@ -284,11 +284,9 @@ class DraftIssueSerializer(BaseSerializer):class DraftIssueDetailSerializer(DraftIssueSerializer):description_html = serializers.CharField()- description_binary = serializers.CharField()class Meta(DraftIssueSerializer.Meta):fields = DraftIssueSerializer.Meta.fields + ["description_html",- "description_binary",]read_only_fields = fieldsdiff --git a/apiserver/plane/app/serializers/issue.py b/apiserver/plane/app/serializers/issue.pyindex ad1f9606b8..b0904834f7 100644--- a/apiserver/plane/app/serializers/issue.py+++ b/apiserver/plane/app/serializers/issue.py@@ -1,6 +1,3 @@-# Python imports-import base64-# Django importsfrom django.utils import timezonefrom django.core.validators import URLValidator@@ -735,31 +732,14 @@ class IssueLiteSerializer(DynamicBaseSerializer):read_only_fields = fields-class Base64BinaryField(serializers.CharField):- def to_representation(self, value):- # Encode the binary data to base64 string for JSON response- if value:- return base64.b64encode(value).decode("utf-8")- return None-- def to_internal_value(self, data):- # Decode the base64 string to binary data when saving- try:- return base64.b64decode(data)- except (TypeError, ValueError):- raise serializers.ValidationError("Invalid base64-encoded data")--class IssueDetailSerializer(IssueSerializer):description_html = serializers.CharField()- description_binary = Base64BinaryField()is_subscribed = serializers.BooleanField(read_only=True)class Meta(IssueSerializer.Meta):fields = IssueSerializer.Meta.fields + ["description_html","is_subscribed",- "description_binary",]read_only_fields = fieldsdiff --git a/apiserver/plane/app/serializers/workspace.py b/apiserver/plane/app/serializers/workspace.pyindex 4f10602260..1a2b89bba6 100644--- a/apiserver/plane/app/serializers/workspace.py+++ b/apiserver/plane/app/serializers/workspace.py@@ -66,7 +66,6 @@ class WorkSpaceMemberSerializer(DynamicBaseSerializer):class WorkspaceMemberMeSerializer(BaseSerializer):draft_issue_count = serializers.IntegerField(read_only=True)-class Meta:model = WorkspaceMemberfields = "__all__"diff --git a/apiserver/plane/app/urls/intake.py b/apiserver/plane/app/urls/intake.pyindex d4f160577e..be2f3a053f 100644--- a/apiserver/plane/app/urls/intake.py+++ b/apiserver/plane/app/urls/intake.py@@ -92,14 +92,4 @@ urlpatterns = [),name="inbox-issue",),- path(- "workspaces/<str:slug>/projects/<uuid:project_id>/inbox-issues/<uuid:pk>/description/",- IntakeIssueViewSet.as_view(- {- "get": "retrieve_description",- "post": "update_description",- }- ),- name="inbox-issue-description",- ),]diff --git a/apiserver/plane/app/urls/issue.py b/apiserver/plane/app/urls/issue.pyindex e20643546d..e8ad4408df 100644--- a/apiserver/plane/app/urls/issue.py+++ b/apiserver/plane/app/urls/issue.py@@ -66,16 +66,6 @@ urlpatterns = [),name="project-issue",),- path(- "workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:pk>/description/",- IssueViewSet.as_view(- {- "get": "retrieve_description",- "post": "update_description",- }- ),- name="project-issue-description",- ),path("workspaces/<str:slug>/projects/<uuid:project_id>/issue-labels/",LabelViewSet.as_view(@@ -298,15 +288,6 @@ urlpatterns = [),name="project-issue-archive-unarchive",),- path(- "workspaces/<str:slug>/projects/<uuid:project_id>/archived-issues/<uuid:pk>/description/",- IssueArchiveViewSet.as_view(- {- "get": "retrieve_description",- }- ),- name="archive-issue-description",- ),## End Issue Archives## Issue Relationpath(diff --git a/apiserver/plane/app/urls/workspace.py b/apiserver/plane/app/urls/workspace.pyindex 6481f5691c..fb6f4c13ac 100644--- a/apiserver/plane/app/urls/workspace.py+++ b/apiserver/plane/app/urls/workspace.py@@ -276,16 +276,6 @@ urlpatterns = [),name="workspace-drafts-issues",),- path(- "workspaces/<str:slug>/draft-issues/<uuid:pk>/description/",- WorkspaceDraftIssueViewSet.as_view(- {- "get": "retrieve_description",- "post": "update_description",- }- ),- name="workspace-drafts-issues",- ),path("workspaces/<str:slug>/draft-to-issue/<uuid:draft_id>/",WorkspaceDraftIssueViewSet.as_view({"post": "create_draft_to_issue"}),diff --git a/apiserver/plane/app/views/intake/base.py b/apiserver/plane/app/views/intake/base.pyindex 394957884c..9e420c0072 100644--- a/apiserver/plane/app/views/intake/base.py+++ b/apiserver/plane/app/views/intake/base.py@@ -1,7 +1,5 @@# Python importsimport json-import requests-import base64# Django importfrom django.utils import timezone@@ -11,9 +9,6 @@ from django.contrib.postgres.aggregates import ArrayAggfrom django.contrib.postgres.fields import ArrayFieldfrom django.db.models import Value, UUIDFieldfrom django.db.models.functions import Coalesce-from django.http import StreamingHttpResponse-from django.conf import settings-# Third party importsfrom rest_framework import status@@ -45,6 +40,7 @@ from plane.bgtasks.issue_activities_task import issue_activityclass IntakeViewSet(BaseViewSet):+serializer_class = IntakeSerializermodel = Intake@@ -93,6 +89,7 @@ class IntakeViewSet(BaseViewSet):class IntakeIssueViewSet(BaseViewSet):+serializer_class = IntakeIssueSerializermodel = IntakeIssue@@ -643,82 +640,3 @@ class IntakeIssueViewSet(BaseViewSet):intake_issue.delete()return Response(status=status.HTTP_204_NO_CONTENT)-- @allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])- def retrieve_description(self, request, slug, project_id, pk):- issue = Issue.objects.filter(- pk=pk, workspace__slug=slug, project_id=project_id- ).first()- if issue is None:- return Response(- {"error": "Issue not found"},- status=404,- )- binary_data = issue.description_binary-- def stream_data():- if binary_data:- yield binary_data- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="issue_description.bin"'- )- return response-- @allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])- def update_description(self, request, slug, project_id, pk):- issue = Issue.objects.get(- workspace__slug=slug, project_id=project_id, pk=pk- )- base64_description = issue.description_binary- # convert to base64 string- if base64_description:- base64_description = base64.b64encode(base64_description).decode(- "utf-8"- )- data = {- "original_document": base64_description,- "updates": request.data.get("description_binary"),- }- base_url = f"{settings.LIVE_BASE_URL}/resolve-document-conflicts/"- try:- response = requests.post(base_url, json=data, headers=None)- except requests.RequestException:- return Response(- {"error": "Failed to connect to the external service"},- status=status.HTTP_502_BAD_GATEWAY,- )-- if response.status_code == 200:- issue.description = response.json().get(- "description", issue.description- )- issue.description_html = response.json().get("description_html")- response_description_binary = response.json().get(- "description_binary"- )- issue.description_binary = base64.b64decode(- response_description_binary- )- issue.save()-- def stream_data():- if issue.description_binary:- yield issue.description_binary- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="issue_description.bin"'- )- return response-- return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)diff --git a/apiserver/plane/app/views/issue/archive.py b/apiserver/plane/app/views/issue/archive.pyindex 3fa4e3c480..292d9d6173 100644--- a/apiserver/plane/app/views/issue/archive.py+++ b/apiserver/plane/app/views/issue/archive.py@@ -7,8 +7,6 @@ from django.db.models import F, Func, OuterRef, Q, Prefetch, Exists, Subqueryfrom django.utils import timezonefrom django.utils.decorators import method_decoratorfrom django.views.decorators.gzip import gzip_page-from django.http import StreamingHttpResponse-# Third Party importsfrom rest_framework import status@@ -29,7 +27,7 @@ from plane.db.models import (IssueLink,IssueSubscriber,IssueReaction,- CycleIssue,+ CycleIssue)from plane.utils.grouper import (issue_group_values,@@ -329,32 +327,6 @@ class IssueArchiveViewSet(BaseViewSet):return Response(status=status.HTTP_204_NO_CONTENT)- @allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])- def retrieve_description(self, request, slug, project_id, pk):- issue = Issue.objects.filter(- pk=pk, workspace__slug=slug, project_id=project_id- ).first()- if issue is None:- return Response(- {"error": "Issue not found"},- status=404,- )- binary_data = issue.description_binary-- def stream_data():- if binary_data:- yield binary_data- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="issue_description.bin"'- )- return response-class BulkArchiveIssuesEndpoint(BaseAPIView):permission_classes = [diff --git a/apiserver/plane/app/views/issue/base.py b/apiserver/plane/app/views/issue/base.pyindex 09b23f11a4..c30f889ba0 100644--- a/apiserver/plane/app/views/issue/base.py+++ b/apiserver/plane/app/views/issue/base.py@@ -1,7 +1,5 @@# Python importsimport json-import requests-import base64# Django importsfrom django.contrib.postgres.aggregates import ArrayAgg@@ -22,10 +20,8 @@ from django.db.models import ()from django.db.models.functions import Coalescefrom django.utils import timezone-from django.http import StreamingHttpResponsefrom django.utils.decorators import method_decoratorfrom django.views.decorators.gzip import gzip_page-from django.conf import settings# Third Party importsfrom rest_framework import status@@ -729,84 +725,6 @@ class IssueViewSet(BaseViewSet):)return Response(status=status.HTTP_204_NO_CONTENT)- @allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])- def retrieve_description(self, request, slug, project_id, pk):- issue = Issue.issue_objects.filter(- pk=pk, workspace__slug=slug, project_id=project_id- ).first()- if issue is None:- return Response(- {"error": "Issue not found"},- status=404,- )- binary_data = issue.description_binary-- def stream_data():- if binary_data:- yield binary_data- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="issue_description.bin"'- )- return response-- def update_description(self, request, slug, project_id, pk):- issue = Issue.issue_objects.get(- workspace__slug=slug, project_id=project_id, pk=pk- )- base64_description = issue.description_binary- # convert to base64 string- if base64_description:- base64_description = base64.b64encode(base64_description).decode(- "utf-8"- )- data = {- "original_document": base64_description,- "updates": request.data.get("description_binary"),- }- base_url = f"{settings.LIVE_BASE_URL}/resolve-document-conflicts/"- try:- response = requests.post(base_url, json=data, headers=None)- except requests.RequestException:- return Response(- {"error": "Failed to connect to the external service"},- status=status.HTTP_502_BAD_GATEWAY,- )-- if response.status_code == 200:- issue.description = response.json().get(- "description", issue.description- )- issue.description_html = response.json().get("description_html")- response_description_binary = response.json().get(- "description_binary"- )- issue.description_binary = base64.b64decode(- response_description_binary- )- issue.save()-- def stream_data():- if issue.description_binary:- yield issue.description_binary- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="issue_description.bin"'- )- return response-- return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)-class IssueUserDisplayPropertyEndpoint(BaseAPIView):@allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])diff --git a/apiserver/plane/app/views/workspace/draft.py b/apiserver/plane/app/views/workspace/draft.pyindex 1d68256c0c..b2cb529fca 100644--- a/apiserver/plane/app/views/workspace/draft.py+++ b/apiserver/plane/app/views/workspace/draft.py@@ -1,7 +1,5 @@# Python importsimport json-import requests-import base64# Django importsfrom django.utils import timezone@@ -9,7 +7,6 @@ from django.core import serializersfrom django.core.serializers.json import DjangoJSONEncoderfrom django.contrib.postgres.aggregates import ArrayAggfrom django.contrib.postgres.fields import ArrayField-from django.http import StreamingHttpResponsefrom django.db.models import (Q,UUIDField,@@ -20,7 +17,6 @@ from django.db.models import (from django.db.models.functions import Coalescefrom django.utils.decorators import method_decoratorfrom django.views.decorators.gzip import gzip_page-from django.conf import settings# Third Party importsfrom rest_framework import status@@ -354,78 +350,3 @@ class WorkspaceDraftIssueViewSet(BaseViewSet):return Response(serializer.data, status=status.HTTP_201_CREATED)return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)-- @allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])- def retrieve_description(self, request, slug, pk):- issue = DraftIssue.objects.filter(pk=pk, workspace__slug=slug).first()- if issue is None:- return Response(- {"error": "Issue not found"},- status=404,- )- binary_data = issue.description_binary-- def stream_data():- if binary_data:- yield binary_data- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="draft_issue_description.bin"'- )- return response-- @allow_permission([ROLE.ADMIN, ROLE.MEMBER])- def update_description(self, request, slug, pk):- issue = DraftIssue.objects.get(workspace__slug=slug, pk=pk)- base64_description = issue.description_binary- # convert to base64 string- if base64_description:- base64_description = base64.b64encode(base64_description).decode(- "utf-8"- )- data = {- "original_document": base64_description,- "updates": request.data.get("description_binary"),- }- base_url = f"{settings.LIVE_BASE_URL}/resolve-document-conflicts/"- try:- response = requests.post(base_url, json=data, headers=None)- except requests.RequestException:- return Response(- {"error": "Failed to connect to the external service"},- status=status.HTTP_502_BAD_GATEWAY,- )-- if response.status_code == 200:- issue.description = response.json().get(- "description", issue.description- )- issue.description_html = response.json().get("description_html")- response_description_binary = response.json().get(- "description_binary"- )- issue.description_binary = base64.b64decode(- response_description_binary- )- issue.save()-- def stream_data():- if issue.description_binary:- yield issue.description_binary- else:- yield b""-- response = StreamingHttpResponse(- stream_data(), content_type="application/octet-stream"- )- response["Content-Disposition"] = (- 'attachment; filename="issue_description.bin"'- )- return response-- return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)diff --git a/apiserver/plane/db/migrations/0085_intake_intakeissue_remove_inboxissue_created_by_and_more.py b/apiserver/plane/db/migrations/0085_intake_intakeissue_remove_inboxissue_created_by_and_more.pyindex 16c4167cf6..36cf73bc54 100644--- a/apiserver/plane/db/migrations/0085_intake_intakeissue_remove_inboxissue_created_by_and_more.py+++ b/apiserver/plane/db/migrations/0085_intake_intakeissue_remove_inboxissue_created_by_and_more.py@@ -1,7 +1,9 @@# Generated by Django 4.2.15 on 2024-11-06 08:41+from django.conf import settingsfrom django.db import migrations, modelsimport django.db.models.deletion+import uuidclass Migration(migrations.Migration):diff --git a/apiserver/plane/settings/common.py b/apiserver/plane/settings/common.pyindex 5e465cc46d..a7096ef2a9 100644--- a/apiserver/plane/settings/common.py+++ b/apiserver/plane/settings/common.py@@ -381,7 +381,6 @@ CSRF_FAILURE_VIEW = "plane.authentication.views.common.csrf_failure"ADMIN_BASE_URL = os.environ.get("ADMIN_BASE_URL", None)SPACE_BASE_URL = os.environ.get("SPACE_BASE_URL", None)APP_BASE_URL = os.environ.get("APP_BASE_URL")-LIVE_BASE_URL = os.environ.get("LIVE_BASE_URL")HARD_DELETE_AFTER_DAYS = int(os.environ.get("HARD_DELETE_AFTER_DAYS", 60))diff --git a/apiserver/plane/space/urls/intake.py b/apiserver/plane/space/urls/intake.pyindex 350157c950..9f43a28098 100644--- a/apiserver/plane/space/urls/intake.py+++ b/apiserver/plane/space/urls/intake.py@@ -3,6 +3,7 @@ from django.urls import pathfrom plane.space.views import (IntakeIssuePublicViewSet,+ IssueVotePublicViewSet,WorkspaceProjectDeployBoardEndpoint,)diff --git a/live/.prettierignore b/live/.prettierignoredeleted file mode 100644index 09a5bb19de..0000000000--- a/live/.prettierignore+++ /dev/null@@ -1,6 +0,0 @@-.next-.vercel-.tubro-out/-dist/-node_modules/\ No newline at end of filediff --git a/live/.prettierrc b/live/.prettierrcdeleted file mode 100644index 87d988f1b2..0000000000--- a/live/.prettierrc+++ /dev/null@@ -1,5 +0,0 @@-{- "printWidth": 120,- "tabWidth": 2,- "trailingComma": "es5"-}diff --git a/live/src/core/helpers/page.ts b/live/src/core/helpers/page.tsnew file mode 100644index 0000000000..4e79afe6b8--- /dev/null+++ b/live/src/core/helpers/page.ts@@ -0,0 +1,59 @@+import { getSchema } from "@tiptap/core";+import { generateHTML, generateJSON } from "@tiptap/html";+import { prosemirrorJSONToYDoc, yXmlFragmentToProseMirrorRootNode } from "y-prosemirror";+import * as Y from "yjs"+// plane editor+import { CoreEditorExtensionsWithoutProps, DocumentEditorExtensionsWithoutProps } from "@plane/editor/lib";++const DOCUMENT_EDITOR_EXTENSIONS = [+ ...CoreEditorExtensionsWithoutProps,+ ...DocumentEditorExtensionsWithoutProps,+];+const documentEditorSchema = getSchema(DOCUMENT_EDITOR_EXTENSIONS);++export const getAllDocumentFormatsFromBinaryData = (description: Uint8Array): {+ contentBinaryEncoded: string;+ contentJSON: object;+ contentHTML: string;+} => {+ // encode binary description data+ const base64Data = Buffer.from(description).toString("base64");+ const yDoc = new Y.Doc();+ Y.applyUpdate(yDoc, description);+ // convert to JSON+ const type = yDoc.getXmlFragment("default");+ const contentJSON = yXmlFragmentToProseMirrorRootNode(+ type,+ documentEditorSchema+ ).toJSON();+ // convert to HTML+ const contentHTML = generateHTML(contentJSON, DOCUMENT_EDITOR_EXTENSIONS);++ return {+ contentBinaryEncoded: base64Data,+ contentJSON,+ contentHTML,+ };+}++export const getBinaryDataFromHTMLString = (descriptionHTML: string): {+ contentBinary: Uint8Array+} => {+ // convert HTML to JSON+ const contentJSON = generateJSON(+ descriptionHTML ?? "<p></p>",+ DOCUMENT_EDITOR_EXTENSIONS+ );+ // convert JSON to Y.Doc format+ const transformedData = prosemirrorJSONToYDoc(+ documentEditorSchema,+ contentJSON,+ "default"+ );+ // convert Y.Doc to Uint8Array format+ const encodedData = Y.encodeStateAsUpdate(transformedData);++ return {+ contentBinary: encodedData+ }+}\ No newline at end of filediff --git a/live/src/core/lib/page.ts b/live/src/core/lib/page.tsindex fb80402aaf..c2110a2b8d 100644--- a/live/src/core/lib/page.ts+++ b/live/src/core/lib/page.ts@@ -1,8 +1,8 @@-// plane editor+// helpersimport {- getAllDocumentFormatsFromDocumentEditorBinaryData,- getBinaryDataFromDocumentEditorHTMLString,-} from "@plane/editor/lib";+ getAllDocumentFormatsFromBinaryData,+ getBinaryDataFromHTMLString,+} from "@/core/helpers/page.js";// servicesimport { PageService } from "@/core/services/page.service.js";import { manualLogger } from "../helpers/logger.js";@@ -12,10 +12,12 @@ export const updatePageDescription = async (params: URLSearchParams,pageId: string,updatedDescription: Uint8Array,- cookie: string | undefined+ cookie: string | undefined,) => {if (!(updatedDescription instanceof Uint8Array)) {- throw new Error("Invalid updatedDescription: must be an instance of Uint8Array");+ throw new Error(+ "Invalid updatedDescription: must be an instance of Uint8Array",+ );}const workspaceSlug = params.get("workspaceSlug")?.toString();@@ -23,7 +25,7 @@ export const updatePageDescription = async (if (!workspaceSlug || !projectId || !cookie) return;const { contentBinaryEncoded, contentHTML, contentJSON } =- getAllDocumentFormatsFromDocumentEditorBinaryData(updatedDescription);+ getAllDocumentFormatsFromBinaryData(updatedDescription);try {const payload = {description_binary: contentBinaryEncoded,@@ -31,7 +33,13 @@ export const updatePageDescription = async (description: contentJSON,};- await pageService.updateDescription(workspaceSlug, projectId, pageId, payload, cookie);+ await pageService.updateDescription(+ workspaceSlug,+ projectId,+ pageId,+ payload,+ cookie,+ );} catch (error) {manualLogger.error("Update error:", error);throw error;@@ -42,16 +50,26 @@ const fetchDescriptionHTMLAndTransform = async (workspaceSlug: string,projectId: string,pageId: string,- cookie: string+ cookie: string,) => {if (!workspaceSlug || !projectId || !cookie) return;try {- const pageDetails = await pageService.fetchDetails(workspaceSlug, projectId, pageId, cookie);- const contentBinary = getBinaryDataFromDocumentEditorHTMLString(pageDetails.description_html ?? "<p></p>");+ const pageDetails = await pageService.fetchDetails(+ workspaceSlug,+ projectId,+ pageId,+ cookie,+ );+ const { contentBinary } = getBinaryDataFromHTMLString(+ pageDetails.description_html ?? "<p></p>",+ );return contentBinary;} catch (error) {- manualLogger.error("Error while transforming from HTML to Uint8Array", error);+ manualLogger.error(+ "Error while transforming from HTML to Uint8Array",+ error,+ );throw error;}};@@ -59,18 +77,28 @@ const fetchDescriptionHTMLAndTransform = async (export const fetchPageDescriptionBinary = async (params: URLSearchParams,pageId: string,- cookie: string | undefined+ cookie: string | undefined,) => {const workspaceSlug = params.get("workspaceSlug")?.toString();const projectId = params.get("projectId")?.toString();if (!workspaceSlug || !projectId || !cookie) return null;try {- const response = await pageService.fetchDescriptionBinary(workspaceSlug, projectId, pageId, cookie);+ const response = await pageService.fetchDescriptionBinary(+ workspaceSlug,+ projectId,+ pageId,+ cookie,+ );const binaryData = new Uint8Array(response);if (binaryData.byteLength === 0) {- const binary = await fetchDescriptionHTMLAndTransform(workspaceSlug, projectId, pageId, cookie);+ const binary = await fetchDescriptionHTMLAndTransform(+ workspaceSlug,+ projectId,+ pageId,+ cookie,+ );if (binary) {return binary;}diff --git a/live/src/core/resolve-conflicts.ts b/live/src/core/resolve-conflicts.tsdeleted file mode 100644index ffaab707c1..0000000000--- a/live/src/core/resolve-conflicts.ts+++ /dev/null@@ -1,49 +0,0 @@-// plane editor-import {- applyUpdates,- convertBase64StringToBinaryData,- getAllDocumentFormatsFromRichTextEditorBinaryData,-} from "@plane/editor/lib";--export type TResolveConflictsRequestBody = {- original_document: string;- updates: string;-};--export type TResolveConflictsResponse = {- description_binary: string;- description_html: string;- description: object;-};--export const resolveDocumentConflicts = (body: TResolveConflictsRequestBody): TResolveConflictsResponse => {- const { original_document, updates } = body;- try {- // convert from base64 to buffer- const originalDocumentBuffer = original_document ? convertBase64StringToBinaryData(original_document) : null;- const updatesBuffer = updates ? convertBase64StringToBinaryData(updates) : null;- // decode req.body- const decodedOriginalDocument = originalDocumentBuffer ? new Uint8Array(originalDocumentBuffer) : new Uint8Array();- const decodedUpdates = updatesBuffer ? new Uint8Array(updatesBuffer) : new Uint8Array();- // resolve conflicts- let resolvedDocument: Uint8Array;- if (decodedOriginalDocument.length === 0) {- // use updates to create the document id original_description is null- resolvedDocument = applyUpdates(decodedUpdates);- } else {- // use original document and updates to resolve conflicts- resolvedDocument = applyUpdates(decodedOriginalDocument, decodedUpdates);- }-- const { contentBinaryEncoded, contentHTML, contentJSON } =- getAllDocumentFormatsFromRichTextEditorBinaryData(resolvedDocument);-- return {- description_binary: contentBinaryEncoded,- description_html: contentHTML,- description: contentJSON,- };- } catch (error) {- throw new Error("Internal server error");- }-};diff --git a/live/src/server.ts b/live/src/server.tsindex ff9977e0a3..1868b86c19 100644--- a/live/src/server.ts+++ b/live/src/server.ts@@ -5,13 +5,16 @@ import expressWs from "express-ws";import * as Sentry from "@sentry/node";import compression from "compression";import helmet from "helmet";++// corsimport cors from "cors";+// core hocuspocus serverimport { getHocusPocusServer } from "@/core/hocuspocus-server.js";+// helpers-import { errorHandler } from "@/core/helpers/error-handler.js";import { logger, manualLogger } from "@/core/helpers/logger.js";-import { resolveDocumentConflicts, TResolveConflictsRequestBody } from "@/core/resolve-conflicts.js";+import { errorHandler } from "@/core/helpers/error-handler.js";const app = express();expressWs(app);@@ -26,7 +29,7 @@ app.use(compression({level: 6,threshold: 5 * 1000,- })+ }),);// Logging middleware@@ -59,25 +62,6 @@ router.ws("/collaboration", (ws, req) => {}});-app.post("/resolve-document-conflicts", (req, res) => {- const { original_document, updates } = req.body as TResolveConflictsRequestBody;- try {- if (original_document === undefined || updates === undefined) {- res.status(400).send({- message: "Missing required fields",- });- return;- }- const resolvedDocument = resolveDocumentConflicts(req.body);- res.status(200).json(resolvedDocument);- } catch (error) {- manualLogger.error("Error in /resolve-document-conflicts endpoint:", error);- res.status(500).send({- message: "Internal server error",- });- }-});-app.use(process.env.LIVE_BASE_PATH || "/live", router);app.use((_req, res) => {@@ -98,7 +82,9 @@ const gracefulShutdown = async () => {try {// Close the HocusPocus server WebSocket connectionsawait HocusPocusServer.destroy();- manualLogger.info("HocusPocus server WebSocket connections closed gracefully.");+ manualLogger.info(+ "HocusPocus server WebSocket connections closed gracefully.",+ );// Close the Express serverliveServer.close(() => {diff --git a/packages/editor/src/core/components/editors/document/collaborative-editor.tsx b/packages/editor/src/core/components/editors/document/collaborative-editor.tsxindex 6a9b9db532..cd7d6f3548 100644--- a/packages/editor/src/core/components/editors/document/collaborative-editor.tsx+++ b/packages/editor/src/core/components/editors/document/collaborative-editor.tsx@@ -8,7 +8,7 @@ import { IssueWidget } from "@/extensions";// helpersimport { getEditorClassNames } from "@/helpers/common";// hooks-import { useCollaborativeDocumentEditor } from "@/hooks/use-collaborative-document-editor";+import { useCollaborativeEditor } from "@/hooks/use-collaborative-editor";// typesimport { EditorRefApi, ICollaborativeDocumentEditor } from "@/types";@@ -43,7 +43,7 @@ const CollaborativeDocumentEditor = (props: ICollaborativeDocumentEditor) => {}// use document editor- const { editor, hasServerConnectionFailed, hasServerSynced } = useCollaborativeDocumentEditor({+ const { editor, hasServerConnectionFailed, hasServerSynced } = useCollaborativeEditor({onTransaction,disabledExtensions,editorClassName,diff --git a/packages/editor/src/core/components/editors/document/collaborative-read-only-editor.tsx b/packages/editor/src/core/components/editors/document/collaborative-read-only-editor.tsxindex 90de2e84c6..aa925abece 100644--- a/packages/editor/src/core/components/editors/document/collaborative-read-only-editor.tsx+++ b/packages/editor/src/core/components/editors/document/collaborative-read-only-editor.tsx@@ -8,7 +8,7 @@ import { IssueWidget } from "@/extensions";// helpersimport { getEditorClassNames } from "@/helpers/common";// hooks-import { useCollaborativeDocumentReadOnlyEditor } from "@/hooks/use-collaborative-document-read-only-editor";+import { useReadOnlyCollaborativeEditor } from "@/hooks/use-read-only-collaborative-editor";// typesimport { EditorReadOnlyRefApi, ICollaborativeDocumentReadOnlyEditor } from "@/types";@@ -36,7 +36,7 @@ const CollaborativeDocumentReadOnlyEditor = (props: ICollaborativeDocumentReadOn);}- const { editor, hasServerConnectionFailed, hasServerSynced } = useCollaborativeDocumentReadOnlyEditor({+ const { editor, hasServerConnectionFailed, hasServerSynced } = useReadOnlyCollaborativeEditor({editorClassName,extensions,fileHandler,diff --git a/packages/editor/src/core/components/editors/editor-wrapper.tsx b/packages/editor/src/core/components/editors/editor-wrapper.tsxindex a7332f370f..33f011535c 100644--- a/packages/editor/src/core/components/editors/editor-wrapper.tsx+++ b/packages/editor/src/core/components/editors/editor-wrapper.tsx@@ -1,4 +1,4 @@-import { AnyExtension, Editor } from "@tiptap/core";+import { Editor, Extension } from "@tiptap/core";// componentsimport { EditorContainer } from "@/components/editors";// constants@@ -12,7 +12,7 @@ import { EditorContentWrapper } from "./editor-content";type Props = IEditorProps & {children?: (editor: Editor) => React.ReactNode;- extensions: AnyExtension[];+ extensions: Extension<any, any>[];};export const EditorWrapper: React.FC<Props> = (props) => {diff --git a/packages/editor/src/core/components/editors/rich-text/collaborative-editor.tsx b/packages/editor/src/core/components/editors/rich-text/collaborative-editor.tsxdeleted file mode 100644index a96daef332..0000000000--- a/packages/editor/src/core/components/editors/rich-text/collaborative-editor.tsx+++ /dev/null@@ -1,72 +0,0 @@-import React from "react";-// components-import { EditorContainer, EditorContentWrapper } from "@/components/editors";-import { EditorBubbleMenu } from "@/components/menus";-// constants-import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";-// helpers-import { getEditorClassNames } from "@/helpers/common";-// hooks-import { useCollaborativeRichTextEditor } from "@/hooks/use-collaborative-rich-text-editor";-// types-import { EditorRefApi, ICollaborativeRichTextEditor } from "@/types";--const CollaborativeRichTextEditor = (props: ICollaborativeRichTextEditor) => {- const {- containerClassName,- displayConfig = DEFAULT_DISPLAY_CONFIG,- editorClassName,- fileHandler,- forwardedRef,- id,- mentionHandler,- onChange,- placeholder,- tabIndex,- value,- } = props;-- const { editor } = useCollaborativeRichTextEditor({- editorClassName,- fileHandler,- forwardedRef,- id,- mentionHandler,- onChange,- placeholder,- tabIndex,- value,- });-- const editorContainerClassName = getEditorClassNames({- noBorder: true,- borderOnFocus: false,- containerClassName,- });-- if (!editor) return null;-- return (- <EditorContainer- displayConfig={displayConfig}- editor={editor}- editorContainerClassName={editorContainerClassName}- id={id}- >- <EditorBubbleMenu editor={editor} />- <div className="flex flex-col">- <EditorContentWrapper editor={editor} id={id} tabIndex={tabIndex} />- </div>- </EditorContainer>- );-};--const CollaborativeRichTextEditorWithRef = React.forwardRef<EditorRefApi, ICollaborativeRichTextEditor>(- (props, ref) => (- <CollaborativeRichTextEditor {...props} forwardedRef={ref as React.MutableRefObject<EditorRefApi | null>} />- )-);--CollaborativeRichTextEditorWithRef.displayName = "CollaborativeRichTextEditorWithRef";--export { CollaborativeRichTextEditorWithRef };diff --git a/packages/editor/src/core/components/editors/rich-text/collaborative-read-only-editor.tsx b/packages/editor/src/core/components/editors/rich-text/collaborative-read-only-editor.tsxdeleted file mode 100644index 050d97cae6..0000000000--- a/packages/editor/src/core/components/editors/rich-text/collaborative-read-only-editor.tsx+++ /dev/null@@ -1,70 +0,0 @@-import React from "react";-// components-import { EditorContainer, EditorContentWrapper } from "@/components/editors";-import { EditorBubbleMenu } from "@/components/menus";-// constants-import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";-// helpers-import { getEditorClassNames } from "@/helpers/common";-// hooks-import { useCollaborativeRichTextReadOnlyEditor } from "@/hooks/use-collaborative-rich-text-read-only-editor";-// types-import { EditorReadOnlyRefApi, ICollaborativeRichTextReadOnlyEditor } from "@/types";--const CollaborativeRichTextReadOnlyEditor = (props: ICollaborativeRichTextReadOnlyEditor) => {- const {- containerClassName,- displayConfig = DEFAULT_DISPLAY_CONFIG,- editorClassName,- fileHandler,- forwardedRef,- id,- mentionHandler,- value,- } = props;-- const { editor } = useCollaborativeRichTextReadOnlyEditor({- editorClassName,- fileHandler,- forwardedRef,- id,- mentionHandler,- value,- });-- const editorContainerClassName = getEditorClassNames({- noBorder: true,- borderOnFocus: false,- containerClassName,- });-- if (!editor) return null;-- return (- <EditorContainer- displayConfig={displayConfig}- editor={editor}- editorContainerClassName={editorContainerClassName}- id={id}- >- <EditorBubbleMenu editor={editor} />- <div className="flex flex-col">- <EditorContentWrapper editor={editor} id={id} />- </div>- </EditorContainer>- );-};--const CollaborativeRichTextReadOnlyEditorWithRef = React.forwardRef<- EditorReadOnlyRefApi,- ICollaborativeRichTextReadOnlyEditor->((props, ref) => (- <CollaborativeRichTextReadOnlyEditor- {...props}- forwardedRef={ref as React.MutableRefObject<EditorReadOnlyRefApi | null>}- />-));--CollaborativeRichTextReadOnlyEditorWithRef.displayName = "CollaborativeRichTextReadOnlyEditorWithRef";--export { CollaborativeRichTextReadOnlyEditorWithRef };diff --git a/packages/editor/src/core/components/editors/rich-text/index.ts b/packages/editor/src/core/components/editors/rich-text/index.tsindex 3053a54112..b2ba8682a3 100644--- a/packages/editor/src/core/components/editors/rich-text/index.ts+++ b/packages/editor/src/core/components/editors/rich-text/index.ts@@ -1,4 +1,2 @@-export * from "./collaborative-editor";-export * from "./collaborative-read-only-editor";export * from "./editor";export * from "./read-only-editor";diff --git a/packages/editor/src/core/helpers/yjs-utils.ts b/packages/editor/src/core/helpers/yjs-utils.tsdeleted file mode 100644index dd1b9f2fa2..0000000000--- a/packages/editor/src/core/helpers/yjs-utils.ts+++ /dev/null@@ -1,132 +0,0 @@-import { CoreEditorExtensionsWithoutProps, DocumentEditorExtensionsWithoutProps } from "@/extensions";-import { getSchema } from "@tiptap/core";-import { generateHTML, generateJSON } from "@tiptap/html";-import { prosemirrorJSONToYDoc, yXmlFragmentToProseMirrorRootNode } from "y-prosemirror";-import * as Y from "yjs";--// editor extension configs-const RICH_TEXT_EDITOR_EXTENSIONS = CoreEditorExtensionsWithoutProps;-const DOCUMENT_EDITOR_EXTENSIONS = [...CoreEditorExtensionsWithoutProps, ...DocumentEditorExtensionsWithoutProps];-// editor schemas-const richTextEditorSchema = getSchema(RICH_TEXT_EDITOR_EXTENSIONS);-const documentEditorSchema = getSchema(DOCUMENT_EDITOR_EXTENSIONS);--/**- * @description apply updates to a doc and return the updated doc in binary format- * @param {Uint8Array} document- * @param {Uint8Array} updates- * @returns {Uint8Array}- */-export const applyUpdates = (document: Uint8Array, updates?: Uint8Array): Uint8Array => {- const yDoc = new Y.Doc();- Y.applyUpdate(yDoc, document);- if (updates) {- Y.applyUpdate(yDoc, updates);- }-- const encodedDoc = Y.encodeStateAsUpdate(yDoc);- return encodedDoc;-};--/**- * @description this function encodes binary data to base64 string- * @param {Uint8Array} document- * @returns {string}- */-export const convertBinaryDataToBase64String = (document: Uint8Array): string =>- Buffer.from(document).toString("base64");--/**- * @description this function decodes base64 string to binary data- * @param {string} document- * @returns {ArrayBuffer}- */-export const convertBase64StringToBinaryData = (document: string): ArrayBuffer => Buffer.from(document, "base64");--/**- * @description this function generates the binary equivalent of html content for the rich text editor- * @param {string} descriptionHTML- * @returns {Uint8Array}- */-export const getBinaryDataFromRichTextEditorHTMLString = (descriptionHTML: string): Uint8Array => {- // convert HTML to JSON- const contentJSON = generateJSON(descriptionHTML ?? "<p></p>", RICH_TEXT_EDITOR_EXTENSIONS);- // convert JSON to Y.Doc format- const transformedData = prosemirrorJSONToYDoc(richTextEditorSchema, contentJSON, "default");- // convert Y.Doc to Uint8Array format- const encodedData = Y.encodeStateAsUpdate(transformedData);- return encodedData;-};--/**- * @description this function generates the binary equivalent of html content for the document editor- * @param {string} descriptionHTML- * @returns {Uint8Array}- */-export const getBinaryDataFromDocumentEditorHTMLString = (descriptionHTML: string): Uint8Array => {- // convert HTML to JSON- const contentJSON = generateJSON(descriptionHTML ?? "<p></p>", DOCUMENT_EDITOR_EXTENSIONS);- // convert JSON to Y.Doc format- const transformedData = prosemirrorJSONToYDoc(documentEditorSchema, contentJSON, "default");- // convert Y.Doc to Uint8Array format- const encodedData = Y.encodeStateAsUpdate(transformedData);- return encodedData;-};--/**- * @description this function generates all document formats for the provided binary data for the rich text editor- * @param {Uint8Array} description- * @returns- */-export const getAllDocumentFormatsFromRichTextEditorBinaryData = (- description: Uint8Array-): {- contentBinaryEncoded: string;- contentJSON: object;- contentHTML: string;-} => {- // encode binary description data- const base64Data = convertBinaryDataToBase64String(description);- const yDoc = new Y.Doc();- Y.applyUpdate(yDoc, description);- // convert to JSON- const type = yDoc.getXmlFragment("default");- const contentJSON = yXmlFragmentToProseMirrorRootNode(type, richTextEditorSchema).toJSON();- // convert to HTML- const contentHTML = generateHTML(contentJSON, RICH_TEXT_EDITOR_EXTENSIONS);-- return {- contentBinaryEncoded: base64Data,- contentJSON,- contentHTML,- };-};--/**- * @description this function generates all document formats for the provided binary data for the document editor- * @param {Uint8Array} description- * @returns- */-export const getAllDocumentFormatsFromDocumentEditorBinaryData = (- description: Uint8Array-): {- contentBinaryEncoded: string;- contentJSON: object;- contentHTML: string;-} => {- // encode binary description data- const base64Data = convertBinaryDataToBase64String(description);- const yDoc = new Y.Doc();- Y.applyUpdate(yDoc, description);- // convert to JSON- const type = yDoc.getXmlFragment("default");- const contentJSON = yXmlFragmentToProseMirrorRootNode(type, documentEditorSchema).toJSON();- // convert to HTML- const contentHTML = generateHTML(contentJSON, DOCUMENT_EDITOR_EXTENSIONS);-- return {- contentBinaryEncoded: base64Data,- contentJSON,- contentHTML,- };-};diff --git a/packages/editor/src/core/helpers/yjs.ts b/packages/editor/src/core/helpers/yjs.tsnew file mode 100644index 0000000000..ffd9367107--- /dev/null+++ b/packages/editor/src/core/helpers/yjs.ts@@ -0,0 +1,16 @@+import * as Y from "yjs";++/**+ * @description apply updates to a doc and return the updated doc in base64(binary) format+ * @param {Uint8Array} document+ * @param {Uint8Array} updates+ * @returns {string} base64(binary) form of the updated doc+ */+export const applyUpdates = (document: Uint8Array, updates: Uint8Array): Uint8Array => {+ const yDoc = new Y.Doc();+ Y.applyUpdate(yDoc, document);+ Y.applyUpdate(yDoc, updates);++ const encodedDoc = Y.encodeStateAsUpdate(yDoc);+ return encodedDoc;+};diff --git a/packages/editor/src/core/hooks/use-collaborative-document-editor.ts b/packages/editor/src/core/hooks/use-collaborative-editor.tssimilarity index 93%rename from packages/editor/src/core/hooks/use-collaborative-document-editor.tsrename to packages/editor/src/core/hooks/use-collaborative-editor.tsindex d286db9625..5bee8c0c3f 100644--- a/packages/editor/src/core/hooks/use-collaborative-document-editor.ts+++ b/packages/editor/src/core/hooks/use-collaborative-editor.ts@@ -9,9 +9,9 @@ import { useEditor } from "@/hooks/use-editor";// plane editor extensionsimport { DocumentEditorAdditionalExtensions } from "@/plane-editor/extensions";// types-import { TCollaborativeDocumentEditorHookProps } from "@/types";+import { TCollaborativeEditorProps } from "@/types";-export const useCollaborativeDocumentEditor = (props: TCollaborativeDocumentEditorHookProps) => {+export const useCollaborativeEditor = (props: TCollaborativeEditorProps) => {const {onTransaction,disabledExtensions,@@ -102,7 +102,7 @@ export const useCollaborativeDocumentEditor = (props: TCollaborativeDocumentEditforwardedRef,mentionHandler,placeholder,- providerDocument: provider.document,+ provider,tabIndex,});diff --git a/packages/editor/src/core/hooks/use-collaborative-rich-text-editor.ts b/packages/editor/src/core/hooks/use-collaborative-rich-text-editor.tsdeleted file mode 100644index e9a5106d44..0000000000--- a/packages/editor/src/core/hooks/use-collaborative-rich-text-editor.ts+++ /dev/null@@ -1,78 +0,0 @@-import { useEffect, useMemo } from "react";-import Collaboration from "@tiptap/extension-collaboration";-import * as Y from "yjs";-// extensions-import { HeadingListExtension, SideMenuExtension } from "@/extensions";-// hooks-import { useEditor } from "@/hooks/use-editor";-// providers-import { CustomCollaborationProvider } from "@/providers";-// types-import { TCollaborativeRichTextEditorHookProps } from "@/types";--export const useCollaborativeRichTextEditor = (props: TCollaborativeRichTextEditorHookProps) => {- const {- editorClassName,- editorProps = {},- extensions,- fileHandler,- forwardedRef,- handleEditorReady,- id,- mentionHandler,- onChange,- placeholder,- tabIndex,- value,- } = props;- // initialize custom collaboration provider- const provider = useMemo(- () =>- new CustomCollaborationProvider({- name: id,- onChange,- }),- [id]- );-- useEffect(() => {- if (provider.hasSynced) return;- if (value && value.length > 0) {- try {- Y.applyUpdate(provider.document, value);- provider.hasSynced = true;- } catch (error) {- console.error("Error applying binary updates to the description", error);- }- }- }, [value, provider.document]);-- const editor = useEditor({- id,- editorProps,- editorClassName,- enableHistory: false,- extensions: [- SideMenuExtension({- aiEnabled: false,- dragDropEnabled: true,- }),- HeadingListExtension,- Collaboration.configure({- document: provider.document,- }),- ...(extensions ?? []),- ],- fileHandler,- handleEditorReady,- forwardedRef,- mentionHandler,- placeholder,- providerDocument: provider.document,- tabIndex,- });-- return {- editor,- };-};diff --git a/packages/editor/src/core/hooks/use-collaborative-rich-text-read-only-editor.ts b/packages/editor/src/core/hooks/use-collaborative-rich-text-read-only-editor.tsdeleted file mode 100644index be5b915fdb..0000000000--- a/packages/editor/src/core/hooks/use-collaborative-rich-text-read-only-editor.ts+++ /dev/null@@ -1,64 +0,0 @@-import { useEffect, useMemo } from "react";-import Collaboration from "@tiptap/extension-collaboration";-import * as Y from "yjs";-// extensions-import { HeadingListExtension, SideMenuExtension } from "@/extensions";-// hooks-import { useReadOnlyEditor } from "@/hooks/use-read-only-editor";-// providers-import { CustomCollaborationProvider } from "@/providers";-// types-import { TCollaborativeRichTextReadOnlyEditorHookProps } from "@/types";--export const useCollaborativeRichTextReadOnlyEditor = (props: TCollaborativeRichTextReadOnlyEditorHookProps) => {- const {- editorClassName,- editorProps = {},- extensions,- fileHandler,- forwardedRef,- handleEditorReady,- id,- mentionHandler,- value,- } = props;- // initialize custom collaboration provider- const provider = useMemo(- () =>- new CustomCollaborationProvider({- name: id,- }),- [id]- );-- useEffect(() => {- if (value.length > 0) {- Y.applyUpdate(provider.document, value);- }- }, [value, provider.document]);-- const editor = useReadOnlyEditor({- editorProps,- editorClassName,- extensions: [- SideMenuExtension({- aiEnabled: false,- dragDropEnabled: true,- }),- HeadingListExtension,- Collaboration.configure({- document: provider.document,- }),- ...(extensions ?? []),- ],- fileHandler,- handleEditorReady,- forwardedRef,- mentionHandler,- providerDocument: provider.document,- });-- return {- editor,- };-};diff --git a/packages/editor/src/core/hooks/use-editor.ts b/packages/editor/src/core/hooks/use-editor.tsindex 579dd816f4..eef72797ce 100644--- a/packages/editor/src/core/hooks/use-editor.ts+++ b/packages/editor/src/core/hooks/use-editor.ts@@ -1,4 +1,5 @@import { useImperativeHandle, useRef, MutableRefObject, useState, useEffect } from "react";+import { HocuspocusProvider } from "@hocuspocus/provider";import { DOMSerializer } from "@tiptap/pm/model";import { Selection } from "@tiptap/pm/state";import { EditorProps } from "@tiptap/pm/view";@@ -35,7 +36,7 @@ export interface CustomEditorProps {onTransaction?: () => void;autofocus?: boolean;placeholder?: string | ((isFocused: boolean, value: string) => string);- providerDocument?: Y.Doc;+ provider?: HocuspocusProvider;tabIndex?: number;// undefined when prop is not passed, null if intentionally passed to stop// swr syncing@@ -57,7 +58,7 @@ export const useEditor = (props: CustomEditorProps) => {onChange,onTransaction,placeholder,- providerDocument,+ provider,tabIndex,value,autofocus = false,@@ -205,7 +206,7 @@ export const useEditor = (props: CustomEditorProps) => {return markdownOutput;},getDocument: () => {- const documentBinary = providerDocument ? Y.encodeStateAsUpdate(providerDocument) : null;+ const documentBinary = provider?.document ? Y.encodeStateAsUpdate(provider?.document) : null;const documentHTML = editorRef.current?.getHTML() ?? "<p></p>";const documentJSON = editorRef.current?.getJSON() ?? null;@@ -283,7 +284,7 @@ export const useEditor = (props: CustomEditorProps) => {words: editorRef?.current?.storage?.characterCount?.words?.() ?? 0,}),setProviderDocument: (value) => {- const document = providerDocument;+ const document = provider?.document;if (!document) return;Y.applyUpdate(document, value);},diff --git a/packages/editor/src/core/hooks/use-collaborative-document-read-only-editor.ts b/packages/editor/src/core/hooks/use-read-only-collaborative-editor.tssimilarity index 90%rename from packages/editor/src/core/hooks/use-collaborative-document-read-only-editor.tsrename to packages/editor/src/core/hooks/use-read-only-collaborative-editor.tsindex 274a40763d..d408192297 100644--- a/packages/editor/src/core/hooks/use-collaborative-document-read-only-editor.ts+++ b/packages/editor/src/core/hooks/use-read-only-collaborative-editor.ts@@ -7,9 +7,9 @@ import { HeadingListExtension } from "@/extensions";// hooksimport { useReadOnlyEditor } from "@/hooks/use-read-only-editor";// types-import { TCollaborativeDocumentReadOnlyEditorHookProps } from "@/types";+import { TReadOnlyCollaborativeEditorProps } from "@/types";-export const useCollaborativeDocumentReadOnlyEditor = (props: TCollaborativeDocumentReadOnlyEditorHookProps) => {+export const useReadOnlyCollaborativeEditor = (props: TReadOnlyCollaborativeEditorProps) => {const {editorClassName,editorProps = {},@@ -79,7 +79,7 @@ export const useCollaborativeDocumentReadOnlyEditor = (props: TCollaborativeDocuforwardedRef,handleEditorReady,mentionHandler,- providerDocument: provider.document,+ provider,});return {diff --git a/packages/editor/src/core/hooks/use-read-only-editor.ts b/packages/editor/src/core/hooks/use-read-only-editor.tsindex cde6a8937a..23ce023adc 100644--- a/packages/editor/src/core/hooks/use-read-only-editor.ts+++ b/packages/editor/src/core/hooks/use-read-only-editor.ts@@ -1,4 +1,5 @@import { useImperativeHandle, useRef, MutableRefObject, useEffect } from "react";+import { HocuspocusProvider } from "@hocuspocus/provider";import { EditorProps } from "@tiptap/pm/view";import { useEditor as useCustomEditor, Editor } from "@tiptap/react";import * as Y from "yjs";@@ -23,7 +24,7 @@ interface CustomReadOnlyEditorProps {mentionHandler: {highlights: () => Promise<IMentionHighlight[]>;};- providerDocument?: Y.Doc;+ provider?: HocuspocusProvider;}export const useReadOnlyEditor = (props: CustomReadOnlyEditorProps) => {@@ -36,7 +37,7 @@ export const useReadOnlyEditor = (props: CustomReadOnlyEditorProps) => {fileHandler,handleEditorReady,mentionHandler,- providerDocument,+ provider,} = props;const editor = useCustomEditor({@@ -85,7 +86,7 @@ export const useReadOnlyEditor = (props: CustomReadOnlyEditorProps) => {return markdownOutput;},getDocument: () => {- const documentBinary = providerDocument ? Y.encodeStateAsUpdate(providerDocument) : null;+ const documentBinary = provider?.document ? Y.encodeStateAsUpdate(provider?.document) : null;const documentHTML = editorRef.current?.getHTML() ?? "<p></p>";const documentJSON = editorRef.current?.getJSON() ?? null;diff --git a/packages/editor/src/core/providers/custom-collaboration-provider.ts b/packages/editor/src/core/providers/custom-collaboration-provider.tsdeleted file mode 100644index 036b15fa15..0000000000--- a/packages/editor/src/core/providers/custom-collaboration-provider.ts+++ /dev/null@@ -1,61 +0,0 @@-import * as Y from "yjs";--export interface CompleteCollaborationProviderConfiguration {- /**- * The identifier/name of your document- */- name: string;- /**- * The actual Y.js document- */- document: Y.Doc;- /**- * onChange callback- */- onChange: (updates: Uint8Array) => void;-}--export type CollaborationProviderConfiguration = Required<Pick<CompleteCollaborationProviderConfiguration, "name">> &- Partial<CompleteCollaborationProviderConfiguration>;--export class CustomCollaborationProvider {- public hasSynced: boolean;-- public configuration: CompleteCollaborationProviderConfiguration = {- name: "",- document: new Y.Doc(),- onChange: () => {},- };-- constructor(configuration: CollaborationProviderConfiguration) {- this.hasSynced = false;- this.setConfiguration(configuration);- this.document.on("update", this.documentUpdateHandler.bind(this));- this.document.on("destroy", this.documentDestroyHandler.bind(this));- }-- public setConfiguration(configuration: Partial<CompleteCollaborationProviderConfiguration> = {}): void {- this.configuration = {- ...this.configuration,- ...configuration,- };- }-- get document() {- return this.configuration.document;- }-- async documentUpdateHandler(_update: Uint8Array, origin: any) {- if (!this.hasSynced) return;- // return if the update is from the provider itself- if (origin === this) return;- // call onChange with the update- const stateVector = Y.encodeStateAsUpdate(this.document);- this.configuration.onChange?.(stateVector);- }-- documentDestroyHandler() {- this.document.off("update", this.documentUpdateHandler);- this.document.off("destroy", this.documentDestroyHandler);- }-}diff --git a/packages/editor/src/core/providers/index.ts b/packages/editor/src/core/providers/index.tsdeleted file mode 100644index 36e7996394..0000000000--- a/packages/editor/src/core/providers/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./custom-collaboration-provider";diff --git a/packages/editor/src/core/types/collaboration-hook.ts b/packages/editor/src/core/types/collaboration.tssimilarity index 60%rename from packages/editor/src/core/types/collaboration-hook.tsrename to packages/editor/src/core/types/collaboration.tsindex 5796df2190..8609995ed8 100644--- a/packages/editor/src/core/types/collaboration-hook.ts+++ b/packages/editor/src/core/types/collaboration.ts@@ -19,7 +19,7 @@ export type TServerHandler = {onServerError?: () => void;};-type TCollaborativeEditorHookCommonProps = {+type TCollaborativeEditorHookProps = {disabledExtensions?: TExtensions[];editorClassName: string;editorProps?: EditorProps;@@ -30,9 +30,12 @@ type TCollaborativeEditorHookCommonProps = {highlights: () => Promise<IMentionHighlight[]>;suggestions?: () => Promise<IMentionSuggestion[]>;};+ realtimeConfig: TRealtimeConfig;+ serverHandler?: TServerHandler;+ user: TUserDetails;};-type TCollaborativeEditorHookProps = TCollaborativeEditorHookCommonProps & {+export type TCollaborativeEditorProps = TCollaborativeEditorHookProps & {onTransaction?: () => void;embedHandler?: TEmbedConfig;fileHandler: TFileHandler;@@ -41,29 +44,7 @@ type TCollaborativeEditorHookProps = TCollaborativeEditorHookCommonProps & {tabIndex?: number;};-type TCollaborativeReadOnlyEditorHookProps = TCollaborativeEditorHookCommonProps & {+export type TReadOnlyCollaborativeEditorProps = TCollaborativeEditorHookProps & {fileHandler: Pick<TFileHandler, "getAssetSrc">;forwardedRef?: React.MutableRefObject<EditorReadOnlyRefApi | null>;};--export type TCollaborativeRichTextEditorHookProps = TCollaborativeEditorHookProps & {- onChange: (updatedDescription: Uint8Array) => void;- value: Uint8Array;-};--export type TCollaborativeRichTextReadOnlyEditorHookProps = TCollaborativeReadOnlyEditorHookProps & {- value: Uint8Array;-};--export type TCollaborativeDocumentEditorHookProps = TCollaborativeEditorHookProps & {- embedHandler?: TEmbedConfig;- realtimeConfig: TRealtimeConfig;- serverHandler?: TServerHandler;- user: TUserDetails;-};--export type TCollaborativeDocumentReadOnlyEditorHookProps = TCollaborativeReadOnlyEditorHookProps & {- realtimeConfig: TRealtimeConfig;- serverHandler?: TServerHandler;- user: TUserDetails;-};diff --git a/packages/editor/src/core/types/editor.ts b/packages/editor/src/core/types/editor.tsindex 4b2bf3e38b..53aae1f265 100644--- a/packages/editor/src/core/types/editor.ts+++ b/packages/editor/src/core/types/editor.ts@@ -132,12 +132,6 @@ export interface IRichTextEditor extends IEditorProps {dragDropEnabled?: boolean;}-export interface ICollaborativeRichTextEditor extends Omit<IEditorProps, "initialValue" | "onChange" | "value"> {- dragDropEnabled?: boolean;- onChange: (updatedDescription: Uint8Array) => void;- value: Uint8Array;-}-export interface ICollaborativeDocumentEditorextends Omit<IEditorProps, "initialValue" | "onChange" | "onEnterKeyPress" | "value"> {aiHandler?: TAIHandler;@@ -167,10 +161,6 @@ export type ILiteTextReadOnlyEditor = IReadOnlyEditorProps;export type IRichTextReadOnlyEditor = IReadOnlyEditorProps;-export type ICollaborativeRichTextReadOnlyEditor = Omit<IReadOnlyEditorProps, "initialValue"> & {- value: Uint8Array;-};-export interface ICollaborativeDocumentReadOnlyEditor extends Omit<IReadOnlyEditorProps, "initialValue"> {embedHandler: TEmbedConfig;handleEditorReady?: (value: boolean) => void;diff --git a/packages/editor/src/core/types/index.ts b/packages/editor/src/core/types/index.tsindex b4c4ad3625..8da9ed276e 100644--- a/packages/editor/src/core/types/index.ts+++ b/packages/editor/src/core/types/index.ts@@ -1,5 +1,5 @@export * from "./ai";-export * from "./collaboration-hook";+export * from "./collaboration";export * from "./config";export * from "./editor";export * from "./embed";diff --git a/packages/editor/src/index.ts b/packages/editor/src/index.tsindex eb59deade4..ed7d913469 100644--- a/packages/editor/src/index.ts+++ b/packages/editor/src/index.ts@@ -10,8 +10,6 @@ import "./styles/drag-drop.css";export {CollaborativeDocumentEditorWithRef,CollaborativeDocumentReadOnlyEditorWithRef,- CollaborativeRichTextEditorWithRef,- CollaborativeRichTextReadOnlyEditorWithRef,DocumentReadOnlyEditorWithRef,LiteTextEditorWithRef,LiteTextReadOnlyEditorWithRef,@@ -27,7 +25,7 @@ export * from "@/constants/common";// helpersexport * from "@/helpers/common";export * from "@/helpers/editor-commands";-export * from "@/helpers/yjs-utils";+export * from "@/helpers/yjs";export * from "@/extensions/table/table";// componentsdiff --git a/packages/editor/src/lib.ts b/packages/editor/src/lib.tsindex 2f684724bc..e14c40127f 100644--- a/packages/editor/src/lib.ts+++ b/packages/editor/src/lib.ts@@ -1 +1 @@-export * from "@/helpers/yjs-utils";+export * from "@/extensions/core-without-props";diff --git a/packages/types/src/issues/issue.d.ts b/packages/types/src/issues/issue.d.tsindex 1d9580fd1b..ae4a98d63f 100644--- a/packages/types/src/issues/issue.d.ts+++ b/packages/types/src/issues/issue.d.ts@@ -50,7 +50,6 @@ export type IssueRelation = {};export type TIssue = TBaseIssue & {- description_binary?: string;description_html?: string;is_subscribed?: boolean;parent?: Partial<TBaseIssue>;diff --git a/web/core/components/core/modals/gpt-assistant-popover.tsx b/web/core/components/core/modals/gpt-assistant-popover.tsxindex 99ae0e5863..0056977ed6 100644--- a/web/core/components/core/modals/gpt-assistant-popover.tsx+++ b/web/core/components/core/modals/gpt-assistant-popover.tsx@@ -9,7 +9,7 @@ import { Popover, Transition } from "@headlessui/react";// uiimport { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";// components-import { RichTextReadOnlyEditor } from "@/components/editor";+import { RichTextReadOnlyEditor } from "@/components/editor/rich-text-editor/rich-text-read-only-editor";// servicesimport { AIService } from "@/services/ai.service";diff --git a/web/core/components/editor/rich-text-editor/collaborative-editor.tsx b/web/core/components/editor/rich-text-editor/collaborative-editor.tsxdeleted file mode 100644index 103d0d77fc..0000000000--- a/web/core/components/editor/rich-text-editor/collaborative-editor.tsx+++ /dev/null@@ -1,63 +0,0 @@-import React, { forwardRef } from "react";-// editor-import { CollaborativeRichTextEditorWithRef, EditorRefApi, ICollaborativeRichTextEditor } from "@plane/editor";-// types-import { IUserLite } from "@plane/types";-// helpers-import { cn } from "@/helpers/common.helper";-import { getEditorFileHandlers } from "@/helpers/editor.helper";-// hooks-import { useMember, useMention, useUser } from "@/hooks/store";-// plane web hooks-import { useFileSize } from "@/plane-web/hooks/use-file-size";--interface Props extends Omit<ICollaborativeRichTextEditor, "fileHandler" | "mentionHandler"> {- key: string;- projectId: string;- uploadFile: (file: File) => Promise<string>;- workspaceId: string;- workspaceSlug: string;-}--export const CollaborativeRichTextEditor = forwardRef<EditorRefApi, Props>((props, ref) => {- const { containerClassName, workspaceSlug, workspaceId, projectId, uploadFile, ...rest } = props;- // store hooks- const { data: currentUser } = useUser();- const {- getUserDetails,- project: { getProjectMemberIds },- } = useMember();- // derived values- const projectMemberIds = getProjectMemberIds(projectId);- const projectMemberDetails = projectMemberIds?.map((id) => getUserDetails(id) as IUserLite);- // use-mention- const { mentionHighlights, mentionSuggestions } = useMention({- workspaceSlug,- projectId,- members: projectMemberDetails,- user: currentUser,- });- // file size- const { maxFileSize } = useFileSize();-- return (- <CollaborativeRichTextEditorWithRef- ref={ref}- fileHandler={getEditorFileHandlers({- maxFileSize,- projectId,- uploadFile,- workspaceId,- workspaceSlug,- })}- mentionHandler={{- highlights: mentionHighlights,- suggestions: mentionSuggestions,- }}- {...rest}- containerClassName={cn("relative pl-3", containerClassName)}- />- );-});--CollaborativeRichTextEditor.displayName = "CollaborativeRichTextEditor";diff --git a/web/core/components/editor/rich-text-editor/collaborative-read-only-editor.tsx b/web/core/components/editor/rich-text-editor/collaborative-read-only-editor.tsxdeleted file mode 100644index 2e80f86c75..0000000000--- a/web/core/components/editor/rich-text-editor/collaborative-read-only-editor.tsx+++ /dev/null@@ -1,63 +0,0 @@-import React from "react";-// editor-import {- CollaborativeRichTextReadOnlyEditorWithRef,- EditorReadOnlyRefApi,- ICollaborativeRichTextReadOnlyEditor,-} from "@plane/editor";-// plane ui-import { Loader } from "@plane/ui";-// helpers-import { cn } from "@/helpers/common.helper";-import { getReadOnlyEditorFileHandlers } from "@/helpers/editor.helper";-// hooks-import { useMention } from "@/hooks/store";-import { useIssueDescription } from "@/hooks/use-issue-description";--type RichTextReadOnlyEditorWrapperProps = Omit<- ICollaborativeRichTextReadOnlyEditor,- "fileHandler" | "mentionHandler" | "value"-> & {- descriptionBinary: string | null;- descriptionHTML: string;- projectId?: string;- workspaceSlug: string;-};--export const CollaborativeRichTextReadOnlyEditor = React.forwardRef<- EditorReadOnlyRefApi,- RichTextReadOnlyEditorWrapperProps->(({ descriptionBinary: savedDescriptionBinary, descriptionHTML, projectId, workspaceSlug, ...props }, ref) => {- const { mentionHighlights } = useMention({});-- const { descriptionBinary } = useIssueDescription({- descriptionBinary: savedDescriptionBinary,- descriptionHTML,- });-- if (!descriptionBinary)- return (- <Loader>- <Loader.Item height="150px" />- </Loader>- );-- return (- <CollaborativeRichTextReadOnlyEditorWithRef- ref={ref}- value={descriptionBinary}- fileHandler={getReadOnlyEditorFileHandlers({- projectId,- workspaceSlug,- })}- mentionHandler={{- highlights: mentionHighlights,- }}- {...props}- // overriding the containerClassName to add relative class passed- containerClassName={cn(props.containerClassName, "relative pl-3")}- />- );-});--CollaborativeRichTextReadOnlyEditor.displayName = "CollaborativeRichTextReadOnlyEditor";diff --git a/web/core/components/editor/rich-text-editor/index.ts b/web/core/components/editor/rich-text-editor/index.tsindex 3053a54112..f185d0054e 100644--- a/web/core/components/editor/rich-text-editor/index.ts+++ b/web/core/components/editor/rich-text-editor/index.ts@@ -1,4 +1,2 @@-export * from "./collaborative-editor";-export * from "./collaborative-read-only-editor";-export * from "./editor";-export * from "./read-only-editor";+export * from "./rich-text-editor";+export * from "./rich-text-read-only-editor";diff --git a/web/core/components/editor/rich-text-editor/editor.tsx b/web/core/components/editor/rich-text-editor/rich-text-editor.tsxsimilarity index 100%rename from web/core/components/editor/rich-text-editor/editor.tsxrename to web/core/components/editor/rich-text-editor/rich-text-editor.tsxdiff --git a/web/core/components/editor/rich-text-editor/read-only-editor.tsx b/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsxsimilarity index 100%rename from web/core/components/editor/rich-text-editor/read-only-editor.tsxrename to web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsxdiff --git a/web/core/components/inbox/content/issue-root.tsx b/web/core/components/inbox/content/issue-root.tsxindex f547a552b8..2673245b0f 100644--- a/web/core/components/inbox/content/issue-root.tsx+++ b/web/core/components/inbox/content/issue-root.tsx@@ -3,8 +3,10 @@import { Dispatch, SetStateAction, useEffect, useMemo } from "react";import { observer } from "mobx-react";import { usePathname } from "next/navigation";+// plane types+import { TIssue } from "@plane/types";// plane ui-import { TOAST_TYPE, setToast } from "@plane/ui";+import { Loader, TOAST_TYPE, setToast } from "@plane/ui";// componentsimport { InboxIssueContentProperties } from "@/components/inbox/content";import {@@ -20,12 +22,11 @@ import { ISSUE_ARCHIVED, ISSUE_DELETED } from "@/constants/event-tracker";// helpersimport { getTextContent } from "@/helpers/editor.helper";// hooks-import { useEventTracker, useIssueDetail, useProject, useUser } from "@/hooks/store";+import { useEventTracker, useIssueDetail, useProject, useProjectInbox, useUser } from "@/hooks/store";import useReloadConfirmations from "@/hooks/use-reload-confirmation";// store typesimport { DeDupeIssuePopoverRoot } from "@/plane-web/components/de-dupe";import { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";-// storeimport { IInboxIssueStore } from "@/store/inbox/inbox-issue.store";type Props = {@@ -44,6 +45,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {const { data: currentUser } = useUser();const { setShowAlert } = useReloadConfirmations(isSubmitting === "submitting");const { captureIssueEvent } = useEventTracker();+ const { loader } = useProjectInbox();const { getProjectById } = useProject();const { removeIssue, archiveIssue } = useIssueDetail();@@ -58,7 +60,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {}}, [isSubmitting, setShowAlert, setIsSubmitting]);- // derived values+ // dervied valuesconst issue = inboxIssue.issue;const projectDetails = issue?.project_id ? getProjectById(issue?.project_id) : undefined;@@ -73,8 +75,12 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {const issueOperations: TIssueOperations = useMemo(() => ({- fetch: async () => {},- remove: async (_workspaceSlug, _projectId, _issueId) => {+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars, arrow-body-style+ fetch: async (_workspaceSlug: string, _projectId: string, _issueId: string) => {+ return;+ },+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars, arrow-body-style+ remove: async (_workspaceSlug: string, _projectId: string, _issueId: string) => {try {await removeIssue(workspaceSlug, projectId, _issueId);setToast({@@ -101,7 +107,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {});}},- update: async (_workspaceSlug, _projectId, _issueId, data) => {+ update: async (_workspaceSlug: string, _projectId: string, _issueId: string, data: Partial<TIssue>) => {try {await inboxIssue.updateIssue(data);captureIssueEvent({@@ -113,7 +119,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {},path: pathname,});- } catch {+ } catch (error) {setToast({title: "Issue update failed",type: TOAST_TYPE.ERROR,@@ -130,14 +136,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {});}},- updateDescription: async (_workspaceSlug, _projectId, _issueId, descriptionBinary) => {- try {- return await inboxIssue.updateIssueDescription(descriptionBinary);- } catch {- throw new Error("Failed to update issue description");- }- },- archive: async (workspaceSlug, projectId, issueId) => {+ archive: async (workspaceSlug: string, projectId: string, issueId: string) => {try {await archiveIssue(workspaceSlug, projectId, issueId);captureIssueEvent({@@ -155,7 +154,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {}},}),- [archiveIssue, captureIssueEvent, inboxIssue, pathname, projectId, removeIssue, workspaceSlug]+ [inboxIssue]);if (!issue?.project_id || !issue?.id) return <></>;@@ -185,20 +184,21 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {containerClassName="-ml-3"/>- {issue.description_binary !== undefined && (+ {loader === "issue-loading" ? (+ <Loader className="min-h-[6rem] rounded-md border border-custom-border-200">+ <Loader.Item width="100%" height="140px" />+ </Loader>+ ) : (<IssueDescriptionInput- key={issue.id}- containerClassName="-ml-3 border-none"- descriptionBinary={issue.description_binary}- descriptionHTML={issue.description_html ?? "<p></p>"}- disabled={!isEditable}- updateDescription={async (data) =>- await issueOperations.updateDescription(workspaceSlug, projectId, issue.id ?? "", data)- }- issueId={issue.id}+ workspaceSlug={workspaceSlug}projectId={issue.project_id}+ issueId={issue.id}+ swrIssueDescription={issue.description_html ?? "<p></p>"}+ initialValue={issue.description_html ?? "<p></p>"}+ disabled={!isEditable}+ issueOperations={issueOperations}setIsSubmitting={(value) => setIsSubmitting(value)}- workspaceSlug={workspaceSlug}+ containerClassName="-ml-3 border-none"/>)}diff --git a/web/core/components/inbox/modals/create-modal/issue-description.tsx b/web/core/components/inbox/modals/create-modal/issue-description.tsxindex 4cf7b3f932..b9bad6c11a 100644--- a/web/core/components/inbox/modals/create-modal/issue-description.tsx+++ b/web/core/components/inbox/modals/create-modal/issue-description.tsx@@ -10,7 +10,7 @@ import { EFileAssetType } from "@plane/types/src/enums";// uiimport { Loader } from "@plane/ui";// components-import { RichTextEditor } from "@/components/editor";+import { RichTextEditor } from "@/components/editor/rich-text-editor/rich-text-editor";// constantsimport { ETabIndices } from "@/constants/tab-indices";// helpersdiff --git a/web/core/components/issues/description-input.tsx b/web/core/components/issues/description-input.tsxindex 7e6229d9e4..8c18618c50 100644--- a/web/core/components/issues/description-input.tsx+++ b/web/core/components/issues/description-input.tsx@@ -1,144 +1,157 @@"use client";-import { FC, useCallback, useRef } from "react";+import { FC, useCallback, useEffect, useState } from "react";import debounce from "lodash/debounce";import { observer } from "mobx-react";-// plane editor-import { convertBinaryDataToBase64String, EditorRefApi } from "@plane/editor";+import { Controller, useForm } from "react-hook-form";// types+import { TIssue } from "@plane/types";import { EFileAssetType } from "@plane/types/src/enums";-// plane ui+// uiimport { Loader } from "@plane/ui";// components-import { CollaborativeRichTextEditor, CollaborativeRichTextReadOnlyEditor } from "@/components/editor";+import { RichTextEditor, RichTextReadOnlyEditor } from "@/components/editor";+import { TIssueOperations } from "@/components/issues/issue-detail";// helpersimport { getDescriptionPlaceholder } from "@/helpers/issue.helper";// hooksimport { useWorkspace } from "@/hooks/store";-import { useIssueDescription } from "@/hooks/use-issue-description";// servicesimport { FileService } from "@/services/file.service";const fileService = new FileService();export type IssueDescriptionInputProps = {containerClassName?: string;- descriptionBinary: string | null;- descriptionHTML: string;- disabled?: boolean;+ workspaceSlug: string;+ projectId: string;issueId: string;- key: string;+ initialValue: string | undefined;+ disabled?: boolean;+ issueOperations: TIssueOperations;placeholder?: string | ((isFocused: boolean, value: string) => string);- projectId: string;setIsSubmitting: (initialValue: "submitting" | "submitted" | "saved") => void;- updateDescription: (data: string) => Promise<ArrayBuffer>;- workspaceSlug: string;+ swrIssueDescription?: string | null | undefined;};export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((props) => {const {containerClassName,- descriptionBinary: savedDescriptionBinary,- descriptionHTML,- disabled,- issueId,- placeholder,+ workspaceSlug,projectId,+ issueId,+ disabled,+ swrIssueDescription,+ initialValue,+ issueOperations,setIsSubmitting,- updateDescription,- workspaceSlug,+ placeholder,} = props;- // refs- const editorRef = useRef<EditorRefApi>(null);- // store hooks- const { getWorkspaceBySlug } = useWorkspace();- // derived values- const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id?.toString() ?? "";- // use issue description- const { descriptionBinary, resolveConflictsAndUpdateDescription } = useIssueDescription({- descriptionBinary: savedDescriptionBinary,- descriptionHTML,- updateDescription,++ const { handleSubmit, reset, control } = useForm<TIssue>({+ defaultValues: {+ description_html: initialValue,+ },});- const debouncedDescriptionSave = useCallback(- debounce(async (updatedDescription: Uint8Array) => {- const editor = editorRef.current;- if (!editor) return;- const encodedDescription = convertBinaryDataToBase64String(updatedDescription);- await resolveConflictsAndUpdateDescription(encodedDescription, editor);- setIsSubmitting("submitted");- }, 1500),- []+ const [localIssueDescription, setLocalIssueDescription] = useState({+ id: issueId,+ description_html: initialValue,+ });++ const handleDescriptionFormSubmit = useCallback(+ async (formData: Partial<TIssue>) => {+ await issueOperations.update(workspaceSlug, projectId, issueId, {+ description_html: formData.description_html ?? "<p></p>",+ });+ },+ [workspaceSlug, projectId, issueId, issueOperations]);- if (!descriptionBinary)- return (- <Loader className="min-h-[120px] max-h-64 space-y-2 overflow-hidden rounded-md">- <Loader.Item width="100%" height="26px" />- <div className="flex items-center gap-2">- <Loader.Item width="26px" height="26px" />- <Loader.Item width="400px" height="26px" />- </div>- <div className="flex items-center gap-2">- <Loader.Item width="26px" height="26px" />- <Loader.Item width="400px" height="26px" />- </div>- <Loader.Item width="80%" height="26px" />- <div className="flex items-center gap-2">- <Loader.Item width="50%" height="26px" />- </div>- <div className="border-0.5 absolute bottom-2 right-3.5 z-10 flex items-center gap-2">- <Loader.Item width="100px" height="26px" />- <Loader.Item width="50px" height="26px" />- </div>- </Loader>- );+ const { getWorkspaceBySlug } = useWorkspace();+ // computed values+ const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id as string;++ // reset form values+ useEffect(() => {+ if (!issueId) return;+ reset({+ id: issueId,+ description_html: initialValue === "" ? "<p></p>" : initialValue,+ });+ setLocalIssueDescription({+ id: issueId,+ description_html: initialValue === "" ? "<p></p>" : initialValue,+ });+ }, [initialValue, issueId, reset]);++ // ADDING handleDescriptionFormSubmit TO DEPENDENCY ARRAY PRODUCES ADVERSE EFFECTS+ // TODO: Verify the exhaustive-deps warning+ // eslint-disable-next-line react-hooks/exhaustive-deps+ const debouncedFormSave = useCallback(+ debounce(async () => {+ handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting("submitted"));+ }, 1500),+ [handleSubmit, issueId]+ );return (<>- {!disabled ? (- <CollaborativeRichTextEditor- key={issueId}- containerClassName={containerClassName}- value={descriptionBinary}- onChange={(val) => {- setIsSubmitting("submitting");- debouncedDescriptionSave(val);- }}- dragDropEnabled- id={issueId}- placeholder={placeholder ? placeholder : (isFocused, value) => getDescriptionPlaceholder(isFocused, value)}- projectId={projectId}- ref={editorRef}- uploadFile={async (file) => {- try {- const { asset_id } = await fileService.uploadProjectAsset(- workspaceSlug,- projectId,- {- entity_identifier: issueId,- entity_type: EFileAssetType.ISSUE_DESCRIPTION,- },- file- );- return asset_id;- } catch (error) {- console.log("Error in uploading issue asset:", error);- throw new Error("Asset upload failed. Please try again later.");- }- }}- workspaceId={workspaceId}- workspaceSlug={workspaceSlug}+ {localIssueDescription.description_html ? (+ <Controller+ name="description_html"+ control={control}+ render={({ field: { onChange } }) =>+ !disabled ? (+ <RichTextEditor+ id={issueId}+ initialValue={localIssueDescription.description_html ?? "<p></p>"}+ value={swrIssueDescription ?? null}+ workspaceSlug={workspaceSlug}+ workspaceId={workspaceId}+ projectId={projectId}+ dragDropEnabled+ onChange={(_description: object, description_html: string) => {+ setIsSubmitting("submitting");+ onChange(description_html);+ debouncedFormSave();+ }}+ placeholder={+ placeholder ? placeholder : (isFocused, value) => getDescriptionPlaceholder(isFocused, value)+ }+ containerClassName={containerClassName}+ uploadFile={async (file) => {+ try {+ const { asset_id } = await fileService.uploadProjectAsset(+ workspaceSlug,+ projectId,+ {+ entity_identifier: issueId,+ entity_type: EFileAssetType.ISSUE_DESCRIPTION,+ },+ file+ );+ return asset_id;+ } catch (error) {+ console.log("Error in uploading issue asset:", error);+ throw new Error("Asset upload failed. Please try again later.");+ }+ }}+ />+ ) : (+ <RichTextReadOnlyEditor+ id={issueId}+ initialValue={localIssueDescription.description_html ?? ""}+ containerClassName={containerClassName}+ workspaceSlug={workspaceSlug}+ projectId={projectId}+ />+ )+ }/>) : (- <CollaborativeRichTextReadOnlyEditor- containerClassName={containerClassName}- descriptionBinary={savedDescriptionBinary}- descriptionHTML={descriptionHTML}- id={issueId}- projectId={projectId}- workspaceSlug={workspaceSlug}- />+ <Loader>+ <Loader.Item height="150px" />+ </Loader>)}</>);diff --git a/web/core/components/issues/issue-detail/main-content.tsx b/web/core/components/issues/issue-detail/main-content.tsxindex 37be0c6c6d..fb4dbc1fce 100644--- a/web/core/components/issues/issue-detail/main-content.tsx+++ b/web/core/components/issues/issue-detail/main-content.tsx@@ -22,7 +22,6 @@ import useSize from "@/hooks/use-window-size";// plane web componentsimport { DeDupeIssuePopoverRoot } from "@/plane-web/components/de-dupe";import { IssueTypeSwitcher } from "@/plane-web/components/issues";-// plane web hooksimport { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";// typesimport { TIssueOperations } from "./root";@@ -114,22 +113,16 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {containerClassName="-ml-3"/>- {issue.description_binary !== undefined && (- <IssueDescriptionInput- key={issue.id}- containerClassName="-ml-3 border-none"- descriptionBinary={issue.description_binary}- descriptionHTML={issue.description_html ?? "<p></p>"}- disabled={!isEditable}- updateDescription={async (data) =>- await issueOperations.updateDescription(workspaceSlug, issue.project_id ?? "", issue.id, data)- }- issueId={issue.id}- projectId={issue.project_id}- setIsSubmitting={(value) => setIsSubmitting(value)}- workspaceSlug={workspaceSlug}- />- )}+ <IssueDescriptionInput+ workspaceSlug={workspaceSlug}+ projectId={issue.project_id}+ issueId={issue.id}+ initialValue={issue.description_html}+ disabled={!isEditable}+ issueOperations={issueOperations}+ setIsSubmitting={(value) => setIsSubmitting(value)}+ containerClassName="-ml-3 border-none"+ />{currentUser && (<IssueReactiondiff --git a/web/core/components/issues/issue-detail/root.tsx b/web/core/components/issues/issue-detail/root.tsxindex 572312423d..9db4b1ab9e 100644--- a/web/core/components/issues/issue-detail/root.tsx+++ b/web/core/components/issues/issue-detail/root.tsx@@ -26,12 +26,6 @@ import { IssueDetailsSidebar } from "./sidebar";export type TIssueOperations = {fetch: (workspaceSlug: string, projectId: string, issueId: string, loader?: boolean) => Promise<void>;update: (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;- updateDescription: (- workspaceSlug: string,- projectId: string,- issueId: string,- descriptionBinary: string- ) => Promise<ArrayBuffer>;remove: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;archive?: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;restore?: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;@@ -70,7 +64,6 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {issue: { getIssueById },fetchIssue,updateIssue,- updateIssueDescription,removeIssue,archiveIssue,addCycleToIssue,@@ -125,13 +118,6 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {});}},- updateDescription: async (workspaceSlug, projectId, issueId, descriptionBinary) => {- try {- return await updateIssueDescription(workspaceSlug, projectId, issueId, descriptionBinary);- } catch {- throw new Error("Failed to update issue description");- }- },remove: async (workspaceSlug: string, projectId: string, issueId: string) => {try {if (is_archived) await removeArchivedIssue(workspaceSlug, projectId, issueId);@@ -331,7 +317,6 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {is_archived,fetchIssue,updateIssue,- updateIssueDescription,removeIssue,archiveIssue,removeArchivedIssue,diff --git a/web/core/components/issues/peek-overview/issue-detail.tsx b/web/core/components/issues/peek-overview/issue-detail.tsxindex 6aec30422b..74aba71fdc 100644--- a/web/core/components/issues/peek-overview/issue-detail.tsx+++ b/web/core/components/issues/peek-overview/issue-detail.tsx@@ -12,9 +12,8 @@ import useReloadConfirmations from "@/hooks/use-reload-confirmation";// plane web componentsimport { DeDupeIssuePopoverRoot } from "@/plane-web/components/de-dupe";import { IssueTypeSwitcher } from "@/plane-web/components/issues";-// plane web hooks-import { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";// local components+import { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";import { IssueDescriptionInput } from "../description-input";import { IssueReaction } from "../issue-detail/reactions";import { IssueTitleInput } from "../title-input";@@ -64,6 +63,13 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(if (!issue || !issue.project_id) return <></>;+ const issueDescription =+ issue.description_html !== undefined || issue.description_html !== null+ ? issue.description_html != ""+ ? issue.description_html+ : "<p></p>"+ : undefined;+return (<div className="space-y-2">{issue.parent_id && (@@ -99,22 +105,16 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(containerClassName="-ml-3"/>- {issue.description_binary !== undefined && (- <IssueDescriptionInput- key={issue.id}- containerClassName="-ml-3 border-none"- descriptionBinary={issue.description_binary}- descriptionHTML={issue.description_html ?? "<p></p>"}- disabled={disabled}- updateDescription={async (data) =>- await issueOperations.updateDescription(workspaceSlug, issue.project_id ?? "", issue.id, data)- }- issueId={issue.id}- projectId={issue.project_id}- setIsSubmitting={(value) => setIsSubmitting(value)}- workspaceSlug={workspaceSlug}- />- )}+ <IssueDescriptionInput+ workspaceSlug={workspaceSlug}+ projectId={issue.project_id}+ issueId={issue.id}+ initialValue={issueDescription}+ disabled={disabled}+ issueOperations={issueOperations}+ setIsSubmitting={(value) => setIsSubmitting(value)}+ containerClassName="-ml-3 border-none"+ />{currentUser && (<IssueReactiondiff --git a/web/core/components/issues/peek-overview/root.tsx b/web/core/components/issues/peek-overview/root.tsxindex f7e1f0cfb5..70eb51d81b 100644--- a/web/core/components/issues/peek-overview/root.tsx+++ b/web/core/components/issues/peek-overview/root.tsx@@ -39,7 +39,6 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {setPeekIssue,issue: { fetchIssue, getIsFetchingIssueDetails },fetchActivities,- updateIssueDescription,} = useIssueDetail();const { issues } = useIssuesStore();@@ -93,16 +92,6 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {});}},- updateDescription: async (workspaceSlug, projectId, issueId, descriptionBinary) => {- if (!workspaceSlug || !projectId || !issueId) {- throw new Error("Required fields missing while updating binary description");- }- try {- return await updateIssueDescription(workspaceSlug, projectId, issueId, descriptionBinary);- } catch {- throw new Error("Failed to update issue description");- }- },remove: async (workspaceSlug: string, projectId: string, issueId: string) => {try {return issues?.removeIssue(workspaceSlug, projectId, issueId).then(() => {@@ -329,17 +318,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {}},}),- [- fetchIssue,- is_draft,- issues,- fetchActivities,- captureIssueEvent,- pathname,- removeRoutePeekId,- restoreIssue,- updateIssueDescription,- ]+ [fetchIssue, is_draft, issues, fetchActivities, captureIssueEvent, pathname, removeRoutePeekId, restoreIssue]);useEffect(() => {diff --git a/web/core/components/pages/editor/page-root.tsx b/web/core/components/pages/editor/page-root.tsxindex 500a77586f..ff1f3519e9 100644--- a/web/core/components/pages/editor/page-root.tsx+++ b/web/core/components/pages/editor/page-root.tsx@@ -50,9 +50,7 @@ export const PageRoot = observer((props: TPageRootProps) => {usePageFallback({editorRef,fetchPageDescription: async () => {- if (!page.id) {- throw new Error("Required fields missing while fetching binary description");- }+ if (!page.id) return;return await projectPageService.fetchDescriptionBinary(workspaceSlug, projectId, page.id);},hasConnectionFailed,diff --git a/web/core/components/profile/activity/activity-list.tsx b/web/core/components/profile/activity/activity-list.tsxindex 6b83a92bbd..bdb6c6f935 100644--- a/web/core/components/profile/activity/activity-list.tsx+++ b/web/core/components/profile/activity/activity-list.tsx@@ -8,7 +8,7 @@ import { IUserActivityResponse } from "@plane/types";// componentsimport { ActivityIcon, ActivityMessage, IssueLink } from "@/components/core";// editor-import { RichTextReadOnlyEditor } from "@/components/editor";+import { RichTextReadOnlyEditor } from "@/components/editor/rich-text-editor/rich-text-read-only-editor";// uiimport { ActivitySettingsLoader } from "@/components/ui";// helpersdiff --git a/web/core/components/profile/activity/profile-activity-list.tsx b/web/core/components/profile/activity/profile-activity-list.tsxindex 0fe9b44f9a..6878fe9b3c 100644--- a/web/core/components/profile/activity/profile-activity-list.tsx+++ b/web/core/components/profile/activity/profile-activity-list.tsx@@ -7,7 +7,7 @@ import useSWR from "swr";import { History, MessageSquare } from "lucide-react";// hooksimport { ActivityIcon, ActivityMessage, IssueLink } from "@/components/core";-import { RichTextReadOnlyEditor } from "@/components/editor";+import { RichTextReadOnlyEditor } from "@/components/editor/rich-text-editor/rich-text-read-only-editor";import { ActivitySettingsLoader } from "@/components/ui";// constantsimport { USER_ACTIVITY } from "@/constants/fetch-keys";diff --git a/web/core/hooks/use-issue-description.ts b/web/core/hooks/use-issue-description.tsdeleted file mode 100644index 5493ffae02..0000000000--- a/web/core/hooks/use-issue-description.ts+++ /dev/null@@ -1,54 +0,0 @@-import { useCallback, useEffect, useState } from "react";-// plane editor-import {- convertBase64StringToBinaryData,- EditorRefApi,- getBinaryDataFromRichTextEditorHTMLString,-} from "@plane/editor";--type TArgs = {- descriptionBinary: string | null;- descriptionHTML: string | null;- updateDescription?: (data: string) => Promise<ArrayBuffer>;-};--export const useIssueDescription = (args: TArgs) => {- const { descriptionBinary: savedDescriptionBinary, descriptionHTML, updateDescription } = args;- // states- const [descriptionBinary, setDescriptionBinary] = useState<Uint8Array | null>(null);- // update description- const resolveConflictsAndUpdateDescription = useCallback(- async (encodedDescription: string, editorRef: EditorRefApi | null) => {- if (!updateDescription) return;- try {- const conflictFreeEncodedDescription = await updateDescription(encodedDescription);- const decodedDescription = conflictFreeEncodedDescription- ? new Uint8Array(conflictFreeEncodedDescription)- : new Uint8Array();- editorRef?.setProviderDocument(decodedDescription);- } catch (error) {- console.error("Error while updating description", error);- }- },- [updateDescription]- );-- useEffect(() => {- if (descriptionBinary) return;- if (savedDescriptionBinary) {- const savedDescriptionBuffer = convertBase64StringToBinaryData(savedDescriptionBinary);- const decodedSavedDescription = savedDescriptionBuffer- ? new Uint8Array(savedDescriptionBuffer)- : new Uint8Array();- setDescriptionBinary(decodedSavedDescription);- } else {- const decodedDescriptionHTML = getBinaryDataFromRichTextEditorHTMLString(descriptionHTML ?? "<p></p>");- setDescriptionBinary(decodedDescriptionHTML);- }- }, [descriptionBinary, descriptionHTML, savedDescriptionBinary]);-- return {- descriptionBinary,- resolveConflictsAndUpdateDescription,- };-};diff --git a/web/core/hooks/use-page-fallback.ts b/web/core/hooks/use-page-fallback.tsindex 4e604ffb46..9f5ef34829 100644--- a/web/core/hooks/use-page-fallback.ts+++ b/web/core/hooks/use-page-fallback.ts@@ -1,6 +1,6 @@import { useCallback, useEffect } from "react";// plane editor-import { convertBinaryDataToBase64String, EditorRefApi } from "@plane/editor";+import { EditorRefApi } from "@plane/editor";// plane typesimport { TDocumentPayload } from "@plane/types";// hooks@@ -8,7 +8,7 @@ import useAutoSave from "@/hooks/use-auto-save";type TArgs = {editorRef: React.RefObject<EditorRefApi>;- fetchPageDescription: () => Promise<ArrayBuffer>;+ fetchPageDescription: () => Promise<any>;hasConnectionFailed: boolean;updatePageDescription: (data: TDocumentPayload) => Promise<void>;};@@ -29,7 +29,7 @@ export const usePageFallback = (args: TArgs) => {editor.setProviderDocument(latestDecodedDescription);const { binary, html, json } = editor.getDocument();if (!binary || !json) return;- const encodedBinary = convertBinaryDataToBase64String(binary);+ const encodedBinary = Buffer.from(binary).toString("base64");await updatePageDescription({description_binary: encodedBinary,diff --git a/web/core/services/inbox/inbox-issue.service.ts b/web/core/services/inbox/inbox-issue.service.tsindex d8e6357cc9..8837b6e74a 100644--- a/web/core/services/inbox/inbox-issue.service.ts+++ b/web/core/services/inbox/inbox-issue.service.ts@@ -1,5 +1,5 @@// types-import type { TInboxIssue, TIssue, TInboxIssueWithPagination, TInboxForm, TDocumentPayload } from "@plane/types";+import type { TInboxIssue, TIssue, TInboxIssueWithPagination, TInboxForm } from "@plane/types";import { API_BASE_URL } from "@/helpers/common.helper";import { APIService } from "@/services/api.service";// helpers@@ -76,25 +76,6 @@ export class InboxIssueService extends APIService {});}- async updateDescriptionBinary(- workspaceSlug: string,- projectId: string,- inboxIssueId: string,- data: Pick<TDocumentPayload, "description_binary">- ): Promise<ArrayBuffer> {- return this.post(- `/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/${inboxIssueId}/description/`,- data,- {- responseType: "arraybuffer",- }- )- .then((response) => response?.data)- .catch((error) => {- throw error?.response?.data;- });- }-async retrievePublishForm(workspaceSlug: string, projectId: string): Promise<TInboxForm> {return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/intake-settings/`).then((response) => response?.data)diff --git a/web/core/services/issue/issue.service.ts b/web/core/services/issue/issue.service.tsindex 5a9854062f..2cef113d80 100644--- a/web/core/services/issue/issue.service.ts+++ b/web/core/services/issue/issue.service.ts@@ -4,7 +4,6 @@ import isEmpty from "lodash/isEmpty";import type {IIssueDisplayProperties,TBulkOperationsPayload,- TDocumentPayload,TIssue,TIssueActivity,TIssueLink,@@ -389,19 +388,4 @@ export class IssueService extends APIService {throw error?.response?.data;});}-- async updateDescriptionBinary(- workspaceSlug: string,- projectId: string,- issueId: string,- data: Pick<TDocumentPayload, "description_binary">- ): Promise<ArrayBuffer> {- return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/description/`, data, {- responseType: "arraybuffer",- })- .then((response) => response?.data)- .catch((error) => {- throw error?.response?.data;- });- }}diff --git a/web/core/services/page/project-page.service.ts b/web/core/services/page/project-page.service.tsindex f5331d8891..00d9401a69 100644--- a/web/core/services/page/project-page.service.ts+++ b/web/core/services/page/project-page.service.ts@@ -4,10 +4,15 @@ import { TDocumentPayload, TPage } from "@plane/types";import { API_BASE_URL } from "@/helpers/common.helper";// servicesimport { APIService } from "@/services/api.service";+import { FileUploadService } from "@/services/file-upload.service";export class ProjectPageService extends APIService {+ private fileUploadService: FileUploadService;+constructor() {super(API_BASE_URL);+ // upload service+ this.fileUploadService = new FileUploadService();}async fetchAll(workspaceSlug: string, projectId: string): Promise<TPage[]> {@@ -128,7 +133,7 @@ export class ProjectPageService extends APIService {});}- async fetchDescriptionBinary(workspaceSlug: string, projectId: string, pageId: string): Promise<ArrayBuffer> {+ async fetchDescriptionBinary(workspaceSlug: string, projectId: string, pageId: string): Promise<any> {return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/description/`, {headers: {"Content-Type": "application/octet-stream",diff --git a/web/core/store/inbox/inbox-issue.store.ts b/web/core/store/inbox/inbox-issue.store.tsindex 30a03207d8..e080225aaf 100644--- a/web/core/store/inbox/inbox-issue.store.ts+++ b/web/core/store/inbox/inbox-issue.store.ts@@ -26,7 +26,6 @@ export interface IInboxIssueStore {updateInboxIssueDuplicateTo: (issueId: string) => Promise<void>; // connecting the inbox issue to the project existing issueupdateInboxIssueSnoozeTill: (date: Date | undefined) => Promise<void>; // snooze the issueupdateIssue: (issue: Partial<TIssue>) => Promise<void>; // updating the issue- updateIssueDescription: (descriptionBinary: string) => Promise<ArrayBuffer>; // updating the local issue descriptionupdateProjectIssue: (issue: Partial<TIssue>) => Promise<void>; // updating the issuefetchIssueActivity: () => Promise<void>; // fetching the issue activity}@@ -79,7 +78,6 @@ export class InboxIssueStore implements IInboxIssueStore {updateInboxIssueDuplicateTo: action,updateInboxIssueSnoozeTill: action,updateIssue: action,- updateIssueDescription: action,updateProjectIssue: action,fetchIssueActivity: action,});@@ -177,26 +175,6 @@ export class InboxIssueStore implements IInboxIssueStore {}};- updateIssueDescription = async (descriptionBinary: string): Promise<ArrayBuffer> => {- try {- if (!this.issue.id) throw new Error("Issue id is missing");- const res = await this.inboxIssueService.updateDescriptionBinary(- this.workspaceSlug,- this.projectId,- this.issue.id,- {- description_binary: descriptionBinary,- }- );- set(this.issue, "description_binary", descriptionBinary);- // fetching activity- this.fetchIssueActivity();- return res;- } catch {- throw new Error("Failed to update local issue description");- }- };-updateProjectIssue = async (issue: Partial<TIssue>) => {const inboxIssue = clone(this.issue);try {diff --git a/web/core/store/issue/issue-details/issue.store.ts b/web/core/store/issue/issue-details/issue.store.tsindex 342c3adca6..db0ccc39af 100644--- a/web/core/store/issue/issue-details/issue.store.ts+++ b/web/core/store/issue/issue-details/issue.store.ts@@ -7,7 +7,6 @@ import { persistence } from "@/local-db/storage.sqlite";// servicesimport { IssueArchiveService, IssueDraftService, IssueService } from "@/services/issue";// types-import { IIssueRootStore } from "../root.store";import { IIssueDetail } from "./root.store";export interface IIssueStoreActions {@@ -16,15 +15,9 @@ export interface IIssueStoreActions {workspaceSlug: string,projectId: string,issueId: string,- issueStatus?: "DEFAULT" | "DRAFT"+ issueStatus?: "DEFAULT" | "DRAFT",) => Promise<TIssue>;updateIssue: (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;- updateIssueDescription: (- workspaceSlug: string,- projectId: string,- issueId: string,- descriptionBinary: string- ) => Promise<ArrayBuffer>;removeIssue: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;archiveIssue: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;addCycleToIssue: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;@@ -51,21 +44,19 @@ export class IssueStore implements IIssueStore {fetchingIssueDetails: string | undefined = undefined;localDBIssueDescription: string | undefined = undefined;// root store- rootIssueStore: IIssueRootStore;rootIssueDetailStore: IIssueDetail;// servicesissueService;issueArchiveService;issueDraftService;- constructor(rootStore: IIssueRootStore, rootIssueDetailStore: IIssueDetail) {+ constructor(rootStore: IIssueDetail) {makeObservable(this, {fetchingIssueDetails: observable.ref,localDBIssueDescription: observable.ref,});// root store- this.rootIssueStore = rootStore;- this.rootIssueDetailStore = rootIssueDetailStore;+ this.rootIssueDetailStore = rootStore;// servicesthis.issueService = new IssueService();this.issueArchiveService = new IssueArchiveService();@@ -165,7 +156,6 @@ export class IssueStore implements IIssueStore {id: issue?.id,sequence_id: issue?.sequence_id,name: issue?.name,- description_binary: issue?.description_binary,description_html: issue?.description_html,sort_order: issue?.sort_order,state_id: issue?.state_id,@@ -204,20 +194,6 @@ export class IssueStore implements IIssueStore {await this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);};- updateIssueDescription = async (- workspaceSlug: string,- projectId: string,- issueId: string,- descriptionBinary: string- ): Promise<ArrayBuffer> => {- const res = await this.issueService.updateDescriptionBinary(workspaceSlug, projectId, issueId, {- description_binary: descriptionBinary,- });- this.rootIssueStore.issues.updateIssue(issueId, { description_binary: descriptionBinary });- this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);- return res;- };-removeIssue = async (workspaceSlug: string, projectId: string, issueId: string) =>this.rootIssueDetailStore.rootIssueStore.projectIssues.removeIssue(workspaceSlug, projectId, issueId);diff --git a/web/core/store/issue/issue-details/root.store.ts b/web/core/store/issue/issue-details/root.store.tsindex 6a98715d9b..e6e0ca8d0b 100644--- a/web/core/store/issue/issue-details/root.store.ts+++ b/web/core/store/issue/issue-details/root.store.ts@@ -192,7 +192,7 @@ export class IssueDetail implements IIssueDetail {// storethis.rootIssueStore = rootStore;- this.issue = new IssueStore(rootStore, this);+ this.issue = new IssueStore(this);this.reaction = new IssueReactionStore(this);this.attachment = new IssueAttachmentStore(rootStore);this.activity = new IssueActivityStore(rootStore.rootStore as RootStore);@@ -257,12 +257,6 @@ export class IssueDetail implements IIssueDetail {) => this.issue.fetchIssue(workspaceSlug, projectId, issueId, issueStatus);updateIssue = async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) =>this.issue.updateIssue(workspaceSlug, projectId, issueId, data);- updateIssueDescription = async (- workspaceSlug: string,- projectId: string,- issueId: string,- descriptionBinary: string- ) => this.issue.updateIssueDescription(workspaceSlug, projectId, issueId, descriptionBinary);removeIssue = async (workspaceSlug: string, projectId: string, issueId: string) =>this.issue.removeIssue(workspaceSlug, projectId, issueId);archiveIssue = async (workspaceSlug: string, projectId: string, issueId: string) =>