|
@@ -6,19 +6,17 @@
|
|
<StyledSimpleText
|
|
<StyledSimpleText
|
|
ref="editArea"
|
|
ref="editArea"
|
|
:class="{
|
|
:class="{
|
|
- 'can-edit': canEdit,
|
|
|
|
- 'is-drag-over': dragOver
|
|
|
|
|
|
+ 'can-edit': canEdit
|
|
}"
|
|
}"
|
|
:contenteditable="canEdit"
|
|
:contenteditable="canEdit"
|
|
class="edit-area"
|
|
class="edit-area"
|
|
tabindex="0"
|
|
tabindex="0"
|
|
v-bind="style"
|
|
v-bind="style"
|
|
@blur="handleBlur"
|
|
@blur="handleBlur"
|
|
- @keydown="handleKeyDown"
|
|
|
|
@mousedown="handleMouseDown"
|
|
@mousedown="handleMouseDown"
|
|
@paste="clearStyle"
|
|
@paste="clearStyle"
|
|
>
|
|
>
|
|
- <div class="yvan-simple-text-inner" v-html="expression"></div>
|
|
|
|
|
|
+ <div class="yvan-simple-text-inner" v-html="expression" />
|
|
</StyledSimpleText>
|
|
</StyledSimpleText>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -26,7 +24,6 @@
|
|
<script lang="js">
|
|
<script lang="js">
|
|
import {mapState} from 'pinia';
|
|
import {mapState} from 'pinia';
|
|
import {globalStore} from "@/store";
|
|
import {globalStore} from "@/store";
|
|
-import system from '@/utils/system';
|
|
|
|
import commonMixin from '@/mixin/commonMixin';
|
|
import commonMixin from '@/mixin/commonMixin';
|
|
import {StyledSimpleText} from '@/components/elements/style';
|
|
import {StyledSimpleText} from '@/components/elements/style';
|
|
import YvanSimpleTextProps from "@/components/elements/YvanSimpleTextProps.vue";
|
|
import YvanSimpleTextProps from "@/components/elements/YvanSimpleTextProps.vue";
|
|
@@ -48,14 +45,6 @@ export default {
|
|
type: String,
|
|
type: String,
|
|
default: ''
|
|
default: ''
|
|
},
|
|
},
|
|
- propValue: {
|
|
|
|
- type: String,
|
|
|
|
- default: ''
|
|
|
|
- },
|
|
|
|
- bindValue: {
|
|
|
|
- type: Object,
|
|
|
|
- default: null
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(globalStore, {
|
|
...mapState(globalStore, {
|
|
@@ -71,8 +60,7 @@ export default {
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- canEdit: false,
|
|
|
|
- dragOver: false
|
|
|
|
|
|
+ canEdit: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -101,33 +89,6 @@ export default {
|
|
selection.removeAllRanges()
|
|
selection.removeAllRanges()
|
|
selection.addRange(range)
|
|
selection.addRange(range)
|
|
},
|
|
},
|
|
- handleDrop(e) {
|
|
|
|
- this.dragOver = false
|
|
|
|
- const index = e.dataTransfer.getData('datasource-index')
|
|
|
|
- if (index) {
|
|
|
|
- console.log(' >>> ', index, this.dataSource)
|
|
|
|
- // let bindingDataSource = this.dataSource[index]
|
|
|
|
- let bindingDataSource = {
|
|
|
|
- title: '当前页',
|
|
|
|
- code: 'pageNumber',
|
|
|
|
- fieldName: 'page_number',
|
|
|
|
- typeName: 'String'
|
|
|
|
- }
|
|
|
|
- if (bindingDataSource) {
|
|
|
|
- globalStore().setBindValue({
|
|
|
|
- id: this.element.id,
|
|
|
|
- bindValue: bindingDataSource
|
|
|
|
- })
|
|
|
|
- globalStore().setPropValue({
|
|
|
|
- id: this.element.id,
|
|
|
|
- propValue: `<span class="yvan-binding-value">[绑定:${bindingDataSource.title}]</span>`
|
|
|
|
- })
|
|
|
|
- this.canEdit = false
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- system.toast('拖拽元素非数据源元素,此次拖拽无效', 'info')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
handleBlur() {
|
|
handleBlur() {
|
|
this.canEdit = false
|
|
this.canEdit = false
|
|
},
|
|
},
|
|
@@ -146,12 +107,6 @@ export default {
|
|
clearStyle(e) {
|
|
clearStyle(e) {
|
|
this.$emit('input', this.element, e.target.innerHTML)
|
|
this.$emit('input', this.element, e.target.innerHTML)
|
|
},
|
|
},
|
|
- handleDragEnter() {
|
|
|
|
- this.dragOver = true
|
|
|
|
- },
|
|
|
|
- handleDragLeave() {
|
|
|
|
- this.dragOver = false
|
|
|
|
- },
|
|
|
|
},
|
|
},
|
|
install(Vue) {
|
|
install(Vue) {
|
|
Vue.component(this.name, this)
|
|
Vue.component(this.name, this)
|
|
@@ -171,9 +126,10 @@ export default {
|
|
},
|
|
},
|
|
canEdit(newVal) {
|
|
canEdit(newVal) {
|
|
if (!newVal) {
|
|
if (!newVal) {
|
|
- globalStore().setPropValue({
|
|
|
|
|
|
+ globalStore().setExpression({
|
|
|
|
+ bandCode: this.element.bandCode,
|
|
id: this.element.id,
|
|
id: this.element.id,
|
|
- propValue: this.$refs.editArea.$el.innerHTML
|
|
|
|
|
|
+ expression: this.$refs.editArea.$el.innerHTML
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -193,11 +149,6 @@ export default {
|
|
word-break: break-all;
|
|
word-break: break-all;
|
|
}
|
|
}
|
|
|
|
|
|
- .is-drag-over {
|
|
|
|
- border: 2px solid var(--roy-color-warning);
|
|
|
|
- background: #cccccc;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.can-edit {
|
|
.can-edit {
|
|
height: 100%;
|
|
height: 100%;
|
|
cursor: text;
|
|
cursor: text;
|