Skip to content

Commit 4ee3abc

Browse files
fix: conflicts
2 parents 8e27bfd + df55be6 commit 4ee3abc

13 files changed

Lines changed: 179 additions & 112 deletions

File tree

rspack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ module.exports = (env, options) => {
8989
],
9090
type: 'javascript/auto',
9191
},
92+
{
93+
test: /\.svg$/,
94+
resourceQuery: /raw/,
95+
type: 'asset/source',
96+
},
9297
// Asset files
9398
{
9499
test: /\.(png|svg|jpg|jpeg|ico|ttf|webp|eot|woff|webm|mp4|wav)(\?.*)?$/,
100+
resourceQuery: { not: [/raw/] },
95101
type: 'asset/resource',
96102
},
97103
// Regular CSS/SCSS files

src/cm/themes/noctisLilac.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const config = {
1111
cursor: "#5c49e9",
1212
dropdownBackground: "#f2f1f8",
1313
dropdownBorder: "#e1def3",
14-
activeLine: "#e1def3",
14+
activeLine: "#e1def355",
1515
lineNumber: "#0c006b70",
1616
lineNumberActive: "#0c006b",
1717
matchingBracket: "#d5d1f2",

src/dialogs/loader.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@ import DOMPurify from "dompurify";
22
import Ref from "html-tag-js/ref";
33
import actionStack from "lib/actionStack";
44
import restoreTheme from "lib/restoreTheme";
5+
import tailSpinSvg from "res/tail-spin.svg?raw";
56

67
let loaderIsImmortal = false;
78
let onCancelCallback = null;
89
let $currentDialog = null;
910
let $currentMask = null;
11+
const titleLoaderId = "__title-loader";
12+
const tailSpinGradientId = "tail-spin-gradient";
13+
let tailSpinSvgId = 0;
14+
15+
function createTailSpinSvg() {
16+
const gradientId = `${tailSpinGradientId}-${tailSpinSvgId++}`;
17+
return tailSpinSvg.split(tailSpinGradientId).join(gradientId);
18+
}
1019

1120
/**
1221
* @typedef {object} LoaderOptions
@@ -51,7 +60,7 @@ function create(titleText, message = "", options = {}) {
5160
{titleText}
5261
</strong>
5362
<span className="message loader">
54-
<span className="loader"></span>
63+
<span className="loader" innerHTML={createTailSpinSvg()}></span>
5564
<div
5665
ref={$message}
5766
className="message"
@@ -96,6 +105,18 @@ function create(titleText, message = "", options = {}) {
96105
};
97106
}
98107

108+
function createTitleLoader() {
109+
const $titleLoader = tag.get(`#${titleLoaderId}`) || (
110+
<span id={titleLoaderId} innerHTML={createTailSpinSvg()}></span>
111+
);
112+
113+
if (!$titleLoader.isConnected) {
114+
app.append($titleLoader);
115+
}
116+
117+
return $titleLoader;
118+
}
119+
99120
/**
100121
* Removes the loader from DOM permanently
101122
*/
@@ -159,6 +180,7 @@ function showTitleLoader(immortal = false) {
159180
}
160181

161182
setTimeout(() => {
183+
createTitleLoader();
162184
app.classList.remove("title-loading-hide");
163185
app.classList.add("title-loading");
164186
}, 0);

src/dialogs/style.scss

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@use "../styles/mixins.scss";
2-
31
.prompt {
42
position: fixed;
53
left: 50%;
@@ -285,8 +283,19 @@
285283
align-items: center;
286284

287285
.loader {
288-
@include mixins.circular-loader(30px);
286+
width: 30px;
287+
height: 30px;
288+
color: rgb(153, 153, 255);
289+
color: var(--primary-color);
290+
display: flex;
291+
flex-shrink: 0;
289292
margin: 0 10px;
293+
294+
svg {
295+
width: 100%;
296+
height: 100%;
297+
display: block;
298+
}
290299
}
291300

292301
.message {

src/lib/editorFile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import helpers from "utils/helpers";
2222
import Path from "utils/Path";
2323
import Url from "utils/Url";
2424
import config from "./config";
25+
import { isInitialPluginLoadComplete } from "./loadPlugins";
2526
import openFolder from "./openFolder";
2627
import run from "./run";
2728
import saveFile from "./saveFile";
@@ -229,6 +230,7 @@ function createSessionProxy(state, file) {
229230

230231
function maybeRecommendLanguageModeExtension(file, modeInfo) {
231232
if (appSettings.value.recommendExtensions === false) return;
233+
if (!isInitialPluginLoadComplete()) return;
232234
if (modeInfo?.name !== "text" || modeInfo.supportsFile(file.filename)) return;
233235

234236
void import("./languageModeRecommendations").then(

src/lib/loadPlugins.js

Lines changed: 70 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const AUTO_DISABLED_PLUGINS = new Set();
3636
const PLUGIN_LOAD_TIMEOUT = 15000;
3737
const PLUGIN_DISABLE_TIMEOUT = 60000;
3838
let pluginDisabledUpdateQueue = Promise.resolve();
39+
let initialPluginLoadComplete = false;
3940

4041
class PluginLoadTimeoutError extends Error {
4142
constructor() {
@@ -45,70 +46,84 @@ class PluginLoadTimeoutError extends Error {
4546
}
4647

4748
export default async function loadPlugins(loadOnlyTheme = false) {
48-
const plugins = await fsOperation(PLUGIN_DIR).lsDir();
49-
const results = [];
50-
51-
if (plugins.length > 0) {
52-
toast(strings["loading plugins"]);
49+
if (!loadOnlyTheme) {
50+
initialPluginLoadComplete = false;
5351
}
5452

55-
let pluginsToLoad = [];
56-
const currentTheme = settings.value.appTheme;
57-
const enabledMap = settings.value.pluginsDisabled || {};
53+
try {
54+
const plugins = await fsOperation(PLUGIN_DIR).lsDir();
55+
const results = [];
5856

59-
if (loadOnlyTheme) {
60-
// Only load theme plugins matching current theme
61-
pluginsToLoad = plugins.filter((pluginDir) => {
62-
const pluginId = Url.basename(pluginDir.url);
63-
// Skip already loaded and plugins that were previously marked broken
64-
return (
65-
isThemePlugin(pluginId) &&
66-
!LOADED_PLUGINS.has(pluginId) &&
67-
enabledMap[pluginId] !== true &&
68-
!BROKEN_PLUGINS.has(pluginId)
69-
);
70-
});
71-
} else {
72-
// Load non-theme plugins that aren't loaded yet and are enabled
73-
pluginsToLoad = plugins.filter((pluginDir) => {
57+
if (plugins.length > 0) {
58+
toast(strings["loading plugins"]);
59+
}
60+
61+
let pluginsToLoad = [];
62+
const currentTheme = settings.value.appTheme;
63+
const enabledMap = settings.value.pluginsDisabled || {};
64+
65+
if (loadOnlyTheme) {
66+
// Only load theme plugins matching current theme
67+
pluginsToLoad = plugins.filter((pluginDir) => {
68+
const pluginId = Url.basename(pluginDir.url);
69+
// Skip already loaded and plugins that were previously marked broken
70+
return (
71+
isThemePlugin(pluginId) &&
72+
!LOADED_PLUGINS.has(pluginId) &&
73+
enabledMap[pluginId] !== true &&
74+
!BROKEN_PLUGINS.has(pluginId)
75+
);
76+
});
77+
} else {
78+
// Load non-theme plugins that aren't loaded yet and are enabled
79+
pluginsToLoad = plugins.filter((pluginDir) => {
80+
const pluginId = Url.basename(pluginDir.url);
81+
// Skip theme plugins, already loaded, disabled or previously marked broken
82+
return (
83+
!isThemePlugin(pluginId) &&
84+
!LOADED_PLUGINS.has(pluginId) &&
85+
enabledMap[pluginId] !== true &&
86+
!BROKEN_PLUGINS.has(pluginId)
87+
);
88+
});
89+
}
90+
91+
const loadPromises = pluginsToLoad.map(async (pluginDir) => {
7492
const pluginId = Url.basename(pluginDir.url);
75-
// Skip theme plugins, already loaded, disabled or previously marked broken
76-
return (
77-
!isThemePlugin(pluginId) &&
78-
!LOADED_PLUGINS.has(pluginId) &&
79-
enabledMap[pluginId] !== true &&
80-
!BROKEN_PLUGINS.has(pluginId)
81-
);
82-
});
83-
}
8493

85-
const loadPromises = pluginsToLoad.map(async (pluginDir) => {
86-
const pluginId = Url.basename(pluginDir.url);
87-
88-
if (loadOnlyTheme && currentTheme) {
89-
const pluginIdLower = pluginId.toLowerCase();
90-
const currentThemeLower = currentTheme.toLowerCase();
91-
const matchFound = pluginIdLower.includes(currentThemeLower);
92-
// Skip if:
93-
// 1. No match found with current theme AND
94-
// 2. It's not a theme plugin at all
95-
if (!matchFound && !isThemePlugin(pluginId)) {
96-
return;
94+
if (loadOnlyTheme && currentTheme) {
95+
const pluginIdLower = pluginId.toLowerCase();
96+
const currentThemeLower = currentTheme.toLowerCase();
97+
const matchFound = pluginIdLower.includes(currentThemeLower);
98+
// Skip if:
99+
// 1. No match found with current theme AND
100+
// 2. It's not a theme plugin at all
101+
if (!matchFound && !isThemePlugin(pluginId)) {
102+
return;
103+
}
97104
}
98-
}
99105

100-
try {
101-
results.push(await loadPluginWithTimeout(pluginId));
102-
} catch (error) {
103-
console.error(`Error loading plugin ${pluginId}:`, error);
104-
results.push(false);
105-
}
106-
});
106+
try {
107+
results.push(await loadPluginWithTimeout(pluginId));
108+
} catch (error) {
109+
console.error(`Error loading plugin ${pluginId}:`, error);
110+
results.push(false);
111+
}
112+
});
113+
114+
await Promise.allSettled(loadPromises);
107115

108-
await Promise.allSettled(loadPromises);
116+
acode[onPluginsLoadCompleteCallback]();
117+
return results.filter(Boolean).length;
118+
} finally {
119+
if (!loadOnlyTheme) {
120+
initialPluginLoadComplete = true;
121+
}
122+
}
123+
}
109124

110-
acode[onPluginsLoadCompleteCallback]();
111-
return results.filter(Boolean).length;
125+
export function isInitialPluginLoadComplete() {
126+
return initialPluginLoadComplete;
112127
}
113128

114129
export async function loadPluginWithTimeout(pluginId, justInstalled = false) {

src/lib/showFileInfo.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fsOperation from "fileSystem";
22
import dialog from "dialogs/dialog";
3+
import loader from "dialogs/loader";
34
import { filesize } from "filesize";
45
import mustache from "mustache";
56
import helpers from "utils/helpers";
@@ -13,7 +14,7 @@ import settings from "./settings";
1314
*/
1415
export default async function showFileInfo(url) {
1516
if (!url) url = editorManager.activeFile.uri;
16-
app.classList.add("title-loading");
17+
loader.showTitleLoader();
1718
try {
1819
const fs = fsOperation(url);
1920
const stats = await fs.stat();
@@ -65,5 +66,5 @@ export default async function showFileInfo(url) {
6566
helpers.error(err);
6667
}
6768

68-
app.classList.remove("title-loading");
69+
loader.removeTitleLoader();
6970
}

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ async function onDeviceReady() {
297297
const { activeFile } = editorManager;
298298
for (const file of editorManager.files) {
299299
if (file?.type === "editor") {
300+
<<<<<<< HEAD
300301
file.setMode(undefined, { recommend: false });
302+
=======
303+
file.setMode();
304+
>>>>>>> upstream/main
301305
}
302306
}
303307
editorManager.reapplyActiveFile();

src/main.scss

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,48 @@ body {
4747
box-shadow: none !important;
4848
}
4949

50+
#__title-loader {
51+
display: none;
52+
}
53+
5054
&:not(.loading).title-loading {
5155
&.title-loading-hide {
52-
&::after {
53-
background-image: none;
56+
#__title-loader {
5457
transform: translateX(-50%) translateY(-100%) scale3d(0.5, 0.5, 1);
5558
opacity: 0;
5659
animation: hide-loader 100ms ease-in 1;
5760
}
5861
}
5962

60-
&::after {
61-
content: "";
62-
background-color: #3333ff;
63-
background-color: var(--primary-color);
63+
#__title-loader {
64+
align-items: center;
65+
background-color: #ffffff;
66+
background-color: var(--popup-background-color);
6467
border-radius: 50%;
68+
color: #9999ff;
69+
color: var(--popup-text-color);
70+
display: flex;
71+
justify-content: center;
6572
position: fixed;
6673
height: 40px;
6774
width: 40px;
6875
top: 6px;
6976
left: 50%;
7077
transform: translateX(-50%);
71-
background-image: url(res/tail-spin.svg);
72-
background-repeat: no-repeat;
73-
background-position: center;
74-
background-size: 30px;
7578
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2);
7679
box-shadow: 0 0 4px 0 var(--box-shadow-color);
7780
border: solid 1px transparent;
7881
border: solid 1px var(--popup-border-color);
7982
animation: appear 100ms ease-out 1;
8083
box-sizing: border-box;
84+
pointer-events: none;
8185
z-index: 999;
86+
87+
svg {
88+
width: 30px;
89+
height: 30px;
90+
display: block;
91+
}
8292
}
8393
}
8494

src/res/tail-spin.svg

Lines changed: 7 additions & 7 deletions
Loading

0 commit comments

Comments
 (0)