|
@@ -77,6 +77,11 @@ export default {
|
|
|
value(val){
|
|
|
this.content = val
|
|
|
},
|
|
|
+ show(val){
|
|
|
+ if(!val){
|
|
|
+ this.$refs.myEditBox.focus()
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
computed: {},
|
|
|
created() {},
|
|
@@ -86,12 +91,15 @@ export default {
|
|
|
event.preventDefault(); // 取消默认的右击菜单显示行为
|
|
|
that.showCustomMenu(event)
|
|
|
});
|
|
|
+ this.setFocus()
|
|
|
// 当点击任意地方或者按下ESC键时,隐藏菜单
|
|
|
// window.onclick = this.hideCustomMenu
|
|
|
+ var that = this
|
|
|
window.addEventListener('click',function(event){
|
|
|
var customMenu = that.$refs.customMenu
|
|
|
if (customMenu && event.target != customMenu && !customMenu.contains(event.target)) {
|
|
|
customMenu.style.display = "none";
|
|
|
+ that.show = false
|
|
|
}
|
|
|
|
|
|
})
|
|
@@ -117,10 +125,12 @@ export default {
|
|
|
// var html = this.addTag(SplitHtmls,method)
|
|
|
this.content = html
|
|
|
this.show = false
|
|
|
+
|
|
|
this.$emit('input',html)
|
|
|
// this.$emit('blur',html)
|
|
|
this.$emit('change',html)
|
|
|
this.close()
|
|
|
+
|
|
|
},
|
|
|
|
|
|
|
|
@@ -170,8 +180,8 @@ export default {
|
|
|
this.$nextTick(()=>{
|
|
|
this.show = true
|
|
|
var customMenu = this.$refs.customMenu
|
|
|
- var xPos = event.layerX + "px";
|
|
|
- var yPos = event.layerY + "px";
|
|
|
+ var xPos = event.clientX + "px";
|
|
|
+ var yPos = event.clientY + "px";
|
|
|
customMenu.style.display = "block";
|
|
|
customMenu.style.left = xPos;
|
|
|
customMenu.style.top = yPos;
|
|
@@ -193,8 +203,10 @@ export default {
|
|
|
e = e || window.event;
|
|
|
if (e.keyCode == 27) { // ESC键的keycode值为27
|
|
|
customMenu.style.display = "none";
|
|
|
+ this.show = false
|
|
|
}
|
|
|
if (e.keyCode === 13) {
|
|
|
+ // return
|
|
|
e.preventDefault(); // 阻止默认操作
|
|
|
document.execCommand("insertHTML", false, "<br><br>"); // 插入换行
|
|
|
}
|
|
@@ -435,9 +447,9 @@ async urlToBase64(imageUrl) {
|
|
|
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
|
|
|
min-width: 100px;
|
|
|
text-align: center;
|
|
|
- z-index: 999;
|
|
|
+ z-index: 9999;
|
|
|
display: none; /* 初始状态下不显示 */
|
|
|
- position: absolute;
|
|
|
+ position: fixed;
|
|
|
&>div{
|
|
|
padding:10px;
|
|
|
line-height: 25px;
|