codex-overleaf-link 2.3.4 → 2.3.5
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/README.md +318 -211
- package/extension/bootstrap/manifest.template.json +1 -1
- package/extension/src/background.js +5 -0
- package/extension/src/content/composerPanel.js +1 -1
- package/extension/src/content/contentRuntime.js +27 -28
- package/extension/src/content/generated/content.bundle.js +457 -125
- package/extension/src/content/generated/content.bundle.meta.json +5 -3
- package/extension/src/content/globalPreferencesController.js +125 -0
- package/extension/src/content/legacyGlobalRegistry.js +2 -0
- package/extension/src/content/panelRenderer.js +6 -1
- package/extension/src/content/projectSettingsCoordinator.js +1 -0
- package/extension/src/content/providerSettingsCoordinator.js +15 -0
- package/extension/src/content/providerSettingsDialog.js +24 -15
- package/extension/src/content/settingsPanel.js +5 -3
- package/extension/src/content/themeController.js +3 -0
- package/extension/src/shared/compatibility.js +1 -1
- package/extension/src/shared/globalPreferences.js +131 -0
- package/extension/src/shared/i18n.js +2 -2
- package/extension/styles/panel.css +17 -2
- package/package.json +1 -1
- package/scripts/install-managed.mjs +1 -1
|
@@ -15,6 +15,11 @@ if (!globalThis.CodexOverleafNativeRequestIdentity) {
|
|
|
15
15
|
: 'shared/nativeRequestIdentity.js';
|
|
16
16
|
importScripts(runtimeBase ? chrome.runtime.getURL(identityPath) : identityPath);
|
|
17
17
|
}
|
|
18
|
+
if (!globalThis.CodexOverleafGlobalPreferences) {
|
|
19
|
+
const runtimeBase = String(globalThis.__CODEX_OVERLEAF_RUNTIME_BASE__ || '');
|
|
20
|
+
importScripts(runtimeBase ? chrome.runtime.getURL(`${runtimeBase}/src/shared/globalPreferences.js`) : 'shared/globalPreferences.js');
|
|
21
|
+
}
|
|
22
|
+
globalThis.CodexOverleafGlobalPreferences?.installBackground(chrome);
|
|
18
23
|
|
|
19
24
|
(function initBackground() {
|
|
20
25
|
'use strict';
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
</span>
|
|
111
111
|
</div>
|
|
112
112
|
<div class="codex-context-selection" data-context-selection></div>
|
|
113
|
-
<div class="codex-context-status" data-context-status>Type @ to
|
|
113
|
+
<div class="codex-context-status" data-context-status>Type @ to choose files or add @compile-log. Name the section you want in your request.</div>
|
|
114
114
|
<div class="codex-context-files" data-context-file-list></div>
|
|
115
115
|
</div>
|
|
116
116
|
</form>
|
|
@@ -217,6 +217,7 @@
|
|
|
217
217
|
renderAuditHistoryPanel: () => renderAuditHistoryPanel(),
|
|
218
218
|
renderRecentProjectsVariant: (...args) => renderRecentProjectsVariant(...args),
|
|
219
219
|
saveStateSoon: () => saveStateSoon(),
|
|
220
|
+
updateGlobalPreferences: patch => getGlobalPreferences().update(patch),
|
|
220
221
|
setState: next => { state = next; },
|
|
221
222
|
tr,
|
|
222
223
|
tx,
|
|
@@ -664,6 +665,7 @@
|
|
|
664
665
|
const providerSettingsCoordinator = Modules.ProviderSettingsCoordinator.create({
|
|
665
666
|
ProviderProfiles: Modules.ProviderProfiles,
|
|
666
667
|
ProviderSettingsDialog: Modules.ProviderSettingsDialog,
|
|
668
|
+
hasCurrentProject: () => Boolean(getCurrentProjectId()),
|
|
667
669
|
tx,
|
|
668
670
|
sendBackgroundNative,
|
|
669
671
|
document,
|
|
@@ -840,6 +842,7 @@
|
|
|
840
842
|
let composerPanelInstance = null;
|
|
841
843
|
let state = null;
|
|
842
844
|
let storageKey = LEGACY_STORAGE_KEY;
|
|
845
|
+
let globalPreferencesController = null;
|
|
843
846
|
let currentRunView = null;
|
|
844
847
|
let pendingRetryReplacement = null;
|
|
845
848
|
let runQueueScheduler = null;
|
|
@@ -975,9 +978,10 @@
|
|
|
975
978
|
});
|
|
976
979
|
|
|
977
980
|
async function init() {
|
|
981
|
+
await getGlobalPreferences().initialize();
|
|
978
982
|
await refreshAccountScopeId();
|
|
979
983
|
storageKey = getProjectStorageKey(LEGACY_STORAGE_KEY, window.location.href);
|
|
980
|
-
state = normalizePanelState(await loadStoredState(), { restoreRunningRuns: true });
|
|
984
|
+
state = normalizePanelState(getGlobalPreferences().overlay(await loadStoredState()), { restoreRunningRuns: true });
|
|
981
985
|
initializeRunQueueScheduler();
|
|
982
986
|
recoverInterruptedRunJournals()
|
|
983
987
|
.then(() => applyStateToPanel())
|
|
@@ -999,6 +1003,7 @@
|
|
|
999
1003
|
recentProjects.mountDashboardShell();
|
|
1000
1004
|
}
|
|
1001
1005
|
applyStateToPanel();
|
|
1006
|
+
getGlobalPreferences().refreshView();
|
|
1002
1007
|
// Welcome-panel + write-guard: seed the lifecycle
|
|
1003
1008
|
// module-locals from the current URL, install the SPA route hook so
|
|
1004
1009
|
// future Overleaf navigations swap variants, and warm the account-scope
|
|
@@ -1263,7 +1268,7 @@
|
|
|
1263
1268
|
button: panel.querySelector('[data-custom-instructions-settings]'),
|
|
1264
1269
|
callbacks: {
|
|
1265
1270
|
onBack: () => closeCustomInstructionsSettings(),
|
|
1266
|
-
onInputChange:
|
|
1271
|
+
onInputChange: event => persistPanelInputs(event),
|
|
1267
1272
|
onSkillsOpen: () => openSkillsView(),
|
|
1268
1273
|
onSkillsBack: () => closeSkillsView(),
|
|
1269
1274
|
onProvidersOpen: () => providerSettingsCoordinator.open(),
|
|
@@ -4332,6 +4337,19 @@
|
|
|
4332
4337
|
return scopedPersistenceCoordinator;
|
|
4333
4338
|
}
|
|
4334
4339
|
|
|
4340
|
+
function getGlobalPreferences() {
|
|
4341
|
+
if (!globalPreferencesController) globalPreferencesController = Modules.GlobalPreferencesController.create({
|
|
4342
|
+
chromeApi: chrome, getState: () => state, setState: next => { state = next; }, getPanel: () => panel,
|
|
4343
|
+
applyTheme: applyPanelTheme, applyLocale: () => { applyLocaleToPanel(); refreshDashboardSoon(); },
|
|
4344
|
+
onPreloadChange: enabled => contextTrayController.scheduleContextPrefetch({ enabled }),
|
|
4345
|
+
onSkillsChange: () => { renderLocalSkillList(); updateSkillsEntrySummary(); },
|
|
4346
|
+
onError: error => showPluginToast(tx(
|
|
4347
|
+
`Global settings could not be saved or loaded: ${error.message}. Please retry.`,
|
|
4348
|
+
`全局设置未能保存或读取:${error.message}。请重试。`), { status: 'failed', sticky: true })
|
|
4349
|
+
});
|
|
4350
|
+
return globalPreferencesController;
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4335
4353
|
async function reloadProjectRunHistory(newProjectId) {
|
|
4336
4354
|
// Rebind the storage key to the new project and reload the panel state
|
|
4337
4355
|
// from chrome.storage.local so the per-project session list reflects
|
|
@@ -4339,7 +4357,7 @@
|
|
|
4339
4357
|
try {
|
|
4340
4358
|
storageKey = getProjectStorageKey(LEGACY_STORAGE_KEY, window.location.href);
|
|
4341
4359
|
const reloaded = await loadStoredState();
|
|
4342
|
-
state = normalizePanelState(reloaded, { restoreRunningRuns: true });
|
|
4360
|
+
state = normalizePanelState(getGlobalPreferences().overlay(reloaded), { restoreRunningRuns: true });
|
|
4343
4361
|
applyStateToPanel();
|
|
4344
4362
|
} catch (_error) {
|
|
4345
4363
|
// Reload failures fall back to the in-memory state; the next saveState
|
|
@@ -5077,8 +5095,8 @@
|
|
|
5077
5095
|
return fileItems.length
|
|
5078
5096
|
? fileItems.join(', ')
|
|
5079
5097
|
: tx(
|
|
5080
|
-
'@whole-project (default); add @
|
|
5081
|
-
'@whole-project
|
|
5098
|
+
'@whole-project (default); choose files or add @compile-log',
|
|
5099
|
+
'@whole-project(默认);可选择文件或添加 @compile-log'
|
|
5082
5100
|
);
|
|
5083
5101
|
}
|
|
5084
5102
|
|
|
@@ -5911,6 +5929,8 @@
|
|
|
5911
5929
|
}
|
|
5912
5930
|
|
|
5913
5931
|
async function persistPanelInputs(event) {
|
|
5932
|
+
const globalWrite = getGlobalPreferences().handleInput(event);
|
|
5933
|
+
if (globalWrite) return globalWrite;
|
|
5914
5934
|
// Typing in the task box is the hottest write path: a full saveState per
|
|
5915
5935
|
// keystroke serializes every session/run/event and rewrites IndexedDB, so
|
|
5916
5936
|
// panels get slower as history grows. Drafts take the debounced saver;
|
|
@@ -6009,29 +6029,8 @@
|
|
|
6009
6029
|
setCustomInstructionsForProject(projectId, customInstructionsInput.value);
|
|
6010
6030
|
}
|
|
6011
6031
|
setGovernanceRulesForCurrentProject(readGovernanceRulesFromSettings());
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
setSkillLoadingSettings(newSettings);
|
|
6015
|
-
// Theme is a global preference; read it from the settings select (which
|
|
6016
|
-
// lives inside the panel, like the other settings inputs), persist it on
|
|
6017
|
-
// state, and apply immediately. applyPanelTheme normalizes the value.
|
|
6018
|
-
const themePref = panel?.querySelector('[data-theme-select]')?.value || 'dark';
|
|
6019
|
-
if (state) {
|
|
6020
|
-
state.theme = themePref;
|
|
6021
|
-
}
|
|
6022
|
-
applyPanelTheme(themePref);
|
|
6023
|
-
// Language is a global UI preference (moved here from the diagnostics
|
|
6024
|
-
// menu); re-translate the panel when it changes.
|
|
6025
|
-
const languagePref = panel?.querySelector('[data-language-select]')?.value;
|
|
6026
|
-
if (languagePref && state && languagePref !== getLocale()) {
|
|
6027
|
-
state.locale = i18n?.normalizeLocale?.(languagePref) || languagePref;
|
|
6028
|
-
applyLocaleToPanel();
|
|
6029
|
-
}
|
|
6030
|
-
// Re-render skill list when master toggle changes so per-skill toggles update their disabled state.
|
|
6031
|
-
if (prevOverleafSkills !== getSkillLoadingSettings().loadCodexOverleafSkills) {
|
|
6032
|
-
renderLocalSkillList();
|
|
6033
|
-
}
|
|
6034
|
-
updateSkillsEntrySummary();
|
|
6032
|
+
// Global controls are handled as field patches by getGlobalPreferences;
|
|
6033
|
+
// unrelated session autosaves must not read stale settings controls.
|
|
6035
6034
|
}
|
|
6036
6035
|
}
|
|
6037
6036
|
|