collabdocchat 2.1.0 → 2.1.2
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/package.json +1 -3
- package/scripts/remove-quill-from-user-dashboard.js +46 -0
- package/src/pages/admin-dashboard.js +1403 -1403
- package/src/pages/user-dashboard.js +155 -157
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "collabdocchat",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
|
|
5
5
|
"main": "./server/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -80,8 +80,6 @@
|
|
|
80
80
|
"mongoose": "^8.0.3",
|
|
81
81
|
"multer": "^2.0.2",
|
|
82
82
|
"node-cron": "^3.0.3",
|
|
83
|
-
"quill": "^1.3.7",
|
|
84
|
-
"quill-cursors": "^4.0.2",
|
|
85
83
|
"redis": "^4.6.0",
|
|
86
84
|
"ws": "^8.14.2",
|
|
87
85
|
"y-websocket": "^1.5.0",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
const filePath = path.join(__dirname, '../src/pages/user-dashboard.js');
|
|
9
|
+
|
|
10
|
+
console.log('正在读取文件...');
|
|
11
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
12
|
+
|
|
13
|
+
console.log('移除 Quill 导入...');
|
|
14
|
+
content = content.replace(/import Quill from 'quill';\r?\n/g, '');
|
|
15
|
+
content = content.replace(/import 'quill\/dist\/quill\.snow\.css';\r?\n/g, '');
|
|
16
|
+
|
|
17
|
+
console.log('替换 Quill 编辑器为 textarea...');
|
|
18
|
+
// 替换 Quill 初始化代码
|
|
19
|
+
content = content.replace(
|
|
20
|
+
/\/\/ 初始化 Quill 编辑器[\s\S]*?const quill = new Quill\('#editor', \{[\s\S]*?\}\);/g,
|
|
21
|
+
'// 使用原生 textarea\n const editor = document.getElementById(\'editor\');'
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// 替换 quill.root.innerHTML 为 editor.value
|
|
25
|
+
content = content.replace(/quill\.root\.innerHTML/g, 'editor.value');
|
|
26
|
+
|
|
27
|
+
// 替换 quill.on('text-change' 为 editor.addEventListener('input'
|
|
28
|
+
content = content.replace(/quill\.on\('text-change',/g, 'editor.addEventListener(\'input\',');
|
|
29
|
+
|
|
30
|
+
// 替换 quill.getSelection() 和 quill.setSelection()
|
|
31
|
+
content = content.replace(
|
|
32
|
+
/const selection = quill\.getSelection\(\);\s*quill\.root\.innerHTML = data\.content;\s*if \(selection\) \{\s*quill\.setSelection\(selection\);\s*\}/g,
|
|
33
|
+
'const cursorPos = editor.selectionStart;\n editor.value = data.content;\n editor.setSelectionRange(cursorPos, cursorPos);'
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// 替换编辑器 HTML 结构
|
|
37
|
+
content = content.replace(
|
|
38
|
+
/<div id="editor"><\/div>/g,
|
|
39
|
+
'<textarea id="editor" style="width: 100%; min-height: 400px; padding: 10px; font-family: monospace;"></textarea>'
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
console.log('写入文件...');
|
|
43
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
44
|
+
|
|
45
|
+
console.log('✅ 完成!已移除 Quill 依赖并替换为原生 textarea');
|
|
46
|
+
|