feat(editor): update editor limits and add error boundary

- Reduced maximum document size for the editor from 5MB to 1MB.
- Introduced a new line limit of 5000 for documents in the editor.
- Implemented a PlateErrorBoundary component to handle rendering errors gracefully in the editor panel.
- Updated logic in the editor panel to check both size and line count for document limits.
This commit is contained in:
Anish Sarkar 2026-06-17 12:11:31 +05:30
parent 7ce409c580
commit 4658130bb8
3 changed files with 117 additions and 35 deletions

View file

@ -0,0 +1,34 @@
"use client";
import { Component, type ReactNode } from "react";
interface PlateErrorBoundaryProps {
children: ReactNode;
fallback: ReactNode;
}
interface PlateErrorBoundaryState {
hasError: boolean;
}
export class PlateErrorBoundary extends Component<
PlateErrorBoundaryProps,
PlateErrorBoundaryState
> {
constructor(props: PlateErrorBoundaryProps) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError(): PlateErrorBoundaryState {
return { hasError: true };
}
render() {
if (this.state.hasError) {
return this.props.fallback;
}
return this.props.children;
}
}