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