mirror of
https://github.com/beatsad/Vault2Dify.git
synced 2026-07-22 07:46:49 +00:00
fix: remove marketplace css lint warnings
This commit is contained in:
parent
320eecdbb3
commit
9022d62dc3
4 changed files with 92 additions and 87 deletions
8
main.js
8
main.js
File diff suppressed because one or more lines are too long
6
main.ts
6
main.ts
|
|
@ -1693,7 +1693,9 @@ class DifySyncSettingTab extends PluginSettingTab {
|
|||
private renderConnectionSection(containerEl: HTMLElement) {
|
||||
const { card } = this.createReviewSection(containerEl, 'connection-title', this.plugin.t('settingsReviewConnectionTitle'));
|
||||
let keyInput: HTMLInputElement;
|
||||
this.createNativeSetting(card, 'setting-row')
|
||||
const apiKeySetting = this.createNativeSetting(card, 'setting-row');
|
||||
apiKeySetting.controlEl.addClass('has-secret-toggle');
|
||||
apiKeySetting
|
||||
.setName(this.createSettingName(this.plugin.t('apiKeyName'), { required: true }))
|
||||
.setTooltip(this.plugin.t('apiKeyDesc'))
|
||||
.addText((text) => {
|
||||
|
|
@ -2653,7 +2655,9 @@ class MappingEditorModal extends Modal {
|
|||
|
||||
private renderDatasetChoices() {
|
||||
this.datasetOptionsEl.empty();
|
||||
this.datasetOptionsEl.removeClass('is-empty');
|
||||
if (this.plugin.settings.knowledgeBases.length === 0) {
|
||||
this.datasetOptionsEl.addClass('is-empty');
|
||||
this.datasetOptionsEl.createDiv({ text: this.plugin.t('datasetsDropdownEmpty'), cls: 'dataset-empty-state' });
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
106
styles.css
106
styles.css
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
.dify-sync-error {
|
||||
color: var(--text-error) !important;
|
||||
color: var(--text-error);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
.dify-sync-settings .is-hidden,
|
||||
.dify-sync-modal .is-hidden {
|
||||
display: none !important;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Theme bridge: Obsidian variables shared by the settings page and plugin modals. */
|
||||
|
|
@ -192,32 +192,30 @@
|
|||
}
|
||||
|
||||
.dify-sync-settings .heading-text {
|
||||
display: inline-block !important;
|
||||
position: static !important;
|
||||
width: auto !important;
|
||||
max-width: 100% !important;
|
||||
flex: 0 0 auto !important;
|
||||
height: auto !important;
|
||||
clip: auto !important;
|
||||
overflow: visible !important;
|
||||
visibility: visible !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
text-indent: 0 !important;
|
||||
display: inline-block;
|
||||
position: static;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
flex: 0 0 auto;
|
||||
height: auto;
|
||||
clip: auto;
|
||||
overflow: visible;
|
||||
visibility: visible;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--text-normal);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.dify-sync-settings .title-line .heading-text {
|
||||
all: unset;
|
||||
display: block !important;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: auto !important;
|
||||
max-width: 100% !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
text-indent: 0 !important;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--text-normal);
|
||||
font-family: inherit;
|
||||
text-align: left;
|
||||
font-size: 1.45rem;
|
||||
font-weight: 720;
|
||||
|
|
@ -238,7 +236,7 @@
|
|||
.dify-sync-settings .title-line > .heading-text,
|
||||
.dify-sync-settings .title-line > .settings-subtitle {
|
||||
align-self: flex-start;
|
||||
margin-left: 0 !important;
|
||||
margin-left: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
|
@ -406,11 +404,11 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
min-height: 2.25rem;
|
||||
}
|
||||
|
||||
.dify-sync-settings .setting-item-control:has(.secret-toggle) {
|
||||
.dify-sync-settings .setting-item-control.has-secret-toggle {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dify-sync-settings .setting-item-control:has(.secret-toggle) input {
|
||||
.dify-sync-settings .setting-item-control.has-secret-toggle input {
|
||||
padding-inline-end: 3rem;
|
||||
}
|
||||
|
||||
|
|
@ -433,14 +431,14 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
top: 50%;
|
||||
right: 8px;
|
||||
width: 30px;
|
||||
height: 28px !important;
|
||||
min-height: 28px !important;
|
||||
max-height: 28px !important;
|
||||
padding: 0 !important;
|
||||
height: 28px;
|
||||
min-height: 28px;
|
||||
max-height: 28px;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
border: 0 !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
color: var(--dify-prototype-muted);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
|
@ -456,9 +454,9 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
.dify-sync-settings .secret-toggle:hover,
|
||||
.dify-sync-settings .secret-toggle:active,
|
||||
.dify-sync-settings .secret-toggle:focus-visible {
|
||||
border: 0 !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
color: var(--text-normal);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
|
@ -910,7 +908,7 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
grid-auto-rows: max-content;
|
||||
}
|
||||
|
||||
.dify-sync-modal.mapping-modal #dataset-dropdown-menu:has(.dataset-empty-state) {
|
||||
.dify-sync-modal.mapping-modal #dataset-dropdown-menu.is-empty {
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
|
|
@ -931,16 +929,16 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
width: 100%;
|
||||
text-align: left;
|
||||
margin: 0.125rem 0;
|
||||
border-color: transparent !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.dify-sync-modal .select-option:hover,
|
||||
.dify-sync-modal .select-option:focus-visible {
|
||||
border-color: transparent !important;
|
||||
background: var(--background-modifier-hover) !important;
|
||||
box-shadow: none !important;
|
||||
border-color: transparent;
|
||||
background: var(--background-modifier-hover);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.dify-sync-settings .help-icon {
|
||||
|
|
@ -1284,8 +1282,8 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
}
|
||||
|
||||
.dify-sync-modal.mapping-modal .dify-sync-obsidian-folder-tree .dify-sync-folder-toggle {
|
||||
position: static !important;
|
||||
inset: auto !important;
|
||||
position: static;
|
||||
inset: auto;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
|
@ -1295,10 +1293,10 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
min-width: 24px;
|
||||
height: 28px;
|
||||
min-height: 28px;
|
||||
margin: 0 !important;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
transform: none !important;
|
||||
transform: none;
|
||||
color: var(--text-faint);
|
||||
}
|
||||
|
||||
|
|
@ -1652,8 +1650,8 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
.diagnostic-body,
|
||||
.dify-sync-diagnostic-line
|
||||
) {
|
||||
font-size: var(--dify-body-font-size) !important;
|
||||
font-weight: 400 !important;
|
||||
font-size: var(--dify-body-font-size);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.toast-region {
|
||||
|
|
@ -1705,21 +1703,13 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
|
||||
/* Obsidian shell scrollbar workaround: hide the outer native settings scrollbar while preserving plugin scroll behavior. */
|
||||
.dify-sync-outer-scroll-host {
|
||||
overflow-y: hidden !important;
|
||||
scrollbar-width: none !important;
|
||||
-ms-overflow-style: none !important;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.dify-sync-inner-scroll-host {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.dify-sync-outer-scroll-host::-webkit-scrollbar {
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.dify-sync-settings .app {
|
||||
--font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
|
||||
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
|
|
@ -1765,8 +1755,8 @@ section[aria-labelledby="mapping-title"] .section-card {
|
|||
}
|
||||
|
||||
.dify-sync-settings .app .metric-value {
|
||||
font-size: 22px !important;
|
||||
font-weight: 720 !important;
|
||||
font-size: 22px;
|
||||
font-weight: 720;
|
||||
}
|
||||
|
||||
.dify-sync-settings .app .section-card,
|
||||
|
|
|
|||
|
|
@ -55,6 +55,19 @@ function getCssBlock(source, selector) {
|
|||
return source.slice(start, end + 2);
|
||||
}
|
||||
|
||||
test("styles avoid Obsidian Marketplace CSS lint warning patterns", () => {
|
||||
for (const [pattern, label] of [
|
||||
[/!important/, "important overrides"],
|
||||
[/:has\(/, "broad :has selectors"],
|
||||
[/\ball\s*:/, "all shorthand resets"],
|
||||
[/\btext-indent\s*:/, "text-indent resets"],
|
||||
[/\bscrollbar-width\s*:/, "Firefox scrollbar styling"],
|
||||
[/::-webkit-scrollbar/, "WebKit scrollbar styling"],
|
||||
]) {
|
||||
assert.doesNotMatch(stylesSource, pattern, `styles.css should not use ${label}`);
|
||||
}
|
||||
});
|
||||
|
||||
test("settings tab renders restored review layout with native Obsidian setting controls", () => {
|
||||
const settingsTabBlock = mainSource.slice(
|
||||
mainSource.indexOf("class DifySyncSettingTab"),
|
||||
|
|
@ -154,16 +167,11 @@ test("settings modal content hides scrollbars without disabling scroll", () => {
|
|||
]);
|
||||
sourceContainsAll(stylesSource, [
|
||||
".dify-sync-outer-scroll-host",
|
||||
"overflow-y: hidden !important;",
|
||||
"scrollbar-width: none !important;",
|
||||
"-ms-overflow-style: none !important;",
|
||||
"overflow-y: hidden;",
|
||||
".dify-sync-inner-scroll-host",
|
||||
"overscroll-behavior: contain;",
|
||||
".dify-sync-outer-scroll-host::-webkit-scrollbar",
|
||||
"width: 0 !important;",
|
||||
"height: 0 !important;",
|
||||
"display: none !important;",
|
||||
]);
|
||||
assert.doesNotMatch(stylesSource, /scrollbar-width|::-webkit-scrollbar|-ms-overflow-style/, "Scrollbar workaround should avoid marketplace CSS scrollbar warnings");
|
||||
assert.equal(
|
||||
mainSource.includes("this.addScrollbarHost(document.body);"),
|
||||
false,
|
||||
|
|
@ -365,7 +373,7 @@ test("settings topbar renders localized plugin subtitle below the title", () =>
|
|||
".dify-sync-settings .title-line > .heading-text,",
|
||||
".dify-sync-settings .title-line > .settings-subtitle",
|
||||
"align-self: flex-start;",
|
||||
"margin-left: 0 !important;",
|
||||
"margin-left: 0;",
|
||||
"text-align: left;",
|
||||
]);
|
||||
});
|
||||
|
|
@ -463,6 +471,7 @@ test("connection initial labels, placeholders, status dot, and summary metrics a
|
|||
]);
|
||||
sourceContainsAll(mainSource, [
|
||||
".setName(this.createSettingName(this.plugin.t('apiKeyName'), { required: true }))",
|
||||
"apiKeySetting.controlEl.addClass('has-secret-toggle')",
|
||||
".setName(this.createSettingName(this.plugin.t('apiUrlName'), { required: true }))",
|
||||
"required.className = 'required-marker';",
|
||||
]);
|
||||
|
|
@ -483,17 +492,17 @@ test("connection initial labels, placeholders, status dot, and summary metrics a
|
|||
"box-shadow: none;",
|
||||
".dify-sync-settings .native-setting-row .setting-item-description",
|
||||
"display: none;",
|
||||
".dify-sync-settings .setting-item-control:has(.secret-toggle) input",
|
||||
".dify-sync-settings .setting-item-control.has-secret-toggle input",
|
||||
"padding-inline-end: 3rem;",
|
||||
"display: inline-flex;",
|
||||
"align-items: center;",
|
||||
"justify-content: center;",
|
||||
"top: 50%;",
|
||||
"right: 8px;",
|
||||
"height: 28px !important;",
|
||||
"min-height: 28px !important;",
|
||||
"max-height: 28px !important;",
|
||||
"padding: 0 !important;",
|
||||
"height: 28px;",
|
||||
"min-height: 28px;",
|
||||
"max-height: 28px;",
|
||||
"padding: 0;",
|
||||
"line-height: 1;",
|
||||
"transform: translateY(-50%);",
|
||||
".dify-sync-settings .secret-toggle .svg-icon",
|
||||
|
|
@ -635,6 +644,8 @@ test("mapping modal implements restored builder, pending mappings, and delete pr
|
|||
"pendingEmptyDesc",
|
||||
"pendingAdded",
|
||||
"datasetsDropdownEmpty",
|
||||
"this.datasetOptionsEl.removeClass('is-empty');",
|
||||
"this.datasetOptionsEl.addClass('is-empty');",
|
||||
"dataset-empty-state",
|
||||
"dataset-checkmark",
|
||||
"setIcon(checkmark, 'check')",
|
||||
|
|
@ -868,8 +879,8 @@ test("only API key and Dify service URL retain native setting help text", () =>
|
|||
"white-space: nowrap;",
|
||||
".dify-sync-settings .heading-text {",
|
||||
"width: fit-content;",
|
||||
"flex: 0 0 auto !important;",
|
||||
"margin: 0 !important;",
|
||||
"flex: 0 0 auto;",
|
||||
"margin: 0;",
|
||||
]);
|
||||
|
||||
assert.match(
|
||||
|
|
@ -879,8 +890,8 @@ test("only API key and Dify service URL retain native setting help text", () =>
|
|||
);
|
||||
assert.match(
|
||||
getCssBlock(stylesSource, ".dify-sync-settings .title-line .heading-text {"),
|
||||
/all: unset;[\s\S]*padding: 0[\s\S]*text-indent: 0/,
|
||||
"Settings topbar heading should reset native/theme heading offsets instead of moving the title group",
|
||||
/display: block;[\s\S]*padding: 0;[\s\S]*font-family: inherit/,
|
||||
"Settings topbar heading should explicitly reset native/theme heading offsets instead of moving the title group",
|
||||
);
|
||||
assert.match(
|
||||
mainSource,
|
||||
|
|
@ -968,7 +979,7 @@ test("major settings headings align with the background cards", () => {
|
|||
".dify-sync-settings .title-line,",
|
||||
".dify-sync-settings .heading-line {",
|
||||
".dify-sync-settings .title-line .heading-text {",
|
||||
"all: unset;",
|
||||
"font-family: inherit;",
|
||||
]);
|
||||
|
||||
assert.doesNotMatch(
|
||||
|
|
@ -1002,9 +1013,8 @@ test("test vault plugin styles keep natural topbar title alignment", () => {
|
|||
".dify-sync-settings .title-line,",
|
||||
".dify-sync-settings .heading-line {",
|
||||
".dify-sync-settings .title-line .heading-text {",
|
||||
"all: unset;",
|
||||
"padding: 0",
|
||||
"text-indent: 0",
|
||||
"font-family: inherit;",
|
||||
"padding: 0;",
|
||||
]);
|
||||
assert.doesNotMatch(
|
||||
source,
|
||||
|
|
@ -1073,9 +1083,9 @@ test("custom dropdowns are scoped to the mapping modal", () => {
|
|||
"height: 14px;",
|
||||
"align-self: center;",
|
||||
".dify-sync-modal .select-option",
|
||||
"border-color: transparent !important;",
|
||||
"background: transparent !important;",
|
||||
"box-shadow: none !important;",
|
||||
"border-color: transparent;",
|
||||
"background: transparent;",
|
||||
"box-shadow: none;",
|
||||
]);
|
||||
|
||||
assert.match(
|
||||
|
|
@ -1156,6 +1166,7 @@ test("mapping modal picker columns stay constrained within the dialog", () => {
|
|||
".dify-sync-modal.mapping-modal #folder-dropdown-menu,",
|
||||
".dify-sync-modal.mapping-modal #dataset-dropdown-menu",
|
||||
"height: 440px;",
|
||||
".dify-sync-modal.mapping-modal #dataset-dropdown-menu.is-empty",
|
||||
".dify-sync-modal .dataset-select-row",
|
||||
"grid-template-columns: minmax(0, 1fr) auto;",
|
||||
"gap: 8px;",
|
||||
|
|
|
|||
Loading…
Reference in a new issue