Merge pull request #18 from OlegLustenko/feature/layout

WIP Layouts improvements
This commit is contained in:
Oleg Lustenko 2022-10-14 15:21:04 +03:00 committed by GitHub
commit 42185a6ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 8 deletions

10
main.ts
View File

@ -95,7 +95,7 @@ export class BulkRenameSettingsTab extends PluginSettingTab {
display() { display() {
const { containerEl } = this; const { containerEl } = this;
containerEl.empty(); containerEl.empty();
containerEl.createEl('h2', { text: 'Bulk Rename - Settings' }); containerEl.createEl('h1', { text: 'Bulk Rename - Settings' });
containerEl.addEventListener('keyup', (event) => { containerEl.addEventListener('keyup', (event) => {
if (event.key !== 'Enter') { if (event.key !== 'Enter') {
return; return;
@ -116,9 +116,9 @@ export class BulkRenameSettingsTab extends PluginSettingTab {
renderTabs() { renderTabs() {
new Setting(this.containerEl) new Setting(this.containerEl)
.setName('UI will be changed when you click those buttons') .setName('Search by: ')
.addButton((button) => { .addButton((button) => {
button.setButtonText('Search by folder'); button.setButtonText('Folder');
if (isViewTypeFolder(this.plugin.settings)) { if (isViewTypeFolder(this.plugin.settings)) {
button.setCta(); button.setCta();
} }
@ -129,7 +129,7 @@ export class BulkRenameSettingsTab extends PluginSettingTab {
}); });
}) })
.addButton((button) => { .addButton((button) => {
button.setButtonText('Search By Tags'); button.setButtonText('Tags');
if (isViewTypeTags(this.plugin.settings)) { if (isViewTypeTags(this.plugin.settings)) {
button.setCta(); button.setCta();
} }
@ -140,7 +140,7 @@ export class BulkRenameSettingsTab extends PluginSettingTab {
}); });
}) })
.addButton((button) => { .addButton((button) => {
button.setButtonText('Search by RegExp'); button.setButtonText('RegExp');
if (isViewTypeRegExp(this.plugin.settings)) { if (isViewTypeRegExp(this.plugin.settings)) {
button.setCta(); button.setCta();
} }

View File

@ -1,5 +1,5 @@
export const renderDonateButton = (containerEl: HTMLElement) => { export const renderDonateButton = (containerEl: HTMLElement) => {
containerEl.createEl('h3', { text: 'Support development' }); containerEl.createEl('h2', { text: 'Support development' });
const donateText = containerEl.createEl('p'); const donateText = containerEl.createEl('p');

View File

@ -25,7 +25,8 @@ export const renderPreviewFiles = (
const previewLabel = createPreviewElement(); const previewLabel = createPreviewElement();
text.inputEl.insertAdjacentElement('afterend', previewLabel); text.inputEl.insertAdjacentElement('afterend', previewLabel);
text.inputEl.addClass('templater_cmd'); text.inputEl.addClass('bulk_preview_textarea');
text.inputEl.wrap = 'soft';
}) })
.addTextArea((text) => { .addTextArea((text) => {
text.setPlaceholder( text.setPlaceholder(
@ -36,7 +37,8 @@ export const renderPreviewFiles = (
replacedPreviewTextArea = text.inputEl; replacedPreviewTextArea = text.inputEl;
const value = getRenderedFileNamesReplaced(plugin); const value = getRenderedFileNamesReplaced(plugin);
text.setValue(value); text.setValue(value);
text.inputEl.addClass('templater_cmd'); text.inputEl.addClass('bulk_preview_textarea');
text.inputEl.wrap = 'soft';
}) })
.then((setting) => { .then((setting) => {
syncScrolls(existingFilesTextArea, replacedPreviewTextArea, state); syncScrolls(existingFilesTextArea, replacedPreviewTextArea, state);

View File

@ -4,6 +4,21 @@
.bulk_rename_preview { .bulk_rename_preview {
width: 80%; width: 80%;
height: 100%;
gap: 0;
}
.bulk_rename_preview > textarea {
height: 360px;
}
.bulk_preview_textarea {
margin-left: 5px;
margin-right: 5px;
font-size: 14px;
width: 100%;
/*white-space: nowrap;*/
/*overflow: auto;*/
} }
.bulk_button { .bulk_button {
@ -25,11 +40,25 @@
} }
.bulk_regexp_control { .bulk_regexp_control {
background: var(--background-modifier-form-field);
border: 1px solid var(--background-modifier-border); border: 1px solid var(--background-modifier-border);
transition: box-shadow 0.15s ease-in-out, border 0.15s ease-in-out;
font-family: inherit;
border-radius: var(--input-radius);
outline: none;
}
.bulk_regexp_control:hover,
.bulk_regexp_control:focus,
.bulk_regexp_control:focus-visible {
box-shadow: 0 0 0 2px var(--background-modifier-border-hover);
/*box-shadow: 0 0 0 2px var*/
} }
.bulk_regexp_control > input { .bulk_regexp_control > input {
border: none; border: none;
margin: 0;
padding: 0;
} }
.bulk_regexp, .bulk_regexp,
@ -37,8 +66,18 @@
width: 100%; width: 100%;
} }
.bulk_regexp:hover,
.bulk_regexp:focus,
.bulk_regexp:focus-visible .bulk_regexp_flags:hover,
.bulk_regexp_flags:focus,
.bulk_regexp_flags:focus-visible {
border: none !important;
box-shadow: none !important;
}
.bulk_regexp_flags { .bulk_regexp_flags {
caret-color: transparent; caret-color: transparent;
max-width: 80px;
} }
.bulk_regexp_slash { .bulk_regexp_slash {