{"id":2005,"url":"https://github.com/cjwirth/RichEditorView","last_synced_at":"2025-08-06T14:33:02.452Z","repository":{"id":29898158,"uuid":"33443804","full_name":"cjwirth/RichEditorView","owner":"cjwirth","description":"RichEditorView is a simple, modular, drop-in UIView subclass for Rich Text Editing.","archived":true,"fork":false,"pushed_at":"2023-12-01T13:12:03.000Z","size":1905,"stargazers_count":1898,"open_issues_count":112,"forks_count":446,"subscribers_count":52,"default_branch":"master","last_synced_at":"2024-12-08T19:40:03.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjwirth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-04-05T14:44:13.000Z","updated_at":"2024-10-31T09:01:12.000Z","dependencies_parsed_at":"2024-01-29T18:06:33.511Z","dependency_job_id":null,"html_url":"https://github.com/cjwirth/RichEditorView","commit_stats":{"total_commits":125,"total_committers":12,"mean_commits":"10.416666666666666","dds":0.264,"last_synced_commit":"2aa67881e596639effa095aab4a93a73ba98b512"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjwirth%2FRichEditorView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjwirth%2FRichEditorView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjwirth%2FRichEditorView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjwirth%2FRichEditorView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjwirth","download_url":"https://codeload.github.com/cjwirth/RichEditorView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228785779,"owners_count":17972066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:01.022Z","updated_at":"2024-12-09T15:30:49.189Z","avatar_url":"https://github.com/cjwirth.png","language":"Swift","funding_links":[],"categories":["Libs","TextField","Swift","UI","Text","Text [🔝](#readme)"],"sub_categories":["Text","Layout","Other free courses","Other Testing","Keychain"],"readme":"**RichEditorView has been archived. I do not plan on making updates to it.**\n\nThis project was needed for an app I was working on in the mid 2010's. I haven't needed it for a long time, and don't expect to need it in the future. You shouldn't either.\n\nThis project depends on [UIWebView](https://developer.apple.com/documentation/uikit/uiwebview) which was [deprecated in iOS 12](https://developer.apple.com/documentation/webkit/replacing_uiwebview_in_your_app). While it's possible to change it to use [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview), it's not a straightforward find-and-replace. For example, some methods that used to be synchronous are now asynchronous.\n\nThere are [forks](https://github.com/cjwirth/RichEditorView/forks) that have made the migration. I would encourage you to check those out and see if one suits your needs.\n\nRichEditorView\n--------------\n[![License: BSD 3](https://img.shields.io/badge/license-BSD3-blue.svg)](./LICENSE.md)\n[![Cocoapods](https://img.shields.io/cocoapods/v/RichEditorView.svg)](http://cocoapods.org/pods/RichEditorView)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)\n\nRichEditorView is a simple, modular, drop-in UIView subclass for Rich Text Editing.\n\nWritten in Swift 4\n\nSupports iOS 8+ through Cocoapods or Carthage.\n\n- _Looking for Android? Check out_ [wasabeef/richeditor-android](https://github.com/wasabeef/richeditor-android)\n\nSeen in Action\n--------------\n![Demo](./art/Demo.gif)\n\nJust clone the project and open `RichEditorViewSample/RichEditorViewSample.xcworkspace` in Xcode.\n\nFeatures\n--------\n\n![Toolbar Demo](./art/Toolbar.gif)\n\n- [x] Bold\n- [x] Italic\n- [x] Subscript\n- [x] Superscript\n- [x] Strikethrough\n- [x] Underline\n- [x] Justify Left\n- [x] Justify Center\n- [x] Justify Right\n- [x] Heading 1\n- [x] Heading 2\n- [x] Heading 3\n- [x] Heading 4\n- [x] Heading 5\n- [x] Heading 6\n- [x] Undo\n- [x] Redo\n- [x] Ordered List\n- [x] Unordered List\n- [x] Indent\n- [x] Outdent\n- [x] Insert Image\n- [x] Insert Link\n- [x] Text Color\n- [x] Text Background Color\n\nInstallation\n------------\n\n#### Cocoapods\n\nIf you have Cocoapods installed, you can use Cocoapods to include `RichEditorView` into your project.\nAdd the following to your `Podfile`:\n\n```\npod \"RichEditorView\"\nuse_frameworks!\n```\n\nNote: the `use_frameworks!` is required for pods made in Swift.\n\n#### Carthage\n\nAdd the following to your `Cartfile`:\n\n```\ngithub 'cjwirth/RichEditorView'\n```\n\nUsing RichEditorView\n--------------------\n\n`RichEditorView` makes no assumptions about how you want to use it in your app. It is a plain `UIView` subclass, so you are free to use it wherever, however you want.\n\nMost basic use:\n\n```\neditor = RichEditorView(frame: self.view.bounds)\neditor.html = \"\u003ch1\u003eMy Awesome Editor\u003c/h1\u003eNow I am editing in \u003cem\u003estyle.\u003c/em\u003e\"\nself.view.addSubview(editor)\n```\n\n### Editing Text\n\nTo change the styles of the currently selected text, you just call methods directly on the `RichEditorView`:\n```Swift\neditor.bold()\neditor.italic()\neditor.setTextColor(.red)\n```\n\nIf you want to show the editing toolbar `RichEditorToolbar`, you will need to handle displaying it (`KeyboardManager.swift` in the sample project is a good start). But configuring it is as easy as telling it which options you want to enable, and telling it which `RichEditorView` to work on.\n\n```Swift\nlet toolbar = RichEditorToolbar(frame: CGRect(x: 0, y: 0, width: 320, height: 44))\ntoolbar.options = RichEditorDefaultOption.all\ntoolbar.editor = editor // Previously instantiated RichEditorView\n```\n\nSome actions require user feedback (such as select an image, choose a color, etc). In this cases you can conform to the `RichEditorToolbarDelegate` and react to these actions, and maybe display some custom UI. For example, from the sample project, we just select a random color:\n\n```Swift\nprivate func randomColor() -\u003e UIColor {\n    let colors: [UIColor] = [\n        .red, .orange, .yellow,\n        .green, .blue, .purple\n    ]\n\n    let color = colors[Int(arc4random_uniform(UInt32(colors.count)))]\n    return color\n}\n\nfunc richEditorToolbarChangeTextColor(toolbar: RichEditorToolbar) {\n    let color = randomColor()\n    toolbar.editor?.setTextColor(color)\n}\n```\n\n#### Advanced Editing\n\nIf you need even more flexibility with your options, you can add completely custom actions, by either making an object that conforms the the `RichEditorOption` protocol, or configuring a `RichEditorOptionItem` object, and adding it to the toolbar's options:\n\n```Swift\nlet clearAllItem = RichEditorOptionItem(image: UIImage(named: \"clear\"), title: \"Clear\") { toolbar in\n    toolbar?.editor?.html = \"\"\n    return\n}\ntoolbar.options = [clearAllItem]\n```\n\nAuthor\n------\nCaesar Wirth - cjwirth@gmail.com\n\n\u003ca href=\"http://www.twitter.com/cjwirth\"\u003e\n\u003cimg src=\"https://g.twimg.com/Twitter_logo_blue.png\" width=\"50px\" alt=\"@cjwirth on Twitter\"\u003e\n@cjwirth\n\u003c/a\u003e\n\n\nAcknowledgements\n----------------\n\n* [wasabeef/richeditor-android](https://github.com/wasabeef/richeditor-android) - Android version of this library (Apache v2)\n* [nnhubbard/ZSSRichTextEditor](https://github.com/nnhubbard/ZSSRichTextEditor) - Inspiration and Icons (MIT)\n\nLicense\n-------\n\nRichEditorView is released under the BSD 3-Clause License. See [LICENSE.md](./LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjwirth%2FRichEditorView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjwirth%2FRichEditorView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjwirth%2FRichEditorView/lists"}