MCPcopy
hub / github.com/Bistutu/FluentRead / mountSelectionTranslator

Function mountSelectionTranslator

entrypoints/utils/selectionTranslator.ts:12–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 * 挂载选词翻译组件
11 */
12export function mountSelectionTranslator() {
13 // 如果已存在实例或配置禁用了此功能,则不创建
14 if (selectionTranslatorInstance || config.disableSelectionTranslator || config.selectionTranslatorMode === 'disabled') {
15 return;
16 }
17
18 // 创建容器元素
19 const container = document.createElement('div');
20 container.id = 'fluent-read-selection-translator-container';
21 document.body.appendChild(container);
22
23 // 创建Vue应用实例
24 app = createApp(SelectionTranslator);
25
26 // 挂载应用
27 selectionTranslatorInstance = app.mount(container);
28
29 return selectionTranslatorInstance;
30}
31
32/**
33 * 卸载选词翻译组件

Callers 2

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected