vdc-editor 0.1.19 → 0.1.21

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,193 +1,57 @@
1
- # Web Editor and React Native App
1
+ # Gemiso Web Editor
2
2
 
3
- ## Overview
3
+ A powerful Vue 3 based rich text editor library with extensive features and customization options.
4
4
 
5
- This repository contains two main projects:
5
+ ## Tech Stack
6
6
 
7
- 1. **Web Editor**: A web-based text editor built with Vue.js and [Tiptap](https://tiptap.dev/), a modern and extendable rich-text editor framework.
8
- 2. **React Native App**: A mobile app built with React Native that wraps the web editor using a WebView, making the editor accessible on mobile platforms.
7
+ - **Vue 3** - Progressive JavaScript framework for building user interfaces
8
+ - **TypeScript** - Typed superset of JavaScript that compiles to plain JavaScript
9
+ - **Tiptap** - Headless WYSIWYG text editor framework
10
+ - **Tailwind CSS** - Utility-first CSS framework
11
+ - **Vite** - Next generation frontend tooling
12
+ - **Shadcn UI** - Re-usable components built with Tailwind CSS
9
13
 
10
- ---
14
+ ## Development
11
15
 
12
- ## Table of Contents
16
+ ```bash
17
+ # Install dependencies
18
+ pnpm install
13
19
 
14
- - [Web Editor](#web-editor)
15
- - [Features](#features)
16
- - [Setup and Installation](#setup-and-installation)
17
- - [Usage](#usage)
18
- - [React Native App](#react-native-app)
19
- - [Features](#features-1)
20
- - [Setup and Installation](#setup-and-installation-1)
21
- - [Usage](#usage-1)
22
- - [Project Structure](#project-structure)
23
- - [Scripts](#scripts)
24
- - [Contributing](#contributing)
25
- - [License](#license)
26
-
27
- ---
28
-
29
- ## Web Editor
30
-
31
- ### Features
32
-
33
- - **Rich-text editing**: Using Tiptap to provide a highly customizable editing experience.
34
- - **Vue.js**: The frontend framework for building reactive user interfaces.
35
- - **Customization**: Easily extendable with additional features and plugins from the Tiptap ecosystem.
36
-
37
- ### Setup and Installation
38
-
39
- 1. **Clone the repository:**
40
-
41
- ```bash
42
- git clone https://github.com/your-username/your-repo-name.git
43
- cd your-repo-name
44
- ```
45
-
46
- 2. **Navigate to the web editor folder:**
47
-
48
- ```bash
49
- cd pakages/web
50
- ```
51
-
52
- 3. **Install dependencies:**
53
-
54
- ```bash
55
- npm install
56
- ```
57
-
58
- 4. **Run the development server:**
59
-
60
- ```bash
61
- npm run dev
62
- ```
63
-
64
- 5. **Open the editor in your browser** at `http://localhost:5173/`.
65
-
66
- ### Usage
67
-
68
- To start using the editor, simply open the URL in your browser, and you will see a full-featured text editor. You can edit, format, and style text as you like. More features can be added through Tiptap extensions.
69
-
70
- ---
71
-
72
- ## React Native App
73
-
74
- ### Features
75
-
76
- - **WebView**: Displays the Vue-based web editor inside a WebView component.
77
- - **Cross-platform**: Available for both iOS and Android through React Native.
78
- - **Simple navigation**: Load the web editor seamlessly inside the app.
79
-
80
- ### Setup and Installation
81
-
82
- 1. **Navigate to the React Native app folder:**
83
-
84
- ```bash
85
- cd pakages/native
86
- ```
87
-
88
- 2. **Install dependencies:**
89
-
90
- ```bash
91
- npm install
92
- ```
93
-
94
- 3. **Link required packages (for React Native < 0.60):**
95
-
96
- ```bash
97
- react-native link
98
- ```
99
-
100
- 4. **Run the app on iOS or Android:**
101
-
102
- For iOS:
103
-
104
- ```bash
105
- npx react-native run-ios
106
- ```
107
-
108
- For Android:
109
-
110
- ```bash
111
- npx react-native run-android
112
- ```
113
-
114
- ### Usage
115
-
116
- Once the app is running, it will open the web editor inside a WebView, allowing users to edit text from their mobile devices with a responsive interface.
117
-
118
- ---
119
-
120
- ## Project Structure
20
+ # Start development server
21
+ pnpm dev
121
22
 
122
- ```
123
- /packages
124
-
125
- ├── /web # Vue.js project containing the Tiptap editor
126
- │ ├── /src # Vue components and assets
127
- │ ├── /public # Static files
128
- │ └── package.json # Web editor dependencies and scripts
129
-
130
- ├── /native # React Native project wrapping the web editor
131
- │ ├── ... [Link text](https://docs.expo.dev/get-started/start-developing/)
132
-
133
- └── README.md # This README file
134
- ```
135
-
136
- ---
137
-
138
- ## Scripts
139
-
140
- The `package.json` file includes the following script commands under the `"scripts"` section:
141
-
142
- ```json
143
- "scripts": {
144
- "app": "yarn workspace native-app start",
145
- "web": "yarn workspace web-app dev"
146
- }
23
+ # Build library
24
+ pnpm build:lib
147
25
  ```
148
26
 
149
- ### Breakdown:
27
+ ## Available Scripts
150
28
 
151
- - **`"app": "yarn workspace native-app start"`**
29
+ In the project directory, you can run:
152
30
 
153
- - This command is used to **start the React Native app**.
154
- - It specifies that the command should be run within the `native-app` workspace.
155
- - `native-app` refers to the folder that contains the React Native code.
156
- - When you run `yarn app`, it triggers the `yarn start` command in the `native-app` workspace, which will launch the development environment for the React Native app, allowing you to run it on your mobile devices or emulators.
31
+ ### Development
32
+ - `pnpm dev` - Starts the development server using Vite
33
+ - `pnpm build:lib` - Builds the library for production
157
34
 
158
- - **`"web": "yarn workspace web-app dev"`**
159
- - This command is used to **start the web editor** (Vue.js + Tiptap).
160
- - Similar to the React Native script, it is scoped to the `web-app` workspace.
161
- - `web-app` refers to the folder containing the Vue.js web editor.
162
- - When you run `yarn web`, it triggers the `yarn dev` command in the `web-app` workspace, which will start the local development server, allowing you to view and develop the editor in a browser.
35
+ ### Code Quality
36
+ - `pnpm prettier` - Formats all files using Prettier
37
+ - `pnpm lint` - Runs ESLint to check for code issues
38
+ - `pnpm lint:fix` - Automatically fixes ESLint issues when possible
163
39
 
164
- ### How to Use:
40
+ ### Publishing
41
+ - `pnpm push` - Builds the library and publishes it to npm registry
165
42
 
166
- 1. **To run the mobile app (React Native)**:
43
+ ### Version Management
44
+ - `pnpm version:patch` - Bumps patch version (0.0.x), creates git tag, and publishes
45
+ - `pnpm version:minor` - Bumps minor version (0.x.0), creates git tag, and publishes
46
+ - `pnpm version:major` - Bumps major version (x.0.0), creates git tag, and publishes
167
47
 
168
- ```bash
169
- yarn app
170
- ```
48
+ ### Git Hooks
49
+ - `pnpm prepare` - Sets up Husky for git hooks
171
50
 
172
- 2. **To run the web editor (Vue.js + Tiptap)**:
173
- ```bash
174
- yarn web
175
- ```
51
+ ## License
176
52
 
177
- ---
53
+ [MIT License](LICENSE)
178
54
 
179
55
  ## Contributing
180
56
 
181
- Contributions are welcome! Please follow the steps below to contribute:
182
-
183
- 1. Fork the repository.
184
- 2. Create a new feature branch (`git checkout -b feature-branch`).
185
- 3. Commit your changes (`git commit -m 'Add some feature'`).
186
- 4. Push to the branch (`git push origin feature-branch`).
187
- 5. Create a new Pull Request.
188
-
189
- ---
190
-
191
- ## License
192
-
193
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
57
+ Contributions are welcome! Please feel free to submit a Pull Request.
@@ -4,6 +4,7 @@ import { EditorMode } from '../type';
4
4
  interface Props {
5
5
  editor: Editor | null;
6
6
  mode: EditorMode;
7
+ superTextStore?: any;
7
8
  }
8
9
  declare function __VLS_template(): {
9
10
  default?(_: {}): any;
@@ -1,2 +1,34 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
1
+ interface Props {
2
+ pageId: string;
3
+ pageNumber: number;
4
+ superTextStore?: any;
5
+ }
6
+ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
7
+ pageId: string;
8
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
+ updateWidth: (...args: any[]) => void;
10
+ }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
11
+ pageId: string;
12
+ }>>> & Readonly<{
13
+ onUpdateWidth?: ((...args: any[]) => any) | undefined;
14
+ }>, {
15
+ pageId: string;
16
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
17
  export default _default;
18
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
19
+ type __VLS_TypePropsToRuntimeProps<T> = {
20
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
21
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
22
+ } : {
23
+ type: import('vue').PropType<T[K]>;
24
+ required: true;
25
+ };
26
+ };
27
+ type __VLS_WithDefaults<P, D> = {
28
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
29
+ default: D[K];
30
+ }> : P[K];
31
+ };
32
+ type __VLS_Prettify<T> = {
33
+ [K in keyof T]: T[K];
34
+ } & {};
@@ -1,5 +1,5 @@
1
- import { Editor } from '@tiptap/core';
2
1
  import { EditorMode } from '../type';
2
+ import { Editor } from '@tiptap/core';
3
3
 
4
4
  interface Props {
5
5
  editor: Editor;
@@ -0,0 +1,82 @@
1
+ import { EditorProps } from '../../type';
2
+ import { Editor } from '@tiptap/vue-3';
3
+
4
+ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EditorProps>, {
5
+ modelValue: string;
6
+ output: string;
7
+ dark: undefined;
8
+ disabled: boolean;
9
+ hideToolbar: boolean;
10
+ disableBubble: boolean;
11
+ hideBubble: boolean;
12
+ superTextArea: any;
13
+ maxWidth: undefined;
14
+ minHeight: number;
15
+ maxHeight: undefined;
16
+ extensions: () => never[];
17
+ editorClass: undefined;
18
+ contentClass: undefined;
19
+ }>>, {
20
+ editor: Editor;
21
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
+ enter: () => void;
23
+ change: (value: import('../../type').SBSEditorOnChange) => void;
24
+ "update:modelValue": (value: string | object | undefined) => void;
25
+ "changed:selection": (value: any) => void;
26
+ }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EditorProps>, {
27
+ modelValue: string;
28
+ output: string;
29
+ dark: undefined;
30
+ disabled: boolean;
31
+ hideToolbar: boolean;
32
+ disableBubble: boolean;
33
+ hideBubble: boolean;
34
+ superTextArea: any;
35
+ maxWidth: undefined;
36
+ minHeight: number;
37
+ maxHeight: undefined;
38
+ extensions: () => never[];
39
+ editorClass: undefined;
40
+ contentClass: undefined;
41
+ }>>> & Readonly<{
42
+ onChange?: ((value: import('../../type').SBSEditorOnChange) => any) | undefined;
43
+ onEnter?: (() => any) | undefined;
44
+ "onUpdate:modelValue"?: ((value: string | object | undefined) => any) | undefined;
45
+ "onChanged:selection"?: ((value: any) => any) | undefined;
46
+ }>, {
47
+ disabled: boolean;
48
+ extensions: import('@tiptap/core').AnyExtension[];
49
+ modelValue: string | object;
50
+ output: "html" | "json" | "text";
51
+ maxHeight: string | number;
52
+ maxWidth: string | number;
53
+ minHeight: string | number;
54
+ superTextArea: {
55
+ view: boolean;
56
+ button: boolean;
57
+ };
58
+ dark: boolean;
59
+ hideToolbar: boolean;
60
+ disableBubble: boolean;
61
+ hideBubble: boolean;
62
+ editorClass: string | string[] | Record<string, any>;
63
+ contentClass: string | string[] | Record<string, any>;
64
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
65
+ export default _default;
66
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
67
+ type __VLS_TypePropsToRuntimeProps<T> = {
68
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
69
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
70
+ } : {
71
+ type: import('vue').PropType<T[K]>;
72
+ required: true;
73
+ };
74
+ };
75
+ type __VLS_WithDefaults<P, D> = {
76
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
77
+ default: D[K];
78
+ }> : P[K];
79
+ };
80
+ type __VLS_Prettify<T> = {
81
+ [K in keyof T]: T[K];
82
+ } & {};
@@ -1,17 +1,17 @@
1
1
  import { HTMLAttributes } from 'vue';
2
- import { ContextMenuRadioItemProps } from 'radix-vue';
2
+ import { CheckboxRootProps } from 'radix-vue';
3
3
 
4
4
  declare function __VLS_template(): {
5
5
  default?(_: {}): any;
6
6
  };
7
- declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ContextMenuRadioItemProps & {
7
+ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<CheckboxRootProps & {
8
8
  class?: HTMLAttributes["class"];
9
9
  }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
- select: (event: Event) => void;
11
- }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ContextMenuRadioItemProps & {
10
+ "update:checked": (value: boolean) => void;
11
+ }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<CheckboxRootProps & {
12
12
  class?: HTMLAttributes["class"];
13
13
  }>>> & Readonly<{
14
- onSelect?: ((event: Event) => any) | undefined;
14
+ "onUpdate:checked"?: ((value: boolean) => any) | undefined;
15
15
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
16
16
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
17
17
  export default _default;
@@ -143,7 +143,7 @@ export declare const useTiptapStore: () => {
143
143
  removeSuperText: (state: Pick<import('./useSuperTextStore').ModalState, "id">) => void;
144
144
  superText: import('vue').Reactive<import('./useSuperTextStore').ModalState[]>;
145
145
  updateSuperText: (state: import('./useSuperTextStore').ModalState) => void;
146
- updatePositionSuperText: (state: Pick<import('./useSuperTextStore').ModalState, "position" | "id">) => void;
146
+ updatePositionSuperText: (state: Pick<import('./useSuperTextStore').ModalState, "position" | "id" | "pageId">) => void;
147
147
  addMoreSuperText: (text: string, position?: DOMRect) => string;
148
148
  addSuperText: (state: import('./useSuperTextStore').ModalState) => void;
149
149
  onUpdatePositionEvent: import('@vueuse/core').EventHookOn<any>;
@@ -1,5 +1,6 @@
1
1
  export type ModalState = {
2
2
  id: number | string;
3
+ pageId?: number | string;
3
4
  text: string;
4
5
  position?: {
5
6
  top?: number | string;
@@ -10,7 +11,7 @@ export declare const useSuperTextStore: () => {
10
11
  removeSuperText: (state: Pick<ModalState, "id">) => void;
11
12
  superText: import('vue').Reactive<ModalState[]>;
12
13
  updateSuperText: (state: ModalState) => void;
13
- updatePositionSuperText: (state: Pick<ModalState, "position" | "id">) => void;
14
+ updatePositionSuperText: (state: Pick<ModalState, "position" | "id" | "pageId">) => void;
14
15
  addMoreSuperText: (text: string, position?: DOMRect) => string;
15
16
  addSuperText: (state: ModalState) => void;
16
17
  onUpdatePositionEvent: import('@vueuse/core').EventHookOn<any>;
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vue';
2
- import { default as CoreEditor, EditorProps, EditorEmits } from './components/CoreEditor.vue';
2
+ import { default as CoreEditor } from './components/editor/CoreEditor.vue';
3
3
 
4
4
  declare const SBSEditorPlugin: Plugin;
5
5
  export * as extension from './extensions';
@@ -10,5 +10,4 @@ export { useEditor } from '@tiptap/vue-3';
10
10
  export { type Editor as EditorInstance } from '@tiptap/core';
11
11
  export { enUS, koKR } from './locales';
12
12
  export { SBSEditorPlugin, CoreEditor };
13
- export type { EditorProps, EditorEmits };
14
13
  export default SBSEditorPlugin;
package/lib/src/type.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Editor as CoreEditor, Extension, JSONContent } from '@tiptap/core';
2
- import { Editor } from '@tiptap/vue-3';
1
+ import { Editor as CoreEditor, Extension, JSONContent, AnyExtension } from '@tiptap/core';
2
+ import { Editor, EditorOptions } from '@tiptap/vue-3';
3
3
  import { icons } from './components/icons';
4
4
  import { SplitContext } from './extensions/Page/computed';
5
5
 
@@ -146,7 +146,11 @@ export interface PageOption {
146
146
  export interface Config {
147
147
  sidebar: boolean;
148
148
  }
149
- export type EditorMode = 'editor' | 'straight' | 'report';
149
+ export declare enum EditorMode {
150
+ EDITOR = "editor",
151
+ STRAIGHT = "straight",
152
+ REPORT = "report"
153
+ }
150
154
  export interface ITextWithPosition {
151
155
  startIndex: number;
152
156
  length: number;
@@ -169,3 +173,94 @@ export interface IProofreaderInterface {
169
173
  normalizeTextForLanguage(text: string): string;
170
174
  setActiveSpellCheck(): void;
171
175
  }
176
+ export type KeyDownHandler = NonNullable<EditorOptions['editorProps']['handleKeyDown']>;
177
+ export type UpdateHandler = NonNullable<EditorOptions['onUpdate']>;
178
+ export interface EditorProps {
179
+ /**
180
+ * super Text Area
181
+ *
182
+ * @default show: false
183
+ * @default default: false
184
+ */
185
+ superTextArea?: {
186
+ view: boolean;
187
+ button: boolean;
188
+ };
189
+ /**
190
+ * Editor mode
191
+ *
192
+ * @default 'straight'
193
+ */
194
+ mode: EditorMode;
195
+ /**
196
+ * input value
197
+ */
198
+ modelValue?: string | object;
199
+ /**
200
+ * Editor output type
201
+ *
202
+ * @default 'html'
203
+ */
204
+ output?: 'html' | 'json' | 'text';
205
+ /**
206
+ * dark mode
207
+ *
208
+ * @default false
209
+ */
210
+ dark?: boolean;
211
+ /**
212
+ * Readonly
213
+ *
214
+ * @default false
215
+ */
216
+ disabled?: boolean;
217
+ /**
218
+ * Hide Editor Toolbar
219
+ *
220
+ * @default false
221
+ */
222
+ hideToolbar?: boolean;
223
+ /**
224
+ * Hide Editor Menubar
225
+ *
226
+ * @default false
227
+ */
228
+ hideMenubar?: boolean;
229
+ /**
230
+ * Hide Editor Bubble Menu
231
+ *
232
+ * @default false
233
+ */
234
+ disableBubble?: boolean;
235
+ hideBubble?: boolean;
236
+ /**
237
+ * Editor content maximum width
238
+ */
239
+ maxWidth?: string | number;
240
+ /**
241
+ * Editor content minimum height
242
+ */
243
+ minHeight?: string | number;
244
+ /**
245
+ * Editor content maximum height
246
+ */
247
+ maxHeight?: string | number;
248
+ /**
249
+ * Tiptap extensions
250
+ */
251
+ extensions?: AnyExtension[];
252
+ /**
253
+ * Editor container class
254
+ */
255
+ editorClass?: string | string[] | Record<string, any>;
256
+ /**
257
+ * Editor content class
258
+ */
259
+ contentClass?: string | string[] | Record<string, any>;
260
+ }
261
+ export interface EditorEmits {
262
+ (event: 'enter'): void;
263
+ (event: 'change', value: SBSEditorOnChange): void;
264
+ (event: 'update:modelValue', value: EditorProps['modelValue']): void;
265
+ (event: 'changed:selection', value: any): void;
266
+ }
@@ -1,3 +1,4 @@
1
1
  export declare enum EventKey {
2
- TOGGLE_SUPER_TEXT = "toggle-super-text"
2
+ TOGGLE_SUPER_TEXT = "toggle-super-text",
3
+ SUPER_TEXT_UPDATE_POSITION = "SUPER_TEXT_UPDATE_POSITION"
3
4
  }