mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 06:35:56 +08:00
Finalize inline edit field [SCI-6782]
This commit is contained in:
parent
7446e4be9b
commit
66212fd703
|
@ -163,7 +163,7 @@ linters:
|
||||||
max_depth: 3
|
max_depth: 3
|
||||||
|
|
||||||
SelectorFormat:
|
SelectorFormat:
|
||||||
enabled: true
|
enabled: false
|
||||||
convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
|
convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
|
||||||
|
|
||||||
Shorthand:
|
Shorthand:
|
||||||
|
|
|
@ -1,66 +1,67 @@
|
||||||
|
// scss-lint:disable SelectorDepth
|
||||||
|
// scss-lint:disable NestingDepth
|
||||||
.sci-inline-edit {
|
.sci-inline-edit {
|
||||||
display: flex;
|
column-gap: .25em;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto repeat(2, max-content);
|
||||||
|
transition: .4s $timing-function-sharp;
|
||||||
|
|
||||||
&.editing {
|
.sci-inline-edit__content {
|
||||||
margin-top: -0.5em;
|
border: $border-transparent;
|
||||||
}
|
display: flex;
|
||||||
}
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
.sci-inline-edit__content {
|
line-height: 1em;
|
||||||
width: 100%;
|
margin-left: -.25em;
|
||||||
|
|
||||||
span {
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&.blank {
|
|
||||||
color: $color-silver-chalice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
border: 1px solid;
|
|
||||||
border-color: $brand-focus;
|
|
||||||
border-radius: 4px;
|
|
||||||
height: 36px;
|
|
||||||
min-height: 36px;
|
min-height: 36px;
|
||||||
outline: none;
|
padding-left: .25em;
|
||||||
overflow: hidden;
|
|
||||||
padding: 0.5em 1em;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&:focus {
|
.sci-inline-edit__view {
|
||||||
|
cursor: pointer;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&.blank {
|
||||||
|
color: $color-silver-chalice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
line-height: 1em;
|
||||||
|
min-height: 1em;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
padding-top: 2px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.error {
|
||||||
|
border-color: $brand-danger;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.error {
|
.sci-inline-edit__error {
|
||||||
border-color: $brand-danger;
|
color: $brand-danger;
|
||||||
|
font-size: .8em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sci-inline-edit__error {
|
&:hover {
|
||||||
color: $brand-danger;
|
.sci-inline-edit__content {
|
||||||
font-size: .8em;
|
border: $border-default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.editing {
|
||||||
|
|
||||||
|
.sci-inline-edit__content {
|
||||||
|
border-color: $brand-focus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sci-inline-edit__controls {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-left: 8px;
|
|
||||||
width: 76px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci-inline-edit__control {
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 14px;
|
|
||||||
height: 36px;
|
|
||||||
line-height: 36px;
|
|
||||||
text-align: center;
|
|
||||||
width: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci-inline-edit__save {
|
|
||||||
background: $brand-primary;
|
|
||||||
color: $color-white;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +1,43 @@
|
||||||
.step-checklist-container {
|
// scss-lint:disable SelectorDepth
|
||||||
.step-element-name {
|
// scss-lint:disable NestingDepth
|
||||||
align-items: flex-start;
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
.sci-checkbox-container {
|
|
||||||
margin-right: 8px;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-checklist-text {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.done .step-checklist-text {
|
|
||||||
text-decoration: line-through;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover.done .step-checklist-text {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-checklist-add-item {
|
|
||||||
margin-left: 9px;
|
|
||||||
margin-top: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-checklist-items {
|
.step-checklist-items {
|
||||||
|
.step-element-header {
|
||||||
|
.step-element-name {
|
||||||
|
align-items: flex-start;
|
||||||
|
column-gap: .5em;
|
||||||
|
display: grid;
|
||||||
|
font-weight: normal;
|
||||||
|
grid-template-columns: max-content auto;
|
||||||
|
|
||||||
|
.step-checklist-text {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.done .step-checklist-text {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover.done .step-checklist-text {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-checklist-add-item {
|
||||||
|
margin-left: 9px;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.step-checklist-item-ghost {
|
.step-checklist-item-ghost {
|
||||||
border: 1px solid $brand-primary;
|
border: 1px solid $brand-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sci-checkbox-container.disabled {
|
.sci-checkbox-container {
|
||||||
pointer-events: none;
|
margin: 10px 0;
|
||||||
}
|
|
||||||
|
|
||||||
.sci-inline-edit {
|
&.disabled {
|
||||||
font-weight: normal;
|
pointer-events: none;
|
||||||
|
|
||||||
textarea {
|
|
||||||
padding-left: 4px;
|
|
||||||
margin-left: -5px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
.step-position {
|
.step-position {
|
||||||
@include font-main;
|
@include font-main;
|
||||||
|
flex-shrink: 0;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin: 0 4px;
|
margin: 0 4px;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +174,6 @@
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
padding: 0 0 0 8px;
|
padding: 0 0 0 8px;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 8px;
|
|
||||||
|
|
||||||
&.editing-name {
|
&.editing-name {
|
||||||
.step-element-controls {
|
.step-element-controls {
|
||||||
|
@ -205,14 +205,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 4px;
|
right: 0;
|
||||||
top: 4px;
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
height: 32px;
|
|
||||||
width: 32px;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fas {
|
.fas {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
@ -13,19 +13,19 @@
|
||||||
@paste="handlePaste"
|
@paste="handlePaste"
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
></textarea>
|
></textarea>
|
||||||
<span v-else @click="enableEdit" :class="{ 'blank': isBlank }">{{ value || placeholder }}</span>
|
<div v-else @click="enableEdit" class="sci-inline-edit__view" :class="{ 'blank': isBlank }">{{ value || placeholder }}</div>
|
||||||
<div v-if="editing && error" class="sci-inline-edit__error">
|
<div v-if="editing && error" class="sci-inline-edit__error">
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="editing" class="sci-inline-edit__controls">
|
<template v-if="editing">
|
||||||
<div class="sci-inline-edit__control sci-inline-edit__save" @click="update">
|
<div class="sci-inline-edit__control btn btn-primary icon-btn" @click="update">
|
||||||
<i class="fas fa-check"></i>
|
<i class="fas fa-check"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="sci-inline-edit__control sci-inline-edit__cancel" @click="cancelEdit">
|
<div class="sci-inline-edit__control btn btn-light icon-btn" @click="cancelEdit">
|
||||||
<i class="fas fa-times"></i>
|
<i class="fas fa-times"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
focus() {
|
focus() {
|
||||||
if (!this.$refs.input) return;
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
if (!this.$refs.input) return;
|
||||||
|
|
||||||
this.$refs.input.focus();
|
this.$refs.input.focus();
|
||||||
this.resize();
|
this.resize();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue