mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-26 21:39:43 +02:00
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:
parent
7ce409c580
commit
4658130bb8
3 changed files with 117 additions and 35 deletions
34
surfsense_web/components/editor/plate-error-boundary.tsx
Normal file
34
surfsense_web/components/editor/plate-error-boundary.tsx
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue