|
|
|
@ -30,7 +30,7 @@
|
|
|
|
:class="{ 'ml-1': !withRequired, 'absolute': !iconInline, 'inline align-bottom': iconInline }"
|
|
|
|
:class="{ 'ml-1': !withRequired, 'absolute': !iconInline, 'inline align-bottom': iconInline }"
|
|
|
|
:width="iconWidth"
|
|
|
|
:width="iconWidth"
|
|
|
|
:stroke-width="iconStrokeWidth"
|
|
|
|
:stroke-width="iconStrokeWidth"
|
|
|
|
@click="focusContenteditable"
|
|
|
|
@click="[focusContenteditable(), selectOnEditClick && selectContent()]"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
@ -64,6 +64,11 @@ export default {
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
selectOnEditClick: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: false
|
|
|
|
|
|
|
|
},
|
|
|
|
iconStrokeWidth: {
|
|
|
|
iconStrokeWidth: {
|
|
|
|
type: Number,
|
|
|
|
type: Number,
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
@ -85,6 +90,19 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
selectContent () {
|
|
|
|
|
|
|
|
const el = this.$refs.contenteditable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const range = document.createRange()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
range.selectNodeContents(el)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sel = window.getSelection()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sel.removeAllRanges()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sel.addRange(range)
|
|
|
|
|
|
|
|
},
|
|
|
|
onBlur (e) {
|
|
|
|
onBlur (e) {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.value = this.$refs.contenteditable.innerText.trim() || this.modelValue
|
|
|
|
this.value = this.$refs.contenteditable.innerText.trim() || this.modelValue
|
|
|
|
|