Просмотр исходного кода

Merge branch 'fix/documenteditor_ui' into 'develop'

Merge of fix/documenteditor_ui to develop 增加版式文件痕迹保留功能的移动端支持

See merge request o2oa/o2oa!258
胡起 5 лет назад
Родитель
Сommit
7362a7b884

+ 15 - 1
o2web/source/x_component_process_Xform/$Form/default/doc.wcss

@@ -149,11 +149,25 @@
         "position": "absolute",
         "opacity": 1
     },
+    "historyInforMobileNode": {
+        "width": "100%",
+        "padding": "10px",
+        "overflow": "hidden",
+        "border": "1px solid #CCCCCC",
+        "border-radius": "0px",
+        "box-shadow": "0px 0px 0px #CCCCCC",
+        "position": "absolute",
+        "bottom": "0px",
+        "opacity": 1
+    },
     "historyListAreaNode": {
         "width": "260px",
         "float": "right",
         "background-color": "#f3f3f3",
-        "border-left": "1px solid #cccccc"
+        "border-left": "1px solid #cccccc",
+        "position": "absolute",
+        "z-index": "20000",
+        "right": "0px"
     },
     "historyListTitleAreaNode":{
         "height": "80px",

+ 5 - 4
o2web/source/x_component_process_Xform/Documenteditor.js

@@ -818,12 +818,13 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
     _checkScale: function(offset){
         offset = 0;
         if (this.pages.length){
-            var pageSize = this.pages[0].getSize();
+            //var pageSize = this.pages[0].getSize();
+            var pageSize_x = this.options.docPageFullWidth
             var contentSize = this.contentNode.getSize();
             var contentWidth = (offset) ? contentSize.x-20-offset : contentSize.x-20;
-            if (contentWidth<pageSize.x){
+            if (contentWidth<pageSize_x){
                 this.isScale = true;
-                var scale = (contentWidth)/pageSize.x;
+                var scale = (contentWidth)/pageSize_x;
                 this.scale = scale;
                 this.zoom();
                 this.resetNodeSize();
@@ -1782,7 +1783,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
 
             this.setData(this.data, diffFiletext);
             //this._checkSplitPage(this.pages[0]);
-
+debugger;
             this._repage();
         }.bind(this));
     },

+ 40 - 15
o2web/source/x_component_process_Xform/widget/DocumentHistory.js

@@ -11,20 +11,25 @@ MWF.xApplication.process.Xform.widget.DocumentHistory = new Class({
         this.documentEditor = documentEditor;
         this.css = this.documentEditor.css;
     },
+    is_iPad: function(){
+        var ua = navigator.userAgent.toLowerCase();
+        return (ua.match(/iPad/i)=="ipad");
+    },
     load: function(callback){
         this.getHistroyDocumentList(function(){
             if (this.historyDocumentList && this.historyDocumentList.length){
                 this.getHistoryDataList(function(){
                     this.createHistoryToolbar();
-                    this.createHistoryListNode();
+                    if (!layout.mobile || this.is_iPad()) this.createHistoryListNode();
 
                     this.documentEditor.options.pageShow = "single";
+                    debugger;
                     this.documentEditor.resetData();
 
                     this.beginDiffHistory();
 
                     this.loadHistoryToolbar();
-                    this.loadHistoryList();
+                    if (!layout.mobile) this.loadHistoryList();
                     if (callback) callback();
                 }.bind(this));
             }
@@ -140,7 +145,6 @@ MWF.xApplication.process.Xform.widget.DocumentHistory = new Class({
         this.historyListTitleNode = new Element("div", {"styles": this.css.historyListTitleNode}).inject(this.historyListTitleAreaNode);
         this.historyListTitleInsertNode = new Element("div", {"styles": this.css.historyListTitleInsertNode}).inject(this.historyListTitleAreaNode);
         this.historyListTitleDeleteNode = new Element("div", {"styles": this.css.historyListTitleDeleteNode}).inject(this.historyListTitleAreaNode);
-
     },
     loadHistoryList: function(){
         var text = MWF.xApplication.process.Xform.LP.documentHistory.diff_patch_count;
@@ -439,7 +443,7 @@ MWF.xApplication.process.Xform.widget.DocumentHistory = new Class({
             this.documentEditor.resizeToolbar();
         }
 
-        this.historyListAreaNode.destroy();
+        if (this.historyListAreaNode) this.historyListAreaNode.destroy();
         this.historyListAreaNode = null;
         this.documentEditor.zoom(1);
         this.documentEditor._checkScale();
@@ -468,8 +472,10 @@ MWF.xApplication.process.Xform.widget.DocumentHistory = new Class({
                     text = text.replace(/{history}/, this.historyDataList.length).replace(/{diff}/, this.diffCount);
                     this.toolbarNode.getLast().set("html", text);
 
-                    this.createHistoryListNode();
-                    this.loadHistoryList();
+                    if (!layout.mobile || this.is_iPad()) {
+                        this.createHistoryListNode();
+                        this.loadHistoryList();
+                    }
 
                     this.documentEditor.options.pageShow = "single";
                     this.documentEditor.resetData();
@@ -564,20 +570,39 @@ MWF.xApplication.process.Xform.widget.DocumentHistory = new Class({
             this.historyInforDiv.dispose();
             this.historyInforDiv = null;
         }
-        var insertInforDiv = new Element("div", { "styles": this.css.historyInforNode }).inject(this.documentEditor.node);
+        var styles =  (!layout.mobile) ? this.css.historyInforNode : this.css.historyInforMobileNode
+        var insertInforDiv = new Element("div", { "styles": styles }).inject(this.documentEditor.node);
         insertInforDiv.setStyle("background", color);
         insertInfor = insertInfor.replace(/{name}/, o2.name.cn(obj.person))
             .replace(/{activity}/, obj.activityName)
             .replace(/{time}/, obj.createTime);
         insertInforDiv.set("html", insertInfor);
-        insertInforDiv.position({
-            "relativeTo": node,
-            "position": 'upperCenter',
-            "edge": 'bottomCenter',
-            "offset": {
-                "x": 0, "y": -10
-            }
-        });
+        if (!layout.mobile){
+            insertInforDiv.position({
+                "relativeTo": node,
+                "position": 'upperCenter',
+                "edge": 'bottomCenter',
+                "offset": {
+                    "x": 0, "y": -10
+                }
+            });
+        }else{
+
+        }
+
+        // debugger;
+        // var p = node.getPosition(node.getOffsetParent());
+        // if (p.x<0) p.x=0;
+        // var y = (p.y-10-insertInforDiv.getSize().y);
+        // var x = p.x;
+        // alert(x)
+        // var scale = (this.documentEditor.scale<0.7) ? 0.7 : this.documentEditor.scale;
+        // insertInforDiv.setStyles({
+        //     "left": ""+x+"px",
+        //     "top": ""+y+"px",
+        //     "transform":"scale("+scale+")",
+        //     "transform-origin": "0px 0px",
+        // });
         this.historyInforDiv = insertInforDiv;
         return insertInforDiv;
     },