mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-17 18:35:19 +02:00
apply formatter cleanup to web files
This commit is contained in:
parent
7d25778927
commit
e7f9c658ce
43 changed files with 224 additions and 276 deletions
|
|
@ -69,11 +69,7 @@ const categoryConfig: Record<
|
||||||
// Announcement card
|
// Announcement card
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function AnnouncementCard({
|
function AnnouncementCard({ announcement }: { announcement: AnnouncementWithState }) {
|
||||||
announcement,
|
|
||||||
}: {
|
|
||||||
announcement: AnnouncementWithState;
|
|
||||||
}) {
|
|
||||||
const config = categoryConfig[announcement.category] ?? categoryConfig.info;
|
const config = categoryConfig[announcement.category] ?? categoryConfig.info;
|
||||||
const Icon = config.icon;
|
const Icon = config.icon;
|
||||||
|
|
||||||
|
|
@ -179,10 +175,7 @@ export default function AnnouncementsPage() {
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
{announcements.map((announcement) => (
|
{announcements.map((announcement) => (
|
||||||
<AnnouncementCard
|
<AnnouncementCard key={announcement.id} announcement={announcement} />
|
||||||
key={announcement.id}
|
|
||||||
announcement={announcement}
|
|
||||||
/>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ export function AnnouncementToastProvider() {
|
||||||
const authed = isAuthenticated();
|
const authed = isAuthenticated();
|
||||||
const active = getActiveAnnouncements(announcements, authed);
|
const active = getActiveAnnouncements(announcements, authed);
|
||||||
const importantUntoasted = active.filter(
|
const importantUntoasted = active.filter(
|
||||||
(a) => a.isImportant && !isAnnouncementToasted(a.id),
|
(a) => a.isImportant && !isAnnouncementToasted(a.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
for (let i = 0; i < importantUntoasted.length; i++) {
|
for (let i = 0; i < importantUntoasted.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useRef } from "react";
|
|
||||||
import { MarkdownPlugin, remarkMdx } from "@platejs/markdown";
|
import { MarkdownPlugin, remarkMdx } from "@platejs/markdown";
|
||||||
import type { AnyPluginConfig } from "platejs";
|
import type { AnyPluginConfig } from "platejs";
|
||||||
import { createPlatePlugin, Key, Plate, usePlateEditor } from "platejs/react";
|
import { createPlatePlugin, Key, Plate, usePlateEditor } from "platejs/react";
|
||||||
|
import { useEffect, useMemo, useRef } from "react";
|
||||||
import remarkGfm from "remark-gfm";
|
import remarkGfm from "remark-gfm";
|
||||||
import remarkMath from "remark-math";
|
import remarkMath from "remark-math";
|
||||||
|
|
||||||
import { type EditorPreset, presetMap } from "@/components/editor/presets";
|
|
||||||
import { Editor, EditorContainer } from "@/components/ui/editor";
|
|
||||||
import { escapeMdxExpressions } from "@/components/editor/utils/escape-mdx";
|
|
||||||
import { EditorSaveContext } from "@/components/editor/editor-save-context";
|
import { EditorSaveContext } from "@/components/editor/editor-save-context";
|
||||||
|
import { type EditorPreset, presetMap } from "@/components/editor/presets";
|
||||||
|
import { escapeMdxExpressions } from "@/components/editor/utils/escape-mdx";
|
||||||
|
import { Editor, EditorContainer } from "@/components/ui/editor";
|
||||||
|
|
||||||
export interface PlateEditorProps {
|
export interface PlateEditorProps {
|
||||||
/** Markdown string to load as initial content */
|
/** Markdown string to load as initial content */
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
import type { AutoformatRule } from "@platejs/autoformat";
|
import type { AutoformatRule } from "@platejs/autoformat";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
AutoformatPlugin,
|
||||||
autoformatArrow,
|
autoformatArrow,
|
||||||
autoformatLegal,
|
autoformatLegal,
|
||||||
autoformatLegalHtml,
|
autoformatLegalHtml,
|
||||||
autoformatMath,
|
autoformatMath,
|
||||||
AutoformatPlugin,
|
|
||||||
autoformatPunctuation,
|
autoformatPunctuation,
|
||||||
autoformatSmartQuotes,
|
autoformatSmartQuotes,
|
||||||
} from "@platejs/autoformat";
|
} from "@platejs/autoformat";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { DndPlugin } from "@platejs/dnd";
|
||||||
import { DndProvider } from "react-dnd";
|
import { DndProvider } from "react-dnd";
|
||||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||||
|
|
||||||
import { DndPlugin } from "@platejs/dnd";
|
|
||||||
|
|
||||||
import { BlockDraggable } from "@/components/ui/block-draggable";
|
import { BlockDraggable } from "@/components/ui/block-draggable";
|
||||||
|
|
||||||
export const DndKit = [
|
export const DndKit = [
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { PlateEditor } from "platejs/react";
|
|
||||||
|
|
||||||
import { insertCallout } from "@platejs/callout";
|
import { insertCallout } from "@platejs/callout";
|
||||||
import { insertCodeBlock, toggleCodeBlock } from "@platejs/code-block";
|
import { insertCodeBlock, toggleCodeBlock } from "@platejs/code-block";
|
||||||
import { triggerFloatingLink } from "@platejs/link/react";
|
import { triggerFloatingLink } from "@platejs/link/react";
|
||||||
import { insertInlineEquation } from "@platejs/math";
|
import { insertInlineEquation } from "@platejs/math";
|
||||||
import { TablePlugin } from "@platejs/table/react";
|
import { TablePlugin } from "@platejs/table/react";
|
||||||
import { type NodeEntry, type Path, type TElement, KEYS, PathApi } from "platejs";
|
import { KEYS, type NodeEntry, type Path, PathApi, type TElement } from "platejs";
|
||||||
|
import type { PlateEditor } from "platejs/react";
|
||||||
|
|
||||||
const insertList = (editor: PlateEditor, type: string) => {
|
const insertList = (editor: PlateEditor, type: string) => {
|
||||||
editor.tf.insertNodes(
|
editor.tf.insertNodes(
|
||||||
|
|
|
||||||
|
|
@ -215,9 +215,9 @@ function ApprovalCard({
|
||||||
onValueChange={(v) => {
|
onValueChange={(v) => {
|
||||||
setSelectedWorkspaceId(v);
|
setSelectedWorkspaceId(v);
|
||||||
setSelectedTeamId("");
|
setSelectedTeamId("");
|
||||||
setSelectedStateId("__none__");
|
setSelectedStateId("__none__");
|
||||||
setSelectedAssigneeId("__none__");
|
setSelectedAssigneeId("__none__");
|
||||||
setSelectedPriority("0");
|
setSelectedPriority("0");
|
||||||
setSelectedLabelIds([]);
|
setSelectedLabelIds([]);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
@ -243,13 +243,13 @@ function ApprovalCard({
|
||||||
</div>
|
</div>
|
||||||
<Select
|
<Select
|
||||||
value={selectedTeamId}
|
value={selectedTeamId}
|
||||||
onValueChange={(v) => {
|
onValueChange={(v) => {
|
||||||
setSelectedTeamId(v);
|
setSelectedTeamId(v);
|
||||||
const newTeam = selectedWorkspace.teams.find((t) => t.id === v);
|
const newTeam = selectedWorkspace.teams.find((t) => t.id === v);
|
||||||
setSelectedStateId(newTeam?.states?.[0]?.id ?? "__none__");
|
setSelectedStateId(newTeam?.states?.[0]?.id ?? "__none__");
|
||||||
setSelectedAssigneeId("__none__");
|
setSelectedAssigneeId("__none__");
|
||||||
setSelectedLabelIds([]);
|
setSelectedLabelIds([]);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger className="w-full">
|
||||||
<SelectValue placeholder="Select a team" />
|
<SelectValue placeholder="Select a team" />
|
||||||
|
|
|
||||||
|
|
@ -415,134 +415,134 @@ function ApprovalCard({
|
||||||
>
|
>
|
||||||
New Title
|
New Title
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
id="linear-update-title"
|
id="linear-update-title"
|
||||||
value={editedArgs.title}
|
value={editedArgs.title}
|
||||||
onChange={(e) => setEditedArgs({ ...editedArgs, title: e.target.value })}
|
onChange={(e) => setEditedArgs({ ...editedArgs, title: e.target.value })}
|
||||||
placeholder="Issue title"
|
placeholder="Issue title"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label
|
<label
|
||||||
htmlFor="linear-update-description"
|
htmlFor="linear-update-description"
|
||||||
className="text-xs font-medium text-muted-foreground mb-1.5 block"
|
className="text-xs font-medium text-muted-foreground mb-1.5 block"
|
||||||
>
|
>
|
||||||
Description
|
Description
|
||||||
</label>
|
</label>
|
||||||
<Textarea
|
<Textarea
|
||||||
id="linear-update-description"
|
id="linear-update-description"
|
||||||
value={editedArgs.description}
|
value={editedArgs.description}
|
||||||
onChange={(e) => setEditedArgs({ ...editedArgs, description: e.target.value })}
|
onChange={(e) => setEditedArgs({ ...editedArgs, description: e.target.value })}
|
||||||
placeholder="Issue description"
|
placeholder="Issue description"
|
||||||
rows={5}
|
rows={5}
|
||||||
className="resize-none"
|
className="resize-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{team && (
|
{team && (
|
||||||
<>
|
<>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<div className="text-xs font-medium text-muted-foreground">State</div>
|
<div className="text-xs font-medium text-muted-foreground">State</div>
|
||||||
<Select
|
<Select
|
||||||
value={editedArgs.stateId}
|
value={editedArgs.stateId}
|
||||||
onValueChange={(v) => setEditedArgs({ ...editedArgs, stateId: v })}
|
onValueChange={(v) => setEditedArgs({ ...editedArgs, stateId: v })}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger className="w-full">
|
||||||
<SelectValue placeholder="Select state" />
|
<SelectValue placeholder="Select state" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{team.states.map((s) => (
|
{team.states.map((s) => (
|
||||||
<SelectItem key={s.id} value={s.id}>
|
<SelectItem key={s.id} value={s.id}>
|
||||||
{s.name}
|
{s.name}
|
||||||
</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<div className="text-xs font-medium text-muted-foreground">Assignee</div>
|
|
||||||
<Select
|
|
||||||
value={editedArgs.assigneeId}
|
|
||||||
onValueChange={(v) => setEditedArgs({ ...editedArgs, assigneeId: v })}
|
|
||||||
>
|
|
||||||
<SelectTrigger className="w-full">
|
|
||||||
<SelectValue placeholder="Select assignee" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="__none__">Unassigned</SelectItem>
|
|
||||||
{team.members
|
|
||||||
.filter((m) => m.active)
|
|
||||||
.map((m) => (
|
|
||||||
<SelectItem key={m.id} value={m.id}>
|
|
||||||
{m.name} ({m.email})
|
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<div className="text-xs font-medium text-muted-foreground">Priority</div>
|
|
||||||
<Select
|
|
||||||
value={editedArgs.priority}
|
|
||||||
onValueChange={(v) => setEditedArgs({ ...editedArgs, priority: v })}
|
|
||||||
>
|
|
||||||
<SelectTrigger className="w-full">
|
|
||||||
<SelectValue placeholder="Select priority" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
{priorities.map((p) => (
|
|
||||||
<SelectItem key={p.priority} value={String(p.priority)}>
|
|
||||||
{p.label}
|
|
||||||
</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{team.labels.length > 0 && (
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<div className="text-xs font-medium text-muted-foreground">Labels</div>
|
|
||||||
<div className="flex flex-wrap gap-1.5">
|
|
||||||
{team.labels.map((label) => {
|
|
||||||
const isSelected = editedArgs.labelIds.includes(label.id);
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
key={label.id}
|
|
||||||
type="button"
|
|
||||||
onClick={() =>
|
|
||||||
setEditedArgs({
|
|
||||||
...editedArgs,
|
|
||||||
labelIds: isSelected
|
|
||||||
? editedArgs.labelIds.filter((id) => id !== label.id)
|
|
||||||
: [...editedArgs.labelIds, label.id],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
className={`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-opacity ${
|
|
||||||
isSelected
|
|
||||||
? "opacity-100 ring-2 ring-foreground/30"
|
|
||||||
: "opacity-50 hover:opacity-80"
|
|
||||||
}`}
|
|
||||||
style={{
|
|
||||||
backgroundColor: `${label.color}33`,
|
|
||||||
color: label.color,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="size-1.5 rounded-full"
|
|
||||||
style={{ backgroundColor: label.color }}
|
|
||||||
/>
|
|
||||||
{label.name}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</>
|
<div className="space-y-1.5">
|
||||||
)}
|
<div className="text-xs font-medium text-muted-foreground">Assignee</div>
|
||||||
|
<Select
|
||||||
|
value={editedArgs.assigneeId}
|
||||||
|
onValueChange={(v) => setEditedArgs({ ...editedArgs, assigneeId: v })}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="w-full">
|
||||||
|
<SelectValue placeholder="Select assignee" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="__none__">Unassigned</SelectItem>
|
||||||
|
{team.members
|
||||||
|
.filter((m) => m.active)
|
||||||
|
.map((m) => (
|
||||||
|
<SelectItem key={m.id} value={m.id}>
|
||||||
|
{m.name} ({m.email})
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<div className="text-xs font-medium text-muted-foreground">Priority</div>
|
||||||
|
<Select
|
||||||
|
value={editedArgs.priority}
|
||||||
|
onValueChange={(v) => setEditedArgs({ ...editedArgs, priority: v })}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="w-full">
|
||||||
|
<SelectValue placeholder="Select priority" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{priorities.map((p) => (
|
||||||
|
<SelectItem key={p.priority} value={String(p.priority)}>
|
||||||
|
{p.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{team.labels.length > 0 && (
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<div className="text-xs font-medium text-muted-foreground">Labels</div>
|
||||||
|
<div className="flex flex-wrap gap-1.5">
|
||||||
|
{team.labels.map((label) => {
|
||||||
|
const isSelected = editedArgs.labelIds.includes(label.id);
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={label.id}
|
||||||
|
type="button"
|
||||||
|
onClick={() =>
|
||||||
|
setEditedArgs({
|
||||||
|
...editedArgs,
|
||||||
|
labelIds: isSelected
|
||||||
|
? editedArgs.labelIds.filter((id) => id !== label.id)
|
||||||
|
: [...editedArgs.labelIds, label.id],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
className={`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-opacity ${
|
||||||
|
isSelected
|
||||||
|
? "opacity-100 ring-2 ring-foreground/30"
|
||||||
|
: "opacity-50 hover:opacity-80"
|
||||||
|
}`}
|
||||||
|
style={{
|
||||||
|
backgroundColor: `${label.color}33`,
|
||||||
|
color: label.color,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="size-1.5 rounded-full"
|
||||||
|
style={{ backgroundColor: label.color }}
|
||||||
|
/>
|
||||||
|
{label.name}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
@ -588,10 +588,10 @@ function ApprovalCard({
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
setEditedArgs(initialEditState); // Reset to original args
|
setEditedArgs(initialEditState); // Reset to original args
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,21 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { DndPlugin, useDraggable, useDropLine } from "@platejs/dnd";
|
import { DndPlugin, useDraggable, useDropLine } from "@platejs/dnd";
|
||||||
import { expandListItemsWithChildren } from "@platejs/list";
|
import { expandListItemsWithChildren } from "@platejs/list";
|
||||||
import { BlockSelectionPlugin } from "@platejs/selection/react";
|
import { BlockSelectionPlugin } from "@platejs/selection/react";
|
||||||
import { GripVertical } from "lucide-react";
|
import { GripVertical } from "lucide-react";
|
||||||
import { type TElement, getPluginByType, isType, KEYS } from "platejs";
|
import { getPluginByType, isType, KEYS, type TElement } from "platejs";
|
||||||
import {
|
import {
|
||||||
|
MemoizedChildren,
|
||||||
type PlateEditor,
|
type PlateEditor,
|
||||||
type PlateElementProps,
|
type PlateElementProps,
|
||||||
type RenderNodeWrapper,
|
type RenderNodeWrapper,
|
||||||
MemoizedChildren,
|
|
||||||
useEditorRef,
|
useEditorRef,
|
||||||
useElement,
|
useElement,
|
||||||
usePluginOption,
|
usePluginOption,
|
||||||
|
useSelected,
|
||||||
} from "platejs/react";
|
} from "platejs/react";
|
||||||
import { useSelected } from "platejs/react";
|
import * as React from "react";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
import type { TListElement } from "platejs";
|
|
||||||
|
|
||||||
import { isOrderedList } from "@platejs/list";
|
import { isOrderedList } from "@platejs/list";
|
||||||
import { useTodoListElement, useTodoListElementState } from "@platejs/list/react";
|
import { useTodoListElement, useTodoListElementState } from "@platejs/list/react";
|
||||||
|
import type { TListElement } from "platejs";
|
||||||
import { type PlateElementProps, type RenderNodeWrapper, useReadOnly } from "platejs/react";
|
import { type PlateElementProps, type RenderNodeWrapper, useReadOnly } from "platejs/react";
|
||||||
|
import type React from "react";
|
||||||
|
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { DndPlugin } from "@platejs/dnd";
|
import { DndPlugin } from "@platejs/dnd";
|
||||||
import { useBlockSelected } from "@platejs/selection/react";
|
import { useBlockSelected } from "@platejs/selection/react";
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
import { type PlateElementProps, usePluginOption } from "platejs/react";
|
import { type PlateElementProps, usePluginOption } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
export const blockSelectionVariants = cva(
|
export const blockSelectionVariants = cva(
|
||||||
"pointer-events-none absolute inset-0 z-1 bg-brand/[.13] transition-opacity",
|
"pointer-events-none absolute inset-0 z-1 bg-brand/[.13] transition-opacity",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { type PlateElementProps, PlateElement } from "platejs/react";
|
import { PlateElement, type PlateElementProps } from "platejs/react";
|
||||||
|
|
||||||
export function BlockquoteElement(props: PlateElementProps) {
|
export function BlockquoteElement(props: PlateElementProps) {
|
||||||
return <PlateElement as="blockquote" className="my-1 border-l-2 pl-6 italic" {...props} />;
|
return <PlateElement as="blockquote" className="my-1 border-l-2 pl-6 italic" {...props} />;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { TCalloutElement } from "platejs";
|
|
||||||
|
|
||||||
import { CalloutPlugin } from "@platejs/callout/react";
|
import { CalloutPlugin } from "@platejs/callout/react";
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
import { type PlateElementProps, PlateElement, useEditorPlugin } from "platejs/react";
|
import type { TCalloutElement } from "platejs";
|
||||||
|
import { PlateElement, type PlateElementProps, useEditorPlugin } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
import { CheckIcon } from "lucide-react";
|
import { CheckIcon } from "lucide-react";
|
||||||
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { formatCodeBlock, isLangSupported } from "@platejs/code-block";
|
import { formatCodeBlock, isLangSupported } from "@platejs/code-block";
|
||||||
import { BracesIcon, Check, CheckIcon, CopyIcon } from "lucide-react";
|
import { BracesIcon, Check, CheckIcon, CopyIcon } from "lucide-react";
|
||||||
import { type TCodeBlockElement, type TCodeSyntaxLeaf, NodeApi } from "platejs";
|
import { NodeApi, type TCodeBlockElement, type TCodeSyntaxLeaf } from "platejs";
|
||||||
import {
|
import {
|
||||||
type PlateElementProps,
|
|
||||||
type PlateLeafProps,
|
|
||||||
PlateElement,
|
PlateElement,
|
||||||
|
type PlateElementProps,
|
||||||
PlateLeaf,
|
PlateLeaf,
|
||||||
|
type PlateLeafProps,
|
||||||
|
useEditorRef,
|
||||||
|
useElement,
|
||||||
|
useReadOnly,
|
||||||
} from "platejs/react";
|
} from "platejs/react";
|
||||||
import { useEditorRef, useElement, useReadOnly } from "platejs/react";
|
import * as React from "react";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { PlateLeafProps } from "platejs/react";
|
import type { PlateLeafProps } from "platejs/react";
|
||||||
|
|
||||||
import { PlateLeaf } from "platejs/react";
|
import { PlateLeaf } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
export function CodeLeaf(props: PlateLeafProps) {
|
export function CodeLeaf(props: PlateLeafProps) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
||||||
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { VariantProps } from "class-variance-authority";
|
import type { VariantProps } from "class-variance-authority";
|
||||||
import type { PlateContentProps, PlateViewProps } from "platejs/react";
|
|
||||||
|
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
|
import type { PlateContentProps, PlateViewProps } from "platejs/react";
|
||||||
import { PlateContainer, PlateContent, PlateView } from "platejs/react";
|
import { PlateContainer, PlateContent, PlateView } from "platejs/react";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { TEquationElement } from "platejs";
|
|
||||||
|
|
||||||
import { useEquationElement, useEquationInput } from "@platejs/math/react";
|
import { useEquationElement, useEquationInput } from "@platejs/math/react";
|
||||||
import { RadicalIcon } from "lucide-react";
|
import { RadicalIcon } from "lucide-react";
|
||||||
import { type PlateElementProps, PlateElement, useSelected } from "platejs/react";
|
import type { TEquationElement } from "platejs";
|
||||||
|
import { PlateElement, type PlateElementProps, useSelected } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BoldIcon,
|
BoldIcon,
|
||||||
Code2Icon,
|
Code2Icon,
|
||||||
|
|
@ -15,10 +13,11 @@ import {
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
import { useEditorReadOnly, useEditorRef } from "platejs/react";
|
import { useEditorReadOnly, useEditorRef } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { useEditorSave } from "@/components/editor/editor-save-context";
|
import { useEditorSave } from "@/components/editor/editor-save-context";
|
||||||
import { usePlatformShortcut } from "@/hooks/use-platform-shortcut";
|
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
|
import { usePlatformShortcut } from "@/hooks/use-platform-shortcut";
|
||||||
|
|
||||||
import { InsertToolbarButton } from "./insert-toolbar-button";
|
import { InsertToolbarButton } from "./insert-toolbar-button";
|
||||||
import { LinkToolbarButton } from "./link-toolbar-button";
|
import { LinkToolbarButton } from "./link-toolbar-button";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { BoldIcon, Code2Icon, ItalicIcon, StrikethroughIcon, UnderlineIcon } from "lucide-react";
|
import { BoldIcon, Code2Icon, ItalicIcon, StrikethroughIcon, UnderlineIcon } from "lucide-react";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
import { useEditorReadOnly } from "platejs/react";
|
import { useEditorReadOnly } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { LinkToolbarButton } from "./link-toolbar-button";
|
import { LinkToolbarButton } from "./link-toolbar-button";
|
||||||
import { MarkToolbarButton } from "./mark-toolbar-button";
|
import { MarkToolbarButton } from "./mark-toolbar-button";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type FloatingToolbarState,
|
type FloatingToolbarState,
|
||||||
flip,
|
flip,
|
||||||
|
|
@ -12,9 +10,9 @@ import {
|
||||||
import { useComposedRef } from "@udecode/cn";
|
import { useComposedRef } from "@udecode/cn";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
import { useEditorId, useEventEditorValue, usePluginOption } from "platejs/react";
|
import { useEditorId, useEventEditorValue, usePluginOption } from "platejs/react";
|
||||||
|
import type * as React from "react";
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
import { useIsMobile } from "@/hooks/use-mobile";
|
import { useIsMobile } from "@/hooks/use-mobile";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
import { Toolbar } from "./toolbar";
|
import { Toolbar } from "./toolbar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
import { cva, type VariantProps } from "class-variance-authority";
|
||||||
|
|
||||||
import type { PlateElementProps } from "platejs/react";
|
import type { PlateElementProps } from "platejs/react";
|
||||||
|
|
||||||
import { type VariantProps, cva } from "class-variance-authority";
|
|
||||||
import { PlateElement } from "platejs/react";
|
import { PlateElement } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
const headingVariants = cva("relative mb-1", {
|
const headingVariants = cva("relative mb-1", {
|
||||||
variants: {
|
variants: {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { PlateLeafProps } from "platejs/react";
|
import type { PlateLeafProps } from "platejs/react";
|
||||||
|
|
||||||
import { PlateLeaf } from "platejs/react";
|
import { PlateLeaf } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
export function HighlightLeaf(props: PlateLeafProps) {
|
export function HighlightLeaf(props: PlateLeafProps) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { PlateElementProps } from "platejs/react";
|
import type { PlateElementProps } from "platejs/react";
|
||||||
|
|
||||||
import { PlateElement, useFocused, useReadOnly, useSelected } from "platejs/react";
|
import { PlateElement, useFocused, useReadOnly, useSelected } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { Point, TElement } from "platejs";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type ComboboxItemProps,
|
|
||||||
Combobox,
|
Combobox,
|
||||||
ComboboxGroup,
|
ComboboxGroup,
|
||||||
ComboboxGroupLabel,
|
ComboboxGroupLabel,
|
||||||
ComboboxItem,
|
ComboboxItem,
|
||||||
|
type ComboboxItemProps,
|
||||||
ComboboxPopover,
|
ComboboxPopover,
|
||||||
ComboboxProvider,
|
ComboboxProvider,
|
||||||
ComboboxRow,
|
ComboboxRow,
|
||||||
|
|
@ -24,7 +20,9 @@ import {
|
||||||
useHTMLInputCursorState,
|
useHTMLInputCursorState,
|
||||||
} from "@platejs/combobox/react";
|
} from "@platejs/combobox/react";
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
|
import type { Point, TElement } from "platejs";
|
||||||
import { useComposedRef, useEditorRef } from "platejs/react";
|
import { useComposedRef, useEditorRef } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { DropdownMenuProps } from "@radix-ui/react-dropdown-menu";
|
import type { DropdownMenuProps } from "@radix-ui/react-dropdown-menu";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
FileCodeIcon,
|
FileCodeIcon,
|
||||||
|
|
@ -25,14 +22,14 @@ import {
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
import { type PlateEditor, useEditorRef } from "platejs/react";
|
import { type PlateEditor, useEditorRef } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
import { insertBlock, insertInlineElement } from "@/components/editor/transforms";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { insertBlock, insertInlineElement } from "@/components/editor/transforms";
|
|
||||||
|
|
||||||
import { ToolbarButton, ToolbarMenuGroup } from "./toolbar";
|
import { ToolbarButton, ToolbarMenuGroup } from "./toolbar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
import { getLinkAttributes } from "@platejs/link";
|
||||||
|
|
||||||
import type { TLinkElement } from "platejs";
|
import type { TLinkElement } from "platejs";
|
||||||
import type { PlateElementProps } from "platejs/react";
|
import type { PlateElementProps } from "platejs/react";
|
||||||
|
|
||||||
import { getLinkAttributes } from "@platejs/link";
|
|
||||||
import { PlateElement } from "platejs/react";
|
import { PlateElement } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { useLinkToolbarButton, useLinkToolbarButtonState } from "@platejs/link/react";
|
import { useLinkToolbarButton, useLinkToolbarButtonState } from "@platejs/link/react";
|
||||||
import { Link } from "lucide-react";
|
import { Link } from "lucide-react";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { ToolbarButton } from "./toolbar";
|
import { ToolbarButton } from "./toolbar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
import { flip, offset, type UseVirtualFloatingOptions } from "@platejs/floating";
|
||||||
|
|
||||||
import type { TLinkElement } from "platejs";
|
|
||||||
|
|
||||||
import { type UseVirtualFloatingOptions, flip, offset } from "@platejs/floating";
|
|
||||||
import { getLinkAttributes } from "@platejs/link";
|
import { getLinkAttributes } from "@platejs/link";
|
||||||
import {
|
import {
|
||||||
type LinkFloatingToolbarState,
|
|
||||||
FloatingLinkUrlInput,
|
FloatingLinkUrlInput,
|
||||||
|
type LinkFloatingToolbarState,
|
||||||
useFloatingLinkEdit,
|
useFloatingLinkEdit,
|
||||||
useFloatingLinkEditState,
|
useFloatingLinkEditState,
|
||||||
useFloatingLinkInsert,
|
useFloatingLinkInsert,
|
||||||
|
|
@ -16,6 +12,7 @@ import {
|
||||||
} from "@platejs/link/react";
|
} from "@platejs/link/react";
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
import { ExternalLink, Link, Text, Unlink } from "lucide-react";
|
import { ExternalLink, Link, Text, Unlink } from "lucide-react";
|
||||||
|
import type { TLinkElement } from "platejs";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
import {
|
import {
|
||||||
useEditorRef,
|
useEditorRef,
|
||||||
|
|
@ -23,6 +20,7 @@ import {
|
||||||
useFormInputProps,
|
useFormInputProps,
|
||||||
usePluginOption,
|
usePluginOption,
|
||||||
} from "platejs/react";
|
} from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { buttonVariants } from "@/components/ui/button";
|
import { buttonVariants } from "@/components/ui/button";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { useMarkToolbarButton, useMarkToolbarButtonState } from "platejs/react";
|
import { useMarkToolbarButton, useMarkToolbarButtonState } from "platejs/react";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { ToolbarButton } from "./toolbar";
|
import { ToolbarButton } from "./toolbar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { PlateElementProps } from "platejs/react";
|
import type { PlateElementProps } from "platejs/react";
|
||||||
|
|
||||||
import { PlateElement } from "platejs/react";
|
import { PlateElement } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { VariantProps } from "class-variance-authority";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type ResizeHandle as ResizeHandlePrimitive,
|
|
||||||
Resizable as ResizablePrimitive,
|
Resizable as ResizablePrimitive,
|
||||||
|
type ResizeHandle as ResizeHandlePrimitive,
|
||||||
useResizeHandle,
|
useResizeHandle,
|
||||||
useResizeHandleState,
|
useResizeHandleState,
|
||||||
} from "@platejs/resizable";
|
} from "@platejs/resizable";
|
||||||
|
|
||||||
|
import type { VariantProps } from "class-variance-authority";
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
import { Separator as SeparatorPrimitive } from "radix-ui";
|
import { Separator as SeparatorPrimitive } from "radix-ui";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { PlateElementProps } from "platejs/react";
|
|
||||||
|
|
||||||
import { SlashInputPlugin } from "@platejs/slash-command/react";
|
import { SlashInputPlugin } from "@platejs/slash-command/react";
|
||||||
import {
|
import {
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
|
|
@ -23,8 +19,10 @@ import {
|
||||||
TableIcon,
|
TableIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
|
import type { PlateElementProps } from "platejs/react";
|
||||||
import { PlateElement, useEditorRef } from "platejs/react";
|
import { PlateElement, useEditorRef } from "platejs/react";
|
||||||
|
import type * as React from "react";
|
||||||
|
import { insertBlock, insertInlineElement } from "@/components/editor/transforms";
|
||||||
import {
|
import {
|
||||||
InlineCombobox,
|
InlineCombobox,
|
||||||
InlineComboboxContent,
|
InlineComboboxContent,
|
||||||
|
|
@ -34,7 +32,6 @@ import {
|
||||||
InlineComboboxInput,
|
InlineComboboxInput,
|
||||||
InlineComboboxItem,
|
InlineComboboxItem,
|
||||||
} from "@/components/ui/inline-combobox";
|
} from "@/components/ui/inline-combobox";
|
||||||
import { insertBlock, insertInlineElement } from "@/components/editor/transforms";
|
|
||||||
|
|
||||||
interface SlashCommandItem {
|
interface SlashCommandItem {
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { useDraggable, useDropLine } from "@platejs/dnd";
|
import { useDraggable, useDropLine } from "@platejs/dnd";
|
||||||
import { BlockSelectionPlugin, useBlockSelected } from "@platejs/selection/react";
|
import { BlockSelectionPlugin, useBlockSelected } from "@platejs/selection/react";
|
||||||
import {
|
import {
|
||||||
|
|
@ -26,21 +24,22 @@ import {
|
||||||
XIcon,
|
XIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
|
KEYS,
|
||||||
|
PathApi,
|
||||||
type TElement,
|
type TElement,
|
||||||
type TTableCellElement,
|
type TTableCellElement,
|
||||||
type TTableElement,
|
type TTableElement,
|
||||||
type TTableRowElement,
|
type TTableRowElement,
|
||||||
KEYS,
|
|
||||||
PathApi,
|
|
||||||
} from "platejs";
|
} from "platejs";
|
||||||
import {
|
import {
|
||||||
type PlateElementProps,
|
|
||||||
PlateElement,
|
PlateElement,
|
||||||
|
type PlateElementProps,
|
||||||
useComposedRef,
|
useComposedRef,
|
||||||
useEditorPlugin,
|
useEditorPlugin,
|
||||||
useEditorRef,
|
useEditorRef,
|
||||||
useEditorSelector,
|
useEditorSelector,
|
||||||
useElement,
|
useElement,
|
||||||
|
useElementSelector,
|
||||||
useFocusedLast,
|
useFocusedLast,
|
||||||
usePluginOption,
|
usePluginOption,
|
||||||
useReadOnly,
|
useReadOnly,
|
||||||
|
|
@ -48,7 +47,7 @@ import {
|
||||||
useSelected,
|
useSelected,
|
||||||
withHOC,
|
withHOC,
|
||||||
} from "platejs/react";
|
} from "platejs/react";
|
||||||
import { useElementSelector } from "platejs/react";
|
import type * as React from "react";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Popover, PopoverContent } from "@/components/ui/popover";
|
import { Popover, PopoverContent } from "@/components/ui/popover";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { useToggleButton, useToggleButtonState } from "@platejs/toggle/react";
|
import { useToggleButton, useToggleButtonState } from "@platejs/toggle/react";
|
||||||
import { ChevronRightIcon } from "lucide-react";
|
import { ChevronRightIcon } from "lucide-react";
|
||||||
import { type PlateElementProps, PlateElement } from "platejs/react";
|
import { PlateElement, type PlateElementProps } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
||||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
||||||
import { type VariantProps, cva } from "class-variance-authority";
|
import { cva, type VariantProps } from "class-variance-authority";
|
||||||
import { ChevronDown } from "lucide-react";
|
import { ChevronDown } from "lucide-react";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DropdownMenuLabel,
|
DropdownMenuLabel,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
||||||
|
import type * as React from "react";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import type { DropdownMenuProps } from "@radix-ui/react-dropdown-menu";
|
import type { DropdownMenuProps } from "@radix-ui/react-dropdown-menu";
|
||||||
import type { TElement } from "platejs";
|
|
||||||
|
|
||||||
import { DropdownMenuItemIndicator } from "@radix-ui/react-dropdown-menu";
|
import { DropdownMenuItemIndicator } from "@radix-ui/react-dropdown-menu";
|
||||||
import {
|
import {
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
|
|
@ -23,16 +19,17 @@ import {
|
||||||
QuoteIcon,
|
QuoteIcon,
|
||||||
SquareIcon,
|
SquareIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
import type { TElement } from "platejs";
|
||||||
import { KEYS } from "platejs";
|
import { KEYS } from "platejs";
|
||||||
import { useEditorRef, useSelectionFragmentProp } from "platejs/react";
|
import { useEditorRef, useSelectionFragmentProp } from "platejs/react";
|
||||||
|
import * as React from "react";
|
||||||
|
import { getBlockType, setBlockType } from "@/components/editor/transforms";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuRadioItem,
|
DropdownMenuRadioItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { getBlockType, setBlockType } from "@/components/editor/transforms";
|
|
||||||
|
|
||||||
import { ToolbarButton, ToolbarMenuGroup } from "./toolbar";
|
import { ToolbarButton, ToolbarMenuGroup } from "./toolbar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ export function useAnnouncements(options: UseAnnouncementsOptions = {}) {
|
||||||
(a) => ({
|
(a) => ({
|
||||||
...a,
|
...a,
|
||||||
isRead: isAnnouncementRead(a.id),
|
isRead: isAnnouncementRead(a.id),
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (category) {
|
if (category) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export function isAnnouncementActive(announcement: Announcement, now = new Date(
|
||||||
*/
|
*/
|
||||||
export function announcementMatchesAudience(
|
export function announcementMatchesAudience(
|
||||||
announcement: Announcement,
|
announcement: Announcement,
|
||||||
isAuthenticated: boolean,
|
isAuthenticated: boolean
|
||||||
): boolean {
|
): boolean {
|
||||||
switch (announcement.audience) {
|
switch (announcement.audience) {
|
||||||
case "all":
|
case "all":
|
||||||
|
|
@ -44,10 +44,10 @@ export function announcementMatchesAudience(
|
||||||
export function getActiveAnnouncements(
|
export function getActiveAnnouncements(
|
||||||
announcements: Announcement[],
|
announcements: Announcement[],
|
||||||
isAuthenticated: boolean,
|
isAuthenticated: boolean,
|
||||||
now = new Date(),
|
now = new Date()
|
||||||
): Announcement[] {
|
): Announcement[] {
|
||||||
return announcements.filter(
|
return announcements.filter(
|
||||||
(a) => isAnnouncementActive(a, now) && announcementMatchesAudience(a, isAuthenticated),
|
(a) => isAnnouncementActive(a, now) && announcementMatchesAudience(a, isAuthenticated)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ export function getActiveAnnouncements(
|
||||||
*/
|
*/
|
||||||
export function msUntilNextTransition(
|
export function msUntilNextTransition(
|
||||||
announcements: Announcement[],
|
announcements: Announcement[],
|
||||||
now = new Date(),
|
now = new Date()
|
||||||
): number | null {
|
): number | null {
|
||||||
const nowMs = now.getTime();
|
const nowMs = now.getTime();
|
||||||
let nearest: number | null = null;
|
let nearest: number | null = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue