Skip to content

Commit 4a23d3c

Browse files
committed
update
1 parent 0f5b5c4 commit 4a23d3c

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"vxe-table": "^4.16.11",
129129
"winston": "^3.17.0",
130130
"workerpool": "github:frankie-zeng/workerpool#465f31",
131+
"wujie-polyfill": "^1.1.3",
131132
"wujie-vue3": "^1.0.29",
132133
"xterm": "^5.3.0"
133134
},

src/main/plugin-sdk/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@ export function emitEvent(name: string, data: any) {
3030
}
3131

3232
export function getPluginPath(): string {
33-
if (isMainThread) {
34-
return __dirname
35-
}
3633
return workerData?.pluginPath || ''
3734
}

src/renderer/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ dataParseWorker.onmessage = (event) => {
5454
}
5555

5656
window.serviceDetail = window.electron?.ipcRenderer.sendSync('ipc-service-detail')
57-
window.electron.ipcRenderer.on('ipc-log', (event, data) => {
57+
window.electron?.ipcRenderer.on('ipc-log', (event, data) => {
5858
const groups: { method: string; data: any[] }[] = [] // 存储所有分组,每个元素是 {method, data} 对象
5959
let currentGroup: { method: string; data: any[] } | null = null
6060

src/renderer/src/plugin/plugin.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:name="editIndex"
66
:url="entry"
77
:fetch="isDev ? undefined : customFetch"
8-
:plugins="isDev ? undefined : plugins"
8+
:plugins="plugins"
99
:props="{ ...props, modelValue: data }"
1010
:load-error="loadError"
1111
></WujieVue>
@@ -20,6 +20,7 @@ import { usePluginStore } from '@r/stores/plugin'
2020
import { ElMessageBox } from 'element-plus'
2121
import { destroyApp } from 'wujie'
2222
import { cloneDeep } from 'lodash'
23+
import { InstanceofPlugin } from 'wujie-polyfill'
2324
const dataStore = useDataStore()
2425
const props = defineProps<{
2526
editIndex: string
@@ -70,6 +71,15 @@ const plugins = [
7071
}
7172
}
7273
],
74+
jsLoader: (code) => {
75+
// 替换popper.js内计算偏左侧偏移量
76+
const codes = code.replace(
77+
'left: elementRect.left - parentRect.left',
78+
'left: fixed ? elementRect.left : elementRect.left - parentRect.left'
79+
)
80+
// 替换popper.js内右侧偏移量
81+
return codes.replace('popper.right > data.boundaries.right', 'false')
82+
},
7383
7484
htmlLoader: (code) => {
7585
const reHref = /href="\.\/([^"]*)"/g
@@ -80,8 +90,13 @@ const plugins = [
8090
return code
8191
},
8292
83-
cssExcludes: [/element-plus/]
84-
}
93+
cssExcludes: [/element-plus/],
94+
cssBeforeLoaders: [
95+
// 强制使子应用body定位是relative
96+
{ content: 'body{position: relative !important}' }
97+
]
98+
},
99+
InstanceofPlugin()
85100
]
86101
const customFetch = (url: string, options?: RequestInit) => {
87102
url = url.replace('file:///', 'local-resource:///' + basePath + '/')

0 commit comments

Comments
 (0)