initial commit. gotta go

This commit is contained in:
2025-09-26 14:30:57 -05:00
parent b342335502
commit eb0b35bb7f
299 changed files with 6902 additions and 6741 deletions

View File

@@ -1,19 +1,19 @@
import { BubbleMenu as BaseBubbleMenu } from "@tiptap/react";
import React, { useCallback, useState } from "react";
import { BubbleMenu as BaseBubbleMenu } from '@tiptap/react';
import React, { useCallback, useState } from 'react';
import { MenuProps } from "../types";
import { LinkPreviewPanel } from "../components/panels/LinkPreviewPanel";
import { LinkEditorPanel } from "../components/panels/LinkEditorPanel";
import { MenuProps } from '../types';
import { LinkPreviewPanel } from '../components/panels/LinkPreviewPanel';
import { LinkEditorPanel } from '../components/panels/LinkEditorPanel';
export const LinkMenu = ({ editor, appendTo }: MenuProps): React.ReactNode => {
const [showEdit, setShowEdit] = useState(false);
const shouldShow = useCallback(() => {
const isActive = editor.isActive("link");
const isActive = editor.isActive('link');
return isActive;
}, [editor]);
const { href: link } = editor.getAttributes("link");
const { href: link } = editor.getAttributes('link');
const handleEdit = useCallback(() => {
setShowEdit(true);
@@ -24,16 +24,16 @@ export const LinkMenu = ({ editor, appendTo }: MenuProps): React.ReactNode => {
editor
.chain()
.focus()
.extendMarkRange("link")
.setLink({ href: url, target: "_blank" })
.extendMarkRange('link')
.setLink({ href: url, target: '_blank' })
.run();
setShowEdit(false);
},
[editor]
[editor],
);
const onUnsetLink = useCallback(() => {
editor.chain().focus().extendMarkRange("link").unsetLink().run();
editor.chain().focus().extendMarkRange('link').unsetLink().run();
setShowEdit(false);
return null;
}, [editor]);
@@ -54,7 +54,7 @@ export const LinkMenu = ({ editor, appendTo }: MenuProps): React.ReactNode => {
updateDelay={0}
tippyOptions={{
popperOptions: {
modifiers: [{ name: "flip", enabled: false }],
modifiers: [{ name: 'flip', enabled: false }],
},
appendTo: () => {
return appendTo?.current;
@@ -63,7 +63,7 @@ export const LinkMenu = ({ editor, appendTo }: MenuProps): React.ReactNode => {
setShowEdit(false);
},
}}
className="flex gap-1 rounded-md border border-gray-200 bg-white p-1 shadow-md items-center mt-4"
className="mt-4 flex items-center gap-1 rounded-md border border-gray-200 bg-white p-1 shadow-md"
>
{showEdit ? (
<LinkEditorPanel initialUrl={link} onSetLink={onSetLink} />