removed absolute imports from editor/core package

This commit is contained in:
Palanikannan1437 2023-10-03 09:27:52 +05:30
parent b479718ece
commit 857fa18719
19 changed files with 48 additions and 54 deletions

View File

@ -1,16 +1,16 @@
// styles
import "@/styles/tailwind.css";
import "@/styles/editor.css";
import "./styles/tailwind.css";
import "./styles/editor.css";
// utils
export { cn } from "@/lib/utils";
export { getEditorClassNames } from "@/lib/utils";
export { startImageUpload } from "@/ui/plugins/upload-image";
export { cn } from "./lib/utils";
export { getEditorClassNames } from "./lib/utils";
export { startImageUpload } from "./ui/plugins/upload-image";
// components
export { EditorContainer } from "@/ui/components/editor-container";
export { EditorContentWrapper } from "@/ui/components/editor-content";
export { EditorContainer } from "./ui/components/editor-container";
export { EditorContentWrapper } from "./ui/components/editor-content";
// hooks
export { useEditor } from "@/ui/hooks/useEditor";
export { useReadOnlyEditor } from "@/ui/hooks/useReadOnlyEditor";
export { useEditor } from "./ui/hooks/useEditor";
export { useReadOnlyEditor } from "./ui/hooks/useReadOnlyEditor";

View File

@ -1,7 +1,7 @@
import { Editor, EditorContent } from "@tiptap/react";
import { ReactNode } from "react";
import { ImageResizer } from "@/ui/extensions/image/image-resize";
import { TableMenu } from "@/ui/menus/table-menu";
import { ImageResizer } from "../extensions/image/image-resize";
import { TableMenu } from "../menus/table-menu";
interface EditorContentProps {
editor: Editor | null;

View File

@ -1,7 +1,7 @@
import Image from "@tiptap/extension-image";
import TrackImageDeletionPlugin from "@/ui/plugins/delete-image";
import UploadImagesPlugin from "@/ui/plugins/upload-image";
import { DeleteImage } from "@/types/delete-image";
import TrackImageDeletionPlugin from "../../plugins/delete-image";
import UploadImagesPlugin from "../../plugins/upload-image";
import { DeleteImage } from "../../../types/delete-image";
const ImageExtension = (deleteImage: DeleteImage) => Image.extend({
addProseMirrorPlugins() {

View File

@ -8,16 +8,16 @@ import TaskList from "@tiptap/extension-task-list";
import { Markdown } from "tiptap-markdown";
import Gapcursor from "@tiptap/extension-gapcursor";
import { CustomTableCell } from "@/ui/extensions/table/table-cell";
import { Table } from "@/ui/extensions/table";
import { TableHeader } from "@/ui/extensions/table/table-header";
import { CustomTableCell } from "./table/table-cell";
import { Table } from "./table";
import { TableHeader } from "./table/table-header";
import { TableRow } from "@tiptap/extension-table-row";
import ImageExtension from "@/ui/extensions/image";
import ImageExtension from "./image";
import { DeleteImage } from "@/types/delete-image";
import { DeleteImage } from "../../types/delete-image";
import isValidHttpUrl from "@/ui/menus/bubble-menu/utils"
import isValidHttpUrl from "../menus/bubble-menu/utils"
export const CoreEditorExtensions = (
deleteFile: DeleteImage,

View File

@ -1,12 +1,12 @@
import { useEditor as useCustomEditor, Editor } from "@tiptap/react";
import { useImperativeHandle, useRef, MutableRefObject } from "react";
import { useDebouncedCallback } from "use-debounce";
import { UploadImage } from '@/types/upload-image';
import { DeleteImage } from '@/types/delete-image';
import { DeleteImage } from '../../types/delete-image';
import { CoreEditorProps } from "../props";
import { CoreEditorExtensions } from "../extensions";
import { EditorProps } from '@tiptap/pm/view';
import { getTrimmedHTML } from "@/lib/utils";
import { getTrimmedHTML } from "../../lib/utils";
import { UploadImage } from "../../types/upload-image";
const DEBOUNCE_DELAY = 1500;
@ -25,7 +25,6 @@ interface CustomEditorProps {
}
export const useEditor = ({ uploadFile, editable, deleteFile, editorProps = {}, value, extensions = [], onChange, setIsSubmitting, debouncedUpdatesEnabled, forwardedRef, setShouldShowAlert, }: CustomEditorProps) => {
console.log("content aaya", value)
const editor = useCustomEditor({
editable: editable ?? true,
editorProps: {

View File

@ -1,7 +1,7 @@
import { useEditor as useCustomEditor, Editor } from "@tiptap/react";
import { useImperativeHandle, useRef, MutableRefObject } from "react";
import { CoreReadOnlyEditorExtensions } from "@/ui/read-only/extensions";
import { CoreReadOnlyEditorProps } from "@/ui/read-only/props";
import { CoreReadOnlyEditorExtensions } from "../../ui/read-only/extensions";
import { CoreReadOnlyEditorProps } from "../../ui/read-only/props";
interface CustomReadOnlyEditorProps {
value: string;

View File

@ -1,13 +1,13 @@
"use client"
import * as React from 'react';
import { Extension } from "@tiptap/react";
import { UploadImage } from '@/types/upload-image';
import { DeleteImage } from '@/types/delete-image';
import { getEditorClassNames } from '@/lib/utils';
import { UploadImage } from '../types/upload-image';
import { DeleteImage } from '../types/delete-image';
import { getEditorClassNames } from '../lib/utils';
import { EditorProps } from '@tiptap/pm/view';
import { useEditor } from './hooks/useEditor';
import { EditorContainer } from '@/ui/components/editor-container';
import { EditorContentWrapper } from '@/ui/components/editor-content';
import { EditorContainer } from '../ui/components/editor-container';
import { EditorContentWrapper } from '../ui/components/editor-content';
interface ICoreEditor {
value: string;

View File

@ -4,7 +4,7 @@ import { BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon } from
import { NodeSelector } from "./node-selector";
import { LinkSelector } from "./link-selector";
import { cn } from "@/lib/utils";
import { cn } from "../../../lib/utils";
export interface BubbleMenuItem {
name: string;

View File

@ -1,8 +1,8 @@
import { cn } from "@/lib/utils";
import { cn } from "../../../lib/utils";
import { Editor } from "@tiptap/core";
import { Check, Trash } from "lucide-react";
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useRef } from "react";
import isValidHttpUrl from "@/ui/menus/bubble-menu/utils";
import isValidHttpUrl from "./utils";
interface LinkSelectorProps {
editor: Editor;

View File

@ -1,4 +1,4 @@
import { cn } from "@/lib/utils";
import { cn } from "../../../lib/utils";
import { Editor } from "@tiptap/core";
import {
Check,

View File

@ -1,7 +1,7 @@
import { Editor } from "@tiptap/react";
import { BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon } from "lucide-react";
import { cn } from "@/lib/utils";
import { cn } from "../../../lib/utils";
import { Tooltip } from "../table-menu/tooltip";
import { Icon } from "./icon";

View File

@ -4,7 +4,7 @@ import InsertLeftTableIcon from "./InsertLeftTableIcon";
import InsertRightTableIcon from "./InsertRightTableIcon";
import InsertTopTableIcon from "./InsertTopTableIcon";
import InsertBottomTableIcon from "./InsertBottomTableIcon";
import { cn, findTableAncestor } from "@/lib/utils";
import { cn, findTableAncestor } from "../../../lib/utils";
import { Tooltip } from "./tooltip";
interface TableMenuItem {

View File

@ -1,6 +1,6 @@
import { EditorState, Plugin, PluginKey, Transaction } from "@tiptap/pm/state";
import { Node as ProseMirrorNode } from "@tiptap/pm/model";
import { DeleteImage } from "@/types/delete-image";
import { DeleteImage } from "../../types/delete-image";
const deleteKey = new PluginKey("delete-image");
const IMAGE_NODE_TYPE = "image";

View File

@ -1,4 +1,4 @@
import { UploadImage } from "@/types/upload-image";
import { UploadImage } from "../../types/upload-image";
import { EditorState, Plugin, PluginKey } from "@tiptap/pm/state";
import { Decoration, DecorationSet, EditorView } from "@tiptap/pm/view";

View File

@ -1,7 +1,7 @@
import { EditorProps } from "@tiptap/pm/view";
import { findTableAncestor } from "@/lib/utils";
import { startImageUpload } from "@/ui/plugins/upload-image";
import { UploadImage } from "@/types/upload-image";
import { findTableAncestor } from "../lib/utils";
import { startImageUpload } from "./plugins/upload-image";
import { UploadImage } from "../types/upload-image";
export function CoreEditorProps(
uploadFile: UploadImage,

View File

@ -8,13 +8,13 @@ import TaskList from "@tiptap/extension-task-list";
import { Markdown } from "tiptap-markdown";
import Gapcursor from "@tiptap/extension-gapcursor";
import { CustomTableCell } from "@/ui/extensions/table/table-cell";
import { Table } from "@/ui/extensions/table";
import { TableHeader } from "@/ui/extensions/table/table-header";
import { CustomTableCell } from "../extensions/table/table-cell";
import { Table } from "../extensions/table";
import { TableHeader } from "../extensions/table/table-header";
import { TableRow } from "@tiptap/extension-table-row";
import isValidHttpUrl from "@/ui/menus/bubble-menu/utils";
import ReadOnlyImageExtension from "@/ui/extensions/image/read-only-image";
import isValidHttpUrl from "../menus/bubble-menu/utils";
import ReadOnlyImageExtension from "../extensions/image/read-only-image";
export const CoreReadOnlyEditorExtensions = [
StarterKit.configure({

View File

@ -11,10 +11,5 @@
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
}
}
}

View File

@ -1,5 +1,5 @@
import { EnterKeyExtension } from "./enter-key-extension";
export const LiteTextEditorExtensions = () => [
EnterKeyExtension
EnterKeyExtension,
];

View File

@ -8,7 +8,7 @@ import ts from "highlight.js/lib/languages/typescript";
// import "highlight.js/styles/github-dark.css";
import SlashCommand from "./slash-command";
import { UploadImage } from "..";
import { UploadImage } from "../";
const lowlight = createLowlight(common)
lowlight.register("ts", ts);