Browse Source

clear code

marinofaggiana 5 years ago
parent
commit
a3285b4b15

+ 4 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -396,7 +396,7 @@
 		F781996B22636BFA00EBDF6A /* HCFeatures.m in Sources */ = {isa = PBXBuildFile; fileRef = F781996822636BFA00EBDF6A /* HCFeatures.m */; };
 		F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
 		F787704F22E7019900F287A9 /* NCShareLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F787704E22E7019900F287A9 /* NCShareLinkCell.xib */; };
-		F78A18B623CDD07D00F681F3 /* NCViewerRichWorkSpaceNextcloudText.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78A18B523CDD07D00F681F3 /* NCViewerRichWorkSpaceNextcloudText.swift */; };
+		F78A18B623CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */; };
 		F78A18B823CDE2B300F681F3 /* NCViewerRichWorkspace.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78A18B723CDE2B300F681F3 /* NCViewerRichWorkspace.swift */; };
 		F78AA20621F783E900D0F205 /* SwiftRichString.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F78AA20521F783E900D0F205 /* SwiftRichString.framework */; };
 		F78ACD4021903CC20088454D /* NCGridCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD3F21903CC20088454D /* NCGridCell.swift */; };
@@ -1115,7 +1115,7 @@
 		F781996722636BFA00EBDF6A /* HCFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCFeatures.h; sourceTree = "<group>"; };
 		F781996822636BFA00EBDF6A /* HCFeatures.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCFeatures.m; sourceTree = "<group>"; };
 		F787704E22E7019900F287A9 /* NCShareLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareLinkCell.xib; sourceTree = "<group>"; };
-		F78A18B523CDD07D00F681F3 /* NCViewerRichWorkSpaceNextcloudText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkSpaceNextcloudText.swift; sourceTree = "<group>"; };
+		F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkspaceWebView.swift; sourceTree = "<group>"; };
 		F78A18B723CDE2B300F681F3 /* NCViewerRichWorkspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkspace.swift; sourceTree = "<group>"; };
 		F78AA20521F783E900D0F205 /* SwiftRichString.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftRichString.framework; path = Carthage/Build/iOS/SwiftRichString.framework; sourceTree = "<group>"; };
 		F78ACD3F21903CC20088454D /* NCGridCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCGridCell.swift; sourceTree = "<group>"; };
@@ -2514,9 +2514,9 @@
 				F7F4B1D723C74B3E00D82A6E /* NCRichWorkspace.swift */,
 				F722814223C8C34500C41898 /* NCRichWorkspace.xib */,
 				F75C0C4723D1FAE300163CC8 /* NCRichWorkspaceCommon.swift */,
-				F78A18B523CDD07D00F681F3 /* NCViewerRichWorkSpaceNextcloudText.swift */,
 				F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */,
 				F78A18B723CDE2B300F681F3 /* NCViewerRichWorkspace.swift */,
+				F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */,
 			);
 			path = RichWorkspace;
 			sourceTree = "<group>";
@@ -3533,7 +3533,7 @@
 				F7B6ACD622FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */,
 				F738E8421F90FFD100F95C8E /* NCManageEndToEndEncryption.m in Sources */,
 				F78A18B823CDE2B300F681F3 /* NCViewerRichWorkspace.swift in Sources */,
-				F78A18B623CDD07D00F681F3 /* NCViewerRichWorkSpaceNextcloudText.swift in Sources */,
+				F78A18B623CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift in Sources */,
 				F75A9EE623796C6F0044CFCE /* NCNetworking.swift in Sources */,
 				F760F79D21F21F61006B1A73 /* CropRectView.swift in Sources */,
 				F73B4F091F470D9100BBEE4B /* nsEUCKRProber.cpp in Sources */,

+ 8 - 7
iOSClient/Main/CCMain.m

@@ -156,7 +156,7 @@
     viewRichWorkspaceTapped.delegate = self;
     [self.viewRichWorkspace addGestureRecognizer:viewRichWorkspaceTapped];
     heightRichWorkspace = UIScreen.mainScreen.bounds.size.height/5 + heightSearchBar;
-    [self.viewRichWorkspace setHeightSearch:heightSearchBar];
+    self.viewRichWorkspace.textViewTopConstraint.constant = heightSearchBar;
     [self.viewRichWorkspace setFrame:CGRectMake(0, 0, self.tableView.frame.size.width, heightRichWorkspace)];
     
     // Table Header View
@@ -1955,13 +1955,13 @@
 
 - (void)createRichWorkspace
 {
-    NCRichWorkspaceTextCommon *richWorkspaceTextCommon = [NCRichWorkspaceTextCommon new];
+    NCRichWorkspaceCommon *richWorkspaceCommon = [NCRichWorkspaceCommon new];
     tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.activeAccount, self.serverUrl, k_fileNameRichWorkspace.lowercaseString]];
     
     if (metadata) {
-        [richWorkspaceTextCommon openViewerNextcloudTextWithServerUrl:self.serverUrl viewController:self];
+        [richWorkspaceCommon openViewerNextcloudTextWithServerUrl:self.serverUrl viewController:self];
     } else {
-        [richWorkspaceTextCommon createViewerNextcloudTextWithServerUrl:self.serverUrl viewController:self];
+        [richWorkspaceCommon createViewerNextcloudTextWithServerUrl:self.serverUrl viewController:self];
     }
 }
 
@@ -3871,15 +3871,16 @@
 - (void)setTableViewHeader
 {
     tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:appDelegate.activeAccount];
+    NCRichWorkspaceCommon *richWorkspaceCommon = [NCRichWorkspaceCommon new];
   
     if (capabilities.versionMajor < k_nextcloud_version_18_0 || self.richWorkspace.length == 0 || self.searchController.isActive) {
-        
-        [self.viewRichWorkspace setRichWorkspaceText:@"" gradient:false userInteractionEnabled:false];
+                
+        [richWorkspaceCommon setRichWorkspaceText:@"" userInteractionEnabled:false textView:self.viewRichWorkspace.textView];
         [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 userInteractionEnabled:false];
+        [richWorkspaceCommon setRichWorkspaceText:self.richWorkspace userInteractionEnabled:false textView:self.viewRichWorkspace.textView];
         [self.viewRichWorkspace setFrame:CGRectMake(self.tableView.tableHeaderView.frame.origin.x, self.tableView.tableHeaderView.frame.origin.y, self.tableView.frame.size.width, heightRichWorkspace)];
     }
     

+ 4 - 21
iOSClient/RichWorkspace/NCRichWorkspace.swift

@@ -27,30 +27,12 @@ import SwiftRichString
 
 @objc class NCViewRichWorkspace: UIView {
     
-    @IBOutlet weak var textView: UITextView!
-    @IBOutlet weak var textViewTopConstraint: NSLayoutConstraint!
+    @objc @IBOutlet weak var textView: UITextView!
+    @objc @IBOutlet weak var textViewTopConstraint: NSLayoutConstraint!
 
-    var richWorkspace: String = ""
-    var gradient: Bool = false
-    var _userInteractionEnabled: Bool = false
     let gradientLayer: CAGradientLayer = CAGradientLayer()
 
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)
-        
-        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
-        self.backgroundColor = NCBrandColor.sharedInstance.backgroundView
-    }
-    
-    @objc func changeTheming() {
-        self.backgroundColor = NCBrandColor.sharedInstance.backgroundView
-        setRichWorkspaceText(richWorkspace, gradient: gradient, userInteractionEnabled: _userInteractionEnabled)
-    }
-    
-    @objc func setHeightSearch(_ height: CGFloat) {
-        textViewTopConstraint.constant = height
-    }
-    
+    /*
     @objc func setRichWorkspaceText(_ richWorkspace: String, gradient: Bool, userInteractionEnabled: Bool) {
         
         let h1 = Style {
@@ -124,4 +106,5 @@ import SwiftRichString
         self.gradient = gradient
         self._userInteractionEnabled = userInteractionEnabled
     }
+    */
 }

+ 71 - 15
iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift

@@ -23,8 +23,9 @@
 
 import Foundation
 import NCCommunication
+import SwiftRichString
 
-@objc class NCRichWorkspaceTextCommon: NSObject {
+@objc class NCRichWorkspaceCommon: NSObject {
 
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
@@ -45,12 +46,12 @@ import NCCommunication
             
             if errorCode == 0 && account == self.appDelegate.activeAccount {
                 
-                if let viewerRichWorkSpaceText = UIStoryboard.init(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkSpaceNextcloudText") as? NCViewerRichWorkSpaceNextcloudText {
+                if let viewerRichWorkspaceWebView = UIStoryboard.init(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView {
                     
-                    viewerRichWorkSpaceText.url = url!
-                    viewerRichWorkSpaceText.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
+                    viewerRichWorkspaceWebView.url = url!
+                    viewerRichWorkspaceWebView.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
                     
-                    viewController.present(viewerRichWorkSpaceText, animated: true, completion: nil)
+                    viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil)
                 }
                 
             } else if errorCode != 0 {
@@ -80,13 +81,13 @@ import NCCommunication
                     
                     if errorCode == 0 && account == self.appDelegate.activeAccount {
                         
-                        if let viewerRichWorkSpaceText = UIStoryboard.init(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkSpaceNextcloudText") as? NCViewerRichWorkSpaceNextcloudText {
+                        if let viewerRichWorkspaceWebView = UIStoryboard.init(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView {
                             
-                            viewerRichWorkSpaceText.url = url!
-                            viewerRichWorkSpaceText.metadata = metadata
-                            viewerRichWorkSpaceText.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
+                            viewerRichWorkspaceWebView.url = url!
+                            viewerRichWorkspaceWebView.metadata = metadata
+                            viewerRichWorkspaceWebView.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
                             
-                            viewController.present(viewerRichWorkSpaceText, animated: true, completion: nil)
+                            viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil)
                         }
                         
                     } else if errorCode != 0 {
@@ -96,15 +97,70 @@ import NCCommunication
                 
             } else {
                 
-                if let viewerRichWorkSpaceText = UIStoryboard.init(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkSpaceNextcloudText") as? NCViewerRichWorkSpaceNextcloudText {
+                if let viewerRichWorkspaceWebView = UIStoryboard.init(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView {
                     
-                    viewerRichWorkSpaceText.url = metadata.url
-                    viewerRichWorkSpaceText.metadata = metadata
-                    viewerRichWorkSpaceText.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
+                    viewerRichWorkspaceWebView.url = metadata.url
+                    viewerRichWorkspaceWebView.metadata = metadata
+                    viewerRichWorkspaceWebView.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
                     
-                    viewController.present(viewerRichWorkSpaceText, animated: true, completion: nil)
+                    viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil)
                 }
             }
         }
     }
+    
+    @objc func setRichWorkspaceText(_ richWorkspace: String, userInteractionEnabled: Bool, textView: UITextView) {
+           
+           let h1 = Style {
+               $0.font = UIFont.systemFont(ofSize: 25, weight: .bold)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+           let h2 = Style {
+               $0.font = UIFont.systemFont(ofSize: 23, weight: .bold)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+           let h3 = Style {
+               $0.font = UIFont.systemFont(ofSize: 21, weight: .bold)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+           let h4 = Style {
+               $0.font = UIFont.systemFont(ofSize: 19, weight: .bold)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+           let h5 = Style {
+               $0.font = UIFont.systemFont(ofSize: 17, weight: .bold)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+           let h6 = Style {
+               $0.font = UIFont.systemFont(ofSize: 15, weight: .bold)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+           let normal = Style {
+               $0.font = UIFont.systemFont(ofSize: 15)
+               $0.color = NCBrandColor.sharedInstance.textView
+           }
+          
+           var richWorkspaceStyling = ""
+           let richWorkspaceArray = richWorkspace.components(separatedBy: "\n")
+           for string in richWorkspaceArray {
+               if string.hasPrefix("# ") {
+                   richWorkspaceStyling = richWorkspaceStyling + "<h1>" + string.replacingOccurrences(of: "# ", with: "") + "</h1>\r\n"
+               } else if string.hasPrefix("## ") {
+                   richWorkspaceStyling = richWorkspaceStyling + "<h2>" + string.replacingOccurrences(of: "## ", with: "") + "</h2>\r\n"
+               } else if string.hasPrefix("### ") {
+                   richWorkspaceStyling = richWorkspaceStyling + "<h3>" + string.replacingOccurrences(of: "### ", with: "") + "</h3>\r\n"
+               } else if string.hasPrefix("#### ") {
+                   richWorkspaceStyling = richWorkspaceStyling + "<h4>" + string.replacingOccurrences(of: "#### ", with: "") + "</h4>\r\n"
+               } else if string.hasPrefix("##### ") {
+                   richWorkspaceStyling = richWorkspaceStyling + "<h5>" + string.replacingOccurrences(of: "##### ", with: "") + "</h5>\r\n"
+               } else if string.hasPrefix("###### ") {
+                   richWorkspaceStyling = richWorkspaceStyling + "<h6>" + string.replacingOccurrences(of: "###### ", with: "") + "</h6>\r\n"
+               } else {
+                   richWorkspaceStyling = richWorkspaceStyling + string + "\r\n"
+               }
+           }
+           
+           textView.attributedText = richWorkspaceStyling.set(style: StyleGroup(base: normal, ["h1": h1, "h2": h2, "h3": h3, "h4": h4, "h5": h5, "h6": h6]))
+           textView.isUserInteractionEnabled = userInteractionEnabled
+       }
 }

+ 15 - 30
iOSClient/RichWorkspace/NCViewerRichWorkspace.storyboard

@@ -11,56 +11,41 @@
         <!--Viewer Rich Workspace-->
         <scene sceneID="5lu-RQ-5e2">
             <objects>
-                <viewController id="6oU-Ar-6R2" customClass="NCViewerRichWorkspace" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="NCViewerRichWorkspace" id="6oU-Ar-6R2" customClass="NCViewerRichWorkspace" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="Hcj-yo-mxA">
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZTH-4c-how" customClass="NCViewRichWorkspace" customModule="Nextcloud" customModuleProvider="target">
-                                <rect key="frame" x="0.0" y="88" width="414" height="774"/>
-                                <subviews>
-                                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="tWU-uH-OcN">
-                                        <rect key="frame" x="15" y="0.0" width="389" height="774"/>
-                                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                        <color key="textColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
-                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
-                                    </textView>
-                                </subviews>
-                                <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
-                                <constraints>
-                                    <constraint firstAttribute="bottom" secondItem="tWU-uH-OcN" secondAttribute="bottom" id="0JY-Sv-nGd"/>
-                                    <constraint firstItem="tWU-uH-OcN" firstAttribute="leading" secondItem="ZTH-4c-how" secondAttribute="leading" constant="15" id="Etf-Ey-64j"/>
-                                    <constraint firstAttribute="trailing" secondItem="tWU-uH-OcN" secondAttribute="trailing" constant="10" id="b6f-DP-hJI"/>
-                                    <constraint firstItem="tWU-uH-OcN" firstAttribute="top" secondItem="ZTH-4c-how" secondAttribute="top" id="d81-lI-ub5"/>
-                                </constraints>
-                                <connections>
-                                    <outlet property="textView" destination="tWU-uH-OcN" id="kaU-Ye-UzC"/>
-                                </connections>
-                            </view>
+                            <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="tWU-uH-OcN">
+                                <rect key="frame" x="15" y="88" width="389" height="774"/>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <color key="textColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
+                            </textView>
                         </subviews>
                         <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                         <constraints>
-                            <constraint firstItem="ZTH-4c-how" firstAttribute="leading" secondItem="Isy-ab-db7" secondAttribute="leading" id="GN8-UG-8rE"/>
-                            <constraint firstItem="ZTH-4c-how" firstAttribute="top" secondItem="Isy-ab-db7" secondAttribute="top" id="KgT-gT-3KV"/>
-                            <constraint firstItem="Isy-ab-db7" firstAttribute="bottom" secondItem="ZTH-4c-how" secondAttribute="bottom" id="qnK-fT-kwF"/>
-                            <constraint firstItem="Isy-ab-db7" firstAttribute="trailing" secondItem="ZTH-4c-how" secondAttribute="trailing" id="xKM-8k-2Bn"/>
+                            <constraint firstItem="tWU-uH-OcN" firstAttribute="leading" secondItem="Isy-ab-db7" secondAttribute="leading" constant="15" id="U5r-S4-VjQ"/>
+                            <constraint firstItem="tWU-uH-OcN" firstAttribute="top" secondItem="Isy-ab-db7" secondAttribute="top" id="UoK-d1-aHC"/>
+                            <constraint firstItem="Isy-ab-db7" firstAttribute="bottom" secondItem="tWU-uH-OcN" secondAttribute="bottom" id="hKD-qx-JT8"/>
+                            <constraint firstItem="Isy-ab-db7" firstAttribute="trailing" secondItem="tWU-uH-OcN" secondAttribute="trailing" constant="10" id="x1a-WA-AX7"/>
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="Isy-ab-db7"/>
                     </view>
                     <navigationItem key="navigationItem" id="YSS-NL-35O"/>
                     <connections>
-                        <outlet property="viewRichWorkspace" destination="ZTH-4c-how" id="Tj4-ng-4pc"/>
+                        <outlet property="textView" destination="tWU-uH-OcN" id="41C-KX-15c"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="hXn-we-pg4" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
             </objects>
             <point key="canvasLocation" x="1013.0434782608696" y="23.4375"/>
         </scene>
-        <!--Viewer Rich Work Space Nextcloud Text-->
+        <!--Viewer Rich Workspace Web View-->
         <scene sceneID="FAF-zB-yaq">
             <objects>
-                <viewController storyboardIdentifier="NCViewerRichWorkSpaceNextcloudText" id="Ces-GG-tAv" customClass="NCViewerRichWorkSpaceNextcloudText" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="NCViewerRichWorkspaceWebView" id="Ces-GG-tAv" customClass="NCViewerRichWorkspaceWebView" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="T4r-I1-FJU">
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

+ 5 - 5
iOSClient/RichWorkspace/NCViewerRichWorkspace.swift

@@ -26,9 +26,10 @@ import NCCommunication
 
 @objc class NCViewerRichWorkspace: UIViewController, UIAdaptivePresentationControllerDelegate {
 
-    @IBOutlet weak var viewRichWorkspace: NCViewRichWorkspace!
+    @IBOutlet weak var textView: UITextView!
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    private let richWorkspaceCommon = NCRichWorkspaceCommon()
     @objc public var richWorkspace: String = ""
     @objc public var serverUrl: String = ""
    
@@ -43,7 +44,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, userInteractionEnabled: true)
+        richWorkspaceCommon.setRichWorkspaceText(richWorkspace, userInteractionEnabled: true, textView: textView)
         
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
         changeTheming()
@@ -61,7 +62,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, userInteractionEnabled: true)
+                self.richWorkspaceCommon.setRichWorkspaceText(self.richWorkspace, userInteractionEnabled: true, textView: self.textView)
             }
         }
     }
@@ -80,7 +81,6 @@ import NCCommunication
     
     @IBAction func editItemAction(_ sender: Any) {
         
-        let richWorkspaceTextCommon = NCRichWorkspaceTextCommon()
-        richWorkspaceTextCommon.openViewerNextcloudText(serverUrl: serverUrl, viewController: self)
+        richWorkspaceCommon.openViewerNextcloudText(serverUrl: serverUrl, viewController: self)
     }
 }

+ 2 - 2
iOSClient/RichWorkspace/NCViewerRichWorkSpaceNextcloudText.swift → iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift

@@ -1,5 +1,5 @@
 //
-//  NCViewerRichWorkSpaceNextcloudText.swift
+//  NCViewerRichWorkspaceWebView.swift
 //  Nextcloud
 //
 //  Created by Marino Faggiana on 12/12/19.
@@ -23,7 +23,7 @@
 
 import Foundation
 
-class NCViewerRichWorkSpaceNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMessageHandler {
+class NCViewerRichWorkspaceWebView: UIViewController, WKNavigationDelegate, WKScriptMessageHandler {
     
     @IBOutlet weak var webView: WKWebView!
     @IBOutlet weak var webViewBottomConstraint: NSLayoutConstraint!