cjwirth / RichEditorView

RichEditorView is a simple, modular, drop-in UIView subclass for Rich Text Editing.
BSD 3-Clause "New" or "Revised" License
1.9k stars 445 forks source link

Please update WKWebView instead of UIWebView #239

Open maulik3107 opened 4 years ago

maulik3107 commented 4 years ago

WKWebView instead of UIWebView because apple reject app

Thanks,

Maulik Patel

Borko4vp commented 4 years ago

I have exact same problem with the UIWebView. Any info if this will be updated any time soon?

maulik3107 commented 4 years ago

My issue is solve remove pod in move below file in your project, RichEditorView.zip

gim- commented 4 years ago

This is a dead project. Is there an active fork for this or a library that can replace it easily?

maulik3107 commented 4 years ago

@gim- u right pod library is old but i update WKWebView code in this zip so it's working fine.

gim- commented 4 years ago

@gim- u right pod library is old but i update WKWebView code in this zip so it's working fine.

It's ok as a temporary solution, but in a long term it's better to migrate to more up-to-date library that's being maintained properly

ppamorim commented 4 years ago

@gim- https://github.com/T-Pro/RichEditorView

To use it:

pod 'RichEditorView', :git => 'https://github.com/T-Pro/RichEditorView.git', :branch => 'master'
maulik3107 commented 4 years ago

@ppamorim i have already used this library but in this pod UIWebView not updated so apple reject app

ppamorim commented 4 years ago

@maulik3107 How come this is possible? Please check this class: https://github.com/T-Pro/RichEditorView/blob/master/RichEditorView/Classes/RichEditorWebView.swift

I am using this very same library and Apple never rejected my app. Please check your app first.

maulik3107 commented 4 years ago

@ppamorim Thank u so much now it's working with above link.

thiwankacs commented 4 years ago

@ppamorim The toolbar not appearing. What is the reason.

maulik3107 commented 4 years ago

@thiwankacs //Outlet @IBOutlet weak var viewEditor: RichEditorView! lazy var toolbar: RichEditorToolbar = { let toolbar = RichEditorToolbar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 44)) toolbar.options = RichEditorDefaultOption.all return toolbar }()

// Do In viewDidLoad

    viewEditor.delegate = self
    viewEditor.inputAccessoryView = toolbar
    viewEditor.placeholder = "Type some text..."
    toolbar.delegate = self
    toolbar.editor = viewEditor

    // We will create a custom action that clears all the input text when it is pressed
    let item = RichEditorOptionItem(image: nil, title: "Clear") { toolbar in
        toolbar.editor?.html = ""
    }

    var options = toolbar.options
    options.append(item)
    toolbar.options = options
thiwankacs commented 4 years ago

@maulik3107

Here is the code I written

import UIKit import RichEditorView

class ViewController: UIViewController {

@IBOutlet weak var editorView: RichEditorView!

override func viewDidLoad() {
    super.viewDidLoad()

    let toolbar: RichEditorToolbar = {
        let toolbar = RichEditorToolbar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 44))
        toolbar.options = [RichEditorDefaultOption.undo, RichEditorDefaultOption.redo, RichEditorDefaultOption.bold, RichEditorDefaultOption.underline, RichEditorDefaultOption.italic, RichEditorDefaultOption.strike, RichEditorDefaultOption.orderedList, RichEditorDefaultOption.unorderedList, RichEditorDefaultOption.header(1), RichEditorDefaultOption.header(2), RichEditorDefaultOption.outdent, RichEditorDefaultOption.indent, RichEditorDefaultOption.link]
        return toolbar
    }()

    editorView.delegate = self
    editorView.inputAccessoryView = toolbar
    editorView.placeholder = "placeholderText"
    editorView.html = SimplifyaManager.shared.workingQuestion.note

    toolbar.delegate = self
    toolbar.editor = editorView
    toolbar.editor?.layer.backgroundColor = UIColor.clear.cgColor
    editorView.clipsToBounds = true
    editorView.layer.masksToBounds = true
}

}

extension ViewController: RichEditorToolbarDelegate, RichEditorDelegate { func richEditorDidLoad(_ editor: RichEditorView) { editor.setEditorBackgroundColor(.white) editor.setEditorFontColor(.black) editor.setFontSize(14) }

func richEditorToolbarInsertLink(_ toolbar: RichEditorToolbar) {
    /// some code
}

}

That code shows toolbar on UIWebView but not showing toolbar with WKWebView.

maulik3107 commented 4 years ago

@thiwankacs Please firstly u update pod library from below link:

pod 'RichEditorView', :git => 'https://github.com/T-Pro/RichEditorView.git', :branch => 'master'

thiwankacs commented 4 years ago

@maulik3107 Yep I updated pod to that link. First I removed the original RichEditorView and add T-Pro/RichEditorView. pod 'RichEditorView', :git => 'https://github.com/T-Pro/RichEditorView.git', :branch => 'master'

Actually toolbar not showing with WKWebView. Is There any new configs or some thing to do.

maulik3107 commented 4 years ago

@thiwankacs There is no new configs, project target set minimum 11.0 & up can u plz check & Please remove all pod first & install new pod

thiwankacs commented 4 years ago

@maulik3107 Yep I removed old pod and add T-Pro/RichEditorView. My minimum iOS version is 10.0. Is it a problem for new pod?.

maulik3107 commented 4 years ago

@thiwankacs Your project open in xcode 11 then no issue Please backup first & check

thiwankacs commented 4 years ago

@maulik3107

I changed my minimum iOS version to 11.0. And run on iPad which runs iOS 12.14. And my Xcode version is 11.3. But I'm unable to see toolbar.

IMG_0335

Here is the logs

Logs.pdf

maulik3107 commented 4 years ago

@thiwankacs Screenshot 2020-06-12 at 10 49 34 AM

thiwankacs commented 4 years ago

@maulik3107 Class and Module also RichEditorView.

thiwankacs commented 4 years ago

@maulik3107

I created new project add freshly installed pod 'RichEditorView', :git => 'https://github.com/T-Pro/RichEditorView.git', :branch => 'master' and that is only pod I used in this. Target iOS version is 11.0

Then I added view to storyboard and add @IBOutlet weak var editorView: RichEditorView! Also the view class and module is RichEditorView

and here is the viewController

`import UIKit import RichEditorView

class ViewController: UIViewController, RichEditorToolbarDelegate, RichEditorDelegate {

@IBOutlet weak var editorView: RichEditorView!

lazy var toolbar: RichEditorToolbar = {
let toolbar = RichEditorToolbar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 44))
toolbar.options = RichEditorDefaultOption.all
return toolbar
}()

override func viewDidLoad() {
    super.viewDidLoad()

    editorView.delegate = self
    editorView.inputAccessoryView = toolbar
    editorView.placeholder = "Type some text..."
    toolbar.delegate = self
    toolbar.editor = editorView
}
func richEditorDidLoad(_ editor: RichEditorView) {
    editor.setEditorBackgroundColor(.white)
    editor.setEditorFontColor(.black)
    editor.setFontSize(14)
}

func richEditorToolbarInsertLink(_ toolbar: RichEditorToolbar) {

}

}`

Here is the result still toolbar is missing. Please give me any idea.

IMG_0336

maulik3107 commented 4 years ago

@thiwankacs Please check i uploaded demo RichEditorview.zip

thiwankacs commented 4 years ago

@maulik3107

First of all thanks for your valuable support. I run your code and still the same. And I'll attach my code. I'm asking about the section above the keyboard.

RICHTEXT

sampleProject.zip

maulik3107 commented 4 years ago

@thiwankacs i checked your code it's working fine!

Simulator Screen Shot - iPhone 11 Pro - 2020-06-12 at 16 45 58

thiwankacs commented 4 years ago

@maulik3107

Seriously. What is the iOS and Device You checked.

maulik3107 commented 4 years ago

@thiwankacs i checked in simulator 13.3 os version

thiwankacs commented 4 years ago

@maulik3107

I checked devices with iOS 12.1 and 12.4. Is there any idea.

agni601 commented 4 years ago

@maulik3107

I checked this thread and implemented also. working fine. but If I use this version, will apple approve my app?

maulik3107 commented 4 years ago

@agni601 Yes, sure apple will approved

thiwankacs commented 4 years ago

Any one have idea about networking toolbar in iOS 12.1 and 12.4.

maulik3107 commented 4 years ago

@thiwankacs No

agni601 commented 4 years ago

@maulik3107 is there any way to insert the image as a background image of the editor?

maulik3107 commented 4 years ago

@agni601 : sorry, i don't know

maulik3107 commented 4 years ago

@gim- @ppamorim @Borko4vp @thiwankacs

any one have idea how send messages via Bluetooth using Swift. Please help