@kg-ui/kg-ui-plus 0.1.51 → 0.1.52
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/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/lib/web-office-sdk-solution-v2.0.7.es.mjs +854 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/testWPS.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/testWPS.vue2.mjs +121 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/testWPS.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/AiBar.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/AiBar.vue2.mjs +125 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/AiBar.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/AiInput.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/AiInput.vue2.mjs +124 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/AiInput.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/index.vue.mjs +71 -0
- package/dist/es/KgCopilot/CopiCanvas/document-viewer/wps-file-viewer/wps-ai-integration2/index.vue2.mjs +4 -0
- package/dist/es/KgCopilot/CopiCanvas/index.vue.mjs +1 -1
- package/dist/es/KgCopilot/CopiCanvas/index.vue2.mjs +3 -4
- package/dist/es/KgCopilot/CopiCanvas/index.vue3.mjs +2 -2
- package/dist/es/api/copilot.mjs +0 -8
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/refresh.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@vueuse_core@9.13.0_vue@3.2.45/node_modules/@vueuse/core/index.mjs +105 -2
- package/dist/es/node_modules/.pnpm/@vueuse_shared@9.13.0_vue@3.2.45/node_modules/@vueuse/shared/index.mjs +13 -2
- package/dist/es/store/modules/copilot.mjs +38 -1
- package/dist/es/style.css +1 -1
- package/package.json +124 -116
- package/dist/es/KgCopilot/CopiCanvas/FilePreview.vue.mjs +0 -7
- package/dist/es/KgCopilot/CopiCanvas/FilePreview.vue2.mjs +0 -295
- package/dist/es/KgCopilot/CopiCanvas/FilePreview.vue3.mjs +0 -4
- package/dist/es/KgCopilot/CopiCanvas/FileSkeletion.vue.mjs +0 -96
- package/dist/es/KgCopilot/CopiCanvas/FileSkeletion.vue2.mjs +0 -4
- package/dist/es/KgCopilot/CopiCanvas/InitWrap.vue.mjs +0 -7
- package/dist/es/KgCopilot/CopiCanvas/InitWrap.vue2.mjs +0 -41
- package/dist/es/KgCopilot/CopiCanvas/InitWrap.vue3.mjs +0 -4
- package/dist/es/_virtual/_commonjs-dynamic-modules.mjs +0 -6
- package/dist/es/_virtual/jszip.min.mjs +0 -13
- package/dist/es/assets/empty.png.mjs +0 -4
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/folder-opened.mjs +0 -8
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/file-damage-line.mjs +0 -8
- package/dist/es/node_modules/.pnpm/docx-preview@0.3.3/node_modules/docx-preview/dist/docx-preview.mjs +0 -3877
- package/dist/es/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.mjs +0 -2649
package/package.json
CHANGED
@@ -1,116 +1,124 @@
|
|
1
|
-
{
|
2
|
-
"name": "@kg-ui/kg-ui-plus",
|
3
|
-
"version": "0.1.
|
4
|
-
"description": "A Component Library for Vue 3",
|
5
|
-
"private": false,
|
6
|
-
"main": "dist/es/index.mjs",
|
7
|
-
"files": [
|
8
|
-
"dist"
|
9
|
-
],
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
|
15
|
-
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"
|
19
|
-
"
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"
|
33
|
-
|
34
|
-
|
35
|
-
"@
|
36
|
-
"@
|
37
|
-
"@
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
|
50
|
-
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
73
|
-
"
|
74
|
-
"
|
75
|
-
"
|
76
|
-
"
|
77
|
-
"
|
78
|
-
"
|
79
|
-
"
|
80
|
-
"
|
81
|
-
"
|
82
|
-
"
|
83
|
-
"
|
84
|
-
"
|
85
|
-
"
|
86
|
-
"
|
87
|
-
|
88
|
-
|
89
|
-
"
|
90
|
-
"
|
91
|
-
|
92
|
-
|
93
|
-
"
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
"
|
99
|
-
"
|
100
|
-
"
|
101
|
-
"
|
102
|
-
"
|
103
|
-
"
|
104
|
-
"
|
105
|
-
"
|
106
|
-
|
107
|
-
|
108
|
-
"
|
109
|
-
"
|
110
|
-
|
111
|
-
|
112
|
-
"
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
1
|
+
{
|
2
|
+
"name": "@kg-ui/kg-ui-plus",
|
3
|
+
"version": "0.1.52",
|
4
|
+
"description": "A Component Library for Vue 3",
|
5
|
+
"private": false,
|
6
|
+
"main": "dist/es/index.mjs",
|
7
|
+
"files": [
|
8
|
+
"dist"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
12
|
+
"serve": "pnpm dev",
|
13
|
+
"build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build",
|
14
|
+
"report": "rimraf dist && vite build",
|
15
|
+
"preview": "vite preview",
|
16
|
+
"preview:build": "pnpm build && vite preview",
|
17
|
+
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
18
|
+
"svgo": "svgo -f src/assets/svg -o src/assets/svg",
|
19
|
+
"cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
|
20
|
+
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
21
|
+
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
22
|
+
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
|
23
|
+
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/",
|
24
|
+
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
|
25
|
+
"lint:pretty": "pretty-quick --staged",
|
26
|
+
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
|
27
|
+
"preinstall": "npx only-allow pnpm"
|
28
|
+
},
|
29
|
+
"browserslist": [
|
30
|
+
"> 1%",
|
31
|
+
"not ie 11",
|
32
|
+
"not op_mini all"
|
33
|
+
],
|
34
|
+
"dependencies": {
|
35
|
+
"@microsoft/fetch-event-source": "^2.0.1",
|
36
|
+
"@pureadmin/utils": "1.8.5",
|
37
|
+
"@vueuse/core": "^9.13.0",
|
38
|
+
"axios": "1.2.0",
|
39
|
+
"dayjs": "1.11.6",
|
40
|
+
"docx-preview": "^0.3.3",
|
41
|
+
"dompurify": "^3.0.10",
|
42
|
+
"element-plus": "2.2.27",
|
43
|
+
"highlight.js": "^11.9.0",
|
44
|
+
"marked": "^12.0.1",
|
45
|
+
"path": "0.12.7",
|
46
|
+
"pinia": "2.0.28",
|
47
|
+
"pinyin-match": "1.2.4",
|
48
|
+
"qs": "6.11.0"
|
49
|
+
},
|
50
|
+
"devDependencies": {
|
51
|
+
"@babel/core": ">=7.0.0-0 <8.0.0",
|
52
|
+
"@commitlint/cli": "13.1.0",
|
53
|
+
"@commitlint/config-conventional": "13.1.0",
|
54
|
+
"@iconify-icons/ep": "1.2.12",
|
55
|
+
"@iconify-icons/ph": "^1.2.5",
|
56
|
+
"@iconify-icons/ri": "1.2.3",
|
57
|
+
"@iconify/vue": "4.0.0",
|
58
|
+
"@types/node": "18.11.9",
|
59
|
+
"@types/qs": "6.9.7",
|
60
|
+
"@typescript-eslint/eslint-plugin": "5.42.1",
|
61
|
+
"@typescript-eslint/parser": "5.42.1",
|
62
|
+
"@vitejs/plugin-vue": "4.0.0",
|
63
|
+
"@vitejs/plugin-vue-jsx": "3.0.0",
|
64
|
+
"@vue/eslint-config-prettier": "7.0.0",
|
65
|
+
"@vue/eslint-config-typescript": "11.0.2",
|
66
|
+
"autoprefixer": "10.4.13",
|
67
|
+
"cloc": "2.10.0",
|
68
|
+
"cssnano": "5.1.14",
|
69
|
+
"eslint": "8.8.0",
|
70
|
+
"eslint-plugin-prettier": "4.0.0",
|
71
|
+
"eslint-plugin-vue": "9.7.0",
|
72
|
+
"husky": "7.0.4",
|
73
|
+
"lint-staged": "11.1.2",
|
74
|
+
"picocolors": "1.0.0",
|
75
|
+
"postcss": "8.4.18",
|
76
|
+
"postcss-html": "1.5.0",
|
77
|
+
"postcss-import": "15.0.0",
|
78
|
+
"postcss-scss": "4.0.5",
|
79
|
+
"prettier": "2.5.1",
|
80
|
+
"pretty-quick": "3.1.1",
|
81
|
+
"rimraf": "3.0.2",
|
82
|
+
"rollup-plugin-visualizer": "5.8.3",
|
83
|
+
"sass": "^1.72.0",
|
84
|
+
"sass-loader": "^14.1.1",
|
85
|
+
"stylelint": "^14.16.1",
|
86
|
+
"stylelint-config-html": "^1.1.0",
|
87
|
+
"stylelint-config-prettier": "^9.0.5",
|
88
|
+
"stylelint-config-recommended": "^9.0.0",
|
89
|
+
"stylelint-config-standard": "^29.0.0",
|
90
|
+
"stylelint-order": "^5.0.0",
|
91
|
+
"svgo": "3.0.2",
|
92
|
+
"tailwindcss": "3.2.4",
|
93
|
+
"terser": "5.16.1",
|
94
|
+
"typescript": "4.9.3",
|
95
|
+
"unplugin-vue-define-options": "0.12.2",
|
96
|
+
"vite": "4.0.3",
|
97
|
+
"vite-plugin-cdn-import": "0.3.5",
|
98
|
+
"vite-plugin-compression": "0.5.1",
|
99
|
+
"vite-plugin-dts": "1.4.1",
|
100
|
+
"vite-plugin-remove-console": "1.3.0",
|
101
|
+
"vite-svg-loader": "3.6.0",
|
102
|
+
"vue": "3.2.45",
|
103
|
+
"vue-eslint-parser": "9.1.0",
|
104
|
+
"vue-tsc": "1.0.9",
|
105
|
+
"webpack": "^5.0.0"
|
106
|
+
},
|
107
|
+
"publishConfig": {
|
108
|
+
"access": "public",
|
109
|
+
"registry": "https://registry.npmjs.org/"
|
110
|
+
},
|
111
|
+
"pnpm": {
|
112
|
+
"peerDependencyRules": {
|
113
|
+
"ignoreMissing": [
|
114
|
+
"rollup",
|
115
|
+
"webpack"
|
116
|
+
]
|
117
|
+
}
|
118
|
+
},
|
119
|
+
"volta": {
|
120
|
+
"node": "16.13.1"
|
121
|
+
},
|
122
|
+
"author": "lyn",
|
123
|
+
"license": "MIT"
|
124
|
+
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import _sfc_main from "./FilePreview.vue2.mjs";
|
2
|
-
import "./FilePreview.vue3.mjs";
|
3
|
-
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
4
|
-
const FilePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e4b6ab79"]]);
|
5
|
-
export {
|
6
|
-
FilePreview as default
|
7
|
-
};
|
@@ -1,295 +0,0 @@
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, resolveComponent, openBlock, createElementBlock, withDirectives, createVNode, vShow, createElementVNode, normalizeStyle, unref, createCommentVNode, withKeys, vModelText, createTextVNode, toDisplayString, pushScopeId, popScopeId } from "vue";
|
2
|
-
import { ClickOutside } from "element-plus";
|
3
|
-
import { renderAsync } from "../../node_modules/.pnpm/docx-preview@0.3.3/node_modules/docx-preview/dist/docx-preview.mjs";
|
4
|
-
import { getDocxFileByUrl } from "../../api/copilot.mjs";
|
5
|
-
import { storeToRefs } from "pinia";
|
6
|
-
import { useCopilotStoreHook } from "../../store/modules/copilot.mjs";
|
7
|
-
import _sfc_main$1 from "./FileSkeletion.vue.mjs";
|
8
|
-
import data from "../../node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/edit.mjs";
|
9
|
-
import data$1 from "../../node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/promotion.mjs";
|
10
|
-
import data$2 from "../../node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/file-damage-line.mjs";
|
11
|
-
import { useThrottleFn } from "../../node_modules/.pnpm/@vueuse_shared@9.13.0_vue@3.2.45/node_modules/@vueuse/shared/index.mjs";
|
12
|
-
const _withScopeId = (n) => (pushScopeId("data-v-e4b6ab79"), n = n(), popScopeId(), n);
|
13
|
-
const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, " 询问AI助手", -1));
|
14
|
-
const _hoisted_2 = ["onKeydown"];
|
15
|
-
const _hoisted_3 = { class: "err_result" };
|
16
|
-
const _hoisted_4 = { class: "w-[50%] text-center" };
|
17
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
18
|
-
__name: "FilePreview",
|
19
|
-
setup(__props) {
|
20
|
-
const CopilotStore = useCopilotStoreHook();
|
21
|
-
const { previewFileUrl, reviseReport } = storeToRefs(CopilotStore);
|
22
|
-
const { sendMsg } = CopilotStore;
|
23
|
-
const docPreviewRef = ref();
|
24
|
-
const docPreviewBoxRef = ref();
|
25
|
-
const result = ref("");
|
26
|
-
const zoom = ref(1);
|
27
|
-
const getZoom = useThrottleFn(() => {
|
28
|
-
const num = docPreviewBoxRef.value.clientWidth / 850;
|
29
|
-
zoom.value = num;
|
30
|
-
}, 100);
|
31
|
-
const loading = ref(false);
|
32
|
-
watch(
|
33
|
-
() => previewFileUrl.value,
|
34
|
-
(url) => {
|
35
|
-
if (!url)
|
36
|
-
return;
|
37
|
-
loading.value = true;
|
38
|
-
result.value = "";
|
39
|
-
getDocxFileByUrl(url).then((res) => {
|
40
|
-
const blob = res.data;
|
41
|
-
renderAsync(blob, docPreviewRef.value).then(() => {
|
42
|
-
getZoom();
|
43
|
-
loading.value = false;
|
44
|
-
}).catch(() => {
|
45
|
-
result.value = "解析失败";
|
46
|
-
loading.value = false;
|
47
|
-
});
|
48
|
-
}).catch((res) => {
|
49
|
-
result.value = res.response.status === 403 ? "文件已过期" : "获取失败";
|
50
|
-
loading.value = false;
|
51
|
-
});
|
52
|
-
},
|
53
|
-
{ immediate: true }
|
54
|
-
);
|
55
|
-
const resizeObserver = new ResizeObserver(() => {
|
56
|
-
getZoom();
|
57
|
-
});
|
58
|
-
onMounted(() => {
|
59
|
-
resizeObserver.observe(docPreviewBoxRef.value);
|
60
|
-
getZoom();
|
61
|
-
});
|
62
|
-
onBeforeUnmount(() => {
|
63
|
-
resizeObserver.disconnect();
|
64
|
-
});
|
65
|
-
const selectWordVisible = ref(false);
|
66
|
-
const selectionPos = ref({ top: "", left: "" });
|
67
|
-
const selectTxt = ref("");
|
68
|
-
const range = ref();
|
69
|
-
const selection = ref();
|
70
|
-
const handleSelectText = (e) => {
|
71
|
-
if (!reviseReport.value)
|
72
|
-
return;
|
73
|
-
selection.value = window.getSelection();
|
74
|
-
if (!selection.value)
|
75
|
-
return;
|
76
|
-
range.value = selection.value.getRangeAt(0);
|
77
|
-
const text = selection.value.toString();
|
78
|
-
if (!text.length)
|
79
|
-
return false;
|
80
|
-
setTimeout(() => {
|
81
|
-
selectTxt.value = "“" + text + "”";
|
82
|
-
showSelectMenu(e);
|
83
|
-
}, 100);
|
84
|
-
};
|
85
|
-
const menuInputRef = ref();
|
86
|
-
const showSelectMenu = (event) => {
|
87
|
-
if (!selection.value)
|
88
|
-
return;
|
89
|
-
const menuWidth = 350;
|
90
|
-
const menuHeight = 45;
|
91
|
-
let top = event.clientY;
|
92
|
-
let left = event.clientX;
|
93
|
-
const viewportWidth = window.innerWidth;
|
94
|
-
const viewportHeight = window.innerHeight;
|
95
|
-
if (left + menuWidth > viewportWidth) {
|
96
|
-
left = viewportWidth - menuWidth;
|
97
|
-
}
|
98
|
-
if (top + menuHeight > viewportHeight) {
|
99
|
-
top = viewportHeight - menuHeight;
|
100
|
-
}
|
101
|
-
selectionPos.value.top = top + 5 + "px";
|
102
|
-
selectionPos.value.left = left + 5 + "px";
|
103
|
-
selectWordVisible.value = true;
|
104
|
-
};
|
105
|
-
const highlightSelectedText = () => {
|
106
|
-
if (!selection.value.rangeCount)
|
107
|
-
return;
|
108
|
-
range.value.value = selection.value.getRangeAt(0);
|
109
|
-
const highlightSpan = document.createElement("span");
|
110
|
-
highlightSpan.className = "highlight";
|
111
|
-
const cloneStyle = ["fontSize", "fontFamily", "minHeight", "color"];
|
112
|
-
const startContainer = range.value.startContainer;
|
113
|
-
const endContainer = range.value.endContainer;
|
114
|
-
const startOffset = range.value.startOffset;
|
115
|
-
const endOffset = range.value.endOffset;
|
116
|
-
if (startContainer === endContainer) {
|
117
|
-
const selectedText = range.value.extractContents();
|
118
|
-
cloneStyle.forEach((key) => {
|
119
|
-
highlightSpan.style[key] = (startContainer.style || startContainer.parentNode.style)[key];
|
120
|
-
});
|
121
|
-
highlightSpan.appendChild(selectedText);
|
122
|
-
range.value.insertNode(highlightSpan);
|
123
|
-
} else {
|
124
|
-
const commonAncestor = range.value.commonAncestorContainer;
|
125
|
-
const walker = document.createTreeWalker(
|
126
|
-
commonAncestor,
|
127
|
-
NodeFilter.SHOW_TEXT,
|
128
|
-
{
|
129
|
-
acceptNode: (node) => range.value.intersectsNode(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
130
|
-
}
|
131
|
-
);
|
132
|
-
const nodesToHighlight = [];
|
133
|
-
while (walker.nextNode()) {
|
134
|
-
nodesToHighlight.push(walker.currentNode);
|
135
|
-
}
|
136
|
-
nodesToHighlight.forEach((node, index) => {
|
137
|
-
const parent = node.parentNode;
|
138
|
-
if (parent) {
|
139
|
-
const span = document.createElement("span");
|
140
|
-
span.className = "highlight";
|
141
|
-
for (const key of cloneStyle) {
|
142
|
-
span.style[key] = parent.style[key];
|
143
|
-
}
|
144
|
-
if (index === 0) {
|
145
|
-
const text = node.textContent.slice(startOffset);
|
146
|
-
span.textContent = text;
|
147
|
-
const remainingText = document.createTextNode(
|
148
|
-
node.textContent.slice(0, startOffset)
|
149
|
-
);
|
150
|
-
parent.insertBefore(remainingText, node);
|
151
|
-
} else if (index === nodesToHighlight.length - 1) {
|
152
|
-
const text = node.textContent.slice(0, endOffset);
|
153
|
-
span.textContent = text;
|
154
|
-
const remainingText = document.createTextNode(
|
155
|
-
node.textContent.slice(endOffset)
|
156
|
-
);
|
157
|
-
parent.appendChild(remainingText);
|
158
|
-
} else {
|
159
|
-
span.textContent = node.textContent;
|
160
|
-
}
|
161
|
-
parent.replaceChild(span, node);
|
162
|
-
}
|
163
|
-
});
|
164
|
-
}
|
165
|
-
};
|
166
|
-
const removeHighlight = () => {
|
167
|
-
const highlightedElements = document.querySelectorAll(".highlight");
|
168
|
-
highlightedElements.forEach((element) => {
|
169
|
-
const parent = element.parentNode;
|
170
|
-
if (parent) {
|
171
|
-
const fragment = document.createDocumentFragment();
|
172
|
-
while (element.firstChild) {
|
173
|
-
fragment.appendChild(element.firstChild);
|
174
|
-
}
|
175
|
-
parent.replaceChild(fragment, element);
|
176
|
-
parent.normalize();
|
177
|
-
}
|
178
|
-
});
|
179
|
-
};
|
180
|
-
const inputRef = ref();
|
181
|
-
const showSuggestInput = ref(false);
|
182
|
-
const handleClickSuggestBtn = () => {
|
183
|
-
showSuggestInput.value = true;
|
184
|
-
highlightSelectedText();
|
185
|
-
setTimeout(() => {
|
186
|
-
if (inputRef.value) {
|
187
|
-
inputRef.value.focus();
|
188
|
-
}
|
189
|
-
}, 100);
|
190
|
-
};
|
191
|
-
const suggestInputValue = ref("");
|
192
|
-
const sendSuggest = () => {
|
193
|
-
if (!suggestInputValue.value.length)
|
194
|
-
return;
|
195
|
-
sendMsg(suggestInputValue.value, selectTxt.value);
|
196
|
-
onClickOutside();
|
197
|
-
};
|
198
|
-
const onClickOutside = () => {
|
199
|
-
if (selectWordVisible.value) {
|
200
|
-
selectWordVisible.value = false;
|
201
|
-
showSuggestInput.value = false;
|
202
|
-
suggestInputValue.value = "";
|
203
|
-
selection.value = null;
|
204
|
-
removeHighlight();
|
205
|
-
}
|
206
|
-
};
|
207
|
-
return (_ctx, _cache) => {
|
208
|
-
const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
|
209
|
-
return openBlock(), createElementBlock("div", {
|
210
|
-
ref_key: "docPreviewBoxRef",
|
211
|
-
ref: docPreviewBoxRef,
|
212
|
-
class: "preview-box"
|
213
|
-
}, [
|
214
|
-
withDirectives(createVNode(_sfc_main$1, null, null, 512), [
|
215
|
-
[vShow, loading.value]
|
216
|
-
]),
|
217
|
-
withDirectives(createElementVNode("div", {
|
218
|
-
ref_key: "docPreviewRef",
|
219
|
-
ref: docPreviewRef,
|
220
|
-
class: "preview",
|
221
|
-
style: normalizeStyle({ zoom: zoom.value }),
|
222
|
-
onMouseup: handleSelectText
|
223
|
-
}, null, 36), [
|
224
|
-
[vShow, !result.value && !loading.value]
|
225
|
-
]),
|
226
|
-
selectWordVisible.value ? withDirectives((openBlock(), createElementBlock("div", {
|
227
|
-
key: 0,
|
228
|
-
class: "select-word",
|
229
|
-
style: normalizeStyle({ ...selectionPos.value })
|
230
|
-
}, [
|
231
|
-
!showSuggestInput.value ? (openBlock(), createElementBlock("button", {
|
232
|
-
key: 0,
|
233
|
-
onClick: handleClickSuggestBtn,
|
234
|
-
class: "flex items-center edit-button"
|
235
|
-
}, [
|
236
|
-
createVNode(_component_IconifyIconOffline, {
|
237
|
-
class: "mr-1",
|
238
|
-
icon: unref(data)
|
239
|
-
}, null, 8, ["icon"]),
|
240
|
-
_hoisted_1
|
241
|
-
])) : createCommentVNode("", true),
|
242
|
-
showSuggestInput.value ? (openBlock(), createElementBlock("div", {
|
243
|
-
key: 1,
|
244
|
-
ref_key: "menuInputRef",
|
245
|
-
ref: menuInputRef,
|
246
|
-
class: "flex justify-between items-center input-box"
|
247
|
-
}, [
|
248
|
-
withDirectives(createElementVNode("input", {
|
249
|
-
ref_key: "inputRef",
|
250
|
-
ref: inputRef,
|
251
|
-
class: "edit-input",
|
252
|
-
type: "text",
|
253
|
-
placeholder: "编辑和说明...",
|
254
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => suggestInputValue.value = $event),
|
255
|
-
onKeydown: withKeys(sendSuggest, ["enter"])
|
256
|
-
}, null, 40, _hoisted_2), [
|
257
|
-
[vModelText, suggestInputValue.value]
|
258
|
-
]),
|
259
|
-
createElementVNode("button", {
|
260
|
-
class: "send-button",
|
261
|
-
onClick: sendSuggest
|
262
|
-
}, [
|
263
|
-
createVNode(_component_IconifyIconOffline, {
|
264
|
-
class: "icon",
|
265
|
-
icon: unref(data$1),
|
266
|
-
style: normalizeStyle({
|
267
|
-
color: suggestInputValue.value.length ? "#1e56ea" : "#dbdbdb"
|
268
|
-
})
|
269
|
-
}, null, 8, ["icon", "style"])
|
270
|
-
])
|
271
|
-
], 512)) : createCommentVNode("", true)
|
272
|
-
], 4)), [
|
273
|
-
[unref(ClickOutside), onClickOutside]
|
274
|
-
]) : createCommentVNode("", true),
|
275
|
-
withDirectives(createElementVNode("div", _hoisted_3, [
|
276
|
-
createElementVNode("div", _hoisted_4, [
|
277
|
-
createVNode(_component_IconifyIconOffline, {
|
278
|
-
icon: unref(data$2),
|
279
|
-
width: "100%",
|
280
|
-
style: normalizeStyle({
|
281
|
-
color: "rgb(175 176 179)"
|
282
|
-
})
|
283
|
-
}, null, 8, ["icon", "style"]),
|
284
|
-
createTextVNode(" " + toDisplayString(result.value), 1)
|
285
|
-
])
|
286
|
-
], 512), [
|
287
|
-
[vShow, result.value]
|
288
|
-
])
|
289
|
-
], 512);
|
290
|
-
};
|
291
|
-
}
|
292
|
-
});
|
293
|
-
export {
|
294
|
-
_sfc_main as default
|
295
|
-
};
|
@@ -1,96 +0,0 @@
|
|
1
|
-
import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode, createElementBlock, Fragment, renderList } from "vue";
|
2
|
-
const _hoisted_1 = { class: "flex justify-center mb-3" };
|
3
|
-
const _hoisted_2 = { style: { "display": "flex", "align-items": "center", "justify-items": "space-between" } };
|
4
|
-
const _hoisted_3 = { style: { "display": "flex", "align-items": "center", "justify-items": "space-between" } };
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
6
|
-
__name: "FileSkeletion",
|
7
|
-
setup(__props) {
|
8
|
-
const fileLoading = ref(true);
|
9
|
-
return (_ctx, _cache) => {
|
10
|
-
const _component_el_skeleton_item = resolveComponent("el-skeleton-item");
|
11
|
-
const _component_el_skeleton = resolveComponent("el-skeleton");
|
12
|
-
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
13
|
-
return openBlock(), createBlock(_component_el_scrollbar, {
|
14
|
-
height: "100%",
|
15
|
-
class: "p-5"
|
16
|
-
}, {
|
17
|
-
default: withCtx(() => [
|
18
|
-
createVNode(_component_el_skeleton, {
|
19
|
-
loading: fileLoading.value,
|
20
|
-
animated: "",
|
21
|
-
throttle: 500,
|
22
|
-
count: 1
|
23
|
-
}, {
|
24
|
-
template: withCtx(() => [
|
25
|
-
createElementVNode("div", _hoisted_1, [
|
26
|
-
createVNode(_component_el_skeleton_item, {
|
27
|
-
variant: "p",
|
28
|
-
style: { "width": "50%" }
|
29
|
-
})
|
30
|
-
]),
|
31
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(3, (index) => {
|
32
|
-
return createElementVNode("div", { key: index }, [
|
33
|
-
createElementVNode("div", _hoisted_2, [
|
34
|
-
createVNode(_component_el_skeleton_item, {
|
35
|
-
variant: "p",
|
36
|
-
style: { "margin-right": "16px" }
|
37
|
-
}),
|
38
|
-
createVNode(_component_el_skeleton_item, {
|
39
|
-
variant: "p",
|
40
|
-
style: { "width": "30%" }
|
41
|
-
})
|
42
|
-
]),
|
43
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(5, (index2) => {
|
44
|
-
return createVNode(_component_el_skeleton_item, {
|
45
|
-
key: index2,
|
46
|
-
variant: "p"
|
47
|
-
});
|
48
|
-
}), 64)),
|
49
|
-
createElementVNode("div", null, [
|
50
|
-
createVNode(_component_el_skeleton_item, {
|
51
|
-
variant: "p",
|
52
|
-
style: { "width": "50%" }
|
53
|
-
}),
|
54
|
-
createElementVNode("div", _hoisted_3, [
|
55
|
-
createVNode(_component_el_skeleton_item, {
|
56
|
-
variant: "p",
|
57
|
-
style: { "margin-right": "16px" }
|
58
|
-
}),
|
59
|
-
createVNode(_component_el_skeleton_item, {
|
60
|
-
variant: "p",
|
61
|
-
style: { "width": "30%" }
|
62
|
-
})
|
63
|
-
]),
|
64
|
-
createVNode(_component_el_skeleton_item, {
|
65
|
-
variant: "p",
|
66
|
-
style: { "width": "50%" }
|
67
|
-
}),
|
68
|
-
createVNode(_component_el_skeleton_item, {
|
69
|
-
variant: "p",
|
70
|
-
style: { "width": "30%" }
|
71
|
-
})
|
72
|
-
])
|
73
|
-
]);
|
74
|
-
}), 64)),
|
75
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(3, (index) => {
|
76
|
-
return createVNode(_component_el_skeleton_item, {
|
77
|
-
key: index,
|
78
|
-
variant: "p"
|
79
|
-
});
|
80
|
-
}), 64)),
|
81
|
-
createVNode(_component_el_skeleton_item, {
|
82
|
-
variant: "p",
|
83
|
-
style: { "width": "80%" }
|
84
|
-
})
|
85
|
-
]),
|
86
|
-
_: 1
|
87
|
-
}, 8, ["loading"])
|
88
|
-
]),
|
89
|
-
_: 1
|
90
|
-
});
|
91
|
-
};
|
92
|
-
}
|
93
|
-
});
|
94
|
-
export {
|
95
|
-
_sfc_main as default
|
96
|
-
};
|