vue-editor-prose-kit 0.1.0
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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/vue-editor-prose-kit.css +2 -0
- package/dist/vue-editor-prose-kit.js +14607 -0
- package/dist/vue-editor-prose-kit.umd.cjs +143 -0
- package/lib/index.js +9 -0
- package/package.json +78 -0
- package/src/components/VueEditor.vue +865 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 goodboy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# vue-editor-prose-kit
|
|
2
|
+
|
|
3
|
+
基于 Vue 3 + Tiptap 的富文本编辑器组件库。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- 可配置工具栏(分组/按钮开关)
|
|
8
|
+
- 内置链接编辑面板
|
|
9
|
+
- 图片上传适配接口(支持自定义上传实现)
|
|
10
|
+
- 内容安全清洗(DOMPurify)
|
|
11
|
+
- 支持 `v-model`、事件回调和实例方法暴露
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install vue-editor-prose-kit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Node 版本
|
|
20
|
+
|
|
21
|
+
- 推荐使用 `Node >= 20.19`(仓库内置 `.nvmrc` 为 `22`)
|
|
22
|
+
|
|
23
|
+
## 快速使用
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<template>
|
|
27
|
+
<VueEditor v-model="content" :upload-image="uploadImage" />
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup>
|
|
31
|
+
import { ref } from "vue";
|
|
32
|
+
import { VueEditor } from "vue-editor-prose-kit";
|
|
33
|
+
|
|
34
|
+
const content = ref("<p>Hello editor</p>");
|
|
35
|
+
|
|
36
|
+
async function uploadImage(file) {
|
|
37
|
+
// 替换成你的上传逻辑,返回图片 URL
|
|
38
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
39
|
+
void arrayBuffer;
|
|
40
|
+
return "https://your-cdn.example.com/image.png";
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 本地开发
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install
|
|
49
|
+
npm run build
|
|
50
|
+
npm run docs:dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Vercel 部署
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 预览环境部署
|
|
57
|
+
npm run vercel:deploy
|
|
58
|
+
|
|
59
|
+
# 生产环境部署
|
|
60
|
+
npm run vercel:deploy:prod
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 文档
|
|
64
|
+
|
|
65
|
+
- 本地文档服务: [http://localhost:5173](http://localhost:5173)
|
|
66
|
+
- 在线预览页面: `/guide/playground`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.vue-editor[data-v-97ac2982]{background:#fff;border:1px solid #dcdfe6;border-radius:8px;overflow:hidden}.vue-editor.is-disabled[data-v-97ac2982]{opacity:.78}.editor-toolbar[data-v-97ac2982]{background:#f8fafc;border-bottom:1px solid #ebeef5;flex-wrap:wrap;gap:8px;padding:10px;display:flex}.toolbar-group[data-v-97ac2982]{border-right:1px solid #e5e7eb;align-items:center;gap:4px;padding-right:8px;display:inline-flex}.toolbar-group[data-v-97ac2982]:last-child{border-right:none;padding-right:0}.toolbar-select[data-v-97ac2982],.toolbar-btn[data-v-97ac2982],.link-btn[data-v-97ac2982]{color:#1f2937;cursor:pointer;background:#fff;border:1px solid #d1d5db;border-radius:6px;padding:8px 10px;font-size:13px;line-height:1}.toolbar-btn[data-v-97ac2982]{justify-content:center;align-items:center;min-width:36px;min-height:34px;padding:7px 8px;display:inline-flex}.btn-icon[data-v-97ac2982]{letter-spacing:.2px;font-size:14px;font-weight:600}.toolbar-btn[data-v-97ac2982]:hover,.toolbar-select[data-v-97ac2982]:hover,.link-btn[data-v-97ac2982]:hover{border-color:#9ca3af}.toolbar-btn.active[data-v-97ac2982]{color:#1d4ed8;background:#eff6ff;border-color:#2563eb}.toolbar-btn[data-v-97ac2982]:disabled{opacity:.45;cursor:not-allowed}.link-editor[data-v-97ac2982]{background:#f9fafb;border-bottom:1px solid #ebeef5;align-items:center;gap:8px;padding:10px;display:flex}.link-input[data-v-97ac2982]{border:1px solid #d1d5db;border-radius:6px;flex:1;min-width:160px;padding:8px 10px;font-size:13px}.link-input[data-v-97ac2982]:focus{border-color:#2563eb;outline:none;box-shadow:0 0 0 2px #2563eb26}.link-btn.primary[data-v-97ac2982]{color:#fff;background:#2563eb;border-color:#2563eb}.editor-body[data-v-97ac2982]{padding:14px}.hidden-file-input[data-v-97ac2982]{display:none}[data-v-97ac2982] .ProseMirror{min-height:inherit;color:#111827;outline:none;line-height:1.75}[data-v-97ac2982] .ProseMirror p.is-editor-empty:first-child:before{color:#9ca3af;content:attr(data-placeholder);float:left;pointer-events:none;height:0}[data-v-97ac2982] .ProseMirror p,[data-v-97ac2982] .ProseMirror h1,[data-v-97ac2982] .ProseMirror h2,[data-v-97ac2982] .ProseMirror h3,[data-v-97ac2982] .ProseMirror blockquote,[data-v-97ac2982] .ProseMirror ul,[data-v-97ac2982] .ProseMirror ol,[data-v-97ac2982] .ProseMirror pre{margin:0 0 12px}[data-v-97ac2982] .ProseMirror h1{font-size:28px}[data-v-97ac2982] .ProseMirror h2{font-size:24px}[data-v-97ac2982] .ProseMirror h3{font-size:20px}[data-v-97ac2982] .ProseMirror blockquote{color:#374151;background:#fff7ed;border-left:4px solid #f87171;margin-left:0;padding:8px 12px}[data-v-97ac2982] .ProseMirror pre{color:#f9fafb;background:#111827;border-radius:6px;padding:10px 12px;overflow-x:auto}[data-v-97ac2982] .ProseMirror ul,[data-v-97ac2982] .ProseMirror ol{padding-left:22px}[data-v-97ac2982] .ProseMirror a{color:#2563eb;text-decoration:underline}[data-v-97ac2982] .ProseMirror img{border-radius:6px;max-width:100%;display:block}.sr-only[data-v-97ac2982]{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
|
|
2
|
+
/*$vite$:1*/
|