Skip to content

Commit 1c3d39f

Browse files
committed
fix: #171
1 parent 6f665b8 commit 1c3d39f

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

front-end/h5/src/components/core/editor/shortcuts-panel/shortcut-button.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,33 @@ export default {
1111
},
1212
clickFn: {
1313
required: false,
14-
type: Function
14+
type: Function,
15+
default: () => {}
16+
},
17+
mousedownFn: {
18+
required: false,
19+
type: Function,
20+
default: () => {}
1521
},
1622
disabled: {
1723
type: Boolean,
1824
default: false
1925
}
2026
},
2127
render: (h, { props, listeners, slots }) => {
22-
const onClick = props.clickFn || function () {}
2328
return (
24-
<a-button
29+
<button
2530
class="shortcut-button"
26-
onClick={onClick}
31+
onClick={props.clickFn}
32+
onMousedown={props.mousedownFn}
2733
disabled={props.disabled}
2834
>
2935
<i
3036
class={['shortcut-icon', 'fa', `fa-${props.faIcon}`]}
3137
aria-hidden='true'
3238
/>
3339
<span>{ props.title }</span>
34-
</a-button>
40+
</button>
3541
)
3642
}
3743
}

front-end/h5/src/components/core/styles/shortcut-btn.scss

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
background-color: #f5f8fb !important;
1212
color: #393e46 !important;
1313

14-
transition: all .25s;
14+
// !#zh: 移除动画,防止因为动画导致的拖拽延迟
15+
// !#en: remove animation to prevent moving delay
16+
// transition: all .25s;
17+
// transition: none !important;
1518
cursor: pointer;
1619

1720
&:disabled {
@@ -20,4 +23,12 @@
2023
.shortcut-icon {
2124
padding: 4px;
2225
}
26+
27+
// !#zh: learn from ant-design-vue button style which prevent show the select area
28+
// !#en: 从 ant-design-vue 借鉴而来,防止从组件列表拖拽元素至画布过程中,出现用户选中文字内容效果
29+
user-select: none;
30+
span {
31+
pointer-events: none;
32+
}
2333
}
34+

0 commit comments

Comments
 (0)