marinofaggiana 5 年之前
父節點
當前提交
c9820e43e1

+ 2 - 2
iOSClient/Main/CCMain.m

@@ -3864,12 +3864,12 @@
   
     if (capabilities.versionMajor < k_nextcloud_version_18_0 || self.richWorkspace.length == 0 || self.searchController.isActive) {
         
-        [self.viewRichWorkspace setRichWorkspaceText:@"" gradient:false];
+        [self.viewRichWorkspace setRichWorkspaceText:@"" gradient:false userInteractionEnabled:false];
         [self.tableView.tableHeaderView setFrame:CGRectMake(self.tableView.tableHeaderView.frame.origin.x, self.tableView.tableHeaderView.frame.origin.y, self.tableView.frame.size.width, heightSearchBar)];
         
     } else {
         
-        [self.viewRichWorkspace setRichWorkspaceText:self.richWorkspace gradient:true];
+        [self.viewRichWorkspace setRichWorkspaceText:self.richWorkspace gradient:true userInteractionEnabled:false];
         [self.viewRichWorkspace setFrame:CGRectMake(self.tableView.tableHeaderView.frame.origin.x, self.tableView.tableHeaderView.frame.origin.y, self.tableView.frame.size.width, heightRichWorkspace + heightSearchBar)];
     }
     

+ 8 - 6
iOSClient/RichWorkspace/NCRichWorkspace.swift

@@ -30,6 +30,7 @@ import SwiftRichString
     @IBOutlet weak var textView: UITextView!
     var richWorkspace: String = ""
     var gradient: Bool = false
+    var _userInteractionEnabled: Bool = false
     let gradientLayer: CAGradientLayer = CAGradientLayer()
 
     required init?(coder: NSCoder) {
@@ -41,13 +42,10 @@ import SwiftRichString
     
     @objc func changeTheming() {
         self.backgroundColor = NCBrandColor.sharedInstance.backgroundView
-        setRichWorkspaceText(richWorkspace, gradient: gradient)
+        setRichWorkspaceText(richWorkspace, gradient: gradient, userInteractionEnabled: _userInteractionEnabled)
     }
     
-    @objc func setRichWorkspaceText(_ richWorkspace: String, gradient: Bool) {
-        
-        self.richWorkspace = richWorkspace
-        self.gradient = gradient
+    @objc func setRichWorkspaceText(_ richWorkspace: String, gradient: Bool, userInteractionEnabled: Bool) {
         
         let h1 = Style {
             $0.font = UIFont.systemFont(ofSize: 25, weight: .bold)
@@ -99,7 +97,7 @@ import SwiftRichString
         }
         
         textView.attributedText = richWorkspaceStyling.set(style: StyleGroup(base: normal, ["h1": h1, "h2": h2, "h3": h3, "h4": h4, "h5": h5, "h6": h6]))
-        textView.isUserInteractionEnabled = false
+        textView.isUserInteractionEnabled = userInteractionEnabled
         textView.sizeToFit()
         
         if gradient {
@@ -115,5 +113,9 @@ import SwiftRichString
             gradientLayer.endPoint = CGPoint(x: 0, y: 1)
             textView.layer.addSublayer(gradientLayer)
         }
+        
+        self.richWorkspace = richWorkspace
+        self.gradient = gradient
+        self._userInteractionEnabled = userInteractionEnabled
     }
 }

+ 1 - 1
iOSClient/RichWorkspace/NCRichWorkspace.xib

@@ -14,7 +14,7 @@
             <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="wri-16-tQY">
+                <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="wri-16-tQY">
                     <rect key="frame" x="15" y="5" width="295" height="470"/>
                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <color key="textColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>

+ 2 - 2
iOSClient/RichWorkspace/NCViewerRichWorkspace.swift

@@ -43,7 +43,7 @@ import NCCommunication
         let editItem = UIBarButtonItem(image: UIImage(named: "actionSheetModify"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(editItemAction(_:)))
         self.navigationItem.rightBarButtonItem = editItem
 
-        viewRichWorkspace.setRichWorkspaceText(richWorkspace, gradient: false)
+        viewRichWorkspace.setRichWorkspaceText(richWorkspace, gradient: false, userInteractionEnabled: true)
         
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
         changeTheming()
@@ -61,7 +61,7 @@ import NCCommunication
                 NCManageDatabase.sharedInstance.setDirectory(ocId: metadataFolder.ocId, serverUrl: metadataFolder.serverUrl, richWorkspace: metadataFolder.richWorkspace, account: account)
                 self.richWorkspace = metadataFolder.richWorkspace
                 self.appDelegate.activeMain.richWorkspace = self.richWorkspace
-                self.viewRichWorkspace.setRichWorkspaceText(self.richWorkspace, gradient: false)
+                self.viewRichWorkspace.setRichWorkspaceText(self.richWorkspace, gradient: false, userInteractionEnabled: true)
             }
         }
     }