@sanmokeji/smo-editor 0.0.7 → 0.0.8
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 +16 -40
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
🚀 **SmoEditor** 是一款基于 Vue 3 和 Tiptap 打造的轻量、高效、开箱即用的富文本编辑器组件。具备完美的 TypeScript 类型支持。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
7
|
## ✨ 特性
|
|
8
8
|
|
|
@@ -31,14 +31,6 @@ npm install @sanmokeji/smo-editor
|
|
|
31
31
|
yarn add @sanmokeji/smo-editor
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
### 前置依赖
|
|
35
|
-
|
|
36
|
-
确保项目中已安装以下 peer 依赖:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pnpm add vue @tiptap/vue-3
|
|
40
|
-
```
|
|
41
|
-
|
|
42
34
|
## 🚀 快速开始
|
|
43
35
|
|
|
44
36
|
```vue
|
|
@@ -74,13 +66,13 @@ const html = ref('<p>初始内容</p>')
|
|
|
74
66
|
|
|
75
67
|
### Props
|
|
76
68
|
|
|
77
|
-
| 属性
|
|
78
|
-
| --------------- | ----------------------------------------------------------------- | ------ |
|
|
69
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
70
|
+
| --------------- | ----------------------------------------------------------------- | ------ | --------------------------- |
|
|
79
71
|
| `modelValue` | `string` | `''` | 编辑器 HTML 内容(v-model) |
|
|
80
|
-
| `editable` | `boolean` | `true` | 是否为可编辑状态
|
|
81
|
-
| `placeholder` | `string` | `''` | 占位符文本
|
|
72
|
+
| `editable` | `boolean` | `true` | 是否为可编辑状态 |
|
|
73
|
+
| `placeholder` | `string` | `''` | 占位符文本 |
|
|
82
74
|
| `height` | `string \| number` | — | 编辑器容器高度 |
|
|
83
|
-
| `onImageUpload` | `(file: File) => ImageUploadResult \| Promise<ImageUploadResult>` | — | 图片上传回调
|
|
75
|
+
| `onImageUpload` | `(file: File) => ImageUploadResult \| Promise<ImageUploadResult>` | — | 图片上传回调 |
|
|
84
76
|
|
|
85
77
|
### 图片上传
|
|
86
78
|
|
|
@@ -114,7 +106,7 @@ const uploadImage = async (file: File): Promise<ImageUploadResult> => {
|
|
|
114
106
|
- **宽度**:自动 / 25% / 50% / 75% / 100%
|
|
115
107
|
- **Alt 文本**:编辑图片替代文字
|
|
116
108
|
|
|
117
|
-
###
|
|
109
|
+
### 只读模式(待定)
|
|
118
110
|
|
|
119
111
|
```vue
|
|
120
112
|
<template>
|
|
@@ -171,36 +163,20 @@ CSS 文件中包含 `.smot-editor-` 前缀的类名,不会污染全局样式
|
|
|
171
163
|
内置工具栏提供以下功能:
|
|
172
164
|
|
|
173
165
|
| 分组 | 功能 |
|
|
174
|
-
|
|
|
166
|
+
| ---- | ---------------------------------- |
|
|
175
167
|
| 标题 | H1 / H2 / H3 / H4 / H5 / H6 / 正文 |
|
|
176
|
-
| 内联 | 加粗 / 斜体 / 删除线 / 行内代码
|
|
177
|
-
| 块级 | 引用 / 代码块 / 分割线
|
|
178
|
-
| 列表 | 有序列表 / 无序列表
|
|
179
|
-
| 对齐 | 左对齐 / 居中 / 右对齐
|
|
180
|
-
| 媒体 | 图片上传(含浮动编辑菜单)
|
|
181
|
-
| 链接 | 设置 / 编辑超链接
|
|
182
|
-
| 历史 | 撤销 / 重做
|
|
183
|
-
|
|
184
|
-
## 🔧 开发
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
# 安装依赖
|
|
188
|
-
pnpm install
|
|
189
|
-
|
|
190
|
-
# 启动开发服务器
|
|
191
|
-
pnpm dev
|
|
192
|
-
|
|
193
|
-
# 构建生产版本
|
|
194
|
-
pnpm build
|
|
195
|
-
|
|
196
|
-
# 类型检查
|
|
197
|
-
pnpm type-check
|
|
198
|
-
```
|
|
168
|
+
| 内联 | 加粗 / 斜体 / 删除线 / 行内代码 |
|
|
169
|
+
| 块级 | 引用 / 代码块 / 分割线 |
|
|
170
|
+
| 列表 | 有序列表 / 无序列表 |
|
|
171
|
+
| 对齐 | 左对齐 / 居中 / 右对齐 |
|
|
172
|
+
| 媒体 | 图片上传(含浮动编辑菜单) |
|
|
173
|
+
| 链接 | 设置 / 编辑超链接 |
|
|
174
|
+
| 历史 | 撤销 / 重做 |
|
|
199
175
|
|
|
200
176
|
## 📄 License
|
|
201
177
|
|
|
202
178
|
MIT
|
|
203
179
|
|
|
204
|
-
|
|
180
|
+
---
|
|
205
181
|
|
|
206
182
|
Made with ❤️ by SanMoKeJi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanmokeji/smo-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"main": "./dist/smo-editor.umd.cjs",
|
|
5
5
|
"module": "./dist/smo-editor.js",
|
|
6
6
|
"types": "./dist/smo-editor.d.ts",
|
|
@@ -31,6 +31,17 @@
|
|
|
31
31
|
"富文本编辑器",
|
|
32
32
|
"markdown"
|
|
33
33
|
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "vite",
|
|
36
|
+
"build": "run-p type-check \"build-only {@}\" --",
|
|
37
|
+
"preview": "vite preview",
|
|
38
|
+
"build-only": "vite build",
|
|
39
|
+
"type-check": "vue-tsc --build",
|
|
40
|
+
"lint": "run-s lint:*",
|
|
41
|
+
"lint:oxlint": "oxlint . --fix",
|
|
42
|
+
"lint:eslint": "eslint . --fix --cache",
|
|
43
|
+
"format": "prettier --write --experimental-cli src/"
|
|
44
|
+
},
|
|
34
45
|
"peerDependencies": {
|
|
35
46
|
"vue": "^3.5.0"
|
|
36
47
|
},
|
|
@@ -70,16 +81,5 @@
|
|
|
70
81
|
},
|
|
71
82
|
"engines": {
|
|
72
83
|
"node": "^20.19.0 || >=22.12.0"
|
|
73
|
-
},
|
|
74
|
-
"scripts": {
|
|
75
|
-
"dev": "vite",
|
|
76
|
-
"build": "run-p type-check \"build-only {@}\" --",
|
|
77
|
-
"preview": "vite preview",
|
|
78
|
-
"build-only": "vite build",
|
|
79
|
-
"type-check": "vue-tsc --build",
|
|
80
|
-
"lint": "run-s lint:*",
|
|
81
|
-
"lint:oxlint": "oxlint . --fix",
|
|
82
|
-
"lint:eslint": "eslint . --fix --cache",
|
|
83
|
-
"format": "prettier --write --experimental-cli src/"
|
|
84
84
|
}
|
|
85
|
-
}
|
|
85
|
+
}
|