소스 검색

Improves autolink UI

- prevents writing new empty autolink entries
- cleans up empty autolink arrays
main
Keith Daulton 2 년 전
부모
커밋
c1a848ec33
2개의 변경된 파일21개의 추가작업 그리고 12개의 파일을 삭제
  1. +0
    -1
      src/webviews/apps/settings/settings.ts
  2. +21
    -11
      src/webviews/apps/shared/appWithConfigBase.ts

+ 0
- 1
src/webviews/apps/settings/settings.ts 파일 보기

@ -308,7 +308,6 @@ export class SettingsApp extends AppWithConfig {
type="button"
data-action="hide"
data-action-target="autolink"
disabled
title="Delete"
aria-label="Delete"
><i class="codicon codicon-close"></i></button>

+ 21
- 11
src/webviews/apps/shared/appWithConfigBase.ts 파일 보기

@ -129,20 +129,30 @@ export abstract class AppWithConfig extends Ap
const index = parseInt(props[1], 10);
const objectProps = props.slice(2);
const setting: Record<string, any>[] = this.getSettingValue(settingName) ?? [];
let setting: Record<string, any>[] | undefined = this.getSettingValue(settingName);
if (value == null && (setting === undefined || setting?.length === 0)) {
if (setting !== undefined) {
this._changes[settingName] = undefined;
}
} else {
setting = setting ?? [];
const settingItem = setting[index] ?? Object.create(null);
if (setting[index] === undefined) {
setting[index] = settingItem;
}
let settingItem = setting[index];
if (value != null || (value == null && settingItem !== undefined)) {
if (settingItem === undefined) {
settingItem = Object.create(null);
setting[index] = settingItem;
}
set(
setting[index],
objectProps.join('.'),
element.type === 'number' && value != null ? Number(value) : value,
);
set(
settingItem,
objectProps.join('.'),
element.type === 'number' && value != null ? Number(value) : value,
);
this._changes[settingName] = setting;
this._changes[settingName] = setting;
}
}
} else {
this._changes[element.name] = element.type === 'number' && value != null ? Number(value) : value;
}

불러오는 중...
취소
저장