Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync/template #3780

Merged
merged 3 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import type { ReactNode } from 'react';
import type { TPlaceholderElement } from '@udecode/plate-media';

import { cn } from '@udecode/cn';
import {
insertNodes,
removeNodes,
withoutSavingHistory,
} from '@udecode/plate-common';
import {
findNodePath,
useEditorPlugin,
Expand All @@ -21,7 +26,6 @@ import {
VideoPlugin,
updateUploadHistory,
} from '@udecode/plate-media/react';
import { insertNodes, removeNodes, withoutSavingHistory } from '@udecode/slate';
import { AudioLines, FileUp, Film, ImageIcon } from 'lucide-react';
import { useFilePicker } from 'use-file-picker';

Expand Down
43 changes: 20 additions & 23 deletions apps/www/src/registry/default/plate-ui/media-toolbar-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import React, { useCallback, useEffect, useState } from 'react';
import type { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';

import { cn } from '@udecode/cn';
import { useEditorRef } from '@udecode/plate-core/react';
import { insertNodes } from '@udecode/plate-common';
import { focusEditor, useEditorRef } from '@udecode/plate-common/react';
import {
AudioPlugin,
FilePlugin,
ImagePlugin,
VideoPlugin,
} from '@udecode/plate-media/react';
import { insertNodes } from '@udecode/slate';
import { focusEditor } from '@udecode/slate-react';
import {
AudioLinesIcon,
FileUpIcon,
Expand Down Expand Up @@ -171,26 +170,24 @@ export function MediaToolbarButton({
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{currentConfig.title}</AlertDialogTitle>
<AlertDialogDescription className="flex items-center gap-2">
<div className="group relative w-full">
<label
className="absolute top-1/2 block -translate-y-1/2 cursor-text px-1 text-sm text-muted-foreground/70 transition-all group-focus-within:pointer-events-none group-focus-within:top-0 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium group-focus-within:text-foreground has-[+input:not(:placeholder-shown)]:pointer-events-none has-[+input:not(:placeholder-shown)]:top-0 has-[+input:not(:placeholder-shown)]:cursor-default has-[+input:not(:placeholder-shown)]:text-xs has-[+input:not(:placeholder-shown)]:font-medium has-[+input:not(:placeholder-shown)]:text-foreground"
htmlFor="input-32"
>
<span className="inline-flex bg-background px-2">URL</span>
</label>
<Input
id="input-32"
value={url}
onChange={(e) => setUrl(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter') embedMedia();
}}
placeholder=""
type="email"
autoFocus
/>
</div>
<AlertDialogDescription className="group relative flex w-full items-center gap-2">
<label
className="absolute top-1/2 block -translate-y-1/2 cursor-text px-1 text-sm text-muted-foreground/70 transition-all group-focus-within:pointer-events-none group-focus-within:top-0 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium group-focus-within:text-foreground has-[+input:not(:placeholder-shown)]:pointer-events-none has-[+input:not(:placeholder-shown)]:top-0 has-[+input:not(:placeholder-shown)]:cursor-default has-[+input:not(:placeholder-shown)]:text-xs has-[+input:not(:placeholder-shown)]:font-medium has-[+input:not(:placeholder-shown)]:text-foreground"
htmlFor="input-32"
>
<span className="inline-flex bg-background px-2">URL</span>
</label>
<Input
id="input-32"
value={url}
onChange={(e) => setUrl(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter') embedMedia();
}}
placeholder=""
type="email"
autoFocus
/>
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from 'react';

import { useEditorRef } from '@udecode/plate-core/react';
import { useEditorRef } from '@udecode/plate-common/react';
import { PlaceholderPlugin, UploadErrorCode } from '@udecode/plate-media/react';
import { toast } from 'sonner';

Expand Down
2 changes: 2 additions & 0 deletions templates/plate-playground-template/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OPENAI_API_KEY=
UPLOADTHING_TOKEN=
1 change: 1 addition & 0 deletions templates/plate-playground-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ cp .env.example .env.local
Configure `.env.local`:

- `OPENAI_API_KEY` – OpenAI API key ([get one here](https://platform.openai.com/account/api-keys))
- `UPLOADTHING_TOKEN` – UploadThing API key ([get one here](https://uploadthing.com/dashboard)) You can also using your own backend

Start the development server:

Expand Down
17 changes: 12 additions & 5 deletions templates/plate-playground-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-context-menu": "^2.2.2",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-toolbar": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@udecode/cn": "^39.0.0",
"@udecode/plate-ai": "40.0.4",
"@udecode/plate-ai": "40.1.0",
"@udecode/plate-alignment": "^40.0.0",
"@udecode/plate-autoformat": "^40.0.0",
"@udecode/plate-basic-elements": "^40.0.2",
Expand All @@ -43,7 +44,7 @@
"@udecode/plate-cursor": "^40.0.0",
"@udecode/plate-date": "^40.0.0",
"@udecode/plate-dnd": "40.0.0",
"@udecode/plate-docx": "40.0.2",
"@udecode/plate-docx": "40.2.0",
"@udecode/plate-emoji": "^40.0.0",
"@udecode/plate-excalidraw": "^40.0.0",
"@udecode/plate-floating": "^40.0.0",
Expand All @@ -58,20 +59,26 @@
"@udecode/plate-layout": "^40.0.0",
"@udecode/plate-line-height": "^40.0.0",
"@udecode/plate-link": "^40.0.0",
"@udecode/plate-markdown": "^40.0.4",
"@udecode/plate-markdown": "40.0.5",
"@udecode/plate-math": "^40.0.0",
"@udecode/plate-media": "40.0.0",
"@udecode/plate-media": "40.2.0",
"@udecode/plate-mention": "40.0.0",
"@udecode/plate-node-id": "^40.0.0",
"@udecode/plate-reset-node": "^40.0.0",
"@udecode/plate-resizable": "^40.0.0",
"@udecode/plate-select": "^40.0.0",
"@udecode/plate-selection": "^40.0.0",
"@udecode/plate-selection": "40.1.0",
"@udecode/plate-slash-command": "^40.0.0",
"@udecode/plate-tabbable": "^40.0.0",
"@udecode/plate-table": "^40.0.0",
"@udecode/plate-toggle": "^40.0.0",
"@udecode/plate-trailing-block": "^40.0.0",
"@uploadthing/react": "7.1.0",
"uploadthing": "7.2.0",
"zod": "^3.23.8",
"react-player": "^2.16.0",
"sonner": "^1.5.0",
"use-file-picker": "^2.1.2",
"ai": "^3.4.33",
"class-variance-authority": "0.7.0",
"clsx": "^2.1.1",
Expand Down
Loading
Loading