{"id":2013,"url":"https://github.com/nnhubbard/ZSSRichTextEditor","last_synced_at":"2025-08-02T05:33:28.847Z","repository":{"id":13699383,"uuid":"16393248","full_name":"nnhubbard/ZSSRichTextEditor","owner":"nnhubbard","description":"A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view","archived":false,"fork":false,"pushed_at":"2021-09-07T17:08:31.000Z","size":786,"stargazers_count":3787,"open_issues_count":132,"forks_count":589,"subscribers_count":100,"default_branch":"master","last_synced_at":"2025-07-16T20:45:13.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nnhubbard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-30T22:39:12.000Z","updated_at":"2025-07-16T00:49:07.000Z","dependencies_parsed_at":"2022-08-08T03:15:10.496Z","dependency_job_id":null,"html_url":"https://github.com/nnhubbard/ZSSRichTextEditor","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/nnhubbard/ZSSRichTextEditor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnhubbard%2FZSSRichTextEditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnhubbard%2FZSSRichTextEditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnhubbard%2FZSSRichTextEditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnhubbard%2FZSSRichTextEditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nnhubbard","download_url":"https://codeload.github.com/nnhubbard/ZSSRichTextEditor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnhubbard%2FZSSRichTextEditor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268339405,"owners_count":24234544,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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.249Z","updated_at":"2025-08-02T05:33:28.535Z","avatar_url":"https://github.com/nnhubbard.png","language":"Objective-C","funding_links":[],"categories":["RichText","UI","Text","Objective-C","UI Components","OOM-Leaks-Crash"],"sub_categories":["Layout","Other free courses","Other Testing","Keychain","Label"],"readme":"ZSSRichTextEditor\n=============\n\nThe Editor\n---\n\n`ZSSRichTextEditor` is a beautiful Rich Text `WYSIWYG Editor` for `iOS`. It includes all of the standard editor tools one would expect from a `WYSIWYG` editor as well as an amazing source view with syntax highlighting.\n\n![toolbar](https://user-images.githubusercontent.com/30858/132384030-59c0d2be-ab90-4535-9dd8-e5ee3e405e2e.gif)\n\nThe editor is used how any other text input area in iOS is used. A selection of text or content is made, then tapping on the toolbar item below will apply that style. A Source View is also included, you can make changes and this will be reflected in the editor preview.\n\n![editor](https://user-images.githubusercontent.com/30858/132384094-9a1d2182-0c21-468d-b3d9-2049397e2af5.gif)\n\nColors\n---\n\nWe wanted to have a really beautiful color picker to make changing colors really simple. So, we used the open-source HRColorPicker which was exactly what we were looking for. Choosing colors for text or background is simple and seamless.\n\n![colors](https://user-images.githubusercontent.com/30858/132384119-6b4a836d-1c21-400a-bb5a-5d18534d3bd5.gif)\n\nHow It Works\n---\n\nJust subclass `ZSSRichTextEditor` and use the following:\n\n```objective-c\n// HTML Content to set in the editor\nNSString *html = @\"\u003c!-- This is an HTML comment --\u003e\"\n\"\u003cp\u003eThis is a test of the \u003cstrong\u003eZSSRichTextEditor\u003c/strong\u003e by \u003ca title=\\\"Zed Said\\\" href=\\\"http://www.zedsaid.com\\\"\u003eZed Said Studio\u003c/a\u003e\u003c/p\u003e\";\n\n// Set the base URL if you would like to use relative links, such as to images.\nself.baseURL = [NSURL URLWithString:@\"http://www.zedsaid.com\"];\n\n// If you want to pretty print HTML within the source view.\nself.formatHTML = YES;\n\n// set the initial HTML for the editor\n[self setHTML:html];\n```\n\nIf you want to retrieve the HTML from the editor:\n```objective-c\n// Returns an NSString\n[self getHTML];\n```\n\nInsert HTML at the current caret position:\n```objective-c\nNSString *html = @\"\u003cstrong\u003eI love cats!\u003c/strong\u003e\";\n[self insertHTML:html];\n```\n\nChange the tint color of the toolbar buttons:\n```objective-c\n// Set the toolbar item color\nself.toolbarItemTintColor = [UIColor greenColor];\n\n// Set the toolbar selected color\nself.toolbarItemSelectedTintColor = [UIColor redColor];\n```\n\nShow only specified buttons in the toolbar:\n```objective-c\nself.enabledToolbarItems = @[ZSSRichTextEditorToolbarBold, ZSSRichTextEditorToolbarH1, ZSSRichTextEditorToolbarParagraph];\n```\n\nAlways show the toolbar even when the keyboard is hidden:\n```objective-c\nself.alwaysShowToolbar = YES;\n```\n\nSet A Placeholder\n---\n\n```objective-c\n[self setPlaceholder:@\"This is a placeholder that will show when there is no content(html)\"];\n\n```\n\nInsert Link and Insert Image\n---\n\nIf you want to manually insert a link or image where the cursor is, you can use the following methods:\n\n**Insert Image**\n```objective-c\n- (void)insertImage:(NSString *)url alt:(NSString *)alt;\n```\n\n**Insert Link**\n```objective-c\n- (void)insertLink:(NSString *)url title:(NSString *)title;\n```\n\nCustom Pickers\n---\n\nYou can implement your own pickers for images and links if you have an alternate method that you are wanting to use. E.g., uploading an image from your camera roll then inserting the URL.\n\nWhen the alternate picker icon (crosshair) is tapped it will call the corresponding method, which you need to override in your `ZSSRichTextEditor` subclass (see example project):\n\n```objective-c\n- (void)showInsertURLAlternatePicker {\n    \n    [self dismissAlertView];\n    \n    // Show your custom picker\n    \n}\n\n\n- (void)showInsertImageAlternatePicker {\n    \n    [self dismissAlertView];\n    \n    // Show your custom picker\n    \n}\n```\n\nCustom Toolbar Buttons\n---\n\n```objective-c\nUIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, buttonWidth, 28.0f)];\n[myButton setTitle:@\"My Button\" forState:UIControlStateNormal];\n[myButton addTarget:self\n             action:@selector(didTapCustomToolbarButton:)\n   forControlEvents:UIControlEventTouchUpInside];\n\n[self addCustomToolbarItemWithButton:myButton];\n\n```\n\nCustom CSS\n---\n\n```objective-c\nNSString *customCSS = @\"a {text-decoration:none;} a:hover {color:#FF0000;}\";\n[self setCSS:customCSS];\n\n```\n\nReceive Editor Did Change Events\n---\n\nAdd the following to your viewDidLoad method:\n\n```objective-c\nself.receiveEditorDidChangeEvents = YES;\n```\n\nThen you will receive events in the following method:\n\n```objective-c\n- (void)editorDidChangeWithText:(NSString *)text andHTML:(NSString *)html {\n    \n    NSLog(@\"Text Has Changed: %@\", text);\n    \n    NSLog(@\"HTML Has Changed: %@\", html);\n    \n}\n```\n\nReceive Hashtag \u0026 Mention Events\n---\n\nHashtags:\n```objective-c\n- (void)hashtagRecognizedWithWord:(NSString *)word {\n    \n    NSLog(@\"Hashtag has been recognized: %@\", word);\n    \n}\n```\nMentions:\n```objective-c\n- (void)mentionRecognizedWithWord:(NSString *)word {\n    \n    NSLog(@\"Mention has been recognized: %@\", word);\n    \n}\n```\n\nSupported Functions\n---\n\nZSSRichTextEditor has the following functions:\n\n*   Bold\n*   Italic\n*   Subscript\n*   Superscript\n*   Strikethrough\n*   Underline\n*   Remove Formatting\n*   Font\n*   Justify Left\n*   Justify Center\n*   Justify Right\n*   Justify Full\n*   Paragraph\n*   Heading 1\n*   Heading 2\n*   Heading 3\n*   Heading 4\n*   Heading 5\n*   Heading 6\n*   Undo\n*   Redo\n*   Unordered List\n*   Ordered List\n*   Indent\n*   Outdent\n*   Insert Image\n*   Insert Link\n*   Quick Link\n*   Unlink\n*   Horizontal Rule\n*   View Source\n*   Text Color\n*   Background Color\n\nInstallation\n--------------\nYou can use `CocoaPods` or manually using the following instructions:\n\n`ZSSRichTextEditor` requires iOS7 as well as `CoreGraphics.framework` and `CoreText.framework`.\n\n- Copy the `Source` folder to your project.\n- Subclass `ZSSRichTextEditor` and implement the methods as mentioned above.\n\n**When using `ZSSRichTextEditor` in your own project, XCode will automatically add `ZSSRichTextEditor.js` to compile sources under build phases, this will cause `ZSSRichTextEditor` to not work correctly as the javascript file won't be included in your app. Instead, remove it from compile sources and add it to copy bundle resources.**\n\nAttribution\n--------------\n\n`ZSSRichTextEditor` uses portions of code from the following sources:\n\n| Component     | Description   | License  |\n| :------------- |:-------------| :-----|\n| [CYRTextView](https://github.com/illyabusigin/CYRTextView)      | CYRTextView is a UITextView subclass that implements a variety of features that are relevant to a syntax or code text view. | [MIT](https://github.com/illyabusigin/CYRTextView/blob/master/LICENSE) |\n| [HRColorPicker](https://github.com/hayashi311/Color-Picker-for-iOS)      | Simple color picker for iPhone      |   [BSD](https://github.com/hayashi311/Color-Picker-for-iOS/blob/master/ColorPicker/HRColorPickerView.h) |\n| [jQuery](https://jquery.com)      | jQuery is a fast, small, and feature-rich JavaScript library.      |   [MIT](http://jquery.org/license) |\n| [JS Beautifier](https://github.com/einars/js-beautify)      | Makes ugly Javascript pretty      |   [MIT](https://github.com/einars/js-beautify/blob/master/LICENSE) |\n\nContact\n--------------\nVisit us online at [http://www.zedsaid.com](http://www.zedsaid.com) or [@zedsaid](https://twitter.com/zedsaid).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnhubbard%2FZSSRichTextEditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnnhubbard%2FZSSRichTextEditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnhubbard%2FZSSRichTextEditor/lists"}