@lvce-editor/title-bar-worker 4.13.0 → 4.13.1
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 +0 -4
- package/dist/titleBarWorkerMain.js +10 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3777,15 +3777,23 @@ const parseTitleTemplate = (template, folderName, appName) => {
|
|
|
3777
3777
|
return template.replaceAll('${folderName}', () => folderName).replaceAll('${appName}', () => appName);
|
|
3778
3778
|
};
|
|
3779
3779
|
|
|
3780
|
+
const getEndIndex = workspaceUri => {
|
|
3781
|
+
let endIndex = workspaceUri.length;
|
|
3782
|
+
while (endIndex > 0 && workspaceUri[endIndex - 1] === '/') {
|
|
3783
|
+
endIndex--;
|
|
3784
|
+
}
|
|
3785
|
+
return endIndex;
|
|
3786
|
+
};
|
|
3780
3787
|
const getTitle = (workspaceUri, titleTemplate, appName) => {
|
|
3781
3788
|
if (!workspaceUri) {
|
|
3782
3789
|
return '';
|
|
3783
3790
|
}
|
|
3784
|
-
const
|
|
3791
|
+
const endIndex = getEndIndex(workspaceUri);
|
|
3792
|
+
const slashIndex = workspaceUri.lastIndexOf('/', endIndex - 1);
|
|
3785
3793
|
if (slashIndex === -1) {
|
|
3786
3794
|
return '';
|
|
3787
3795
|
}
|
|
3788
|
-
const folderName = workspaceUri.slice(slashIndex + 1);
|
|
3796
|
+
const folderName = workspaceUri.slice(slashIndex + 1, endIndex);
|
|
3789
3797
|
|
|
3790
3798
|
// If titleTemplate is empty, return folderName directly
|
|
3791
3799
|
if (!titleTemplate) {
|