@tano.page/workbench 0.14.0 → 0.15.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/package.json +21 -8
- package/src/App.vue +76 -17
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +424 -7
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/engine.ts +56 -3
- package/src/assistant/files.ts +5 -13
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/locales/de-DE.json +4 -1
- package/src/assistant/locales/en-US.json +4 -1
- package/src/assistant/locales/es-ES.json +4 -1
- package/src/assistant/locales/ja-JP.json +4 -1
- package/src/assistant/locales/zh-CN.json +4 -1
- package/src/assistant/locales/zh-TW.json +4 -1
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/prompts.ts +7 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +319 -12
- package/src/assistant/structures.ts +7 -5
- package/src/assistant/tasks.ts +3 -5
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-shortcuts.ts +26 -22
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/features.ts +1 -0
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locales/de-DE.json +349 -3
- package/src/i18n/locales/en-US.json +349 -2
- package/src/i18n/locales/es-ES.json +349 -3
- package/src/i18n/locales/ja-JP.json +348 -2
- package/src/i18n/locales/zh-TW.json +348 -2
- package/src/mail/components/MailAccountDialog.vue +449 -0
- package/src/mail/components/MailComposerDialog.vue +325 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +820 -0
- package/src/mail/components/SidebarMail.vue +133 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/workspace-objects.ts +1 -1
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +63 -7
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarView.vue +1736 -276
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +129 -54
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +15 -21
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +39 -145
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +21 -6
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +111 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-sdk.ts +174 -8
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +3 -1
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +101 -3
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +21 -8
- package/src/shell/components/WorkbenchModals.vue +27 -46
- package/src/shell/components/WorkbenchPanes.vue +267 -84
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/use-workbench.ts +116 -145
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-knowledge.ts +1 -113
- package/src/stores/workspace-plugins-state.ts +537 -14
- package/src/stores/workspace-tabs-layout.ts +5 -43
- package/src/stores/workspace.ts +69 -66
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +1 -1
- package/src/tabs/components/DesktopTabs.vue +0 -3
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { uiLocale, t } from '../../i18n/i18n';
|
|
3
3
|
import { computed, onScopeDispose, ref, shallowRef, watch } from 'vue';
|
|
4
|
-
import { canonicalPluginJson, parsePluginAutomationJob, type PluginAutomationJob, type PluginAutomationRun
|
|
4
|
+
import { canonicalPluginJson, parsePluginAutomationJob, type PluginAutomationJob, type PluginAutomationRun } from '@tano/protocol';
|
|
5
5
|
import { useWorkbenchRuntime } from '../../runtime';
|
|
6
6
|
import { useWorkspaceStore } from '../../stores/workspace';
|
|
7
7
|
import { AutomationSubmissions } from '../automation-submissions';
|
|
8
|
+
import { pluginPermissionLabels as permissions } from '../plugin-permissions';
|
|
8
9
|
import { assistantHash } from '../../assistant/hash';
|
|
9
10
|
import PluginAutomationWebhook from './PluginAutomationWebhook.vue';
|
|
10
11
|
|
|
@@ -15,11 +16,10 @@ const editor = ref(false), jobId = ref(''), version = ref<string>(), pluginId =
|
|
|
15
16
|
const label = ref(''), enabled = ref(true), schedule = ref('manual'), interval = ref(1440), payload = ref('{}'), approved = ref(false);
|
|
16
17
|
const deleting = ref(''), pending = ref<Record<string, boolean>>({}), reviewed = ref(false);
|
|
17
18
|
let controller = new AbortController(), timer: ReturnType<typeof setTimeout> | undefined;
|
|
18
|
-
const plugins = computed(() => store.installedPlugins.filter(item => item.manifest.manifestVersion === 2 && item.manifest.automations?.length && item.rule?.mode !== 'disabled' && item.rule?.integrity));
|
|
19
|
+
const plugins = computed(() => store.installedPlugins.filter(item => item.scope !== 'user' && !item.system && item.manifest.manifestVersion === 2 && item.manifest.automations?.length && item.rule?.mode !== 'disabled' && item.rule?.integrity));
|
|
19
20
|
const installation = computed(() => plugins.value.find(item => item.manifest.id === pluginId.value));
|
|
20
21
|
const manifest = computed(() => installation.value?.manifest.manifestVersion === 2 ? installation.value.manifest : undefined);
|
|
21
22
|
const canSave = computed(() => !!(approved.value && manifest.value?.automations?.some(item => item.id === automationId.value) && label.value.trim() && installation.value?.rule?.integrity));
|
|
22
|
-
const permissions: Partial<Record<PluginPermission, string>> = { get 'documents.read'() { return t('读取文档'); }, get 'documents.write'() { return t('创建与修改文档'); }, get 'objects.read'() { return t('读取对象'); }, get 'objects.write'() { return t('创建与修改对象'); }, get 'relations.read'() { return t('读取关系'); }, get 'relations.write'() { return t('修改关系'); }, get network() { return t('访问指定网络来源'); }, get connections() { return t('使用单独授权的服务凭据'); } };
|
|
23
23
|
const statuses: Record<PluginAutomationRun['status'], string> = { get queued() { return t('等待执行'); }, get running() { return t('执行中'); }, get succeeded() { return t('已完成'); }, get failed() { return t('失败'); }, get cancelled() { return t('已停止'); }, get uncertain() { return t('结果不确定'); }, get expired() { return t('已过期'); } };
|
|
24
24
|
const date = (value: string | null) => value ? new Date(value).toLocaleString(uiLocale.value) : '—';
|
|
25
25
|
const format = (value: unknown) => JSON.stringify(value, null, 2);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import LoadingSkeleton from '../../shell/components/LoadingSkeleton.vue';
|
|
3
3
|
import { retiredSystemPlugin } from '../workspace-plugins';
|
|
4
|
+
import { userScopeUnsupportedReason } from '../user-plugins';
|
|
4
5
|
import { uiLocale, t } from '../../i18n/i18n';
|
|
5
6
|
import { computed, onScopeDispose, ref, watch } from 'vue';
|
|
6
|
-
import { canonicalPluginJson, comparePluginVersions, type PluginCatalogRelease, type PluginReleaseCatalog } from '@tano/protocol';
|
|
7
|
+
import { canonicalPluginJson, checkPluginCompatibility, comparePluginVersions, type PluginCatalogRelease, type PluginReleaseCatalog } from '@tano/protocol';
|
|
7
8
|
import { useWorkspaceStore } from '../../stores/workspace';
|
|
8
9
|
import PluginDialog from './PluginDialog.vue';
|
|
9
10
|
import PluginChangeSummary from './PluginChangeSummary.vue';
|
|
11
|
+
import { pluginPermissionLabels as labels } from '../plugin-permissions';
|
|
10
12
|
|
|
11
13
|
const store = useWorkspaceStore();
|
|
12
14
|
const catalog = ref<PluginReleaseCatalog>();
|
|
@@ -15,6 +17,7 @@ const selectedId = ref('');
|
|
|
15
17
|
const selectedHash = ref('');
|
|
16
18
|
const loading = ref(false);
|
|
17
19
|
const installing = ref(false);
|
|
20
|
+
const installScope = ref<'workspace' | 'user'>('workspace');
|
|
18
21
|
const error = ref('');
|
|
19
22
|
const status = ref('');
|
|
20
23
|
const visibleLimit = ref(24);
|
|
@@ -31,6 +34,10 @@ const latest = computed(() => {
|
|
|
31
34
|
});
|
|
32
35
|
const versions = computed(() => sorted(releases.value.filter(item => item.manifest.id === selectedId.value)));
|
|
33
36
|
const selected = computed(() => versions.value.find(item => item.integrity === selectedHash.value));
|
|
37
|
+
const userScopeReason = computed(() => (selected.value ? userScopeUnsupportedReason(selected.value.manifest) : undefined));
|
|
38
|
+
const selectedCompat = computed(() =>
|
|
39
|
+
selected.value ? checkPluginCompatibility(selected.value.manifest, store.pluginHostEnvironment) : { compatible: true },
|
|
40
|
+
);
|
|
34
41
|
const installed = computed(() => store.installedPlugins.find(item => item.manifest.id === selectedId.value));
|
|
35
42
|
function isInstalled(release: PluginCatalogRelease) {
|
|
36
43
|
return store.installedPlugins.some(item => item.manifest.id === release.manifest.id && (item.rule?.integrity === release.integrity ||
|
|
@@ -41,9 +48,8 @@ const downgrading = computed(() => selected.value && installed.value && compareP
|
|
|
41
48
|
const selectedPublisher = computed(() => catalog.value?.publishers.find(item => item.id === selected.value?.publisher));
|
|
42
49
|
const permissions = computed(() => selected.value?.manifest.manifestVersion === 2 ? selected.value.manifest.permissions : []);
|
|
43
50
|
const addedPermissions = computed(() => permissions.value.filter(permission => installed.value?.manifest.manifestVersion !== 2 || !installed.value.manifest.permissions.includes(permission)));
|
|
44
|
-
const labels: Record<string, string> = { get 'documents.read'() { return t('读取与打开文档'); }, get 'documents.write'() { return t('创建与修改文档'); }, get 'objects.read'() { return t('读取对象'); }, get 'objects.write'() { return t('创建与修改对象'); }, get 'relations.read'() { return t('读取关系'); }, get 'relations.write'() { return t('修改关系'); }, get storage() { return t('保存插件本机状态'); }, get network() { return t('访问指定网络来源'); }, get connections() { return t('使用单独授权的服务凭据'); }, get native() { return t('调用指定本机能力'); }, get ui() { return t('运行自定义界面'); } };
|
|
45
51
|
function publisher(release: PluginCatalogRelease) { return catalog.value?.publishers.find(item => item.id === release.publisher)?.name ?? release.publisher; }
|
|
46
|
-
function details(release: PluginCatalogRelease) { selectedId.value = release.manifest.id; selectedHash.value = release.integrity; error.value = ''; status.value = ''; }
|
|
52
|
+
function details(release: PluginCatalogRelease) { selectedId.value = release.manifest.id; selectedHash.value = release.integrity; installScope.value = 'workspace'; error.value = ''; status.value = ''; }
|
|
47
53
|
async function refresh() {
|
|
48
54
|
const current = ++sequence;
|
|
49
55
|
const signal = controller.signal;
|
|
@@ -62,7 +68,7 @@ async function install() {
|
|
|
62
68
|
const signal = controller.signal;
|
|
63
69
|
installing.value = true; error.value = ''; status.value = '';
|
|
64
70
|
try {
|
|
65
|
-
await store.installCatalogRelease(release, workspace, signal);
|
|
71
|
+
await store.installCatalogRelease(release, workspace, signal, installScope.value);
|
|
66
72
|
if (!signal.aborted) status.value = release.manifest.manifestVersion === 2
|
|
67
73
|
? t('已安装 {0},请在“已安装”详情中核对并授权此版本运行。', [release.manifest.version]) : t('已安装 {0}。', [release.manifest.version]);
|
|
68
74
|
} catch (cause) { if (!signal.aborted) error.value = String(cause); }
|
|
@@ -116,15 +122,18 @@ onScopeDispose(() => controller.abort());
|
|
|
116
122
|
<p v-if="selected.status === 'withdrawn'" role="status">{{ t('此版本已撤回:') }}{{ selected.reason }}{{ t('。已安装内容不会自动删除。') }}</p>
|
|
117
123
|
<pre class="catalog-notes">{{ selected.notes || t('此版本未提供更新说明。') }}</pre>
|
|
118
124
|
<PluginChangeSummary v-if="!unchanged" :before="installed?.manifest" :after="selected.manifest" :workspace="store.workspace?.name" />
|
|
119
|
-
<p>{{ t('所需权限:') }}{{ permissions.map(permission => labels[permission]).join('、') || t('无代码权限') }}</p>
|
|
120
|
-
<p v-if="installed && addedPermissions.length">{{ t('新增权限:') }}{{ addedPermissions.map(permission => labels[permission]).join('、') }}</p>
|
|
125
|
+
<p>{{ t('所需权限:') }}{{ permissions.map(permission => labels[permission] ?? permission).join('、') || t('无代码权限') }}</p>
|
|
126
|
+
<p v-if="installed && addedPermissions.length">{{ t('新增权限:') }}{{ addedPermissions.map(permission => labels[permission] ?? permission).join('、') }}</p>
|
|
121
127
|
<template v-if="selected.manifest.manifestVersion === 2">
|
|
122
128
|
<p v-if="selected.manifest.networkOrigins.length">{{ t('网络来源:') }}{{ selected.manifest.networkOrigins.join('、') }}</p>
|
|
123
129
|
<p v-if="selected.manifest.nativeCommands.length">{{ t('本机能力:') }}{{ selected.manifest.nativeCommands.join('、') }}</p>
|
|
124
130
|
</template>
|
|
125
131
|
<p class="catalog-origin">{{ (selected.bytes / 1024).toFixed(1) }} KiB · SHA-256 {{ selected.integrity }}</p>
|
|
126
|
-
<
|
|
127
|
-
<
|
|
132
|
+
<label>{{ t('安装范围') }} <select v-model="installScope" :aria-label="t('目录插件安装范围')" :disabled="installing"><option value="workspace">{{ t('当前工作区(随工作区同步)') }}</option><option value="user" :disabled="!!userScopeReason">{{ t('全局插件(跨工作区生效)') }}</option></select></label>
|
|
133
|
+
<p v-if="!selectedCompat.compatible" class="pc-feedback error" role="alert">{{ selectedCompat.reason }}</p>
|
|
134
|
+
<p v-if="installScope === 'workspace' && !store.canManagePlugins">{{ t('需要工作区管理员安装或更新插件。') }}</p>
|
|
135
|
+
<p v-if="userScopeReason">{{ userScopeReason }}</p>
|
|
136
|
+
<button class="pc-button pc-primary" :disabled="installing || (installScope === 'workspace' ? !store.canManagePlugins : !!userScopeReason) || selected.status !== 'published' || unchanged" @click="install">{{ installing ? t('正在校验并安装…') : unchanged ? t('已安装此版本') : t('安装所选版本') }}</button>
|
|
128
137
|
</PluginDialog>
|
|
129
138
|
</section>
|
|
130
139
|
</template>
|
|
@@ -2,14 +2,27 @@
|
|
|
2
2
|
import { t } from '../../i18n/i18n';
|
|
3
3
|
import { computed } from 'vue';
|
|
4
4
|
import { canonicalPluginJson, type PluginManifest } from '@tano/protocol';
|
|
5
|
+
import { pluginPermissionLabels as labels } from '../plugin-permissions';
|
|
5
6
|
const props = defineProps<{ before?: PluginManifest; after: PluginManifest; workspace?: string }>();
|
|
6
|
-
const labels: Record<string, string> = { get 'documents.read'() { return t('读取与打开文档'); }, get 'documents.write'() { return t('创建与修改文档'); }, get 'objects.read'() { return t('读取对象'); }, get 'objects.write'() { return t('创建与修改对象'); }, get 'relations.read'() { return t('读取关系'); }, get 'relations.write'() { return t('修改关系'); }, get storage() { return t('保存插件本机状态'); }, get network() { return t('访问指定网络来源'); }, get connections() { return t('使用单独授权的服务凭据'); }, get native() { return t('调用指定本机能力'); }, get ui() { return t('运行隔离的自定义界面'); } };
|
|
7
7
|
function capabilities(manifest?: PluginManifest) {
|
|
8
|
-
return manifest?.manifestVersion === 2
|
|
8
|
+
return manifest?.manifestVersion === 2
|
|
9
|
+
? [
|
|
10
|
+
manifest.permissions.map(value => labels[value] ?? value),
|
|
11
|
+
manifest.networkOrigins,
|
|
12
|
+
manifest.nativeCommands,
|
|
13
|
+
(manifest.fileHandlers ?? []).flatMap(handler =>
|
|
14
|
+
handler.extensions.map(ext => `${ext}(${handler.mode === 'editor' ? t('编辑') : t('预览')})`),
|
|
15
|
+
),
|
|
16
|
+
[
|
|
17
|
+
...(manifest.assistantTools ?? []).map(tool => `${tool.label}(${tool.effect})`),
|
|
18
|
+
...(manifest.assistantContextProviders ?? []).map(provider => `@${provider.id}(${provider.label})`),
|
|
19
|
+
],
|
|
20
|
+
]
|
|
21
|
+
: [[], [], [], [], []];
|
|
9
22
|
}
|
|
10
23
|
const changes = computed(() => {
|
|
11
24
|
const before = capabilities(props.before), after = capabilities(props.after);
|
|
12
|
-
return [t('运行权限'), t('联网地址'), t('本机能力')].map((label, i) => ({ label, before: before[i]!, after: after[i]!,
|
|
25
|
+
return [t('运行权限'), t('联网地址'), t('本机能力'), t('文件打开器'), t('助手扩展')].map((label, i) => ({ label, before: before[i]!, after: after[i]!,
|
|
13
26
|
added: after[i]!.filter(value => !before[i]!.includes(value)), removed: before[i]!.filter(value => !after[i]!.includes(value)) }));
|
|
14
27
|
});
|
|
15
28
|
const appearanceChanged = computed(() => canonicalPluginJson(props.before?.appearance ?? null) !== canonicalPluginJson(props.after.appearance ?? null));
|
|
@@ -11,7 +11,7 @@ const authentication = ref<PluginConnectionAuthentication>('bearer');
|
|
|
11
11
|
const methods = ref<PluginConnectionMethod[]>(['GET']);
|
|
12
12
|
const busy = ref(false), error = ref(''), status = ref('');
|
|
13
13
|
let controller = new AbortController();
|
|
14
|
-
const plugins = computed(() => store.installedPlugins.filter(item => item.manifest.manifestVersion === 2 && item.manifest.permissions.includes('connections')));
|
|
14
|
+
const plugins = computed(() => store.installedPlugins.filter(item => item.scope !== 'user' && !item.system && item.manifest.manifestVersion === 2 && item.manifest.permissions.includes('connections')));
|
|
15
15
|
const installation = computed(() => plugins.value.find(item => item.manifest.id === pluginId.value));
|
|
16
16
|
const origins = computed(() => installation.value?.manifest.manifestVersion === 2 ? installation.value.manifest.networkOrigins : []);
|
|
17
17
|
const existing = computed(() => entries.value.find(item => item.pluginId === pluginId.value && item.origin === origin.value));
|
|
@@ -3,7 +3,7 @@ import { ref, watch } from 'vue';
|
|
|
3
3
|
import type { PluginJson, PluginUiBundle } from '@tano/protocol';
|
|
4
4
|
import { createPluginUiSandbox, type PluginUiSandbox } from '../ui-sandbox';
|
|
5
5
|
import type { PluginInteraction } from '../workbench';
|
|
6
|
-
const props = defineProps<{ bundle: PluginUiBundle; state: PluginJson; workspaceId: string; pluginId: string; instanceId: string; viewId: string;
|
|
6
|
+
const props = defineProps<{ bundle: PluginUiBundle; state: PluginJson; workspaceId: string; pluginId: string; instanceId: string; viewId: string; fill?: boolean;
|
|
7
7
|
execute: (interaction: PluginInteraction) => Promise<void> }>();
|
|
8
8
|
const container = ref<HTMLElement>();
|
|
9
9
|
const error = ref('');
|
|
@@ -24,7 +24,7 @@ watch([() => container.value, () => props.workspaceId, () => props.pluginId, ()
|
|
|
24
24
|
watch(() => props.state, state => sandbox?.update(state), { flush: 'post' });
|
|
25
25
|
</script>
|
|
26
26
|
<template>
|
|
27
|
-
<div class="plugin-custom-view" :class="{ 'plugin-custom-fill':
|
|
27
|
+
<div class="plugin-custom-view" :class="{ 'plugin-custom-fill': !!fill }">
|
|
28
28
|
<p v-if="error" role="alert">{{ error }}</p>
|
|
29
29
|
<div ref="container" class="plugin-custom-container" v-show="!error" />
|
|
30
30
|
</div>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, watch } from 'vue';
|
|
3
3
|
import { ArrowUpRight, Download, LoaderCircle, ShieldCheck } from 'lucide-vue-next';
|
|
4
|
-
import
|
|
4
|
+
import { checkPluginCompatibility, type PluginMode } from '@tano/protocol';
|
|
5
5
|
import { t } from '../../i18n/i18n';
|
|
6
6
|
import { useWorkspaceStore } from '../../stores/workspace';
|
|
7
7
|
import { bundledPluginCatalog } from '../plugin-catalog';
|
|
8
|
+
import { pluginPermissionLabels as permissionLabels } from '../plugin-permissions';
|
|
9
|
+
import { userScopeUnsupportedReason } from '../user-plugins';
|
|
8
10
|
import { usePluginActions } from '../use-plugin-actions';
|
|
9
11
|
import PluginIcon from './PluginIcon.vue';
|
|
10
12
|
import PluginMaintenance from './PluginMaintenance.vue';
|
|
13
|
+
import PluginSettingsForm from './PluginSettingsForm.vue';
|
|
11
14
|
const props = defineProps<{ pluginId: string }>();
|
|
12
15
|
const store = useWorkspaceStore();
|
|
13
16
|
const detail = computed(
|
|
@@ -23,11 +26,20 @@ const {
|
|
|
23
26
|
policyMode,
|
|
24
27
|
settingsText,
|
|
25
28
|
sourceUrl,
|
|
29
|
+
pathScopesText,
|
|
26
30
|
change,
|
|
27
31
|
authorize,
|
|
28
32
|
savePolicy,
|
|
33
|
+
saveUserSettings,
|
|
29
34
|
installFromCatalog,
|
|
30
35
|
} = usePluginActions(detail);
|
|
36
|
+
const userScopeBlocked = computed(() => (detail.value ? userScopeUnsupportedReason(detail.value) : undefined));
|
|
37
|
+
const compatibility = computed(() =>
|
|
38
|
+
detail.value ? checkPluginCompatibility(detail.value, store.pluginHostEnvironment) : { compatible: true },
|
|
39
|
+
);
|
|
40
|
+
const settingsSchema = computed(() =>
|
|
41
|
+
detail.value?.manifestVersion === 2 ? detail.value.settingsSchema : undefined,
|
|
42
|
+
);
|
|
31
43
|
const detailViews = computed(() =>
|
|
32
44
|
detail.value?.manifestVersion === 2
|
|
33
45
|
? detail.value.views.map((view) => ({
|
|
@@ -38,10 +50,11 @@ const detailViews = computed(() =>
|
|
|
38
50
|
: [],
|
|
39
51
|
);
|
|
40
52
|
const commands = computed(() => (detail.value?.manifestVersion === 2 ? detail.value.commands : []));
|
|
53
|
+
const fileHandlers = computed(() => (detail.value?.manifestVersion === 2 ? (detail.value.fileHandlers ?? []) : []));
|
|
41
54
|
const tabKeys = { details: '详细信息', features: '功能', permissions: '权限', settings: '设置' };
|
|
42
55
|
const tabs = computed(() => [
|
|
43
56
|
'详细信息',
|
|
44
|
-
...(detailViews.value.length || commands.value.length ? ['功能'] : []),
|
|
57
|
+
...(detailViews.value.length || commands.value.length || fileHandlers.value.length ? ['功能'] : []),
|
|
45
58
|
...(detail.value?.manifestVersion === 2 ? ['权限'] : []),
|
|
46
59
|
...(selectedInstallation.value && !selectedInstallation.value.system ? ['设置'] : []),
|
|
47
60
|
]);
|
|
@@ -49,44 +62,6 @@ const active = ref('详细信息');
|
|
|
49
62
|
watch(tabs, (values) => {
|
|
50
63
|
if (!values.includes(active.value)) active.value = values[0];
|
|
51
64
|
});
|
|
52
|
-
const permissionLabels: Record<PluginPermission, string> = {
|
|
53
|
-
get 'attachments.read'() {
|
|
54
|
-
return t('只读访问工作区附件');
|
|
55
|
-
},
|
|
56
|
-
get 'documents.read'() {
|
|
57
|
-
return t('读取与打开文档');
|
|
58
|
-
},
|
|
59
|
-
get 'documents.write'() {
|
|
60
|
-
return t('创建与修改文档');
|
|
61
|
-
},
|
|
62
|
-
get 'objects.read'() {
|
|
63
|
-
return t('读取对象');
|
|
64
|
-
},
|
|
65
|
-
get 'objects.write'() {
|
|
66
|
-
return t('创建与修改对象');
|
|
67
|
-
},
|
|
68
|
-
get 'relations.read'() {
|
|
69
|
-
return t('读取关系');
|
|
70
|
-
},
|
|
71
|
-
get 'relations.write'() {
|
|
72
|
-
return t('修改关系');
|
|
73
|
-
},
|
|
74
|
-
get storage() {
|
|
75
|
-
return t('保存插件本机状态');
|
|
76
|
-
},
|
|
77
|
-
get network() {
|
|
78
|
-
return t('访问指定网络来源');
|
|
79
|
-
},
|
|
80
|
-
get connections() {
|
|
81
|
-
return t('使用单独授权的服务凭据');
|
|
82
|
-
},
|
|
83
|
-
get native() {
|
|
84
|
-
return t('调用指定本机能力');
|
|
85
|
-
},
|
|
86
|
-
get ui() {
|
|
87
|
-
return t('运行隔离的自定义界面');
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
65
|
const modeLabels: Record<PluginMode, string> = {
|
|
91
66
|
get required() {
|
|
92
67
|
return t('必需');
|
|
@@ -114,6 +89,8 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
114
89
|
<p>
|
|
115
90
|
v{{ detail.version }} · {{ detail.id
|
|
116
91
|
}}<span v-if="selectedInstallation?.system"> · {{ t('系统插件') }}</span>
|
|
92
|
+
<span v-else-if="selectedInstallation?.scope === 'user'"> · {{ t('全局插件') }}</span>
|
|
93
|
+
<span v-else-if="selectedInstallation"> · {{ t('工作区插件') }}</span>
|
|
117
94
|
</p>
|
|
118
95
|
</div>
|
|
119
96
|
<span
|
|
@@ -123,12 +100,18 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
123
100
|
>{{ selectedInstallation.enabled ? t('已启用') : t('已停用') }}</span
|
|
124
101
|
>
|
|
125
102
|
</div>
|
|
103
|
+
<p v-if="!compatibility.compatible" role="alert" class="dialog-intro">
|
|
104
|
+
{{ compatibility.reason }}
|
|
105
|
+
</p>
|
|
106
|
+
<p v-if="selectedInstallation?.shadowedUserPlugin" role="status" class="dialog-intro">
|
|
107
|
+
{{ t('当前工作区已锁定此插件版本,正在优先使用工作区版本;切换到其他工作区后恢复你的全局版本。') }}
|
|
108
|
+
</p>
|
|
126
109
|
<footer class="detail-footer">
|
|
127
110
|
<template v-if="selectedInstallation"
|
|
128
111
|
><button
|
|
129
112
|
v-if="!selectedInstallation.system"
|
|
130
113
|
class="pc-button pc-text uninstall"
|
|
131
|
-
:disabled="busy || !store.canManagePlugins"
|
|
114
|
+
:disabled="busy || (selectedInstallation.scope !== 'user' && !store.canManagePlugins)"
|
|
132
115
|
@click="change({ uninstall: detail.id })"
|
|
133
116
|
>
|
|
134
117
|
{{ t('卸载插件') }}</button
|
|
@@ -143,16 +126,25 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
143
126
|
>
|
|
144
127
|
{{ selectedInstallation.enabled ? t('停用插件') : t('启用插件') }}
|
|
145
128
|
</button></template
|
|
146
|
-
><
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
129
|
+
><template v-else>
|
|
130
|
+
<button
|
|
131
|
+
class="pc-button pc-primary"
|
|
132
|
+
:disabled="busy || !store.canManagePlugins"
|
|
133
|
+
@click="installFromCatalog(detail, 'workspace')"
|
|
134
|
+
>
|
|
135
|
+
<Download v-if="!busy" :size="15" /><LoaderCircle v-else class="pc-spin" :size="15" />{{
|
|
136
|
+
busy ? t('正在安装…') : t('安装插件')
|
|
137
|
+
}}
|
|
138
|
+
</button>
|
|
139
|
+
<button
|
|
140
|
+
v-if="!userScopeBlocked"
|
|
141
|
+
class="pc-button pc-secondary"
|
|
142
|
+
:disabled="busy"
|
|
143
|
+
@click="installFromCatalog(detail, 'user')"
|
|
144
|
+
>
|
|
145
|
+
{{ t('安装为全局插件') }}
|
|
146
|
+
</button>
|
|
147
|
+
</template>
|
|
156
148
|
</footer>
|
|
157
149
|
<nav class="center-nav" :aria-label="t('插件详情')">
|
|
158
150
|
<button
|
|
@@ -177,6 +169,12 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
177
169
|
<p v-for="icons in detail.appearance.icons" :key="icons.id">
|
|
178
170
|
{{ t('文件与目录图标') }}:{{ icons.label }}
|
|
179
171
|
</p>
|
|
172
|
+
<p
|
|
173
|
+
v-for="iconRef in (detail.appearance.iconRefs ?? []).filter((ref) => !detail?.appearance?.icons?.some((item) => item.id === ref.id))"
|
|
174
|
+
:key="iconRef.id"
|
|
175
|
+
>
|
|
176
|
+
{{ t('文件与目录图标') }}:{{ iconRef.label }}
|
|
177
|
+
</p>
|
|
180
178
|
<p v-for="layout in detail.appearance.layouts" :key="layout.id">
|
|
181
179
|
{{ t('布局风格') }}:{{ layout.label }}
|
|
182
180
|
</p>
|
|
@@ -245,11 +243,69 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
245
243
|
>
|
|
246
244
|
{{ selectedInstallation.authorized ? t('撤销此设备授权') : t('授权此版本运行') }}
|
|
247
245
|
</button>
|
|
246
|
+
<button
|
|
247
|
+
v-if="
|
|
248
|
+
selectedInstallation?.scope === 'user' &&
|
|
249
|
+
!selectedInstallation.globallyAuthorized &&
|
|
250
|
+
store.canManagePlugins
|
|
251
|
+
"
|
|
252
|
+
class="pc-button pc-secondary"
|
|
253
|
+
@click="authorize(true, { allWorkspaces: true })"
|
|
254
|
+
>
|
|
255
|
+
{{ t('在我的全部个人工作区授权此版本') }}
|
|
256
|
+
</button>
|
|
257
|
+
<p v-if="selectedInstallation?.globallyAuthorized" class="dialog-intro">
|
|
258
|
+
{{ t('此精确版本已授权在你可管理的个人工作区自动运行;非管理员的团队工作区仍需单独授权。') }}
|
|
259
|
+
</p>
|
|
260
|
+
<p
|
|
261
|
+
v-if="selectedInstallation?.scope === 'user' && selectedInstallation.personalCodePolicy === 'block'"
|
|
262
|
+
role="alert"
|
|
263
|
+
class="dialog-intro"
|
|
264
|
+
>
|
|
265
|
+
{{ t('当前工作区管理员策略禁止个人代码插件运行。') }}
|
|
266
|
+
</p>
|
|
267
|
+
<p
|
|
268
|
+
v-else-if="selectedInstallation?.scope === 'user' && selectedInstallation.personalCodePolicy === 'read-only'"
|
|
269
|
+
role="status"
|
|
270
|
+
class="dialog-intro"
|
|
271
|
+
>
|
|
272
|
+
{{ t('当前工作区管理员策略仅允许个人代码插件只读访问,所有写入操作将被拦截。') }}
|
|
273
|
+
</p>
|
|
248
274
|
</section>
|
|
249
275
|
</section>
|
|
250
276
|
<section v-if="active === tabKeys.settings">
|
|
251
277
|
<section
|
|
252
|
-
v-if="selectedInstallation?.
|
|
278
|
+
v-if="selectedInstallation?.scope === 'user'"
|
|
279
|
+
class="detail-section plugin-policy"
|
|
280
|
+
>
|
|
281
|
+
<h4>{{ t('全局插件设置') }}</h4>
|
|
282
|
+
<p>{{ t('此插件为全局安装,跨工作区生效;设置保存在当前设备的应用数据中,不写入工作区文件。') }}</p>
|
|
283
|
+
<PluginSettingsForm v-if="settingsSchema?.length" v-model="settingsText" :schema="settingsSchema" :disabled="busy" />
|
|
284
|
+
<label v-else
|
|
285
|
+
>{{ t('个人设置')
|
|
286
|
+
}}<textarea
|
|
287
|
+
v-model="settingsText"
|
|
288
|
+
:aria-label="t('插件个人设置')"
|
|
289
|
+
rows="4"
|
|
290
|
+
spellcheck="false"
|
|
291
|
+
/>
|
|
292
|
+
</label>
|
|
293
|
+
<label v-if="detail.manifestVersion === 2"
|
|
294
|
+
>{{ t('限制可访问目录(可选,每行一个目录前缀)')
|
|
295
|
+
}}<textarea
|
|
296
|
+
v-model="pathScopesText"
|
|
297
|
+
:aria-label="t('插件目录权限范围')"
|
|
298
|
+
:placeholder="t('例如:日报/')"
|
|
299
|
+
rows="2"
|
|
300
|
+
spellcheck="false"
|
|
301
|
+
/>
|
|
302
|
+
</label>
|
|
303
|
+
<button class="pc-button pc-secondary" :disabled="busy" @click="saveUserSettings">
|
|
304
|
+
{{ t('保存全局设置') }}
|
|
305
|
+
</button>
|
|
306
|
+
</section>
|
|
307
|
+
<section
|
|
308
|
+
v-else-if="selectedInstallation?.rule && !selectedInstallation.system && store.canManagePlugins"
|
|
253
309
|
class="detail-section plugin-policy"
|
|
254
310
|
>
|
|
255
311
|
<h4>{{ t('工作区规则') }}</h4>
|
|
@@ -269,7 +325,8 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
269
325
|
<option value="disabled">{{ t('禁止') }}</option>
|
|
270
326
|
</select></label
|
|
271
327
|
>
|
|
272
|
-
<
|
|
328
|
+
<PluginSettingsForm v-if="settingsSchema?.length" v-model="settingsText" :schema="settingsSchema" :disabled="busy" />
|
|
329
|
+
<label v-else
|
|
273
330
|
>{{ t('共享设置')
|
|
274
331
|
}}<textarea
|
|
275
332
|
v-model="settingsText"
|
|
@@ -278,6 +335,16 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
278
335
|
spellcheck="false"
|
|
279
336
|
/>
|
|
280
337
|
</label>
|
|
338
|
+
<label v-if="detail.manifestVersion === 2"
|
|
339
|
+
>{{ t('限制可访问目录(可选,每行一个目录前缀)')
|
|
340
|
+
}}<textarea
|
|
341
|
+
v-model="pathScopesText"
|
|
342
|
+
:aria-label="t('插件目录权限范围')"
|
|
343
|
+
:placeholder="t('例如:日报/')"
|
|
344
|
+
rows="2"
|
|
345
|
+
spellcheck="false"
|
|
346
|
+
/>
|
|
347
|
+
</label>
|
|
281
348
|
<label v-if="detail.manifestVersion === 2"
|
|
282
349
|
>{{ t('插件包 HTTPS 地址(可选)')
|
|
283
350
|
}}<input v-model="sourceUrl" :aria-label="t('插件包下载地址')" type="url"
|
|
@@ -301,7 +368,9 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
301
368
|
>{{
|
|
302
369
|
selectedInstallation?.system
|
|
303
370
|
? t('系统插件随应用提供;启用偏好仅保存在此设备。')
|
|
304
|
-
:
|
|
371
|
+
: selectedInstallation?.scope === 'user'
|
|
372
|
+
? t('全局插件保存在此设备的应用数据中,跨工作区生效,不写入工作区文件。')
|
|
373
|
+
: t('版本与共享设置保存在工作区;代码和缓存保存在应用数据中。')
|
|
305
374
|
}}<br />{{ t('插件操作遵循你的文档权限。') }}</span
|
|
306
375
|
>
|
|
307
376
|
</p>
|
|
@@ -320,6 +389,12 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
320
389
|
<p v-for="command in commands" :key="command.id">
|
|
321
390
|
{{ command.label }} {{ command.shortcut }}
|
|
322
391
|
</p>
|
|
392
|
+
<section v-if="fileHandlers.length" class="detail-section">
|
|
393
|
+
<h4>{{ t('文件打开器') }}</h4>
|
|
394
|
+
<p v-for="(handler, index) in fileHandlers" :key="index">
|
|
395
|
+
{{ handler.extensions.join('、') }} · {{ handler.mode === 'editor' ? t('编辑') : t('预览') }}
|
|
396
|
+
</p>
|
|
397
|
+
</section>
|
|
323
398
|
</section>
|
|
324
399
|
</article>
|
|
325
400
|
</template>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { PluginRuntimeState } from '../host';
|
|
4
|
+
import type { PluginInteraction, PluginWorkbenchView } from '../workbench';
|
|
5
|
+
import PluginSurface from './PluginSurface.vue';
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
location: 'documentHeader' | 'documentFooter';
|
|
9
|
+
views: readonly PluginWorkbenchView[];
|
|
10
|
+
runtimes: readonly PluginRuntimeState[];
|
|
11
|
+
workspaceId: string;
|
|
12
|
+
execute: (interaction: PluginInteraction) => Promise<void>;
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const renderedSlots = computed(() =>
|
|
16
|
+
props.views
|
|
17
|
+
.filter((view) => view.location === props.location)
|
|
18
|
+
.map((view) => {
|
|
19
|
+
const runtime = props.runtimes.find((rt) => rt.id === view.pluginId);
|
|
20
|
+
const state = runtime?.views.find((entry) => entry.id === view.id);
|
|
21
|
+
return { view, runtime, hasContent: !!state && (!!state.tree || !!state.custom) };
|
|
22
|
+
})
|
|
23
|
+
.filter((entry) => entry.runtime?.status === 'running' && entry.hasContent),
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div
|
|
29
|
+
v-if="renderedSlots.length"
|
|
30
|
+
class="plugin-document-slot"
|
|
31
|
+
:class="`slot-${location}`"
|
|
32
|
+
:data-slot="location"
|
|
33
|
+
>
|
|
34
|
+
<PluginSurface
|
|
35
|
+
v-for="{ view, runtime } in renderedSlots"
|
|
36
|
+
:key="`${workspaceId}:${view.key}`"
|
|
37
|
+
:view="view"
|
|
38
|
+
:workspace-id="workspaceId"
|
|
39
|
+
:runtime="runtime"
|
|
40
|
+
:execute="execute"
|
|
41
|
+
compact
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<style scoped>
|
|
47
|
+
.plugin-document-slot {
|
|
48
|
+
width: 100%;
|
|
49
|
+
max-width: var(--page-width, 820px);
|
|
50
|
+
margin: 0 auto;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: 8px;
|
|
54
|
+
}
|
|
55
|
+
.plugin-document-slot.slot-documentHeader {
|
|
56
|
+
margin-bottom: 12px;
|
|
57
|
+
}
|
|
58
|
+
.plugin-document-slot.slot-documentFooter {
|
|
59
|
+
margin-top: 20px;
|
|
60
|
+
padding-top: 12px;
|
|
61
|
+
border-top: 1px solid var(--line);
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -44,12 +44,11 @@ onBeforeUnmount(() => {
|
|
|
44
44
|
window.removeEventListener('pointerdown', dismissMenus);
|
|
45
45
|
window.removeEventListener('keydown', dismissMenus);
|
|
46
46
|
});
|
|
47
|
-
const
|
|
47
|
+
const PluginImportDialog = defineAsyncComponent(() => import('./PluginImportDialog.vue'));
|
|
48
48
|
const store = useWorkspaceStore();
|
|
49
49
|
const query = ref(''),
|
|
50
50
|
menu = ref(''),
|
|
51
51
|
importing = ref(false);
|
|
52
|
-
const importer = ref<{ openImport(): void }>();
|
|
53
52
|
const installedOpen = ref(true),
|
|
54
53
|
recommendedOpen = ref(!store.installedPlugins.length);
|
|
55
54
|
const { error, status, pending, busy, change, installFromCatalog } = usePluginActions();
|
|
@@ -67,9 +66,8 @@ const recommended = computed(() =>
|
|
|
67
66
|
function closeMenu(event: Event) {
|
|
68
67
|
(event.currentTarget as HTMLElement).closest('details')?.removeAttribute('open');
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
else importing.value = true;
|
|
69
|
+
function openImport() {
|
|
70
|
+
importing.value = true;
|
|
73
71
|
menu.value = '';
|
|
74
72
|
}
|
|
75
73
|
</script>
|
|
@@ -117,6 +115,7 @@ async function openImport() {
|
|
|
117
115
|
<PluginIcon :id="item.manifest.id" /><span
|
|
118
116
|
><strong
|
|
119
117
|
>{{ item.manifest.name }}
|
|
118
|
+
<small v-if="item.scope === 'user'">{{ t('全局') }}</small>
|
|
120
119
|
<small v-if="!item.enabled">{{ t('已停用') }}</small></strong
|
|
121
120
|
><span class="description">{{ item.manifest.description }}</span></span
|
|
122
121
|
>
|
|
@@ -131,7 +130,7 @@ async function openImport() {
|
|
|
131
130
|
<Power :size="14" />{{ item.enabled ? t('停用插件') : t('启用插件') }}</button
|
|
132
131
|
><button
|
|
133
132
|
v-if="!item.system"
|
|
134
|
-
:disabled="busy || !store.canManagePlugins"
|
|
133
|
+
:disabled="busy || (item.scope !== 'user' && !store.canManagePlugins)"
|
|
135
134
|
@click="change({ uninstall: item.manifest.id })"
|
|
136
135
|
>
|
|
137
136
|
<Trash2 :size="14" />{{ t('卸载插件') }}</button
|
|
@@ -174,18 +173,16 @@ async function openImport() {
|
|
|
174
173
|
</button>
|
|
175
174
|
</div>
|
|
176
175
|
</section>
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
/>
|
|
188
|
-
</div>
|
|
176
|
+
<PluginImportDialog
|
|
177
|
+
v-if="importing"
|
|
178
|
+
@close="importing = false"
|
|
179
|
+
@feedback="
|
|
180
|
+
(message, failure) => {
|
|
181
|
+
status = message;
|
|
182
|
+
error = failure;
|
|
183
|
+
}
|
|
184
|
+
"
|
|
185
|
+
/>
|
|
189
186
|
</div>
|
|
190
187
|
</template>
|
|
191
188
|
<style scoped>
|
|
@@ -313,7 +310,4 @@ strong {
|
|
|
313
310
|
font-size: 13px;
|
|
314
311
|
font-weight: 500;
|
|
315
312
|
}
|
|
316
|
-
.import-host {
|
|
317
|
-
display: none;
|
|
318
|
-
}
|
|
319
313
|
</style>
|