Skip to content

Commit

Permalink
style: update style dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
hunghg255 committed Oct 25, 2024
1 parent aa530df commit 208ebcf
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
12 changes: 6 additions & 6 deletions playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ const extensions = [
},
}),
Video.configure({
upload: (files: File[]) => {
const f = files.map(file => ({
src: URL.createObjectURL(file),
alt: file.name,
}))
return Promise.resolve(f)
upload: (files: File) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(URL.createObjectURL(files))
}, 500)
})
},
}),
ImageGif.configure({
Expand Down
2 changes: 1 addition & 1 deletion src/components/RichTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function RichTextEditor(props: RichTextEditorProps, ref: React.ForwardedRef<{ ed

return (
<div className="reactjs-tiptap-editor">
<TooltipProvider delayDuration={0}>
<TooltipProvider delayDuration={0} disableHoverableContent>
<div className="richtext-rounded-[0.5rem] richtext-bg-background richtext-shadow richtext-overflow-hidden richtext-outline richtext-outline-1">

<div className="richtext-flex richtext-flex-col richtext-w-full richtext-max-h-full">
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const Checkbox = React.forwardRef<
<CheckboxPrimitive.Root
ref={ref}
className={cn(
'richtext-peer richtext-h-4 richtext-w-4 richtext-shrink-0 richtext-rounded-sm richtext-border richtext-border-primary richtext-ring-offset-background focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 data-[state=checked]:richtext-bg-primary data-[state=checked]:richtext-text-primary-foreground',
'!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-p-0 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-2 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground',
className,
)}
{...props}
>
<CheckboxPrimitive.Indicator
className={cn('richtext-flex richtext-items-center richtext-justify-center richtext-text-current')}
className={cn('!richtext-flex !richtext-p-0 !richtext-items-center !richtext-justify-center !richtext-text-current')}
>
<Check className="richtext-h-4 richtext-w-4" />
<Check className="!richtext-h-4 !richtext-w-4" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
))
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
'richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg',
'richtext-dialog-content richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg',
className,
)}
{...props}
Expand Down
3 changes: 2 additions & 1 deletion src/constants/resetCSS.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const RESET_CSS = `
.reactjs-tiptap-editor {
.reactjs-tiptap-editor, .richtext-dialog-content {
button,
input:where([type=button]),
input:where([type=reset]),
Expand Down Expand Up @@ -36,6 +36,7 @@ export const RESET_CSS = `
}
.reactjs-tiptap-editor,
.richtext-dialog-content,
div[data-radix-popper-content-wrapper],
div[data-tippy-root] {
*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const ExcalidrawActiveButton: React.FC<IProps> = ({ editor }) => {
<DialogContent className="!richtext-max-w-[1300px] richtext-z-[99999]">
<DialogTitle>Excalidraw</DialogTitle>

<div style={{ height: '100%', border: '1px solid hsl(var(--border))' }}>
<div style={{ height: '100%', borderWidth: 1 }}>
{loading && (
<p>
Loading...
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/Image/components/ImageCropper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function ImageCropper({ editor, imageInline, onClose }: any) {
<Dialog open={dialogOpen}>
<DialogTrigger />

<DialogContent className="[&>button]:richtext-hidden">
<DialogContent>
<DialogTitle>{t('editor.image.dialog.tab.uploadCrop')}</DialogTitle>

<div>
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/Mermaid/components/MermaidActiveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const MermaidActiveButton: React.FC<IProps> = ({ editor, upload }) => {
<DialogContent className="!richtext-max-w-[1300px] richtext-z-[99999]">
<DialogTitle>Mermaid</DialogTitle>

<div style={{ height: '100%', border: '1px solid hsl(var(--border))' }}>
<div style={{ height: '100%', borderWidth: 1 }}>
<div className="richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]">
<Textarea
className="richtext-flex-1"
Expand All @@ -125,7 +125,7 @@ export const MermaidActiveButton: React.FC<IProps> = ({ editor, upload }) => {

<div
className="richtext-flex-1 richtext-flex richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]"
style={{ height: '100%', border: '1px solid hsl(var(--border))', minHeight: 500, background: '#fff' }}
style={{ height: '100%', borderWidth: 1, minHeight: 500, background: '#fff' }}
ref={mermaidRef as any}
dangerouslySetInnerHTML={{ __html: svgCode }}
/>
Expand Down

0 comments on commit 208ebcf

Please sign in to comment.