cxmo 4 месяцев назад
Родитель
Сommit
dcfeb880c3

+ 13 - 3
src/views/ppt_manage/mixins/pptEditorMixins.js

@@ -24,6 +24,7 @@ function NodeCheck(dom,className){
     const classList = getAllParentNodes(dom).map(d=>d.className)
     return classList.includes(className)
 }
+let __click__title__outside = null
 export default{
   data(){
     return {
@@ -67,9 +68,10 @@ export default{
       }
     },
     'click-title-outside':{
-        bind(el,binding){
+        bind(el,binding,vnode){
             const clickHandle = (e)=>{
                 //点击标题区域和标题设置之外的地方,退出标题编辑模式
+                if(!vnode.context.isEditTitle) return
                 if(NodeCheck(e.target,'title-edit-box')||NodeCheck(e.target,'title-editor')){
                   return false
                 }
@@ -77,11 +79,11 @@ export default{
                   binding.value(e)
                 }
               }
-              el.__click__title__outside = clickHandle
+              __click__title__outside = clickHandle
               document.addEventListener('click',clickHandle)
         },
         unbind(el,binding,vnode){
-            document.removeEventListener('click',el.__click__title__outside)
+            document.removeEventListener('click',__click__title__outside)
         }
     }
   },
@@ -114,6 +116,14 @@ export default{
                     this.currentIndex = index
                 }
             })
+            let height = $('.ppt-editor-item')[0].offsetHeight
+            const index = this.currentIndex
+            //pptEditor的滚动条动画
+            this.$refs.pptEditor.scrollTo({
+                top:height*index,
+                left:0,
+                behavior: 'smooth'
+            })
         }
         //this.isEditTitle = !this.isEditTitle
         this.isEditTitle = true

+ 3 - 0
src/views/ppt_manage/newVersion/components/formatPage/mixins.js

@@ -155,6 +155,7 @@ export default {
         },
         //删除这张图表
         delChart(position) {
+            this.$parent.isEditTitle = false
             this.$emit('delChart', position)
         },
         //自主黏贴事件:ctrl+v
@@ -247,6 +248,7 @@ export default {
             return
           } */
           if(this.choosedId!==this.pageItem.id) return
+          this.$parent.isEditTitle = false
           this.dragElement = e.currentTarget
           if(dragInfo.type!=='text'){
             //设置拖拽反馈图像
@@ -298,6 +300,7 @@ export default {
           }catch(err){
             this.$message.error(/*'复制失败'*/this.$t('MsgPrompt.copy_fail_msg'))
           }
+          this.$parent.isEditTitle = false
         },
         addChart(position){
           const {chartId} = this.pageItem.elements.find(i=>i.position===position)

+ 1 - 2
src/views/ppt_manage/newVersion/pptEditor.vue

@@ -98,8 +98,7 @@
                                     outline:0,
                                 }:{ color:'#333',fontSize:'22px',fontFamily:'helvetica',outline:0}"
                                     v-click-title-outside="exitEditTitle"
-                                    @click.stop
-                                    @focus="handleEditTitle(item)"
+                                    @click.stop="handleEditTitle(item)"
                                     @input="(e)=>testInput(e,item)"></div>
                         </div>
                         <!-- 内容 -->

+ 1 - 2
src/views/ppt_manage/newVersion/pptEnEditor.vue

@@ -84,8 +84,7 @@
                                     outline:0,
                                 }:{ color:'#333',fontSize:'22px',fontFamily:'helvetica',outline:0}"
                                     v-click-title-outside="exitEditTitle"
-                                    @click.stop
-                                    @focus="handleEditTitle(item)"
+                                    @click.stop="handleEditTitle(item)"
                                     @input="(e)=>testInput(e,item)"></div>
                         </div>
                     <!-- 内容 -->