tiptop-editor 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,63 @@
1
- # ATTENTION:
2
- I'am still working on the package, and finising the last touches.
3
- I will update this README with all there is to know when I'm done.
4
- So please do not be mad at me if you don't understand how to use the package, it will be dealt with very soon.
1
+ # 📝 Tiptop Editor
5
2
 
6
- Thank you.
3
+ A Notion-like rich text editor built with [Tiptap v3](https://tiptap.dev/), [HeroUI](https://heroui.dev/), [Tailwind v4](https://https://tailwindcss.com) packaged as a plug-and-play React component.
4
+
5
+ ![npm version](https://img.shields.io/npm/v/tiptop-editor.svg)
6
+ ![bundle size](https://img.shields.io/bundlephobia/minzip/tiptop-editor)
7
+ ![license](https://img.shields.io/npm/l/tiptop-editor)
8
+
9
+ ---
10
+
11
+ ## ✨ Features
12
+
13
+ - Built on **Tiptap v3** — a powerful, headless rich-text editor
14
+ - Styled with **HeroUI** + **Tailwind**
15
+ - Fully typed with **TypeScript**
16
+ - Ready to embed in any React app
17
+ - Designed for **Notion-like UX**
18
+
19
+ ---
20
+
21
+ ## ⚙️ Installation
22
+ ```bash
23
+ npm install tiptop-editor
24
+ ```
25
+
26
+ ## 🚀 Usage
27
+
28
+ **Import the component in your app**
29
+ ```tsx
30
+ import { TiptopEditor } from "tiptop-editor";
31
+
32
+ <TiptopEditor />
33
+ ```
34
+ **Add the CSS code to your app**
35
+ For the package to behave like it should, you have to import the compiled CSS file. Add this line in your main css file, or import it directly in the component file that's going to host the **TiptopEditor**.
36
+ - In your main css file
37
+ ```css
38
+ @import '../node_modules/tiptop-editor/dist/tiptop-editor.css';
39
+ - In any component file
40
+ ```tsx
41
+ import 'tiptop-editor/dist/tiptop-editor.css'
42
+ **Example**
43
+ The Tiptop component takes as props all the props from the `UseEditorOptions` from [*@tiptap/react*](https://www.npmjs.com/package/@tiptap/react), except the `extensions` prop.
44
+ *Why only that prop, you ask ? Well, since this package is intended to *replicate* the Notion-like style with all their blocks/extensions, as of now, I have not allowed users to pass their own extensions. But that can change in the future, just not now.*
45
+ Anyway, to use the package, just pass your props to `editorOptions` and you're good to go. Customize the Tiptop component will the props you want, as if you were using *EditorContent and passing props to the editor*.
46
+ ```tsx
47
+ <TiptopEditor editorOptions={{
48
+ immediatelyRender: false
49
+ content: '<p>I am the Tiptop Editor</p>'
50
+ ... // Other props
51
+ }}
52
+ />
53
+ ```
54
+
55
+
56
+ ##### 🎨 Of course, I will continue to improve this project over time, as I have many more ideas (more extensions, more customizations, etc..)
57
+
58
+ I will also continue to update this Readme with relevant information.
59
+
60
+ *If you have any suggestions/recommendations to improve this project, any feedback is much appreciated (PRs welcome) !*
61
+ *I also encourage you to open up *Issues* if you find releveant bugs inside the package.*
62
+
63
+ **Thank you, and Happy Coding !**
@@ -1,11 +1,4 @@
1
- import { Editor } from '@tiptap/react';
2
- declare const ColorButton: ({ editor, buttonType, hsl, color, bgColor, tooltipText, tooltipDisabled }: {
3
- editor: Editor;
4
- buttonType: string;
5
- hsl: string;
6
- color: string;
7
- bgColor: string;
8
- tooltipText?: string;
9
- tooltipDisabled?: boolean;
10
- }) => import("react/jsx-runtime").JSX.Element;
11
- export default ColorButton;
1
+ import { default as React } from 'react';
2
+ import { ColorButtonProps } from '../types';
3
+ declare const _default: React.MemoExoticComponent<({ editor, buttonType, hsl, color, bgColor, tooltipText, tooltipDisabled, }: ColorButtonProps) => import("react/jsx-runtime").JSX.Element>;
4
+ export default _default;
@@ -1,5 +1,7 @@
1
+ import { default as React } from 'react';
1
2
  import { Editor } from '@tiptap/react';
2
- declare const ColorButtonMenu: ({ editor }: {
3
+ interface ColorButtonMenuProps {
3
4
  editor: Editor;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export default ColorButtonMenu;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ editor }: ColorButtonMenuProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
@@ -1,3 +1,4 @@
1
1
  import { EditorButtonProps } from '../types';
2
- declare const EditorButton: (props: EditorButtonProps) => import("react/jsx-runtime").JSX.Element;
3
- export default EditorButton;
2
+ import { default as React } from 'react';
3
+ declare const _default: React.MemoExoticComponent<({ editor, buttonKey, tooltipText, isIconOnly, color, variant, isDisabled, icon, iconClass, text, withActive, onPressed, }: EditorButtonProps) => import("react/jsx-runtime").JSX.Element>;
4
+ export default _default;
@@ -1,5 +1,7 @@
1
+ import { default as React } from 'react';
1
2
  import { Editor } from '@tiptap/react';
2
- declare const LinkButtonMenu: ({ editor }: {
3
+ interface LinkButtonMenuProps {
3
4
  editor: Editor;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export default LinkButtonMenu;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ editor }: LinkButtonMenuProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
@@ -1,5 +1,7 @@
1
+ import { default as React } from 'react';
1
2
  import { Editor } from '@tiptap/react';
2
- declare const MoreOptionsButtonMenu: ({ editor }: {
3
+ interface MoreOptionsButtonMenuProps {
3
4
  editor: Editor;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export default MoreOptionsButtonMenu;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ editor }: MoreOptionsButtonMenuProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
@@ -1,7 +1,4 @@
1
- import { Editor } from '@tiptap/react';
2
- declare const TextSelectionMenu: ({ editor, prepend, append }: {
3
- editor: Editor;
4
- prepend?: React.ReactNode;
5
- append?: React.ReactNode;
6
- }) => import("react/jsx-runtime").JSX.Element | null;
7
- export default TextSelectionMenu;
1
+ import { default as React } from 'react';
2
+ import { TextSelectionMenuProps } from '../types';
3
+ declare const _default: React.MemoExoticComponent<({ editor, prepend, append }: TextSelectionMenuProps) => import("react/jsx-runtime").JSX.Element>;
4
+ export default _default;
@@ -1,5 +1,7 @@
1
+ import { default as React } from 'react';
1
2
  import { Editor } from '@tiptap/react';
2
- declare const TransformIntoButtonMenu: ({ editor }: {
3
+ interface TransformIntoButtonMenuProps {
3
4
  editor: Editor;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export default TransformIntoButtonMenu;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ editor }: TransformIntoButtonMenuProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
package/dist/helpers.d.ts CHANGED
@@ -12,3 +12,5 @@ export declare const copyNodeTextContent: (editor: Editor) => void;
12
12
  export declare const deleteNode: (editor: Editor) => void;
13
13
  export declare const removeAllFormatting: (editor: Editor) => void;
14
14
  export declare const transformNodeToAlternative: (editor: Editor, targetOption: SlashCommandGroupCommandsProps) => void;
15
+ export declare const addOrUpdateLink: (editor: Editor, url: string) => void;
16
+ export declare const unsetLink: (editor: Editor) => void;