147 Commits

Author SHA1 Message Date
Michael Babienco cf2da5d359 Update sample for tab key 2020-12-08 09:32:16 -05:00
Michael Babienco 19b63ff242 Add tabKeyAlwaysIndentsOutdents property 2020-12-08 09:28:48 -05:00
Michael Babienco a5b3731db0 Small syntax adjustments 2020-11-13 10:26:50 -05:00
Michael Babienco c60559bb6c Fix handling of system font grabbing 2020-08-03 17:07:07 -04:00
Michael Babienco 1cacbec617 Fix delegate receptor handling 2019-12-31 14:54:04 -05:00
Michael Babienco 1fbf470d24 Fix some possible null refs 2019-09-05 12:34:24 -04:00
Michael Babienco 846aeb292e Fix crash with selection out of range 2019-08-27 15:16:01 -04:00
Michael Babienco 43b1acd9ca Update to Xcode 10 2019-08-27 09:27:16 -04:00
Deadpikle e694418c73 Fix bullet bug where deleting newlines didn't clear bullets 2018-05-16 15:36:58 -04:00
Deadpikle 39592a4bfc Bullet issue fixes; closes #6 & #7 2018-05-16 15:09:37 -04:00
Deadpikle f438543ec4 Update README.md 2018-05-16 14:32:51 -04:00
Deadpikle cb57d0f1e2 Update to Xcode 9.3 2018-05-16 14:30:23 -04:00
Deadpikle fcd80f389b Update gitignore 2018-05-16 14:30:13 -04:00
Deadpikle 42c85ccad2 Make backwards compatible to 10.10 2018-05-16 13:28:25 -04:00
Deadpikle 0a2e10993f Merge pull request #5 from Spider2man3/bullet-point
Made bullet point functionality work a bit more like Word/Pages.
2018-05-11 11:35:07 -04:00
Thomas Manu 82cae6e3c5 Fix wrap-around bug 2018-05-10 17:00:44 -04:00
Thomas Manu 0cada178a2 Remove addition overhead 2018-05-10 16:29:32 -04:00
Thomas Manu 36949138d8 Selecting bullet point only fixes bug of extra character 2018-05-10 15:48:43 -04:00
Thomas Manu 5dc4407f01 Add bug fix to select bullet string from different paragraph 2018-05-10 14:50:32 -04:00
Thomas Manu c9eeb307ef Change name from mouse to isMouseClick 2018-05-10 10:52:17 -04:00
Thomas Manu bd4a7e3760 Change method name to adjustSelectedRangeForBullets 2018-05-09 16:56:56 -04:00
Thomas Manu bffa2250f5 Update documentation and remove unnecessary changes 2018-05-09 16:50:29 -04:00
Thomas Manu 6b1de5c06b Fix bug with hitting left arrow twice and selecting bullet with mouse 2018-05-09 16:08:37 -04:00
Deadpikle d97c7bf74f Fix possible null ref in changeToFont 2018-05-03 15:08:46 -04:00
Thomas Manu f2df27010c Fix issue with flickering cursor and problem with highlighting. 2018-04-10 12:19:10 -04:00
Thomas Manu 9becb802cd Fix bug with having to press left arrow twice to move to a different bullet 2018-04-05 14:03:32 -04:00
Thomas Manu 9bacbb2197 Add function to move cursor around bullet point 2018-04-04 17:17:52 -04:00
Deadpikle 0a895c8673 Update to Xcode 9.3 2018-03-30 09:56:35 -04:00
Deadpikle b26a19dfde Fix incorrect text view changed call in bullet list 2018-03-29 18:58:34 -04:00
Deadpikle a76dc416a6 Add function to change all text to specific font while retaining traits 2018-03-29 16:35:58 -04:00
Deadpikle 6708e23dad Update README.md 2018-03-29 15:52:09 -04:00
Deadpikle 4c4e0264ef Allow user to selectively enable keyboard shortcuts 2018-03-29 15:48:57 -04:00
Deadpikle 140142ec12 Fix bug with bullet list not being indented properly 2018-03-28 17:20:09 -04:00
Deadpikle 075ec588ec Remove some dead comments 2018-03-28 17:12:36 -04:00
Deadpikle 6d8388d263 Improve RTE documentation 2018-03-28 15:01:50 -04:00
Deadpikle 0838210bec Remove unnecessary textObserver property and documentation 2018-03-28 14:47:18 -04:00
Deadpikle 00d20fd3b4 Fix yet another typo in the readme 2018-03-28 14:38:26 -04:00
Deadpikle 05e14bceae Update readme 2018-03-28 14:37:36 -04:00
Deadpikle 7270b0e188 Fix URL in readme 2018-03-28 14:35:47 -04:00
Deadpikle 911e3171b4 Remove TODO from readme in lieu of GitHub issues 2018-03-28 14:33:30 -04:00
Deadpikle 8dacb8b52f Update readme 2018-03-28 14:30:54 -04:00
Deadpikle 747337013d Move files around; update README.md 2018-03-28 14:29:57 -04:00
Deadpikle ed2cc35aa9 Update top code comments 2018-03-28 14:22:09 -04:00
Deadpikle 418a21c4bb Update sample 2018-03-28 14:20:01 -04:00
Deadpikle 187b2811b1 Add SO link for image tinting 2018-03-28 13:56:24 -04:00
Deadpikle a7aef03123 Update README.md 2018-03-28 13:55:36 -04:00
Deadpikle 0261bc1c28 Add basic sample 2018-03-28 13:09:40 -04:00
Deadpikle 877aaca6e3 Update license 2018-03-28 13:06:55 -04:00
Deadpikle e3cb870d16 Make font size related properties public 2018-03-28 13:03:26 -04:00
Deadpikle 012eb54863 Update umbrella header 2018-03-28 12:50:50 -04:00
Deadpikle 783a6c9900 Remove unneeded data source methods 2018-03-28 12:28:21 -04:00
Deadpikle 5d16808ebe Add sample project to workspace 2018-03-28 12:14:54 -04:00
Deadpikle 9267595477 Add workspace and framework output 2018-03-28 12:13:35 -04:00
Deadpikle 53c04bee43 Update README.md 2018-03-27 09:52:04 -04:00
Deadpikle 1f7d91e3d1 Update README.md 2018-03-27 09:50:20 -04:00
Deadpikle bc959a5c0e Remove page break (it was for a proprietary project) 2018-03-27 09:45:09 -04:00
Deadpikle 6eabf61dfe Don't clear selection on text color changed (matches MS Word) 2018-03-02 09:16:43 -05:00
Deadpikle 2e4bab88c3 Comment out some NSLogs 2018-02-22 15:21:27 -05:00
Deadpikle 29c5155a00 For highlight/font color, now ends selection in proper direction 2018-02-14 12:12:32 -05:00
Deadpikle 3fdfe7df62 Update README.md 2018-02-14 11:59:45 -05:00
Deadpikle 0816737aef Fix code style consistancy 2018-02-14 11:58:41 -05:00
Deadpikle bdebd76399 Fix bad preview type -> string conversion 2017-11-29 17:18:09 -05:00
Deadpikle bf00632b25 Allow for retrieval of BULLET_STRING 2017-11-19 14:43:24 -05:00
Deadpikle 9cb29fa75d Add preview change for find & replace
Not actually used by the editor itself, but can be used by clients if needed
2017-11-17 10:41:05 -05:00
Deadpikle be658404dd Don't say that a key was pressed right after a click 2017-05-09 13:11:22 -04:00
Deadpikle 4359c4a153 Fix incorrect if/else chain in keyDown: 2017-05-03 12:10:23 -04:00
Deadpikle 8bb5568179 Remember last key pressed
Lets you do things like know which arrow key was hit last
2017-04-09 19:27:17 -04:00
Deadpikle e1519e03f1 Fix a bug related to backspace and caret placement after bulleted lists 2017-02-08 12:45:37 -05:00
Deadpikle f1379f5a80 Some small code cleanup 2017-02-07 12:14:47 -05:00
Deadpikle 4c46886db2 Add comment regarding bullet unicode # 2017-01-25 16:50:55 -05:00
Deadpikle ac2ce6d7e3 Don't swallow keyboard shortcuts inappropriately with shift down 2017-01-10 13:37:49 -05:00
Deadpikle 4395f51913 Add conversion function from change type to NSString 2016-10-12 13:58:47 -04:00
Deadpikle 001490dc6c Bulleted lists have only 1 non-breaking space after them intead of 2 2016-09-26 12:53:40 -04:00
Deadpikle 1e12b7023b Follow Objective-C style guidelines slightly more 2016-09-25 13:44:01 -04:00
Deadpikle 2261e3d48c Update README.md 2016-09-25 09:52:33 -04:00
Deadpikle a5565e6875 Merge branch 'master' of https://github.com/Deadpikle/macOS-Rich-Text-Editor 2016-09-25 09:51:00 -04:00
Deadpikle 2c2e5d9441 Update top-of-file comments 2016-09-25 09:50:55 -04:00
Deadpikle b3cf8cd4bd Update README.md 2016-09-25 09:18:36 -04:00
Deadpikle 9851f0d834 Update README.md 2016-09-23 17:04:10 -04:00
Deadpikle 53d0bbaa26 Allow pasting rich text only from the same NSTextView derivatives 2016-09-18 16:15:22 -04:00
Deadpikle eea0431ac8 Allow for preview change of delete 2016-08-17 14:43:03 -04:00
Deadpikle 2efecf84c0 Adjust delegate callback for RichTextEditorCallback -> isBold/isItalic/etc 2016-08-08 15:13:45 -04:00
Deadpikle 4bd2a85fca Remove an NSLog statement 2016-08-04 12:06:49 -04:00
Deadpikle f20ea78934 Fix issue where arrow key keyDown event wasn't handled properly 2016-08-03 10:45:35 -04:00
Deadpikle dd93aa1e42 Allow for previewing change *types* before they occur. Fix some formatting issues. 2016-08-03 10:09:31 -04:00
Deadpikle 0f3d3cb5e0 Merge branch 'osx-editor' of https://github.com/Deadpikle/iOS-and-Mac-OS-X-Rich-Text-Editor into osx-editor 2016-08-02 16:44:48 -04:00
Deadpikle f9ee64bce5 Remove some unnecessary rteDelegate methods that were covering for delegate methods 2016-08-02 16:44:43 -04:00
Deadpikle 8de3ad56d5 Update README.md 2016-08-01 16:36:49 -04:00
Deadpikle b4e31e7ff3 Always make sure to update the isInBulletedList 2016-06-30 16:26:00 -04:00
Deadpikle 8926d0c6a1 Add previewTextChangedForRange:replacementString: delegate method 2016-06-30 16:24:11 -04:00
Deadpikle ca69b1f8fe More intelligent page-break code 2016-06-30 15:40:53 -04:00
Deadpikle 9ad60bf88a Fix bug in keyDown:. Add Tab & Shift+Tab in bulleted lists. 2016-06-30 15:14:20 -04:00
Deadpikle 8ddeff89ce Add some keyboard shortcuts and slight refactor of keyDown: 2016-06-30 14:33:46 -04:00
Deadpikle cae56a89fe Insert page break item in current font size and with no underline. Fix bug where RTE didn't report keydown events 2016-06-16 16:43:11 -04:00
Deadpikle cd37faa42a Update README.md 2016-05-25 13:20:13 -04:00
Deadpikle 2c2b9f8937 Fix bug where pasting in plain text carried over font background and foreground colors 2016-05-25 13:15:45 -04:00
Deadpikle c50172cfdd Change typing attribute font size when user changes font size with no text selected 2016-05-25 13:01:29 -04:00
Deadpikle 01c8077411 Fix bug with bulleted lists and deleting characters. Clean up a few NSLogs used for debugging. 2016-05-25 12:45:56 -04:00
Deadpikle 4931fb74eb Fix bug where hitting enter to get out of a bulleted list would not (graphically) move the cursor to the right location 2016-05-25 12:30:04 -04:00
Deadpikle a1432badc7 Somewhat fix bullets. Very poor logic being used atm. 2016-05-25 12:20:49 -04:00
Deadpikle 3c1105ade6 Add WZProtocolInterceptor to avoid self.delegate = self issue. Small cleanup. Bullets still broken. 2016-05-25 11:57:39 -04:00
Deadpikle 3d7c528363 Fix bug in RTE where \n would be at the end of the string sometimes. 2016-02-19 11:16:31 -05:00
Deadpikle 039eb71b46 Attempt to avoid a random crash by using a try/catch block in attributedStringFromHTMLString: 2016-02-19 10:34:17 -05:00
Deadpikle 1768fdd544 Add method to add the text observer. Fix bug where text resizing wouldn't actually call the text changed method. 2016-02-18 12:26:41 -05:00
Deadpikle 6afa44ec50 Fix a bug with resizing text when there was no text available. Allow rteDelegate to get updates on when the NSTextView changes. 2016-01-20 13:19:28 -05:00
Deadpikle 7c176a52e0 Use NSTextStorage in more places where applicable. Delete unneeded files. Other minor changes. 2016-01-19 09:12:42 -05:00
Deadpikle 80da0cee8b Fix a bug with typing attributes when user selected something and then changed attributes. 2016-01-18 14:49:13 -05:00
Deadpikle 7e66ff253f Improve the RTE by using NSTextStorage in most places rather than setting the attributed string all over again. That should fix some issues and speed things up a bit. 2016-01-18 14:26:37 -05:00
Deadpikle 48a55b66b3 Merge branch 'osx-editor' of https://github.com/Deadpikle/iOS-Rich-Text-Editor into osx-editor 2016-01-13 13:02:20 -05:00
Deadpikle ddbf2b0bca Don't allow changing bullet list if text view isn't editable 2016-01-13 13:02:15 -05:00
Deadpikle f2ef1aaa17 Update README.md 2016-01-12 10:14:24 -05:00
Deadpikle 9d8524e3b7 Update README.md 2016-01-12 10:14:04 -05:00
Deadpikle 1ced79a901 Update README.md 2016-01-12 10:11:49 -05:00
Deadpikle 246282645f Code cleanup for OS X. Change BULLET_STRING to class property and change the tab to two spaces (even though that has the potential to be nasty). Misc other changes and fixes. 2016-01-12 10:05:00 -05:00
Deadpikle 7f6816da88 -Improve RTE behavior after highlighting or underlining text.
-Fix issue with white close button not existing on edit mode view.
-Scroll to bottom of notes when going backwards through a presentation.
2015-10-07 14:41:42 -04:00
Deadpikle 1a2a7d1f3b Present mode changes. Keyboard keys and left/right arrows on screen now do same thing. Next/prev slide now scrolls notes as applicable. Current slide show position is now updated. 2015-10-07 11:42:44 -04:00
Deadpikle cc9e585c78 OS X First version sort of working 2015-10-06 11:01:17 -04:00
Deadpikle b9a484f193 Color picker for RTE! 2015-09-22 16:27:06 -04:00
Deadpikle ee9a51afcf Fix a few RTE bugs 2015-09-22 10:27:27 -04:00
Deadpikle 52d78ab789 Rich text editing -- bold, italic, underline, half of bullet list and indent (latter 2 have BUGZ) 2015-09-17 14:52:05 -04:00
Deadpikle 31faf82c0a Deleted RichTextEditorTests.m (SenTesting file) 2015-02-18 16:20:06 -05:00
Deadpikle 8250a14d60 Deleted RichTextEditorTests.h (SenTesting file) 2015-02-18 16:19:52 -05:00
CIRC 2b3c74e01d Updated README.md 2015-02-01 17:59:09 -05:00
CIRC af18f489b6 The commit to rule them all. MANY changes to the Rich Text Editor, namely: Better bullet list functionality, move cursor on indent, fix scrolling issues when editing at the bottom of the text view, new icons for the toolbar (including a dismiss button for iPhones), undo/redo default functionality and (small) API, and general improvements and fixes. The code is by no means perfect or done, but it works, and that is what counts. Strikethrough may be broken, however. 2015-02-01 17:41:59 -05:00
Aryan Ghassemi a513aaa283 Merge pull request #42 from pierrephi/master
iOS7 compatibility change
2014-03-08 00:25:34 -08:00
Pierre-Philippe di Costanzo a162a2e08c Silence compiler warning 2014-03-03 17:27:10 +01:00
Pierre-Philippe di Costanzo 4bdb8b1bd2 When running on iOS7, the status bar is part of the toolbar, fix this geometry 2014-03-03 16:59:57 +01:00
Pierre-Philippe di Costanzo c9efea05c7 Interface guidelines suggest to have the Done button to the right and Cancel button to the left
And this becomes consistant with the button position on the popover
2014-03-03 16:59:25 +01:00
Pierre-Philippe di Costanzo d6f9c20f6c Use system buttons to benefit from automatic translation of button labels (Done and Cancel) 2014-03-03 16:23:01 +01:00
Pierre-Philippe di Costanzo 19d23dfcf4 Upgrade to new iOS7 compatible version of WEPopover 2014-03-03 15:33:04 +01:00
Pierre-Philippe di Costanzo d1a058176a iOS7 uses new method for popover content size 2014-03-03 15:30:59 +01:00
Pierre-Philippe di Costanzo 06f9a5104b Silence compiler warning 2014-03-03 15:28:42 +01:00
Aryan Ghassemi b1fcfc892d - improved icons for first line indent 2013-09-15 10:02:50 -07:00
Aryan Ghassemi fd351b4a44 - Fixed the issue with applying first line indentation to multiple paragraphs at a time
- Added icons for paragraph first line indentation
2013-09-14 10:20:11 -07:00
Aryan Ghassemi dd4af89239 - Separated "Paragraph indentation" from "paragraph first line indentation" so that they can be turned on/off individually 2013-09-02 14:36:11 -07:00
Aryan Ghassemi c7968c5e9e - Added paragraph first line head indent functionality, need to create an icon 2013-09-02 14:05:11 -07:00
Aryan Ghassemi 43e9215536 - Moved initial method to initWithCoder instead of awakeFromNib 2013-09-02 14:03:04 -07:00
Aryan Ghassemi b297e2fd8a - Some OCD cleanup
- Redraw toolbar every time textview becomes first responder, in case features available have changed
2013-08-30 15:50:01 -07:00
Aryan Ghassemi 04ff8caf53 Merge pull request #18 from madsdk/master
Small bugfix and other changes
2013-08-30 15:24:51 -07:00
Mads D. Kristensen bd1dbd46e3 Merged with current tip 2013-08-29 08:56:42 +02:00
Aryan Gh 7bafcf8a89 - Fixed auto resizing mask on UITextView in iPhone storyboard (No changes to main source, just a UI fix on demo) 2013-08-27 22:17:03 -07:00
Mads D. Kristensen 0b881d8530 Made the toolbar height a define 2013-08-27 13:27:56 +02:00
Mads D. Kristensen 2b00d098da Moved the population of the toolbar into a separate method so that the toolbal can be repopulated at runtime if necessary. Fixed an error where the the toolbar could not be hidden. 2013-08-27 12:31:51 +02:00
Mads D. Kristensen 9febc8db06 Implemented an empty bullet point method to remove the compiler warning 2013-08-27 12:31:16 +02:00
Mads D. Kristensen 105ca38129 Fixed some typos 2013-08-26 14:20:00 +02:00
Mads D. Kristensen 0607ba8d01 Added some initializers. Made it possible to change color and width of the border. 2013-08-26 13:24:10 +02:00
Mads D. Kristensen 8ec5c2edc5 Changed UIViewAnimationCurveLinear to UIViewAnimationOptionCurveLinear - twice... 2013-08-26 13:04:09 +02:00
170 changed files with 5513 additions and 4578 deletions
+33
View File
@@ -0,0 +1,33 @@
*.DS_Store
# Created by https://www.gitignore.io/api/xcode
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
# End of https://www.gitignore.io/api/xcode
macOSRichTextEditor.xcworkspace/xcshareddata/
@@ -0,0 +1,479 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 48;
objects = {
/* Begin PBXBuildFile section */
342F59DF206BF5D00045E75A /* macOSRichTextEditor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 342F59D5206BF5D00045E75A /* macOSRichTextEditor.framework */; };
342F59E4206BF5D00045E75A /* macOSRichTextEditorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 342F59E3206BF5D00045E75A /* macOSRichTextEditorTests.m */; };
342F59E6206BF5D00045E75A /* macOSRichTextEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 342F59D8206BF5D00045E75A /* macOSRichTextEditor.h */; settings = {ATTRIBUTES = (Public, ); }; };
342F59F9206BF5FC0045E75A /* RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 342F59F0206BF5FC0045E75A /* RichTextEditor.m */; };
342F59FA206BF5FC0045E75A /* WZProtocolInterceptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 342F59F1206BF5FC0045E75A /* WZProtocolInterceptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
342F59FB206BF5FC0045E75A /* RichTextEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 342F59F2206BF5FC0045E75A /* RichTextEditor.h */; settings = {ATTRIBUTES = (Public, ); }; };
342F59FC206BF5FC0045E75A /* NSFont+RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 342F59F4206BF5FC0045E75A /* NSFont+RichTextEditor.m */; };
342F59FD206BF5FC0045E75A /* NSAttributedString+RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 342F59F5206BF5FC0045E75A /* NSAttributedString+RichTextEditor.m */; };
342F59FE206BF5FC0045E75A /* NSAttributedString+RichTextEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 342F59F6206BF5FC0045E75A /* NSAttributedString+RichTextEditor.h */; settings = {ATTRIBUTES = (Public, ); }; };
342F59FF206BF5FC0045E75A /* NSFont+RichTextEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 342F59F7206BF5FC0045E75A /* NSFont+RichTextEditor.h */; settings = {ATTRIBUTES = (Public, ); }; };
342F5A00206BF5FC0045E75A /* WZProtocolInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 342F59F8206BF5FC0045E75A /* WZProtocolInterceptor.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
342F59E0206BF5D00045E75A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 342F59CC206BF5D00045E75A /* Project object */;
proxyType = 1;
remoteGlobalIDString = 342F59D4206BF5D00045E75A;
remoteInfo = macOSRichTextEditor;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
342F59D5206BF5D00045E75A /* macOSRichTextEditor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = macOSRichTextEditor.framework; sourceTree = BUILT_PRODUCTS_DIR; };
342F59D8206BF5D00045E75A /* macOSRichTextEditor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = macOSRichTextEditor.h; sourceTree = "<group>"; };
342F59D9206BF5D00045E75A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
342F59DE206BF5D00045E75A /* macOSRichTextEditorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = macOSRichTextEditorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
342F59E3206BF5D00045E75A /* macOSRichTextEditorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = macOSRichTextEditorTests.m; sourceTree = "<group>"; };
342F59E5206BF5D00045E75A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
342F59F0206BF5FC0045E75A /* RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditor.m; sourceTree = "<group>"; };
342F59F1206BF5FC0045E75A /* WZProtocolInterceptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WZProtocolInterceptor.h; sourceTree = "<group>"; };
342F59F2206BF5FC0045E75A /* RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditor.h; sourceTree = "<group>"; };
342F59F4206BF5FC0045E75A /* NSFont+RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFont+RichTextEditor.m"; sourceTree = "<group>"; };
342F59F5206BF5FC0045E75A /* NSAttributedString+RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSAttributedString+RichTextEditor.m"; sourceTree = "<group>"; };
342F59F6206BF5FC0045E75A /* NSAttributedString+RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSAttributedString+RichTextEditor.h"; sourceTree = "<group>"; };
342F59F7206BF5FC0045E75A /* NSFont+RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFont+RichTextEditor.h"; sourceTree = "<group>"; };
342F59F8206BF5FC0045E75A /* WZProtocolInterceptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WZProtocolInterceptor.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
342F59D1206BF5D00045E75A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
342F59DB206BF5D00045E75A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
342F59DF206BF5D00045E75A /* macOSRichTextEditor.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
342F59CB206BF5D00045E75A = {
isa = PBXGroup;
children = (
342F59D7206BF5D00045E75A /* macOSRichTextEditor */,
342F59E2206BF5D00045E75A /* macOSRichTextEditorTests */,
342F59D6206BF5D00045E75A /* Products */,
);
sourceTree = "<group>";
};
342F59D6206BF5D00045E75A /* Products */ = {
isa = PBXGroup;
children = (
342F59D5206BF5D00045E75A /* macOSRichTextEditor.framework */,
342F59DE206BF5D00045E75A /* macOSRichTextEditorTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
342F59D7206BF5D00045E75A /* macOSRichTextEditor */ = {
isa = PBXGroup;
children = (
342F5A01206BF6840045E75A /* Source */,
342F59D8206BF5D00045E75A /* macOSRichTextEditor.h */,
342F59D9206BF5D00045E75A /* Info.plist */,
);
path = macOSRichTextEditor;
sourceTree = "<group>";
};
342F59E2206BF5D00045E75A /* macOSRichTextEditorTests */ = {
isa = PBXGroup;
children = (
342F59E3206BF5D00045E75A /* macOSRichTextEditorTests.m */,
342F59E5206BF5D00045E75A /* Info.plist */,
);
path = macOSRichTextEditorTests;
sourceTree = "<group>";
};
342F59F3206BF5FC0045E75A /* Categories */ = {
isa = PBXGroup;
children = (
342F59F7206BF5FC0045E75A /* NSFont+RichTextEditor.h */,
342F59F4206BF5FC0045E75A /* NSFont+RichTextEditor.m */,
342F59F6206BF5FC0045E75A /* NSAttributedString+RichTextEditor.h */,
342F59F5206BF5FC0045E75A /* NSAttributedString+RichTextEditor.m */,
);
path = Categories;
sourceTree = "<group>";
};
342F5A01206BF6840045E75A /* Source */ = {
isa = PBXGroup;
children = (
342F59F3206BF5FC0045E75A /* Categories */,
342F59F2206BF5FC0045E75A /* RichTextEditor.h */,
342F59F0206BF5FC0045E75A /* RichTextEditor.m */,
342F59F1206BF5FC0045E75A /* WZProtocolInterceptor.h */,
342F59F8206BF5FC0045E75A /* WZProtocolInterceptor.m */,
);
path = Source;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
342F59D2206BF5D00045E75A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
342F59E6206BF5D00045E75A /* macOSRichTextEditor.h in Headers */,
342F59FF206BF5FC0045E75A /* NSFont+RichTextEditor.h in Headers */,
342F59FB206BF5FC0045E75A /* RichTextEditor.h in Headers */,
342F59FE206BF5FC0045E75A /* NSAttributedString+RichTextEditor.h in Headers */,
342F59FA206BF5FC0045E75A /* WZProtocolInterceptor.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
342F59D4206BF5D00045E75A /* macOSRichTextEditor */ = {
isa = PBXNativeTarget;
buildConfigurationList = 342F59E9206BF5D00045E75A /* Build configuration list for PBXNativeTarget "macOSRichTextEditor" */;
buildPhases = (
342F59D0206BF5D00045E75A /* Sources */,
342F59D1206BF5D00045E75A /* Frameworks */,
342F59D2206BF5D00045E75A /* Headers */,
342F59D3206BF5D00045E75A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = macOSRichTextEditor;
productName = macOSRichTextEditor;
productReference = 342F59D5206BF5D00045E75A /* macOSRichTextEditor.framework */;
productType = "com.apple.product-type.framework";
};
342F59DD206BF5D00045E75A /* macOSRichTextEditorTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 342F59EC206BF5D00045E75A /* Build configuration list for PBXNativeTarget "macOSRichTextEditorTests" */;
buildPhases = (
342F59DA206BF5D00045E75A /* Sources */,
342F59DB206BF5D00045E75A /* Frameworks */,
342F59DC206BF5D00045E75A /* Resources */,
);
buildRules = (
);
dependencies = (
342F59E1206BF5D00045E75A /* PBXTargetDependency */,
);
name = macOSRichTextEditorTests;
productName = macOSRichTextEditorTests;
productReference = 342F59DE206BF5D00045E75A /* macOSRichTextEditorTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
342F59CC206BF5D00045E75A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Pikle Productions";
TargetAttributes = {
342F59D4206BF5D00045E75A = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Automatic;
};
342F59DD206BF5D00045E75A = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 342F59CF206BF5D00045E75A /* Build configuration list for PBXProject "macOSRichTextEditor" */;
compatibilityVersion = "Xcode 8.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 342F59CB206BF5D00045E75A;
productRefGroup = 342F59D6206BF5D00045E75A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
342F59D4206BF5D00045E75A /* macOSRichTextEditor */,
342F59DD206BF5D00045E75A /* macOSRichTextEditorTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
342F59D3206BF5D00045E75A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
342F59DC206BF5D00045E75A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
342F59D0206BF5D00045E75A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
342F5A00206BF5FC0045E75A /* WZProtocolInterceptor.m in Sources */,
342F59F9206BF5FC0045E75A /* RichTextEditor.m in Sources */,
342F59FC206BF5FC0045E75A /* NSFont+RichTextEditor.m in Sources */,
342F59FD206BF5FC0045E75A /* NSAttributedString+RichTextEditor.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
342F59DA206BF5D00045E75A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
342F59E4206BF5D00045E75A /* macOSRichTextEditorTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
342F59E1206BF5D00045E75A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 342F59D4206BF5D00045E75A /* macOSRichTextEditor */;
targetProxy = 342F59E0206BF5D00045E75A /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
342F59E7206BF5D00045E75A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
342F59E8206BF5D00045E75A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
342F59EA206BF5D00045E75A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = macOSRichTextEditor/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pikleproductions.macOSRichTextEditor;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
};
name = Debug;
};
342F59EB206BF5D00045E75A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = macOSRichTextEditor/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pikleproductions.macOSRichTextEditor;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
};
name = Release;
};
342F59ED206BF5D00045E75A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = macOSRichTextEditorTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pikleproductions.macOSRichTextEditorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
342F59EE206BF5D00045E75A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = macOSRichTextEditorTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pikleproductions.macOSRichTextEditorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
342F59CF206BF5D00045E75A /* Build configuration list for PBXProject "macOSRichTextEditor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
342F59E7206BF5D00045E75A /* Debug */,
342F59E8206BF5D00045E75A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
342F59E9206BF5D00045E75A /* Build configuration list for PBXNativeTarget "macOSRichTextEditor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
342F59EA206BF5D00045E75A /* Debug */,
342F59EB206BF5D00045E75A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
342F59EC206BF5D00045E75A /* Build configuration list for PBXNativeTarget "macOSRichTextEditorTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
342F59ED206BF5D00045E75A /* Debug */,
342F59EE206BF5D00045E75A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 342F59CC206BF5D00045E75A /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Pikle Productions. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -4,8 +4,11 @@
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
// Heavily modified for macOS by Deadpikle
// Copyright (c) 2016 Deadpikle. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
// https://github.com/aryaxt/iOS-Rich-Text-Editor -- Original
// https://github.com/Deadpikle/macOS-Rich-Text-Editor -- Fork
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +29,7 @@
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "UIFont+RichTextEditor.h"
#import "NSFont+RichTextEditor.h"
@interface NSAttributedString (RichTextEditor)
@@ -4,9 +4,11 @@
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
// Heavily modified for macOS by Deadpikle
// Copyright (c) 2016 Deadpikle. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor -- Original
// https://github.com/Deadpikle/macOS-Rich-Text-Editor -- Fork
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@@ -29,10 +31,13 @@
@implementation NSAttributedString (RichTextEditor)
#pragma mark - Public MEthods -
#pragma mark - Public Methods -
- (NSRange)firstParagraphRangeFromTextRange:(NSRange)range
{
- (NSRange)firstParagraphRangeFromTextRange:(NSRange)range {
if (self.string.length == 0 || self.string.length < range.location) {
return NSMakeRange(0, 0);
}
NSInteger start = -1;
NSInteger end = -1;
NSInteger length = 0;
@@ -41,11 +46,9 @@
range.location-1 :
range.location;
for (int i=startingRange ; i>=0 ; i--)
{
for (NSInteger i = startingRange; i >= 0; i--) {
char c = [self.string characterAtIndex:i];
if (c == '\n')
{
if (c == '\n') {
start = i+1;
break;
}
@@ -55,8 +58,7 @@
NSInteger moveForwardIndex = (range.location > start) ? range.location : start;
for (int i=moveForwardIndex; i<= self.string.length-1 ; i++)
{
for (NSInteger i = moveForwardIndex; i <= self.string.length - 1; i++) {
char c = [self.string characterAtIndex:i];
if (c == '\n')
{
@@ -71,33 +73,30 @@
return NSMakeRange(start, length);
}
- (NSArray *)rangeOfParagraphsFromTextRange:(NSRange)textRange
{
- (NSArray *)rangeOfParagraphsFromTextRange:(NSRange)textRange {
NSMutableArray *paragraphRanges = [NSMutableArray array];
NSInteger rangeStartIndex = textRange.location;
while (true)
{
while (true) {
NSRange range = [self firstParagraphRangeFromTextRange:NSMakeRange(rangeStartIndex, 0)];
rangeStartIndex = range.location + range.length + 1;
[paragraphRanges addObject:[NSValue valueWithRange:range]];
if (range.location + range.length >= textRange.location + textRange.length)
if (range.location + range.length >= textRange.location + textRange.length) {
break;
}
}
return paragraphRanges;
}
- (NSString *)htmlString
{
- (NSString *)htmlString {
NSMutableString *htmlString = [NSMutableString string];
NSArray *paragraphRanges = [self rangeOfParagraphsFromTextRange:NSMakeRange(0, self.string.length-1)];
for (int i=0 ; i<paragraphRanges.count ; i++)
{
NSValue *value = [paragraphRanges objectAtIndex:i];
for (int i = 0; i < paragraphRanges.count; i++) {
NSValue *value = paragraphRanges[i];
NSRange range = [value rangeValue];
NSDictionary *paragraphDictionary = [self attributesAtIndex:range.location effectiveRange:nil];
NSParagraphStyle *paragraphStyle = [paragraphDictionary objectForKey:NSParagraphStyleAttributeName];
@@ -105,16 +104,19 @@
[htmlString appendString:@"<p "];
if (textAlignmentString)
if (textAlignmentString) {
[htmlString appendFormat:@"align=\"%@\" ", textAlignmentString];
}
[htmlString appendFormat:@"style=\""];
if (paragraphStyle.firstLineHeadIndent > 0)
if (paragraphStyle.firstLineHeadIndent > 0) {
[htmlString appendFormat:@"text-indent:%.0fpx; ", paragraphStyle.firstLineHeadIndent - paragraphStyle.headIndent];
}
if (paragraphStyle.headIndent > 0)
if (paragraphStyle.headIndent > 0) {
[htmlString appendFormat:@"margin-left:%.0fpx; ", paragraphStyle.headIndent];
}
[htmlString appendString:@" \">"];
@@ -124,9 +126,9 @@
usingBlock:^(NSDictionary *dictionary, NSRange range, BOOL *stop){
NSMutableString *fontString = [NSMutableString string];
UIFont *font = [dictionary objectForKey:NSFontAttributeName];
UIColor *foregroundColor = [dictionary objectForKey:NSForegroundColorAttributeName];
UIColor *backGroundColor = [dictionary objectForKey:NSBackgroundColorAttributeName];
NSFont *font = [dictionary objectForKey:NSFontAttributeName];
NSColor *foregroundColor = [dictionary objectForKey:NSForegroundColorAttributeName];
NSColor *backGroundColor = [dictionary objectForKey:NSBackgroundColorAttributeName];
NSNumber *underline = [dictionary objectForKey:NSUnderlineStyleAttributeName];
BOOL hasUnderline = (!underline || underline.intValue == NSUnderlineStyleNone) ? NO :YES;
NSNumber *strikeThrough = [dictionary objectForKey:NSStrikethroughStyleAttributeName];
@@ -140,11 +142,13 @@
[fontString appendFormat:@"font-size:%.0fpx; ", font.pointSize];
if (foregroundColor && [foregroundColor isKindOfClass:[UIColor class]])
if (foregroundColor && [foregroundColor isKindOfClass:[NSColor class]]) {
[fontString appendFormat:@"color:%@; ", [self htmlRgbColor:foregroundColor]];
}
if (backGroundColor && [backGroundColor isKindOfClass:[UIColor class]])
if (backGroundColor && [backGroundColor isKindOfClass:[NSColor class]]) {
[fontString appendFormat:@"background-color:%@; ", [self htmlRgbColor:backGroundColor]];
}
[fontString appendString:@"\" "];
// End Style
@@ -152,35 +156,28 @@
[fontString appendString:@">"];
[fontString appendString:[[self.string substringFromIndex:range.location] substringToIndex:range.length]];
[fontString appendString:@"</font>"];
if ([font isBold])
{
if ([font isBold]) {
[fontString insertString:@"<b>" atIndex:0];
[fontString insertString:@"</b>" atIndex:fontString.length];
}
if ([font isItalic])
{
if ([font isItalic]) {
[fontString insertString:@"<i>" atIndex:0];
[fontString insertString:@"</i>" atIndex:fontString.length];
}
if (hasUnderline)
{
if (hasUnderline) {
[fontString insertString:@"<u>" atIndex:0];
[fontString insertString:@"</u>" atIndex:fontString.length];
}
if (hasStrikeThrough)
{
if (hasStrikeThrough) {
[fontString insertString:@"<strike>" atIndex:0];
[fontString insertString:@"</strike>" atIndex:fontString.length];
}
[htmlString appendString:fontString];
}];
[htmlString appendString:@"</p>"];
}
@@ -189,29 +186,22 @@
#pragma mark - Helper Methods -
- (NSString *)htmlTextAlignmentString:(NSTextAlignment)textAlignment
{
switch (textAlignment)
{
case NSTextAlignmentLeft:
- (NSString *)htmlTextAlignmentString:(NSTextAlignment)textAlignment {
switch (textAlignment) {
case NSLeftTextAlignment:
return @"left";
case NSTextAlignmentCenter:
case NSCenterTextAlignment:
return @"center";
case NSTextAlignmentRight:
case NSRightTextAlignment:
return @"right";
case NSTextAlignmentJustified:
case NSJustifiedTextAlignment:
return @"justify";
default:
return nil;
}
}
- (NSString *)htmlRgbColor:(UIColor *)color
{
- (NSString *)htmlRgbColor:(NSColor *)color {
CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
[color getRed:&red green:&green blue:&blue alpha:&alpha];
return [NSString stringWithFormat:@"rgb(%d,%d,%d)",(int)(red*255.0), (int)(green*255.0), (int)(blue*255.0)];
@@ -4,8 +4,11 @@
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
// Heavily modified for macOS by Deadpikle
// Copyright (c) 2016 Deadpikle. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
// https://github.com/aryaxt/iOS-Rich-Text-Editor -- Original
// https://github.com/Deadpikle/macOS-Rich-Text-Editor -- Fork
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,15 +28,15 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import <Cocoa/Cocoa.h>
#import <CoreText/CoreText.h>
@interface UIFont (RichTextEditor)
@interface NSFont (RichTextEditor)
+ (NSString *)postscriptNameFromFullName:(NSString *)fullName;
+ (UIFont *)fontWithName:(NSString *)name size:(CGFloat)size boldTrait:(BOOL)isBold italicTrait:(BOOL)isItalic;
- (UIFont *)fontWithBoldTrait:(BOOL)bold italicTrait:(BOOL)italic andSize:(CGFloat)size;
- (UIFont *)fontWithBoldTrait:(BOOL)bold andItalicTrait:(BOOL)italic;
+ (NSFont *)fontWithName:(NSString *)name size:(CGFloat)size boldTrait:(BOOL)isBold italicTrait:(BOOL)isItalic;
- (NSFont *)fontWithBoldTrait:(BOOL)bold italicTrait:(BOOL)italic andSize:(CGFloat)size;
- (NSFont *)fontWithBoldTrait:(BOOL)bold andItalicTrait:(BOOL)italic;
- (BOOL)isBold;
- (BOOL)isItalic;
@@ -0,0 +1,123 @@
//
// UIFont+RichTextEditor.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
// Heavily modified for macOS by Deadpikle
// Copyright (c) 2016 Deadpikle. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor -- Original
// https://github.com/Deadpikle/macOS-Rich-Text-Editor -- Fork
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "NSFont+RichTextEditor.h"
@implementation NSFont (RichTextEditor)
+ (NSString *)postscriptNameFromFullName:(NSString *)fullName {
// avoid error with "All system UI font access should be through proper APIs..."
// by bailing early if the user gets here with a system font
if ([fullName containsString:@"SFNS"]) {
return fullName;
}
NSFont *font = [NSFont fontWithName:fullName size:1];
return (__bridge NSString *)(CTFontCopyPostScriptName((__bridge CTFontRef)(font)));
}
+ (NSFont *)fontWithName:(NSString *)name size:(CGFloat)size boldTrait:(BOOL)isBold italicTrait:(BOOL)isItalic {
// avoid error with "All system UI font access should be through proper APIs..."
// by bailing early if the user gets here with a system font
if ([name containsString:@"SFNS"]) {
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSFont *sysFont = [NSFont systemFontOfSize:size];
if (isItalic) {
sysFont = [fontManager convertFont:sysFont toHaveTrait:NSFontItalicTrait];
}
if (isBold) {
sysFont = [fontManager convertFont:sysFont toHaveTrait:NSFontBoldTrait];
}
return sysFont;
}
NSString *postScriptName = [NSFont postscriptNameFromFullName:name];
CTFontRef fontWithoutTrait = CTFontCreateWithName((__bridge CFStringRef)(postScriptName), size, NULL);
CTFontSymbolicTraits traits = 0;
CTFontRef newFontRef;
if (isItalic) {
traits |= kCTFontItalicTrait;
}
if (isBold) {
traits |= kCTFontBoldTrait;
}
if (traits == 0) {
newFontRef = CTFontCreateCopyWithAttributes(fontWithoutTrait, 0.0, NULL, NULL);
}
else {
newFontRef = CTFontCreateCopyWithSymbolicTraits(fontWithoutTrait, 0.0, NULL, traits, traits);
}
if (fontWithoutTrait) {
CFRelease(fontWithoutTrait);
}
if (newFontRef) {
NSString *fontNameKey = (__bridge NSString *)(CTFontCopyName(newFontRef, kCTFontPostScriptNameKey));
CGFloat size = CTFontGetSize(newFontRef);
CFRelease(newFontRef);
return [NSFont fontWithName:fontNameKey size:size];
}
return nil;
}
- (NSFont *)fontWithBoldTrait:(BOOL)bold italicTrait:(BOOL)italic andSize:(CGFloat)size {
CTFontRef fontRef = (__bridge CTFontRef)self;
NSString *familyName = (__bridge NSString *)(CTFontCopyName(fontRef, kCTFontFamilyNameKey));
NSString *postScriptName = [NSFont postscriptNameFromFullName:familyName];
return [[self class] fontWithName:postScriptName size:size boldTrait:bold italicTrait:italic];
}
- (NSFont *)fontWithBoldTrait:(BOOL)bold andItalicTrait:(BOOL)italic {
return [self fontWithBoldTrait:bold italicTrait:italic andSize:self.pointSize];
}
- (BOOL)isBold {
CTFontSymbolicTraits trait = CTFontGetSymbolicTraits((__bridge CTFontRef)self);
if ((trait & kCTFontTraitBold) == kCTFontTraitBold) {
return YES;
}
return NO;
}
- (BOOL)isItalic {
CTFontSymbolicTraits trait = CTFontGetSymbolicTraits((__bridge CTFontRef)self);
if ((trait & kCTFontTraitItalic) == kCTFontTraitItalic) {
return YES;
}
return NO;
}
@end
+230
View File
@@ -0,0 +1,230 @@
//
// RichTextEditor.h
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
// Heavily modified for macOS by Deadpikle
// Copyright (c) 2016 Deadpikle. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor -- Original
// https://github.com/Deadpikle/macOS-Rich-Text-Editor -- Fork
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// TODO: better documentation
// TODO: Clean up, clean up, everybody do your share!
#import <Cocoa/Cocoa.h>
@class RichTextEditor;
// These values will always start from 0 and go up. If you want to add your own
// preview changes via a subclass, start from 9999 and go down (or similar) and
// override convertPreviewChangeTypeToString:withNonSpecialChangeText:
typedef NS_ENUM(NSInteger, RichTextEditorPreviewChange) {
RichTextEditorPreviewChangeBold = 0,
RichTextEditorPreviewChangeItalic = 1,
RichTextEditorPreviewChangeUnderline = 2,
RichTextEditorPreviewChangeFontResize = 3,
RichTextEditorPreviewChangeHighlight = 4,
RichTextEditorPreviewChangeFontSize = 5,
RichTextEditorPreviewChangeFontColor = 6,
RichTextEditorPreviewChangeIndentIncrease = 7,
RichTextEditorPreviewChangeIndentDecrease = 8,
RichTextEditorPreviewChangeCut = 9,
RichTextEditorPreviewChangePaste = 10,
RichTextEditorPreviewChangeSpace = 11,
RichTextEditorPreviewChangeEnter = 12,
RichTextEditorPreviewChangeBullet = 13,
RichTextEditorPreviewChangeMouseDown = 14,
RichTextEditorPreviewChangeArrowKey = 15,
RichTextEditorPreviewChangeKeyDown = 16,
RichTextEditorPreviewChangeDelete = 17,
RichTextEditorPreviewChangeFindReplace = 18
};
typedef NS_OPTIONS(NSUInteger, RichTextEditorShortcut) {
RichTextEditorShortcutAll = 0,
RichTextEditorShortcutBold = 1 << 0,
RichTextEditorShortcutItalic = 1 << 1,
RichTextEditorShortcutUnderline = 1 << 2,
RichTextEditorShortcutIncreaseFontSize = 1 << 3,
RichTextEditorShortcutDecreaseFontSize = 1 << 4,
RichTextEditorShortcutBulletedList = 1 << 6,
RichTextEditorShortcutLeaveBulletedList = 1 << 7,
RichTextEditorShortcutDecreaseIndent = 1 << 8,
RichTextEditorShortcutIncreaseIndent = 1 << 9
};
@protocol RichTextEditorDataSource <NSObject>
@optional
- (NSUInteger)levelsOfUndo;
/// If you do not want to enable all keyboard shortcuts (e.g. if you don't want users to resize font ever),
/// then you can use this data source callback to selectively enable keyboard shortcuts.
- (RichTextEditorShortcut)enabledKeyboardShortcuts;
@end
@protocol RichTextEditorDelegate <NSObject>
@required
-(void)selectionForEditor:(RichTextEditor*)editor changedTo:(NSRange)range isBold:(BOOL)isBold isItalic:(BOOL)isItalic isUnderline:(BOOL)isUnderline isInBulletedList:(BOOL)isInBulletedList textBackgroundColor:(NSColor*)textBackgroundColor textColor:(NSColor*)textColor;
@optional
- (BOOL)richTextEditor:(RichTextEditor*)editor keyDownEvent:(NSEvent*)event; // return YES if handled by delegate, NO if RTE should process it
- (BOOL)handlesUndoRedoForText;
- (void)userPerformedUndo; // TODO: remove?
- (void)userPerformedRedo; // TODO: remove?
- (void)richTextEditor:(RichTextEditor*)editor changeAboutToOccurOfType:(RichTextEditorPreviewChange)type;
@end
@interface RichTextEditor : NSTextView
@property (assign) IBOutlet id <RichTextEditorDataSource> rteDataSource;
@property (assign) IBOutlet id <RichTextEditorDelegate> rteDelegate;
@property (nonatomic, assign) CGFloat defaultIndentationSize;
@property (nonatomic, readonly) unichar lastSingleKeyPressed;
/// If YES, only pastes text as rich text if the copy operation came from this class.
/// Note: not this *object* -- this class (so other RichTextEditor boxes can paste
/// between each other). If the text did not come from a RichTextEditor box, then
/// pastes as plain text.
/// If NO, performs the default paste: operation.
/// Defaults to YES.
@property BOOL allowsRichTextPasteOnlyFromThisClass;
/// Amount to change font size on each increase/decrease font size call.
/// Defaults to 10.0f
@property CGFloat fontSizeChangeAmount;
/// Maximum font size. Defaults to 128.0f.
@property CGFloat maxFontSize;
/// Minimum font size. Defaults to 10.0f.
@property CGFloat minFontSize;
/// true if tab should always indent and shift+tab should always outdent the current paragraph(s);
/// false to let the tab key be used as normal
@property BOOL tabKeyAlwaysIndentsOutdents;
/// Pasteboard type string used when copying text from this NSTextView.
+(NSString*)pasteboardDataType;
/// Call the following methods when the user does the given action (clicks bold button, etc.)
/// Toggle bold.
- (void)userSelectedBold;
/// Toggle italic.
- (void)userSelectedItalic;
/// Toggle underline.
- (void)userSelectedUnderline;
/// Toggle bulleted list.
- (void)userSelectedBullet;
/// Increase the total indentation of the current paragraph.
- (void)userSelectedIncreaseIndent;
/// Decrease the total indentation of the current paragraph.
- (void)userSelectedDecreaseIndent;
/// Change the text background (highlight) color for the currently selected text.
- (void)userSelectedTextBackgroundColor:(NSColor*)color;
/// Change the text color for the currently selected text.
- (void)userSelectedTextColor:(NSColor*)color;
/// Perform an undo operation if one is available.
- (void)undo;
/// Perform a redo operation if one is available.
- (void)redo;
/// Convert the font for all text to the given font while keeping bold/italic attributes
- (void)changeToFont:(NSFont*)font;
/// Change the currently selected text to the given font name.
- (void)userChangedToFontName:(NSString*)fontName;
/// Change the currently selected text to the specified font size.
- (void)userChangedToFontSize:(NSNumber*)fontSize;
/// Increases the font size of the currently selected text by self.fontSizeChangeAmount.
- (void)increaseFontSize;
/// Decreases the font size of the currently selected text by self.fontSizeChangeAmount.
- (void)decreaseFontSize;
/// Toggles whether or not the paragraphs in the currently selected text have a first
/// line head indent value of self.defaultIndentationSize.
- (void)userSelectedParagraphFirstLineHeadIndent;
/// Change the text alignment for the paragraphs in the currently selected text.
- (void)userSelectedTextAlignment:(NSTextAlignment)textAlignment;
/// Convenience method; YES if user has something selected (selection length > 0).
- (BOOL)hasSelection;
/// Changes the editor's contents to the given attributed string.
- (void)changeToAttributedString:(NSAttributedString*)string;
/// Convenience method to set the editor's border color.
- (void)setBorderColor:(NSColor*)borderColor;
/// Convenience method to set the editor's border width.
- (void)setBorderWidth:(CGFloat)borderWidth;
/// Converts the current NSAttributedString to an HTML string.
- (NSString *)htmlString;
/// Converts the provided htmlString into an NSAttributedString and then
/// sets the editor's text to the attributed string.
- (void)setHtmlString:(NSString *)htmlString;
/// Grabs the NSString used as the bulleted list prefix.
- (NSString*)bulletString;
/// Converts the provided NSAttributedString into an HTML string.
+ (NSString *)htmlStringFromAttributedText:(NSAttributedString*)text;
/// Converts the given HTML string into an NSAttributedString.
+ (NSAttributedString*)attributedStringFromHTMLString:(NSString *)htmlString;
/// Converts a given RichTextEditorPreviewChange to a human-readable string
+ (NSString *)convertPreviewChangeTypeToString:(RichTextEditorPreviewChange)changeType withNonSpecialChangeText:(BOOL)shouldReturnStringForNonSpecialType;
// // // // // // // // // // // // // // // // // // // //
// I'm not sure why you'd call these externally, but subclasses can make use of this for custom toolbar items or what have you.
// It's just easier to put these in the public header than to have a protected/subclasses-only header.
-(void)sendDelegatePreviewChangeOfType:(RichTextEditorPreviewChange)type;
-(void)sendDelegateTVChanged;
@end
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,20 @@
//
// WZProtocolInterceptor.h
//
// Created by WeZZard on 10/13/13.
// Copyright © 2013 WeZZard. All rights reserved.
// http://stackoverflow.com/a/18777565/3938401
#import <Foundation/Foundation.h>
@interface WZProtocolInterceptor : NSObject
@property (nonatomic, readonly, copy) NSArray * interceptedProtocols;
@property (unsafe_unretained) id receiver;
@property (unsafe_unretained) id middleMan;
- (instancetype)initWithInterceptedProtocol:(Protocol *)interceptedProtocol;
- (instancetype)initWithInterceptedProtocols:(Protocol *)firstInterceptedProtocol, ... NS_REQUIRES_NIL_TERMINATION;
- (instancetype)initWithArrayOfInterceptedProtocols:(NSArray *)arrayOfInterceptedProtocols;
@end
@@ -0,0 +1,103 @@
//
// WZProtocolInterceptor.m
//
// Created by WeZZard on 10/13/13.
// Copyright © 2013 WeZZard. All rights reserved.
// http://stackoverflow.com/a/18777565/3938401
#import "WZProtocolInterceptor.h"
#import <objc/runtime.h>
static inline BOOL selector_belongsToProtocol(SEL selector, Protocol * protocol);
@implementation WZProtocolInterceptor
- (id)forwardingTargetForSelector:(SEL)aSelector {
if (self.middleMan && [self.middleMan respondsToSelector:aSelector] &&
[self isSelectorContainedInInterceptedProtocols:aSelector]) {
return self.middleMan;
}
if ([self.receiver respondsToSelector:aSelector]) {
return self.receiver;
}
return [super forwardingTargetForSelector:aSelector];
}
- (BOOL)respondsToSelector:(SEL)aSelector {
if (self.middleMan && [self.middleMan respondsToSelector:aSelector] &&
[self isSelectorContainedInInterceptedProtocols:aSelector]) {
return YES;
}
if (self.receiver && [self.receiver respondsToSelector:aSelector]) {
return YES;
}
return [super respondsToSelector:aSelector];
}
- (instancetype)initWithInterceptedProtocol:(Protocol *)interceptedProtocol {
self = [super init];
if (self) {
_interceptedProtocols = @[interceptedProtocol];
}
return self;
}
- (instancetype)initWithInterceptedProtocols:(Protocol *)firstInterceptedProtocol, ...; {
self = [super init];
if (self) {
NSMutableArray * mutableProtocols = [NSMutableArray array];
Protocol * eachInterceptedProtocol;
va_list argumentList;
if (firstInterceptedProtocol) {
[mutableProtocols addObject:firstInterceptedProtocol];
va_start(argumentList, firstInterceptedProtocol);
while ((eachInterceptedProtocol = va_arg(argumentList, id))) {
[mutableProtocols addObject:eachInterceptedProtocol];
}
va_end(argumentList);
}
_interceptedProtocols = [mutableProtocols copy];
}
return self;
}
- (instancetype)initWithArrayOfInterceptedProtocols:(NSArray *)arrayOfInterceptedProtocols {
self = [super init];
if (self) {
_interceptedProtocols = [arrayOfInterceptedProtocols copy];
}
return self;
}
- (void)dealloc {
_interceptedProtocols = nil;
}
- (BOOL)isSelectorContainedInInterceptedProtocols:(SEL)aSelector{
__block BOOL isSelectorContainedInInterceptedProtocols = NO;
[self.interceptedProtocols enumerateObjectsUsingBlock:^(Protocol * protocol, NSUInteger idx, BOOL *stop) {
isSelectorContainedInInterceptedProtocols = selector_belongsToProtocol(aSelector, protocol);
* stop = isSelectorContainedInInterceptedProtocols;
}];
return isSelectorContainedInInterceptedProtocols;
}
@end
BOOL selector_belongsToProtocol(SEL selector, Protocol * protocol) {
// Reference: https://gist.github.com/numist/3838169
for (int optionbits = 0; optionbits < (1 << 2); optionbits++) {
BOOL required = optionbits & 1;
BOOL instance = !(optionbits & (1 << 1));
struct objc_method_description hasMethod = protocol_getMethodDescription(protocol, selector, required, instance);
if (hasMethod.name || hasMethod.types) {
return YES;
}
}
return NO;
}
@@ -0,0 +1,21 @@
//
// macOSRichTextEditor.h
// macOSRichTextEditor
//
// Created by Deadpikle on 3/28/18.
// Copyright © 2018 Pikle Productions. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for macOSRichTextEditor.
FOUNDATION_EXPORT double macOSRichTextEditorVersionNumber;
//! Project version string for macOSRichTextEditor.
FOUNDATION_EXPORT const unsigned char macOSRichTextEditorVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <macOSRichTextEditor/PublicHeader.h>
#include <macOSRichTextEditor/RichTextEditor.h>
#include <macOSRichTextEditor/NSFont+RichTextEditor.h>
#include <macOSRichTextEditor/NSAttributedString+RichTextEditor.h>
@@ -3,19 +3,19 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.aryaxt.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
@@ -0,0 +1,39 @@
//
// macOSRichTextEditorTests.m
// macOSRichTextEditorTests
//
// Created by Deadpikle on 3/28/18.
// Copyright © 2018 Pikle Productions. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface macOSRichTextEditorTests : XCTestCase
@end
@implementation macOSRichTextEditorTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end
+327 -2
View File
@@ -1,5 +1,5 @@
Created by Aryan Gh on 5/4/13.
Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
Copyright (c) 2013 Aryan Ghassemi & Deadpikle. All rights reserved.
https://github.com/aryaxt/iOS-Rich-Text-Editor
@@ -19,4 +19,329 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
Modified by Deadpikle for bullet functionality and a few other fixes/improvements
https://github.com/Deadpikle/macOS-Rich-Text-Editor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Google Material Design Icons:
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.
+71 -83
View File
@@ -1,110 +1,98 @@
RichTextEditor-iOS
macOS Rich Text Editor
==================
RichTextEditor for iPhone &amp; iPad
Features:
The macOS Rich Text Editor library allows for rich text editing via a native `NSTextView`. You will need to implement much of the UI yourself (buttons, handling selection changes via the delegate protocol, etc.). The RTE just handles the bold/italic/bulleted lists/etc. formatting for you. The sample should give you some guidance on how this could be accomplished.
To use this library, you only need eight files:
- RichTextEditor.h/m
- NSFont+RichTextEditor.h/m
- NSAttributedString+RichTextEditor.h/m
- WZProtocolInterceptor.h/m
You can copy these files directly into your project, or you can choose to build and use the `.framework` output. Remember to open the `.xcworkspace` file when exploring this project.
This library is based upon Deadpikle's [iOS Rich Text Editor](https://github.com/Deadpikle/iOS-Rich-Text-Editor), which was edited from the [original iOS rich text editor](https://github.com/aryaxt/iOS-Rich-Text-Editor) by [aryaxt](https://github.com/aryaxt).
### Features:
- Bold
- Italic
- Underline
- StrikeThrough
- Font
- Font size
- Text background color
- Text foregroud color
- Text foreground color
- Text alignment
- Paragraph Indent/Outdent
- Paragraph indent/outdent
- Bulleted lists
![alt tag](https://raw.github.com/aryaxt/iOS-Rich-Text-Editor/master/ipadScreenShot.png)
### Compatibility
![alt tag](https://raw.github.com/aryaxt/iOS-Rich-Text-Editor/master/iphoneScreenshot.png)
The rich text editor is compatible with macOS 10.10+. It might work on older versions, but this has not been tested.
#### Keyboard Shortcuts
Custom Font Size Selection
-------------------------
Font size selection can be customized by implementing the following data source method
| Shortcut | Action |
| ------------- | ------------- |
| ⌘ + B | Toggle bold |
| ⌘ + I | Toggle italic |
| ⌘ + U | Toggle underline |
| ⌘ + ⇧ + > | Increase font size |
| ⌘ + ⇧ + < | Decrease font size |
| ⌘ + ⇧ + L | Toggle bulleted list |
| ⌘ + ⇧ + N | If in bulleted list, leave bulleted list |
| ⌘ + ⇧ + T | Decrease indent |
| ⌘ + T | Increase indent |
```objective-c
- (NSArray *)fontSizeSelectionForRichTextEditor:(RichTextEditor *)richTextEditor
{
// pas an array of NSNumbers
return @[@5, @10, @20, @30];
}
By default, all keyboard shortcuts are enabled. If you want to selectively enable some keyboard shortcuts, implement the `RichTextEditorDataSource` method `- (RichTextEditorShortcut)enabledKeyboardShortcuts`. If you want to do this, don't forget to set the `rteDataSource`!
#### Scaling Text [TODO: move to Wiki]
If you want to scale text, you can use code similar to the following (based on http://stackoverflow.com/a/14113905/3938401):
```
// http://stackoverflow.com/a/14113905/3938401
@interface ...
@property CGFloat scaleFactor;
@end
Custom Font Family Selection
-------------------------
Font family selection can be customized by implementing the following data source method
@implementation ...
```objective-c
- (NSArray *)fontFamilySelectionForRichTextEditor:(RichTextEditor *)richTextEditor
{
// pas an array of Strings
// Can be taken from [UIFont familyNames]
return @[@"Helvetica", @"Arial", @"Marion", @"Papyrus"];
}
```
Presentation Style
-------------------------
You can switch between popover, or modal (presenting font-picker, font-size-picker, color-picker dialogs) by implementing the following data source method
```objective-c
- (RichTextEditorToolbarPresentationStyle)presentarionStyleForRichTextEditor:(RichTextEditor *)richTextEditor
{
// RichTextEditorToolbarPresentationStyleModal Or RichTextEditorToolbarPresentationStylePopover
return RichTextEditorToolbarPresentationStyleModal;
}
```
Modal Presentation Style
-------------------------
When presentarionStyleForRichTextEditor is a modal, modal-transition-style & modal-presentation-style can be configured
```objective-c
- (UIModalPresentationStyle)modalPresentationStyleForRichTextEditor:(RichTextEditor *)richTextEditor
{
return UIModalPresentationFormSheet;
-(void)viewDidLoad {
self.scaleFactor = 1.0f;
...
}
- (UIModalTransitionStyle)modalTransitionStyleForRichTextEditor:(RichTextEditor *)richTextEditor
{
return UIModalTransitionStyleFlipHorizontal;
- (void)setScaleFactor:(CGFloat)newScaleFactor adjustPopup:(BOOL)flag {
CGFloat oldScaleFactor = self.scaleFactor;
if (self.scaleFactor != newScaleFactor) {
NSSize curDocFrameSize, newDocBoundsSize;
NSView *clipView = [self.notesTextView superview];
self.scaleFactor = newScaleFactor;
// Get the frame. The frame must stay the same.
curDocFrameSize = [clipView frame].size;
// The new bounds will be frame divided by scale factor
newDocBoundsSize.width = curDocFrameSize.width / self.scaleFactor;
newDocBoundsSize.height = curDocFrameSize.height / self.scaleFactor;
}
self.scaleFactor = newScaleFactor;
[self scaleChanged:oldScaleFactor newScale:newScaleFactor];
}
```
Customizing Features
-------------------------
Features can be turned on/off by iplementing the following data source method
```objective-c
- (RichTextEditorFeature)featuresEnabledForRichTextEditor:(RichTextEditor *)richTextEditor
{
return RichTextEditorFeatureFont |
RichTextEditorFeatureFontSize |
RichTextEditorFeatureBold |
RichTextEditorFeatureParagraphIndentation;
- (void)scaleChanged:(CGFloat)oldScale newScale:(CGFloat)newScale {
CGFloat scaler = newScale / oldScale;
[self.notesTextView scaleUnitSquareToSize:NSMakeSize(scaler, scaler)];
// For some reason, even after ensuring the layout and displaying, the wrapping doesn't update until text is messed
// with. This workaround "fixes" that. Since we need it anyway, I removed the ensureLayoutForTextContainer:
// (from the SO post) and the documentation-implied [self.notesTextView display] calls.
[[self.notesTextView textStorage] appendAttributedString:[[NSAttributedString alloc] initWithString:@""]];
}
@end
```
Enable/Disable RichText Toolbar
-------------------------
You can hide the rich text toolbar by implementing the following method. This method gets called everytime textView becomes first responder.
This can be usefull when you don't want the toolbar, instead you want to use the basic features (bold, italic, underline, strikeThrough), thoguht the UIMeMenuController
```objective-c
- (BOOL)shouldDisplayToolbarForRichTextEditor:(RichTextEditor *)richTextEditor
{
return YES;
}
```
Enable/Disable UIMenuController Options
-------------------------
On default the UIMenuController options (bold, italic, underline, strikeThrough) are turned off. You can implement the follwing method if you want these features to be available through the UIMenuController along with copy/paste/selectAll etc.
```objective-c
- (BOOL)shouldDisplayRichTextOptionsInMenuControllerForRichTextrEditor:(RichTextEditor *)richTextEdiotor
{
return YES;
}
```
Credits
-------------------------
iPhone popover by werner77
https://github.com/werner77/WEPopover
Original Rich Text Editor code by [aryaxt](https://github.com/aryaxt) at the [iOS Rich Text Editor repo](https://github.com/aryaxt/iOS-Rich-Text-Editor). `WZProtocolInterceptor` is from [this SO post](http://stackoverflow.com/a/18777565/3938401).
-855
View File
@@ -1,855 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
153F958A179F9953005B2487 /* NSAttributedString+RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F955C179F9953005B2487 /* NSAttributedString+RichTextEditor.m */; };
153F958B179F9953005B2487 /* UIFont+RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F955E179F9953005B2487 /* UIFont+RichTextEditor.m */; };
153F958C179F9953005B2487 /* UIView+RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9560179F9953005B2487 /* UIView+RichTextEditor.m */; };
153F958D179F9953005B2487 /* popoverArrowDown.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9563179F9953005B2487 /* popoverArrowDown.png */; };
153F958E179F9953005B2487 /* popoverArrowDown@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9564179F9953005B2487 /* popoverArrowDown@2x.png */; };
153F958F179F9953005B2487 /* popoverArrowDownSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9565179F9953005B2487 /* popoverArrowDownSimple.png */; };
153F9590179F9953005B2487 /* popoverArrowLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9566179F9953005B2487 /* popoverArrowLeft.png */; };
153F9591179F9953005B2487 /* popoverArrowLeft@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9567179F9953005B2487 /* popoverArrowLeft@2x.png */; };
153F9592179F9953005B2487 /* popoverArrowLeftSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9568179F9953005B2487 /* popoverArrowLeftSimple.png */; };
153F9593179F9953005B2487 /* popoverArrowRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9569179F9953005B2487 /* popoverArrowRight.png */; };
153F9594179F9953005B2487 /* popoverArrowRight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F956A179F9953005B2487 /* popoverArrowRight@2x.png */; };
153F9595179F9953005B2487 /* popoverArrowRightSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F956B179F9953005B2487 /* popoverArrowRightSimple.png */; };
153F9596179F9953005B2487 /* popoverArrowUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F956C179F9953005B2487 /* popoverArrowUp.png */; };
153F9597179F9953005B2487 /* popoverArrowUp@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F956D179F9953005B2487 /* popoverArrowUp@2x.png */; };
153F9598179F9953005B2487 /* popoverArrowUpSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F956E179F9953005B2487 /* popoverArrowUpSimple.png */; };
153F9599179F9953005B2487 /* popoverBg.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F956F179F9953005B2487 /* popoverBg.png */; };
153F959A179F9953005B2487 /* popoverBg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9570179F9953005B2487 /* popoverBg@2x.png */; };
153F959B179F9953005B2487 /* popoverBgSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 153F9571179F9953005B2487 /* popoverBgSimple.png */; };
153F959C179F9953005B2487 /* UIBarButtonItem+WEPopover.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9573179F9953005B2487 /* UIBarButtonItem+WEPopover.m */; };
153F959D179F9953005B2487 /* WEPopoverContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9575179F9953005B2487 /* WEPopoverContainerView.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
153F959E179F9953005B2487 /* WEPopoverController.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9577179F9953005B2487 /* WEPopoverController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
153F959F179F9953005B2487 /* WETouchableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F957A179F9953005B2487 /* WETouchableView.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
153F95A0179F9953005B2487 /* RichTextEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F957C179F9953005B2487 /* RichTextEditor.m */; };
153F95A1179F9953005B2487 /* RichTextEditorColorPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F957E179F9953005B2487 /* RichTextEditorColorPickerViewController.m */; };
153F95A2179F9953005B2487 /* RichTextEditorFontPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9580179F9953005B2487 /* RichTextEditorFontPickerViewController.m */; };
153F95A3179F9953005B2487 /* RichTextEditorFontSizePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9582179F9953005B2487 /* RichTextEditorFontSizePickerViewController.m */; };
153F95A4179F9953005B2487 /* RichTextEditorToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 153F9585179F9953005B2487 /* RichTextEditorToolbar.m */; };
158389131735A5D7006DE713 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389121735A5D7006DE713 /* UIKit.framework */; };
158389151735A5D7006DE713 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389141735A5D7006DE713 /* Foundation.framework */; };
158389171735A5D7006DE713 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389161735A5D7006DE713 /* CoreGraphics.framework */; };
1583891D1735A5D7006DE713 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1583891B1735A5D7006DE713 /* InfoPlist.strings */; };
1583891F1735A5D7006DE713 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1583891E1735A5D7006DE713 /* main.m */; };
158389231735A5D7006DE713 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 158389221735A5D7006DE713 /* AppDelegate.m */; };
158389251735A5D7006DE713 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 158389241735A5D7006DE713 /* Default.png */; };
158389271735A5D7006DE713 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 158389261735A5D7006DE713 /* Default@2x.png */; };
158389291735A5D7006DE713 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 158389281735A5D7006DE713 /* Default-568h@2x.png */; };
1583892C1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1583892A1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard */; };
1583892F1735A5D7006DE713 /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1583892D1735A5D7006DE713 /* MainStoryboard_iPad.storyboard */; };
158389321735A5D7006DE713 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 158389311735A5D7006DE713 /* ViewController.m */; };
1583893A1735A5D7006DE713 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389391735A5D7006DE713 /* SenTestingKit.framework */; };
1583893B1735A5D7006DE713 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389121735A5D7006DE713 /* UIKit.framework */; };
1583893C1735A5D7006DE713 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389141735A5D7006DE713 /* Foundation.framework */; };
158389441735A5D7006DE713 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 158389421735A5D7006DE713 /* InfoPlist.strings */; };
158389471735A5D7006DE713 /* RichTextEditorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 158389461735A5D7006DE713 /* RichTextEditorTests.m */; };
1583895A1735D7F4006DE713 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389591735D7F4006DE713 /* CoreText.framework */; };
15AE737A17A5696D007F283A /* buttoncenterSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 15AE737617A5696D007F283A /* buttoncenterSelected.png */; };
15AE737B17A5696D007F283A /* buttonleftSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 15AE737717A5696D007F283A /* buttonleftSelected.png */; };
15AE737C17A5696D007F283A /* buttonrightSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 15AE737817A5696D007F283A /* buttonrightSelected.png */; };
15AE737D17A5696D007F283A /* buttonSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 15AE737917A5696D007F283A /* buttonSelected.png */; };
15B6E20B17A4BF700015867C /* dropDownTriangle.png in Resources */ = {isa = PBXBuildFile; fileRef = 15B6E20A17A4BF700015867C /* dropDownTriangle.png */; };
15B6E20F17A4C2820015867C /* RichTextEditorToggleButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 15B6E20E17A4C2820015867C /* RichTextEditorToggleButton.m */; };
15C4131317A4444B0073D047 /* backcolor.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F217A4444B0073D047 /* backcolor.png */; };
15C4131417A4444B0073D047 /* bold.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F317A4444B0073D047 /* bold.png */; };
15C4131517A4444B0073D047 /* bullist.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F417A4444B0073D047 /* bullist.png */; };
15C4131617A4444B0073D047 /* code.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F517A4444B0073D047 /* code.png */; };
15C4131717A4444B0073D047 /* colors.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F617A4444B0073D047 /* colors.jpg */; };
15C4131817A4444B0073D047 /* email.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F717A4444B0073D047 /* email.png */; };
15C4131917A4444B0073D047 /* file.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F817A4444B0073D047 /* file.png */; };
15C4131A17A4444B0073D047 /* forecolor.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412F917A4444B0073D047 /* forecolor.png */; };
15C4131B17A4444B0073D047 /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412FA17A4444B0073D047 /* image.png */; };
15C4131C17A4444B0073D047 /* indent.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412FB17A4444B0073D047 /* indent.png */; };
15C4131D17A4444B0073D047 /* italic.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412FC17A4444B0073D047 /* italic.png */; };
15C4131E17A4444B0073D047 /* justifycenter.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412FD17A4444B0073D047 /* justifycenter.png */; };
15C4131F17A4444B0073D047 /* justifyfull.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412FE17A4444B0073D047 /* justifyfull.png */; };
15C4132017A4444B0073D047 /* justifyleft.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C412FF17A4444B0073D047 /* justifyleft.png */; };
15C4132117A4444B0073D047 /* justifyright.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130017A4444B0073D047 /* justifyright.png */; };
15C4132217A4444B0073D047 /* link.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130117A4444B0073D047 /* link.png */; };
15C4132317A4444B0073D047 /* numlist.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130217A4444B0073D047 /* numlist.png */; };
15C4132417A4444B0073D047 /* outdent.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130317A4444B0073D047 /* outdent.png */; };
15C4132517A4444B0073D047 /* redo.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130417A4444B0073D047 /* redo.png */; };
15C4132617A4444B0073D047 /* removeformat.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130517A4444B0073D047 /* removeformat.png */; };
15C4132717A4444B0073D047 /* strikethrough.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130617A4444B0073D047 /* strikethrough.png */; };
15C4132817A4444B0073D047 /* underline.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130717A4444B0073D047 /* underline.png */; };
15C4132917A4444B0073D047 /* undo.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130817A4444B0073D047 /* undo.png */; };
15C4132A17A4444B0073D047 /* unlink.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4130917A4444B0073D047 /* unlink.png */; };
15C4133817A48C6D0073D047 /* button.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4133417A48C6D0073D047 /* button.png */; };
15C4133917A48C6D0073D047 /* buttoncenter.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4133517A48C6D0073D047 /* buttoncenter.png */; };
15C4133A17A48C6D0073D047 /* buttonleft.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4133617A48C6D0073D047 /* buttonleft.png */; };
15C4133B17A48C6D0073D047 /* buttonright.png in Resources */ = {isa = PBXBuildFile; fileRef = 15C4133717A48C6D0073D047 /* buttonright.png */; };
1AFAED7217C7F9CA00E450B0 /* strikethrough@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED6E17C7F9CA00E450B0 /* strikethrough@2x.png */; };
1AFAED7317C7F9CA00E450B0 /* italic@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED6F17C7F9CA00E450B0 /* italic@2x.png */; };
1AFAED7417C7F9CA00E450B0 /* underline@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7017C7F9CA00E450B0 /* underline@2x.png */; };
1AFAED7517C7F9CA00E450B0 /* bold@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7117C7F9CA00E450B0 /* bold@2x.png */; };
1AFAED7717C8013900E450B0 /* justifyleft@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7617C8013900E450B0 /* justifyleft@2x.png */; };
1AFAED7B17C8022000E450B0 /* justifyfull@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7817C8022000E450B0 /* justifyfull@2x.png */; };
1AFAED7C17C8022000E450B0 /* justifyright@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7917C8022000E450B0 /* justifyright@2x.png */; };
1AFAED7D17C8022000E450B0 /* justifycenter@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7A17C8022000E450B0 /* justifycenter@2x.png */; };
1AFAED8017C802B200E450B0 /* indent@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7E17C802B200E450B0 /* indent@2x.png */; };
1AFAED8117C802B200E450B0 /* outdent@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED7F17C802B200E450B0 /* outdent@2x.png */; };
1AFAED8617C804AB00E450B0 /* numlist@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED8417C804AB00E450B0 /* numlist@2x.png */; };
1AFAED8717C804AB00E450B0 /* bullist@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED8517C804AB00E450B0 /* bullist@2x.png */; };
1AFAED8917C80FC600E450B0 /* dropDownTriangle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAED8817C80FC600E450B0 /* dropDownTriangle@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
1583893D1735A5D7006DE713 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 158389051735A5D7006DE713 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1583890D1735A5D7006DE713;
remoteInfo = RichTextEditor;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
153F955B179F9953005B2487 /* NSAttributedString+RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSAttributedString+RichTextEditor.h"; sourceTree = "<group>"; };
153F955C179F9953005B2487 /* NSAttributedString+RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSAttributedString+RichTextEditor.m"; sourceTree = "<group>"; };
153F955D179F9953005B2487 /* UIFont+RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+RichTextEditor.h"; sourceTree = "<group>"; };
153F955E179F9953005B2487 /* UIFont+RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+RichTextEditor.m"; sourceTree = "<group>"; };
153F955F179F9953005B2487 /* UIView+RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+RichTextEditor.h"; sourceTree = "<group>"; };
153F9560179F9953005B2487 /* UIView+RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+RichTextEditor.m"; sourceTree = "<group>"; };
153F9563179F9953005B2487 /* popoverArrowDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowDown.png; sourceTree = "<group>"; };
153F9564179F9953005B2487 /* popoverArrowDown@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "popoverArrowDown@2x.png"; sourceTree = "<group>"; };
153F9565179F9953005B2487 /* popoverArrowDownSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowDownSimple.png; sourceTree = "<group>"; };
153F9566179F9953005B2487 /* popoverArrowLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowLeft.png; sourceTree = "<group>"; };
153F9567179F9953005B2487 /* popoverArrowLeft@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "popoverArrowLeft@2x.png"; sourceTree = "<group>"; };
153F9568179F9953005B2487 /* popoverArrowLeftSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowLeftSimple.png; sourceTree = "<group>"; };
153F9569179F9953005B2487 /* popoverArrowRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowRight.png; sourceTree = "<group>"; };
153F956A179F9953005B2487 /* popoverArrowRight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "popoverArrowRight@2x.png"; sourceTree = "<group>"; };
153F956B179F9953005B2487 /* popoverArrowRightSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowRightSimple.png; sourceTree = "<group>"; };
153F956C179F9953005B2487 /* popoverArrowUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowUp.png; sourceTree = "<group>"; };
153F956D179F9953005B2487 /* popoverArrowUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "popoverArrowUp@2x.png"; sourceTree = "<group>"; };
153F956E179F9953005B2487 /* popoverArrowUpSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowUpSimple.png; sourceTree = "<group>"; };
153F956F179F9953005B2487 /* popoverBg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverBg.png; sourceTree = "<group>"; };
153F9570179F9953005B2487 /* popoverBg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "popoverBg@2x.png"; sourceTree = "<group>"; };
153F9571179F9953005B2487 /* popoverBgSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverBgSimple.png; sourceTree = "<group>"; };
153F9572179F9953005B2487 /* UIBarButtonItem+WEPopover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+WEPopover.h"; sourceTree = "<group>"; };
153F9573179F9953005B2487 /* UIBarButtonItem+WEPopover.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBarButtonItem+WEPopover.m"; sourceTree = "<group>"; };
153F9574179F9953005B2487 /* WEPopoverContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopoverContainerView.h; sourceTree = "<group>"; };
153F9575179F9953005B2487 /* WEPopoverContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WEPopoverContainerView.m; sourceTree = "<group>"; };
153F9576179F9953005B2487 /* WEPopoverController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopoverController.h; sourceTree = "<group>"; };
153F9577179F9953005B2487 /* WEPopoverController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WEPopoverController.m; sourceTree = "<group>"; };
153F9578179F9953005B2487 /* WEPopoverParentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopoverParentView.h; sourceTree = "<group>"; };
153F9579179F9953005B2487 /* WETouchableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WETouchableView.h; sourceTree = "<group>"; };
153F957A179F9953005B2487 /* WETouchableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WETouchableView.m; sourceTree = "<group>"; };
153F957B179F9953005B2487 /* RichTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditor.h; sourceTree = "<group>"; };
153F957C179F9953005B2487 /* RichTextEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditor.m; sourceTree = "<group>"; };
153F957D179F9953005B2487 /* RichTextEditorColorPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorColorPickerViewController.h; sourceTree = "<group>"; };
153F957E179F9953005B2487 /* RichTextEditorColorPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditorColorPickerViewController.m; sourceTree = "<group>"; };
153F957F179F9953005B2487 /* RichTextEditorFontPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorFontPickerViewController.h; sourceTree = "<group>"; };
153F9580179F9953005B2487 /* RichTextEditorFontPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditorFontPickerViewController.m; sourceTree = "<group>"; };
153F9581179F9953005B2487 /* RichTextEditorFontSizePickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorFontSizePickerViewController.h; sourceTree = "<group>"; };
153F9582179F9953005B2487 /* RichTextEditorFontSizePickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditorFontSizePickerViewController.m; sourceTree = "<group>"; };
153F9583179F9953005B2487 /* RichTextEditorPopover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorPopover.h; sourceTree = "<group>"; };
153F9584179F9953005B2487 /* RichTextEditorToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorToolbar.h; sourceTree = "<group>"; };
153F9585179F9953005B2487 /* RichTextEditorToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditorToolbar.m; sourceTree = "<group>"; };
1583890E1735A5D7006DE713 /* RichTextEditor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RichTextEditor.app; sourceTree = BUILT_PRODUCTS_DIR; };
158389121735A5D7006DE713 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
158389141735A5D7006DE713 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
158389161735A5D7006DE713 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
1583891A1735A5D7006DE713 /* RichTextEditor-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RichTextEditor-Info.plist"; sourceTree = "<group>"; };
1583891C1735A5D7006DE713 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1583891E1735A5D7006DE713 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
158389201735A5D7006DE713 /* RichTextEditor-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RichTextEditor-Prefix.pch"; sourceTree = "<group>"; };
158389211735A5D7006DE713 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
158389221735A5D7006DE713 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
158389241735A5D7006DE713 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
158389261735A5D7006DE713 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
158389281735A5D7006DE713 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
1583892B1735A5D7006DE713 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPhone.storyboard; sourceTree = "<group>"; };
1583892E1735A5D7006DE713 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = "<group>"; };
158389301735A5D7006DE713 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
158389311735A5D7006DE713 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
158389381735A5D7006DE713 /* RichTextEditorTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RichTextEditorTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
158389391735A5D7006DE713 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
158389411735A5D7006DE713 /* RichTextEditorTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RichTextEditorTests-Info.plist"; sourceTree = "<group>"; };
158389431735A5D7006DE713 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
158389451735A5D7006DE713 /* RichTextEditorTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RichTextEditorTests.h; sourceTree = "<group>"; };
158389461735A5D7006DE713 /* RichTextEditorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RichTextEditorTests.m; sourceTree = "<group>"; };
158389591735D7F4006DE713 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
15AE737617A5696D007F283A /* buttoncenterSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttoncenterSelected.png; sourceTree = "<group>"; };
15AE737717A5696D007F283A /* buttonleftSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonleftSelected.png; sourceTree = "<group>"; };
15AE737817A5696D007F283A /* buttonrightSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonrightSelected.png; sourceTree = "<group>"; };
15AE737917A5696D007F283A /* buttonSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonSelected.png; sourceTree = "<group>"; };
15B6E20A17A4BF700015867C /* dropDownTriangle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dropDownTriangle.png; sourceTree = "<group>"; };
15B6E20D17A4C2820015867C /* RichTextEditorToggleButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorToggleButton.h; sourceTree = "<group>"; };
15B6E20E17A4C2820015867C /* RichTextEditorToggleButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextEditorToggleButton.m; sourceTree = "<group>"; };
15C412F217A4444B0073D047 /* backcolor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = backcolor.png; sourceTree = "<group>"; };
15C412F317A4444B0073D047 /* bold.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bold.png; sourceTree = "<group>"; };
15C412F417A4444B0073D047 /* bullist.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bullist.png; sourceTree = "<group>"; };
15C412F517A4444B0073D047 /* code.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = code.png; sourceTree = "<group>"; };
15C412F617A4444B0073D047 /* colors.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = colors.jpg; sourceTree = "<group>"; };
15C412F717A4444B0073D047 /* email.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = email.png; sourceTree = "<group>"; };
15C412F817A4444B0073D047 /* file.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = file.png; sourceTree = "<group>"; };
15C412F917A4444B0073D047 /* forecolor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = forecolor.png; sourceTree = "<group>"; };
15C412FA17A4444B0073D047 /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = "<group>"; };
15C412FB17A4444B0073D047 /* indent.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = indent.png; sourceTree = "<group>"; };
15C412FC17A4444B0073D047 /* italic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = italic.png; sourceTree = "<group>"; };
15C412FD17A4444B0073D047 /* justifycenter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = justifycenter.png; sourceTree = "<group>"; };
15C412FE17A4444B0073D047 /* justifyfull.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = justifyfull.png; sourceTree = "<group>"; };
15C412FF17A4444B0073D047 /* justifyleft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = justifyleft.png; sourceTree = "<group>"; };
15C4130017A4444B0073D047 /* justifyright.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = justifyright.png; sourceTree = "<group>"; };
15C4130117A4444B0073D047 /* link.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = link.png; sourceTree = "<group>"; };
15C4130217A4444B0073D047 /* numlist.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = numlist.png; sourceTree = "<group>"; };
15C4130317A4444B0073D047 /* outdent.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = outdent.png; sourceTree = "<group>"; };
15C4130417A4444B0073D047 /* redo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = redo.png; sourceTree = "<group>"; };
15C4130517A4444B0073D047 /* removeformat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = removeformat.png; sourceTree = "<group>"; };
15C4130617A4444B0073D047 /* strikethrough.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = strikethrough.png; sourceTree = "<group>"; };
15C4130717A4444B0073D047 /* underline.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = underline.png; sourceTree = "<group>"; };
15C4130817A4444B0073D047 /* undo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = undo.png; sourceTree = "<group>"; };
15C4130917A4444B0073D047 /* unlink.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = unlink.png; sourceTree = "<group>"; };
15C4133417A48C6D0073D047 /* button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button.png; sourceTree = "<group>"; };
15C4133517A48C6D0073D047 /* buttoncenter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttoncenter.png; sourceTree = "<group>"; };
15C4133617A48C6D0073D047 /* buttonleft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonleft.png; sourceTree = "<group>"; };
15C4133717A48C6D0073D047 /* buttonright.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonright.png; sourceTree = "<group>"; };
1AFAED6E17C7F9CA00E450B0 /* strikethrough@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "strikethrough@2x.png"; sourceTree = "<group>"; };
1AFAED6F17C7F9CA00E450B0 /* italic@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "italic@2x.png"; sourceTree = "<group>"; };
1AFAED7017C7F9CA00E450B0 /* underline@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "underline@2x.png"; sourceTree = "<group>"; };
1AFAED7117C7F9CA00E450B0 /* bold@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "bold@2x.png"; sourceTree = "<group>"; };
1AFAED7617C8013900E450B0 /* justifyleft@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "justifyleft@2x.png"; sourceTree = "<group>"; };
1AFAED7817C8022000E450B0 /* justifyfull@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "justifyfull@2x.png"; sourceTree = "<group>"; };
1AFAED7917C8022000E450B0 /* justifyright@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "justifyright@2x.png"; sourceTree = "<group>"; };
1AFAED7A17C8022000E450B0 /* justifycenter@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "justifycenter@2x.png"; sourceTree = "<group>"; };
1AFAED7E17C802B200E450B0 /* indent@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "indent@2x.png"; sourceTree = "<group>"; };
1AFAED7F17C802B200E450B0 /* outdent@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "outdent@2x.png"; sourceTree = "<group>"; };
1AFAED8417C804AB00E450B0 /* numlist@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "numlist@2x.png"; sourceTree = "<group>"; };
1AFAED8517C804AB00E450B0 /* bullist@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "bullist@2x.png"; sourceTree = "<group>"; };
1AFAED8817C80FC600E450B0 /* dropDownTriangle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "dropDownTriangle@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1583890B1735A5D7006DE713 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1583895A1735D7F4006DE713 /* CoreText.framework in Frameworks */,
158389131735A5D7006DE713 /* UIKit.framework in Frameworks */,
158389151735A5D7006DE713 /* Foundation.framework in Frameworks */,
158389171735A5D7006DE713 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
158389341735A5D7006DE713 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1583893A1735A5D7006DE713 /* SenTestingKit.framework in Frameworks */,
1583893B1735A5D7006DE713 /* UIKit.framework in Frameworks */,
1583893C1735A5D7006DE713 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
153F9554179F9953005B2487 /* Source */ = {
isa = PBXGroup;
children = (
153F9555179F9953005B2487 /* Assets */,
153F955A179F9953005B2487 /* Categories */,
153F9561179F9953005B2487 /* iphone Popover */,
153F957B179F9953005B2487 /* RichTextEditor.h */,
153F957C179F9953005B2487 /* RichTextEditor.m */,
153F9584179F9953005B2487 /* RichTextEditorToolbar.h */,
153F9585179F9953005B2487 /* RichTextEditorToolbar.m */,
15B6E20D17A4C2820015867C /* RichTextEditorToggleButton.h */,
15B6E20E17A4C2820015867C /* RichTextEditorToggleButton.m */,
153F957D179F9953005B2487 /* RichTextEditorColorPickerViewController.h */,
153F957E179F9953005B2487 /* RichTextEditorColorPickerViewController.m */,
153F957F179F9953005B2487 /* RichTextEditorFontPickerViewController.h */,
153F9580179F9953005B2487 /* RichTextEditorFontPickerViewController.m */,
153F9581179F9953005B2487 /* RichTextEditorFontSizePickerViewController.h */,
153F9582179F9953005B2487 /* RichTextEditorFontSizePickerViewController.m */,
153F9583179F9953005B2487 /* RichTextEditorPopover.h */,
);
path = Source;
sourceTree = "<group>";
};
153F9555179F9953005B2487 /* Assets */ = {
isa = PBXGroup;
children = (
15C4133317A48C2C0073D047 /* buttons */,
15C412F217A4444B0073D047 /* backcolor.png */,
15C412F317A4444B0073D047 /* bold.png */,
1AFAED7117C7F9CA00E450B0 /* bold@2x.png */,
15C412F417A4444B0073D047 /* bullist.png */,
1AFAED8517C804AB00E450B0 /* bullist@2x.png */,
15C412F517A4444B0073D047 /* code.png */,
15C412F617A4444B0073D047 /* colors.jpg */,
15C412F717A4444B0073D047 /* email.png */,
15C412F817A4444B0073D047 /* file.png */,
15C412F917A4444B0073D047 /* forecolor.png */,
15C412FA17A4444B0073D047 /* image.png */,
15C412FB17A4444B0073D047 /* indent.png */,
1AFAED7E17C802B200E450B0 /* indent@2x.png */,
15C412FC17A4444B0073D047 /* italic.png */,
1AFAED6F17C7F9CA00E450B0 /* italic@2x.png */,
15C412FD17A4444B0073D047 /* justifycenter.png */,
1AFAED7A17C8022000E450B0 /* justifycenter@2x.png */,
15C412FE17A4444B0073D047 /* justifyfull.png */,
1AFAED7817C8022000E450B0 /* justifyfull@2x.png */,
15C412FF17A4444B0073D047 /* justifyleft.png */,
1AFAED7617C8013900E450B0 /* justifyleft@2x.png */,
15C4130017A4444B0073D047 /* justifyright.png */,
1AFAED7917C8022000E450B0 /* justifyright@2x.png */,
15C4130117A4444B0073D047 /* link.png */,
15C4130217A4444B0073D047 /* numlist.png */,
1AFAED8417C804AB00E450B0 /* numlist@2x.png */,
15C4130317A4444B0073D047 /* outdent.png */,
1AFAED7F17C802B200E450B0 /* outdent@2x.png */,
15C4130417A4444B0073D047 /* redo.png */,
15C4130517A4444B0073D047 /* removeformat.png */,
15C4130617A4444B0073D047 /* strikethrough.png */,
1AFAED6E17C7F9CA00E450B0 /* strikethrough@2x.png */,
15C4130717A4444B0073D047 /* underline.png */,
1AFAED7017C7F9CA00E450B0 /* underline@2x.png */,
15C4130817A4444B0073D047 /* undo.png */,
15C4130917A4444B0073D047 /* unlink.png */,
);
path = Assets;
sourceTree = "<group>";
};
153F955A179F9953005B2487 /* Categories */ = {
isa = PBXGroup;
children = (
153F955B179F9953005B2487 /* NSAttributedString+RichTextEditor.h */,
153F955C179F9953005B2487 /* NSAttributedString+RichTextEditor.m */,
153F955D179F9953005B2487 /* UIFont+RichTextEditor.h */,
153F955E179F9953005B2487 /* UIFont+RichTextEditor.m */,
153F955F179F9953005B2487 /* UIView+RichTextEditor.h */,
153F9560179F9953005B2487 /* UIView+RichTextEditor.m */,
);
path = Categories;
sourceTree = "<group>";
};
153F9561179F9953005B2487 /* iphone Popover */ = {
isa = PBXGroup;
children = (
153F9562179F9953005B2487 /* Assets */,
153F9572179F9953005B2487 /* UIBarButtonItem+WEPopover.h */,
153F9573179F9953005B2487 /* UIBarButtonItem+WEPopover.m */,
153F9574179F9953005B2487 /* WEPopoverContainerView.h */,
153F9575179F9953005B2487 /* WEPopoverContainerView.m */,
153F9576179F9953005B2487 /* WEPopoverController.h */,
153F9577179F9953005B2487 /* WEPopoverController.m */,
153F9578179F9953005B2487 /* WEPopoverParentView.h */,
153F9579179F9953005B2487 /* WETouchableView.h */,
153F957A179F9953005B2487 /* WETouchableView.m */,
);
path = "iphone Popover";
sourceTree = "<group>";
};
153F9562179F9953005B2487 /* Assets */ = {
isa = PBXGroup;
children = (
153F9563179F9953005B2487 /* popoverArrowDown.png */,
153F9564179F9953005B2487 /* popoverArrowDown@2x.png */,
153F9565179F9953005B2487 /* popoverArrowDownSimple.png */,
153F9566179F9953005B2487 /* popoverArrowLeft.png */,
153F9567179F9953005B2487 /* popoverArrowLeft@2x.png */,
153F9568179F9953005B2487 /* popoverArrowLeftSimple.png */,
153F9569179F9953005B2487 /* popoverArrowRight.png */,
153F956A179F9953005B2487 /* popoverArrowRight@2x.png */,
153F956B179F9953005B2487 /* popoverArrowRightSimple.png */,
153F956C179F9953005B2487 /* popoverArrowUp.png */,
153F956D179F9953005B2487 /* popoverArrowUp@2x.png */,
153F956E179F9953005B2487 /* popoverArrowUpSimple.png */,
153F956F179F9953005B2487 /* popoverBg.png */,
153F9570179F9953005B2487 /* popoverBg@2x.png */,
153F9571179F9953005B2487 /* popoverBgSimple.png */,
);
path = Assets;
sourceTree = "<group>";
};
158389031735A5D7006DE713 = {
isa = PBXGroup;
children = (
158389181735A5D7006DE713 /* RichTextEditor */,
1583893F1735A5D7006DE713 /* RichTextEditorTests */,
158389111735A5D7006DE713 /* Frameworks */,
1583890F1735A5D7006DE713 /* Products */,
);
sourceTree = "<group>";
};
1583890F1735A5D7006DE713 /* Products */ = {
isa = PBXGroup;
children = (
1583890E1735A5D7006DE713 /* RichTextEditor.app */,
158389381735A5D7006DE713 /* RichTextEditorTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
158389111735A5D7006DE713 /* Frameworks */ = {
isa = PBXGroup;
children = (
158389591735D7F4006DE713 /* CoreText.framework */,
158389121735A5D7006DE713 /* UIKit.framework */,
158389141735A5D7006DE713 /* Foundation.framework */,
158389161735A5D7006DE713 /* CoreGraphics.framework */,
158389391735A5D7006DE713 /* SenTestingKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
158389181735A5D7006DE713 /* RichTextEditor */ = {
isa = PBXGroup;
children = (
153F9554179F9953005B2487 /* Source */,
158389211735A5D7006DE713 /* AppDelegate.h */,
158389221735A5D7006DE713 /* AppDelegate.m */,
1583892A1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard */,
1583892D1735A5D7006DE713 /* MainStoryboard_iPad.storyboard */,
158389301735A5D7006DE713 /* ViewController.h */,
158389311735A5D7006DE713 /* ViewController.m */,
158389191735A5D7006DE713 /* Supporting Files */,
);
path = RichTextEditor;
sourceTree = "<group>";
};
158389191735A5D7006DE713 /* Supporting Files */ = {
isa = PBXGroup;
children = (
1583891A1735A5D7006DE713 /* RichTextEditor-Info.plist */,
1583891B1735A5D7006DE713 /* InfoPlist.strings */,
1583891E1735A5D7006DE713 /* main.m */,
158389201735A5D7006DE713 /* RichTextEditor-Prefix.pch */,
158389241735A5D7006DE713 /* Default.png */,
158389261735A5D7006DE713 /* Default@2x.png */,
158389281735A5D7006DE713 /* Default-568h@2x.png */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
1583893F1735A5D7006DE713 /* RichTextEditorTests */ = {
isa = PBXGroup;
children = (
158389451735A5D7006DE713 /* RichTextEditorTests.h */,
158389461735A5D7006DE713 /* RichTextEditorTests.m */,
158389401735A5D7006DE713 /* Supporting Files */,
);
path = RichTextEditorTests;
sourceTree = "<group>";
};
158389401735A5D7006DE713 /* Supporting Files */ = {
isa = PBXGroup;
children = (
158389411735A5D7006DE713 /* RichTextEditorTests-Info.plist */,
158389421735A5D7006DE713 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
15C4133317A48C2C0073D047 /* buttons */ = {
isa = PBXGroup;
children = (
15C4133417A48C6D0073D047 /* button.png */,
15C4133517A48C6D0073D047 /* buttoncenter.png */,
15AE737617A5696D007F283A /* buttoncenterSelected.png */,
15C4133617A48C6D0073D047 /* buttonleft.png */,
15AE737717A5696D007F283A /* buttonleftSelected.png */,
15C4133717A48C6D0073D047 /* buttonright.png */,
15AE737817A5696D007F283A /* buttonrightSelected.png */,
15AE737917A5696D007F283A /* buttonSelected.png */,
15B6E20A17A4BF700015867C /* dropDownTriangle.png */,
1AFAED8817C80FC600E450B0 /* dropDownTriangle@2x.png */,
);
path = buttons;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1583890D1735A5D7006DE713 /* RichTextEditor */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1583894A1735A5D7006DE713 /* Build configuration list for PBXNativeTarget "RichTextEditor" */;
buildPhases = (
1583890A1735A5D7006DE713 /* Sources */,
1583890B1735A5D7006DE713 /* Frameworks */,
1583890C1735A5D7006DE713 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = RichTextEditor;
productName = RichTextEditor;
productReference = 1583890E1735A5D7006DE713 /* RichTextEditor.app */;
productType = "com.apple.product-type.application";
};
158389371735A5D7006DE713 /* RichTextEditorTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1583894D1735A5D7006DE713 /* Build configuration list for PBXNativeTarget "RichTextEditorTests" */;
buildPhases = (
158389331735A5D7006DE713 /* Sources */,
158389341735A5D7006DE713 /* Frameworks */,
158389351735A5D7006DE713 /* Resources */,
158389361735A5D7006DE713 /* ShellScript */,
);
buildRules = (
);
dependencies = (
1583893E1735A5D7006DE713 /* PBXTargetDependency */,
);
name = RichTextEditorTests;
productName = RichTextEditorTests;
productReference = 158389381735A5D7006DE713 /* RichTextEditorTests.octest */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
158389051735A5D7006DE713 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = "Aryan Ghassemi";
};
buildConfigurationList = 158389081735A5D7006DE713 /* Build configuration list for PBXProject "RichTextEditor" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 158389031735A5D7006DE713;
productRefGroup = 1583890F1735A5D7006DE713 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
1583890D1735A5D7006DE713 /* RichTextEditor */,
158389371735A5D7006DE713 /* RichTextEditorTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1583890C1735A5D7006DE713 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1583891D1735A5D7006DE713 /* InfoPlist.strings in Resources */,
153F959A179F9953005B2487 /* popoverBg@2x.png in Resources */,
153F958E179F9953005B2487 /* popoverArrowDown@2x.png in Resources */,
153F958F179F9953005B2487 /* popoverArrowDownSimple.png in Resources */,
153F9591179F9953005B2487 /* popoverArrowLeft@2x.png in Resources */,
153F958D179F9953005B2487 /* popoverArrowDown.png in Resources */,
153F9593179F9953005B2487 /* popoverArrowRight.png in Resources */,
158389251735A5D7006DE713 /* Default.png in Resources */,
153F9597179F9953005B2487 /* popoverArrowUp@2x.png in Resources */,
153F9592179F9953005B2487 /* popoverArrowLeftSimple.png in Resources */,
158389271735A5D7006DE713 /* Default@2x.png in Resources */,
153F9594179F9953005B2487 /* popoverArrowRight@2x.png in Resources */,
153F9596179F9953005B2487 /* popoverArrowUp.png in Resources */,
158389291735A5D7006DE713 /* Default-568h@2x.png in Resources */,
1583892C1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard in Resources */,
153F9599179F9953005B2487 /* popoverBg.png in Resources */,
153F9590179F9953005B2487 /* popoverArrowLeft.png in Resources */,
153F9598179F9953005B2487 /* popoverArrowUpSimple.png in Resources */,
153F959B179F9953005B2487 /* popoverBgSimple.png in Resources */,
153F9595179F9953005B2487 /* popoverArrowRightSimple.png in Resources */,
1583892F1735A5D7006DE713 /* MainStoryboard_iPad.storyboard in Resources */,
15C4131317A4444B0073D047 /* backcolor.png in Resources */,
15C4131417A4444B0073D047 /* bold.png in Resources */,
15C4131517A4444B0073D047 /* bullist.png in Resources */,
15C4131617A4444B0073D047 /* code.png in Resources */,
15C4131717A4444B0073D047 /* colors.jpg in Resources */,
15C4131817A4444B0073D047 /* email.png in Resources */,
15C4131917A4444B0073D047 /* file.png in Resources */,
15C4131A17A4444B0073D047 /* forecolor.png in Resources */,
15C4131B17A4444B0073D047 /* image.png in Resources */,
15C4131C17A4444B0073D047 /* indent.png in Resources */,
15C4131D17A4444B0073D047 /* italic.png in Resources */,
15C4131E17A4444B0073D047 /* justifycenter.png in Resources */,
15C4131F17A4444B0073D047 /* justifyfull.png in Resources */,
15C4132017A4444B0073D047 /* justifyleft.png in Resources */,
15C4132117A4444B0073D047 /* justifyright.png in Resources */,
15C4132217A4444B0073D047 /* link.png in Resources */,
15C4132317A4444B0073D047 /* numlist.png in Resources */,
15C4132417A4444B0073D047 /* outdent.png in Resources */,
15C4132517A4444B0073D047 /* redo.png in Resources */,
15C4132617A4444B0073D047 /* removeformat.png in Resources */,
15C4132717A4444B0073D047 /* strikethrough.png in Resources */,
15C4132817A4444B0073D047 /* underline.png in Resources */,
15C4132917A4444B0073D047 /* undo.png in Resources */,
15C4132A17A4444B0073D047 /* unlink.png in Resources */,
15C4133817A48C6D0073D047 /* button.png in Resources */,
15C4133917A48C6D0073D047 /* buttoncenter.png in Resources */,
15C4133A17A48C6D0073D047 /* buttonleft.png in Resources */,
15C4133B17A48C6D0073D047 /* buttonright.png in Resources */,
15B6E20B17A4BF700015867C /* dropDownTriangle.png in Resources */,
15AE737A17A5696D007F283A /* buttoncenterSelected.png in Resources */,
15AE737B17A5696D007F283A /* buttonleftSelected.png in Resources */,
15AE737C17A5696D007F283A /* buttonrightSelected.png in Resources */,
15AE737D17A5696D007F283A /* buttonSelected.png in Resources */,
1AFAED7217C7F9CA00E450B0 /* strikethrough@2x.png in Resources */,
1AFAED7317C7F9CA00E450B0 /* italic@2x.png in Resources */,
1AFAED7417C7F9CA00E450B0 /* underline@2x.png in Resources */,
1AFAED7517C7F9CA00E450B0 /* bold@2x.png in Resources */,
1AFAED7717C8013900E450B0 /* justifyleft@2x.png in Resources */,
1AFAED7B17C8022000E450B0 /* justifyfull@2x.png in Resources */,
1AFAED7C17C8022000E450B0 /* justifyright@2x.png in Resources */,
1AFAED7D17C8022000E450B0 /* justifycenter@2x.png in Resources */,
1AFAED8017C802B200E450B0 /* indent@2x.png in Resources */,
1AFAED8117C802B200E450B0 /* outdent@2x.png in Resources */,
1AFAED8617C804AB00E450B0 /* numlist@2x.png in Resources */,
1AFAED8717C804AB00E450B0 /* bullist@2x.png in Resources */,
1AFAED8917C80FC600E450B0 /* dropDownTriangle@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
158389351735A5D7006DE713 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
158389441735A5D7006DE713 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
158389361735A5D7006DE713 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1583890A1735A5D7006DE713 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
153F959D179F9953005B2487 /* WEPopoverContainerView.m in Sources */,
153F95A4179F9953005B2487 /* RichTextEditorToolbar.m in Sources */,
153F959C179F9953005B2487 /* UIBarButtonItem+WEPopover.m in Sources */,
153F95A3179F9953005B2487 /* RichTextEditorFontSizePickerViewController.m in Sources */,
153F958B179F9953005B2487 /* UIFont+RichTextEditor.m in Sources */,
1583891F1735A5D7006DE713 /* main.m in Sources */,
153F959E179F9953005B2487 /* WEPopoverController.m in Sources */,
153F95A2179F9953005B2487 /* RichTextEditorFontPickerViewController.m in Sources */,
153F95A0179F9953005B2487 /* RichTextEditor.m in Sources */,
153F958C179F9953005B2487 /* UIView+RichTextEditor.m in Sources */,
153F959F179F9953005B2487 /* WETouchableView.m in Sources */,
158389231735A5D7006DE713 /* AppDelegate.m in Sources */,
158389321735A5D7006DE713 /* ViewController.m in Sources */,
153F95A1179F9953005B2487 /* RichTextEditorColorPickerViewController.m in Sources */,
153F958A179F9953005B2487 /* NSAttributedString+RichTextEditor.m in Sources */,
15B6E20F17A4C2820015867C /* RichTextEditorToggleButton.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
158389331735A5D7006DE713 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
158389471735A5D7006DE713 /* RichTextEditorTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
1583893E1735A5D7006DE713 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1583890D1735A5D7006DE713 /* RichTextEditor */;
targetProxy = 1583893D1735A5D7006DE713 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
1583891B1735A5D7006DE713 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
1583891C1735A5D7006DE713 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
1583892A1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard */ = {
isa = PBXVariantGroup;
children = (
1583892B1735A5D7006DE713 /* en */,
);
name = MainStoryboard_iPhone.storyboard;
sourceTree = "<group>";
};
1583892D1735A5D7006DE713 /* MainStoryboard_iPad.storyboard */ = {
isa = PBXVariantGroup;
children = (
1583892E1735A5D7006DE713 /* en */,
);
name = MainStoryboard_iPad.storyboard;
sourceTree = "<group>";
};
158389421735A5D7006DE713 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
158389431735A5D7006DE713 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
158389481735A5D7006DE713 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
158389491735A5D7006DE713 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
1583894B1735A5D7006DE713 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RichTextEditor/RichTextEditor-Prefix.pch";
INFOPLIST_FILE = "RichTextEditor/RichTextEditor-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
1583894C1735A5D7006DE713 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RichTextEditor/RichTextEditor-Prefix.pch";
INFOPLIST_FILE = "RichTextEditor/RichTextEditor-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
1583894E1735A5D7006DE713 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RichTextEditor.app/RichTextEditor";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RichTextEditor/RichTextEditor-Prefix.pch";
INFOPLIST_FILE = "RichTextEditorTests/RichTextEditorTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
1583894F1735A5D7006DE713 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RichTextEditor.app/RichTextEditor";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RichTextEditor/RichTextEditor-Prefix.pch";
INFOPLIST_FILE = "RichTextEditorTests/RichTextEditorTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
158389081735A5D7006DE713 /* Build configuration list for PBXProject "RichTextEditor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
158389481735A5D7006DE713 /* Debug */,
158389491735A5D7006DE713 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1583894A1735A5D7006DE713 /* Build configuration list for PBXNativeTarget "RichTextEditor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1583894B1735A5D7006DE713 /* Debug */,
1583894C1735A5D7006DE713 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1583894D1735A5D7006DE713 /* Build configuration list for PBXNativeTarget "RichTextEditorTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1583894E1735A5D7006DE713 /* Debug */,
1583894F1735A5D7006DE713 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 158389051735A5D7006DE713 /* Project object */;
}
-34
View File
@@ -1,34 +0,0 @@
//
// AppDelegate.h
// RichTextEditor
//
// Created by Aryan Gh on 5/4/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
-65
View File
@@ -1,65 +0,0 @@
//
// AppDelegate.m
// RichTextEditor
//
// Created by Aryan Gh on 5/4/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

-49
View File
@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.aryaxt.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>MainStoryboard_iPad</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
-14
View File
@@ -1,14 +0,0 @@
//
// Prefix header for all source files of the 'RichTextEditor' target in the 'RichTextEditor' project
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

@@ -1,103 +0,0 @@
//
// UIFont+RichTextEditor.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UIFont+RichTextEditor.h"
@implementation UIFont (RichTextEditor)
+ (NSString *)postscriptNameFromFullName:(NSString *)fullName
{
UIFont *font = [UIFont fontWithName:fullName size:1];
return (__bridge NSString *)(CTFontCopyPostScriptName((__bridge CTFontRef)(font)));
}
+ (UIFont *)fontWithName:(NSString *)name size:(CGFloat)size boldTrait:(BOOL)isBold italicTrait:(BOOL)isItalic
{
NSString *postScriptName = [UIFont postscriptNameFromFullName:name];
CTFontSymbolicTraits traits = 0;
CTFontRef newFontRef;
CTFontRef fontWithoutTrait = CTFontCreateWithName((__bridge CFStringRef)(postScriptName), size, NULL);
if (isItalic)
traits |= kCTFontItalicTrait;
if (isBold)
traits |= kCTFontBoldTrait;
if (traits == 0)
{
newFontRef= CTFontCreateCopyWithAttributes(fontWithoutTrait, 0.0, NULL, NULL);
}
else
{
newFontRef = CTFontCreateCopyWithSymbolicTraits(fontWithoutTrait, 0.0, NULL, traits, traits);
}
if (newFontRef)
{
NSString *fontNameKey = (__bridge NSString *)(CTFontCopyName(newFontRef, kCTFontPostScriptNameKey));
return [UIFont fontWithName:fontNameKey size:CTFontGetSize(newFontRef)];
}
return nil;
}
- (UIFont *)fontWithBoldTrait:(BOOL)bold italicTrait:(BOOL)italic andSize:(CGFloat)size
{
CTFontRef fontRef = (__bridge CTFontRef)self;
NSString *familyName = (__bridge NSString *)(CTFontCopyName(fontRef, kCTFontFamilyNameKey));
NSString *postScriptName = [UIFont postscriptNameFromFullName:familyName];
return [[self class] fontWithName:postScriptName size:size boldTrait:bold italicTrait:italic];
}
- (UIFont *)fontWithBoldTrait:(BOOL)bold andItalicTrait:(BOOL)italic
{
return [self fontWithBoldTrait:bold italicTrait:italic andSize:self.pointSize];
}
- (BOOL)isBold
{
CTFontSymbolicTraits trait = CTFontGetSymbolicTraits((__bridge CTFontRef)self);
if ((trait & kCTFontTraitBold) == kCTFontTraitBold)
return YES;
return NO;
}
- (BOOL)isItalic
{
CTFontSymbolicTraits trait = CTFontGetSymbolicTraits((__bridge CTFontRef)self);
if ((trait & kCTFontTraitItalic) == kCTFontTraitItalic)
return YES;
return NO;
}
@end
@@ -1,72 +0,0 @@
//
// UIView+RichTextEditor.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UIView+RichTextEditor.h"
@implementation UIView (RichTextEditor)
- (UIColor *)colorOfPoint:(CGPoint)point
{
unsigned char pixel[4] = {0};
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, kCGImageAlphaPremultipliedLast);
CGContextTranslateCTM(context, -point.x, -point.y);
[self.layer renderInContext:context];
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
UIColor *color = [UIColor colorWithRed:pixel[0]/255.0 green:pixel[1]/255.0 blue:pixel[2]/255.0 alpha:pixel[3]/255.0];
return color;
}
- (UIViewController *)firstAvailableViewController
{
return (UIViewController *)[self traverseResponderChainForUIViewController];
}
- (id)traverseResponderChainForUIViewController
{
id nextResponder = [self nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]])
{
return nextResponder;
}
else if ([nextResponder isKindOfClass:[UIView class]])
{
return [nextResponder traverseResponderChainForUIViewController];
}
else
{
return nil;
}
}
@end
-51
View File
@@ -1,51 +0,0 @@
//
// RichTextEditor.h
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import "RichTextEditorToolbar.h"
@class RichTextEditor;
@protocol RichTextEditorDataSource <NSObject>
@optional
- (NSArray *)fontSizeSelectionForRichTextEditor:(RichTextEditor *)richTextEditor;
- (NSArray *)fontFamilySelectionForRichTextEditor:(RichTextEditor *)richTextEditor;
- (RichTextEditorToolbarPresentationStyle)presentarionStyleForRichTextEditor:(RichTextEditor *)richTextEditor;
- (UIModalPresentationStyle)modalPresentationStyleForRichTextEditor:(RichTextEditor *)richTextEditor;
- (UIModalTransitionStyle)modalTransitionStyleForRichTextEditor:(RichTextEditor *)richTextEditor;
- (RichTextEditorFeature)featuresEnabledForRichTextEditor:(RichTextEditor *)richTextEditor;
- (BOOL)shouldDisplayToolbarForRichTextEditor:(RichTextEditor *)richTextEditor;
- (BOOL)shouldDisplayRichTextOptionsInMenuControllerForRichTextrEditor:(RichTextEditor *)richTextEdiotor;
@end
@interface RichTextEditor : UITextView
@property (nonatomic, weak) IBOutlet id <RichTextEditorDataSource> dataSource;
@property (nonatomic, assign) CGFloat defaultIndentationSize;
- (NSString *)htmlString;
@end
-536
View File
@@ -1,536 +0,0 @@
//
// RichTextEditor.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "RichTextEditor.h"
#import <QuartzCore/QuartzCore.h>
#import "UIFont+RichTextEditor.h"
#import "NSAttributedString+RichTextEditor.h"
#import "UIView+RichTextEditor.h"
@interface RichTextEditor() <RichTextEditorToolbarDelegate, RichTextEditorToolbarDataSource>
@property (nonatomic, strong) RichTextEditorToolbar *toolBar;
// Gets set to YES when the user starts chaning attributes when there is no text selection (selecting bold, italic, etc)
// Gets set to NO when the user changes selection or starts typing
@property (nonatomic, assign) BOOL typingAttributesInProgress;
@end
@implementation RichTextEditor
- (void)awakeFromNib
{
[super awakeFromNib];
self.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.layer.borderWidth = 1;
self.toolBar = [[RichTextEditorToolbar alloc] initWithFrame:CGRectMake(0, 0, [self currentScreenBoundsDependOnOrientation].size.width, 40)
delegate:self
dataSource:self];
self.typingAttributesInProgress = NO;
self.defaultIndentationSize = 15;
[self setupMenuItems];
//If there is text already, then we do want to update the toolbar. Otherwise we don't.
if ([self hasText])
[self updateToolbarState];
}
- (void)setSelectedTextRange:(UITextRange *)selectedTextRange
{
[super setSelectedTextRange:selectedTextRange];
[self updateToolbarState];
self.typingAttributesInProgress = NO;
}
- (BOOL)canBecomeFirstResponder
{
if (![self.dataSource respondsToSelector:@selector(shouldDisplayToolbarForRichTextEditor:)] ||
[self.dataSource shouldDisplayToolbarForRichTextEditor:self])
{
self.inputAccessoryView = self.toolBar;
}
else
{
self.inputAccessoryView = nil;
}
return [super canBecomeFirstResponder];
}
#pragma mark - MenuController Methods -
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
RichTextEditorFeature features = [self featuresEnabledForRichTextEditorToolbar];
if ([self.dataSource respondsToSelector:@selector(shouldDisplayRichTextOptionsInMenuControllerForRichTextrEditor:)] &&
[self.dataSource shouldDisplayRichTextOptionsInMenuControllerForRichTextrEditor:self])
{
if (action == @selector(richTextEditorToolbarDidSelectBold) && (features & RichTextEditorFeatureBold || features & RichTextEditorFeatureAll))
return YES;
if (action == @selector(richTextEditorToolbarDidSelectItalic) && (features & RichTextEditorFeatureItalic || features & RichTextEditorFeatureAll))
return YES;
if (action == @selector(richTextEditorToolbarDidSelectUnderline) && (features & RichTextEditorFeatureUnderline || features & RichTextEditorFeatureAll))
return YES;
if (action == @selector(richTextEditorToolbarDidSelectStrikeThrough) && (features & RichTextEditorFeatureStrikeThrough || features & RichTextEditorFeatureAll))
return YES;
}
if (action == @selector(selectParagraph:) && self.selectedRange.length > 0)
return YES;
return [super canPerformAction:action withSender:sender];
}
- (void)setupMenuItems
{
UIMenuItem *selectParagraph = [[UIMenuItem alloc] initWithTitle:@"Select Paragraph" action:@selector(selectParagraph:)];
UIMenuItem *boldItem = [[UIMenuItem alloc] initWithTitle:@"Bold" action:@selector(richTextEditorToolbarDidSelectBold)];
UIMenuItem *italicItem = [[UIMenuItem alloc] initWithTitle:@"Italic" action:@selector(richTextEditorToolbarDidSelectItalic)];
UIMenuItem *underlineItem = [[UIMenuItem alloc] initWithTitle:@"Underline" action:@selector(richTextEditorToolbarDidSelectUnderline)];
UIMenuItem *strikeThroughItem = [[UIMenuItem alloc] initWithTitle:@"Strike" action:@selector(richTextEditorToolbarDidSelectStrikeThrough)];
[[UIMenuController sharedMenuController] setMenuItems:@[selectParagraph, boldItem, italicItem, underlineItem, strikeThroughItem]];
}
- (void)selectParagraph:(id)sender
{
if (![self hasText])
return;
NSRange range = [self.attributedText firstParagraphRangeFromTextRange:self.selectedRange];
[self setSelectedRange:range];
[[UIMenuController sharedMenuController] setTargetRect:[self frameOfTextAtRange:self.selectedRange] inView:self];
[[UIMenuController sharedMenuController] setMenuVisible:YES animated:YES];
}
#pragma mark - Public Methods -
- (NSString *)htmlString
{
return [self.attributedText htmlString];
}
#pragma mark - RichTextEditorToolbarDelegate Methods -
- (void)richTextEditorToolbarDidSelectBold
{
UIFont *font = [self fontAtIndex:self.selectedRange.location];
[self applyFontAttributesToSelectedRangeWithBoldTrait:[NSNumber numberWithBool:![font isBold]] italicTrait:nil fontName:nil fontSize:nil];
}
- (void)richTextEditorToolbarDidSelectItalic
{
UIFont *font = [self fontAtIndex:self.selectedRange.location];
[self applyFontAttributesToSelectedRangeWithBoldTrait:nil italicTrait:[NSNumber numberWithBool:![font isItalic]] fontName:nil fontSize:nil];
}
- (void)richTextEditorToolbarDidSelectFontSize:(NSNumber *)fontSize
{
[self applyFontAttributesToSelectedRangeWithBoldTrait:nil italicTrait:nil fontName:nil fontSize:fontSize];
}
- (void)richTextEditorToolbarDidSelectFontWithName:(NSString *)fontName
{
[self applyFontAttributesToSelectedRangeWithBoldTrait:nil italicTrait:nil fontName:fontName fontSize:nil];
}
- (void)richTextEditorToolbarDidSelectTextBackgroundColor:(UIColor *)color
{
[self applyAttrubutesToSelectedRange:color forKey:NSBackgroundColorAttributeName];
}
- (void)richTextEditorToolbarDidSelectTextForegroundColor:(UIColor *)color
{
[self applyAttrubutesToSelectedRange:color forKey:NSForegroundColorAttributeName];
}
- (void)richTextEditorToolbarDidSelectUnderline
{
NSDictionary *dictionary = [self dictionaryAtIndex:self.selectedRange.location];
NSNumber *existingUnderlineStyle = [dictionary objectForKey:NSUnderlineStyleAttributeName];
if (!existingUnderlineStyle || existingUnderlineStyle.intValue == NSUnderlineStyleNone)
existingUnderlineStyle = [NSNumber numberWithInteger:NSUnderlineStyleSingle];
else
existingUnderlineStyle = [NSNumber numberWithInteger:NSUnderlineStyleNone];
[self applyAttrubutesToSelectedRange:existingUnderlineStyle forKey:NSUnderlineStyleAttributeName];
}
- (void)richTextEditorToolbarDidSelectStrikeThrough
{
NSDictionary *dictionary = [self dictionaryAtIndex:self.selectedRange.location];
NSNumber *existingUnderlineStyle = [dictionary objectForKey:NSStrikethroughStyleAttributeName];
if (!existingUnderlineStyle || existingUnderlineStyle.intValue == NSUnderlineStyleNone)
existingUnderlineStyle = [NSNumber numberWithInteger:NSUnderlineStyleSingle];
else
existingUnderlineStyle = [NSNumber numberWithInteger:NSUnderlineStyleNone];
[self applyAttrubutesToSelectedRange:existingUnderlineStyle forKey:NSStrikethroughStyleAttributeName];
}
- (void)richTextEditorToolbarDidSelectParagraphIndentation:(ParagraphIndentation)paragraphIndentation
{
[self enumarateThroughParagraphsInRange:self.selectedRange withBlock:^(NSRange paragraphRange){
NSDictionary *dictionary = [self dictionaryAtIndex:paragraphRange.location];
NSMutableParagraphStyle *paragraphStyle = [[dictionary objectForKey:NSParagraphStyleAttributeName] mutableCopy];
if (!paragraphStyle)
paragraphStyle = [[NSMutableParagraphStyle alloc] init];
if (paragraphIndentation == ParagraphIndentationIncrease)
{
paragraphStyle.headIndent += self.defaultIndentationSize;
paragraphStyle.firstLineHeadIndent += self.defaultIndentationSize;
}
else if (paragraphIndentation == ParagraphIndentationDecrease)
{
paragraphStyle.headIndent -= self.defaultIndentationSize;
paragraphStyle.firstLineHeadIndent -= self.defaultIndentationSize;
if (paragraphStyle.headIndent < 0)
paragraphStyle.headIndent = 0;
if (paragraphStyle.firstLineHeadIndent < 0)
paragraphStyle.firstLineHeadIndent = 0;
}
[self applyAttributes:paragraphStyle forKey:NSParagraphStyleAttributeName atRange:paragraphRange];
}];
}
- (void)richTextEditorToolbarDidSelectTextAlignment:(NSTextAlignment)textAlignment
{
[self enumarateThroughParagraphsInRange:self.selectedRange withBlock:^(NSRange paragraphRange){
NSDictionary *dictionary = [self dictionaryAtIndex:paragraphRange.location];
NSMutableParagraphStyle *paragraphStyle = [[dictionary objectForKey:NSParagraphStyleAttributeName] mutableCopy];
if (!paragraphStyle)
paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = textAlignment;
[self applyAttributes:paragraphStyle forKey:NSParagraphStyleAttributeName atRange:paragraphRange];
}];
}
#pragma mark - Private Methods -
- (CGRect)frameOfTextAtRange:(NSRange)range
{
UITextRange *selectionRange = [self selectedTextRange];
NSArray *selectionRects = [self selectionRectsForRange:selectionRange];
CGRect completeRect = CGRectNull;
for (UITextSelectionRect *selectionRect in selectionRects)
{
completeRect = (CGRectIsNull(completeRect))
? selectionRect.rect
: CGRectUnion(completeRect,selectionRect.rect);
}
return completeRect;
}
- (void)enumarateThroughParagraphsInRange:(NSRange)range withBlock:(void (^)(NSRange paragraphRange))block
{
NSArray *rangeOfParagraphsInSelectedText = nil;
if ([self hasText])
rangeOfParagraphsInSelectedText = [self.attributedText rangeOfParagraphsFromTextRange:self.selectedRange];
NSInteger startRange = 0;
NSInteger endRange = 0;
for (int i=0 ; i<rangeOfParagraphsInSelectedText.count ; i++)
{
NSValue *value = [rangeOfParagraphsInSelectedText objectAtIndex:i];
NSRange range = [value rangeValue];
if (i == 0)
startRange = range.location;
endRange = range.location + range.length;
block(NSMakeRange(startRange, endRange-startRange));
}
}
- (void)updateToolbarState
{
// If no text exists or typing attributes is in progress update toolbar using typing attributes instead of selected text
if (self.typingAttributesInProgress || ![self hasText])
{
[self.toolBar updateStateWithAttributes:self.typingAttributes];
}
else
{
int location = [self offsetFromPosition:self.beginningOfDocument toPosition:self.selectedTextRange.start];
if (location == self.text.length)
location --;
[self.toolBar updateStateWithAttributes:[self.attributedText attributesAtIndex:location effectiveRange:nil]];
}
}
- (UIFont *)fontAtIndex:(NSInteger)index
{
// If index at end of string, get attributes starting from previous character
if (index == self.attributedText.string.length && [self hasText])
--index;
// If no text exists get font from typing attributes
NSDictionary *dictionary = ([self hasText])
? [self.attributedText attributesAtIndex:index effectiveRange:nil]
: self.typingAttributes;
return [dictionary objectForKey:NSFontAttributeName];
}
- (NSDictionary *)dictionaryAtIndex:(NSInteger)index
{
// If index at end of string, get attributes starting from previous character
if (index == self.attributedText.string.length && [self hasText])
--index;
// If no text exists get font from typing attributes
return ([self hasText])
? [self.attributedText attributesAtIndex:index effectiveRange:nil]
: self.typingAttributes;
}
- (void)applyAttributeToTypingAttribute:(id)attribute forKey:(NSString *)key
{
NSMutableDictionary *dictionary = [self.typingAttributes mutableCopy];
[dictionary setObject:attribute forKey:key];
[self setTypingAttributes:dictionary];
}
- (void)applyAttributes:(id)attribute forKey:(NSString *)key atRange:(NSRange)range
{
// If any text selected apply attributes to text
if (range.length > 0)
{
NSMutableAttributedString *attributedString = [self.attributedText mutableCopy];
// Workaround for when there is only one paragraph,
// sometimes the attributedString is actually longer by one then the displayed text,
// and this results in not being able to set to lef align anymore.
if (range.length == attributedString.length-1 && range.length == self.text.length)
++range.length;
[attributedString addAttributes:[NSDictionary dictionaryWithObject:attribute forKey:key] range:range];
[self setAttributedText:attributedString];
[self setSelectedRange:range];
}
// If no text is selected apply attributes to typingAttribute
else
{
self.typingAttributesInProgress = YES;
[self applyAttributeToTypingAttribute:attribute forKey:key];
}
[self updateToolbarState];
}
- (void)applyAttrubutesToSelectedRange:(id)attribute forKey:(NSString *)key
{
[self applyAttributes:attribute forKey:key atRange:self.selectedRange];
}
- (void)applyFontAttributesToSelectedRangeWithBoldTrait:(NSNumber *)isBold italicTrait:(NSNumber *)isItalic fontName:(NSString *)fontName fontSize:(NSNumber *)fontSize
{
[self applyFontAttributesWithBoldTrait:isBold italicTrait:isItalic fontName:fontName fontSize:fontSize toTextAtRange:self.selectedRange];
}
- (void)applyFontAttributesWithBoldTrait:(NSNumber *)isBold italicTrait:(NSNumber *)isItalic fontName:(NSString *)fontName fontSize:(NSNumber *)fontSize toTextAtRange:(NSRange)range
{
// If any text selected apply attributes to text
if (range.length > 0)
{
NSMutableAttributedString *attributedString = [self.attributedText mutableCopy];
[attributedString beginEditing];
[attributedString enumerateAttributesInRange:range
options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
usingBlock:^(NSDictionary *dictionary, NSRange range, BOOL *stop){
UIFont *newFont = [self fontwithBoldTrait:isBold
italicTrait:isItalic
fontName:fontName
fontSize:fontSize
fromDictionary:dictionary];
if (newFont)
[attributedString addAttributes:[NSDictionary dictionaryWithObject:newFont forKey:NSFontAttributeName] range:range];
}];
[attributedString endEditing];
self.attributedText = attributedString;
[self setSelectedRange:range];
}
// If no text is selected apply attributes to typingAttribute
else
{
self.typingAttributesInProgress = YES;
UIFont *newFont = [self fontwithBoldTrait:isBold
italicTrait:isItalic
fontName:fontName
fontSize:fontSize
fromDictionary:self.typingAttributes];
if (newFont)
[self applyAttributeToTypingAttribute:newFont forKey:NSFontAttributeName];
}
[self updateToolbarState];
}
// Returns a font with given attributes. For any missing parameter takes the attribute from a given dictionary
- (UIFont *)fontwithBoldTrait:(NSNumber *)isBold italicTrait:(NSNumber *)isItalic fontName:(NSString *)fontName fontSize:(NSNumber *)fontSize fromDictionary:(NSDictionary *)dictionary
{
UIFont *newFont = nil;
UIFont *font = [dictionary objectForKey:NSFontAttributeName];
BOOL newBold = (isBold) ? isBold.intValue : [font isBold];
BOOL newItalic = (isItalic) ? isItalic.intValue : [font isItalic];
CGFloat newFontSize = (fontSize) ? fontSize.floatValue : font.pointSize;
if (fontName)
{
newFont = [UIFont fontWithName:fontName size:newFontSize boldTrait:newBold italicTrait:newItalic];
}
else
{
newFont = [font fontWithBoldTrait:newBold italicTrait:newItalic andSize:newFontSize];
}
return newFont;
}
- (CGRect)currentScreenBoundsDependOnOrientation
{
CGRect screenBounds = [UIScreen mainScreen].bounds ;
CGFloat width = CGRectGetWidth(screenBounds) ;
CGFloat height = CGRectGetHeight(screenBounds) ;
UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
screenBounds.size = CGSizeMake(width, height);
}
else if (UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
screenBounds.size = CGSizeMake(height, width);
}
return screenBounds ;
}
#pragma mark - RichTextEditorToolbarDataSource Methods -
- (NSArray *)fontFamilySelectionForRichTextEditorToolbar
{
if (self.dataSource && [self.dataSource respondsToSelector:@selector(fontFamilySelectionForRichTextEditor:)])
{
return [self.dataSource fontFamilySelectionForRichTextEditor:self];
}
return nil;
}
- (NSArray *)fontSizeSelectionForRichTextEditorToolbar
{
if (self.dataSource && [self.dataSource respondsToSelector:@selector(fontSizeSelectionForRichTextEditor:)])
{
return [self.dataSource fontSizeSelectionForRichTextEditor:self];
}
return nil;
}
- (RichTextEditorToolbarPresentationStyle)presentarionStyleForRichTextEditorToolbar
{
if (self.dataSource && [self.dataSource respondsToSelector:@selector(presentarionStyleForRichTextEditor:)])
{
return [self.dataSource presentarionStyleForRichTextEditor:self];
}
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
? RichTextEditorToolbarPresentationStylePopover
: RichTextEditorToolbarPresentationStyleModal;
}
- (UIModalPresentationStyle)modalPresentationStyleForRichTextEditorToolbar
{
if (self.dataSource && [self.dataSource respondsToSelector:@selector(modalPresentationStyleForRichTextEditor:)])
{
return [self.dataSource modalPresentationStyleForRichTextEditor:self];
}
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
? UIModalPresentationFormSheet
: UIModalPresentationFullScreen;
}
- (UIModalTransitionStyle)modalTransitionStyleForRichTextEditorToolbar
{
if (self.dataSource && [self.dataSource respondsToSelector:@selector(modalTransitionStyleForRichTextEditor:)])
{
return [self.dataSource modalTransitionStyleForRichTextEditor:self];
}
return UIModalTransitionStyleCoverVertical;
}
- (RichTextEditorFeature)featuresEnabledForRichTextEditorToolbar
{
if (self.dataSource && [self.dataSource respondsToSelector:@selector(featuresEnabledForRichTextEditor:)])
{
return [self.dataSource featuresEnabledForRichTextEditor:self];
}
return RichTextEditorFeatureAll;
}
- (UIViewController *)firsAvailableViewControllerForRichTextEditorToolbar
{
return [self firstAvailableViewController];
}
@end
@@ -1,57 +0,0 @@
//
// RichTextEditorColorPickerViewController.h
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "UIView+RichTextEditor.h"
typedef enum {
RichTextEditorColorPickerActionTextForegroudColor,
RichTextEditorColorPickerActionTextBackgroundColor
}RichTextEditorColorPickerAction;
@protocol RichTextEditorColorPickerViewControllerDelegate <NSObject>
- (void)richTextEditorColorPickerViewControllerDidSelectColor:(UIColor *)color withAction:(RichTextEditorColorPickerAction)action;
- (void)richTextEditorColorPickerViewControllerDidSelectClose;
@end
@protocol RichTextEditorColorPickerViewControllerDataSource <NSObject>
- (BOOL)richTextEditorColorPickerViewControllerShouldDisplayToolbar;
@end
@interface RichTextEditorColorPickerViewController : UIViewController
@property (nonatomic, weak) id <RichTextEditorColorPickerViewControllerDelegate> delegate;
@property (nonatomic, weak) id <RichTextEditorColorPickerViewControllerDataSource> dataSource;
@property (nonatomic, assign) RichTextEditorColorPickerAction action;
@property (nonatomic, strong) UIImageView *colorsImageView;
@property (nonatomic, strong) UIView *selectedColorView;
- (IBAction)doneSelected:(id)sender;
- (IBAction)closeSelected:(id)sender;
@end
@@ -1,132 +0,0 @@
//
// RichTextEditorColorPickerViewController.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "RichTextEditorColorPickerViewController.h"
@implementation RichTextEditorColorPickerViewController
#pragma mark - VoewController Methods -
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UIButton *btnClose = [[UIButton alloc] initWithFrame:CGRectMake(5, 5, 60, 30)];
[btnClose addTarget:self action:@selector(closeSelected:) forControlEvents:UIControlEventTouchUpInside];
[btnClose.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];
[btnClose setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btnClose setTitle:@"Close" forState:UIControlStateNormal];
[self.view addSubview:btnClose];
UIButton *btnDone = [[UIButton alloc] initWithFrame:CGRectMake(65, 5, 60, 30)];
[btnDone addTarget:self action:@selector(doneSelected:) forControlEvents:UIControlEventTouchUpInside];
[btnDone.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];
[btnDone setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btnDone setTitle:@"Done" forState:UIControlStateNormal];
[self.view addSubview:btnDone];
self.selectedColorView = [[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 35 - 5, 5, 35, 30)];
self.selectedColorView.backgroundColor = [UIColor blackColor];
self.selectedColorView.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.selectedColorView.layer.borderWidth = 1;
self.selectedColorView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
[self.view addSubview:self.selectedColorView];
self.colorsImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"colors.jpg"]];;
self.colorsImageView.frame = CGRectMake(2, 40, self.view.frame.size.width-4, self.view.frame.size.height - 40 - 2);
self.colorsImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.colorsImageView.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.colorsImageView.layer.borderWidth = 1;
[self.view addSubview:self.colorsImageView];
if ([self.dataSource richTextEditorColorPickerViewControllerShouldDisplayToolbar])
{
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:toolbar];
UIBarButtonItem *flexibleSpaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
UIBarButtonItem *doneItem = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleDone
target:self
action:@selector(doneSelected:)];
UIBarButtonItem *closeItem = [[UIBarButtonItem alloc] initWithTitle:@"Close"
style:UIBarButtonItemStyleDone
target:self
action:@selector(closeSelected:)];
UIBarButtonItem *selectedColorItem = [[UIBarButtonItem alloc] initWithCustomView:self.selectedColorView];
[toolbar setItems:@[doneItem, selectedColorItem, flexibleSpaceItem , closeItem]];
[self.view addSubview:toolbar];
self.colorsImageView.frame = CGRectMake(2, 46, self.view.frame.size.width-4, self.view.frame.size.height - 46 - 2);
}
self.contentSizeForViewInPopover = CGSizeMake(300, 240);
}
#pragma mark - Private Methods -
- (void)populateColorsForPoint:(CGPoint)point
{
self.selectedColorView.backgroundColor = [self.colorsImageView colorOfPoint:point];
}
#pragma mark - IBActions -
- (IBAction)doneSelected:(id)sender
{
[self.delegate richTextEditorColorPickerViewControllerDidSelectColor:self.selectedColorView.backgroundColor withAction:self.action];
}
- (IBAction)closeSelected:(id)sender
{
[self.delegate richTextEditorColorPickerViewControllerDidSelectClose];
}
#pragma mark - Touch Detection -
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint locationPoint = [[touches anyObject] locationInView:self.colorsImageView];
[self populateColorsForPoint:locationPoint];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint locationPoint = [[touches anyObject] locationInView:self.colorsImageView];
[self populateColorsForPoint:locationPoint];
}
@end
@@ -1,47 +0,0 @@
//
// RichTextEditorFontViewController.h
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@protocol RichTextEditorFontPickerViewControllerDelegate <NSObject>
- (void)richTextEditorFontPickerViewControllerDidSelectFontWithName:(NSString *)fontName;
- (void)richTextEditorFontPickerViewControllerDidSelectClose;
@end
@protocol RichTextEditorFontPickerViewControllerDataSource <NSObject>
- (NSArray *)richTextEditorFontPickerViewControllerCustomFontFamilyNamesForSelection;
- (BOOL)richTextEditorFontPickerViewControllerShouldDisplayToolbar;
@end
@interface RichTextEditorFontPickerViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, weak) id <RichTextEditorFontPickerViewControllerDelegate> delegate;
@property (nonatomic, weak) id <RichTextEditorFontPickerViewControllerDataSource> dataSource;
@property (nonatomic, strong) UITableView *tableview;
@property (nonatomic, strong) NSArray *fontNames;
@end
@@ -1,123 +0,0 @@
//
// RichTextEditorFontViewController.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "RichTextEditorFontPickerViewController.h"
@implementation RichTextEditorFontPickerViewController
- (void)viewDidLoad
{
[super viewDidLoad];
NSArray *customizedFontFamilies = [self.dataSource richTextEditorFontPickerViewControllerCustomFontFamilyNamesForSelection];
if (customizedFontFamilies) {
self.fontNames = customizedFontFamilies;
} else {
self.fontNames = [[UIFont familyNames] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
}
if ([self.dataSource richTextEditorFontPickerViewControllerShouldDisplayToolbar])
{
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:toolbar];
UIBarButtonItem *flexibleSpaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
UIBarButtonItem *closeItem = [[UIBarButtonItem alloc] initWithTitle:@"Close"
style:UIBarButtonItemStyleDone
target:self
action:@selector(closeSelected:)];
[toolbar setItems:@[flexibleSpaceItem , closeItem]];
self.tableview.frame = CGRectMake(0, 44, self.view.frame.size.width, self.view.frame.size.height - 44);
}
else
{
self.tableview.frame = self.view.bounds;
}
[self.view addSubview:self.tableview];
self.contentSizeForViewInPopover = CGSizeMake(250, 400);
}
#pragma mark - IBActions -
- (void)closeSelected:(id)sender
{
[self.delegate richTextEditorFontPickerViewControllerDidSelectClose];
}
#pragma mark - UITableView Delegate & Datasrouce -
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.fontNames.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"FontSizeCell";
NSString *fontName = [self.fontNames objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.textLabel.text = fontName;
cell.textLabel.font = [UIFont fontWithName:fontName size:16];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *fontName = [self.fontNames objectAtIndex:indexPath.row];
[self.delegate richTextEditorFontPickerViewControllerDidSelectFontWithName:fontName];
}
#pragma mark - Setter & Getter -
- (UITableView *)tableview
{
if (!_tableview)
{
_tableview = [[UITableView alloc] initWithFrame:self.view.bounds];
_tableview.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
_tableview.delegate = self;
_tableview.dataSource = self;
}
return _tableview;
}
@end
@@ -1,47 +0,0 @@
//
// RichTextEditorFontSizePickerViewController.h
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@protocol RichTextEditorFontSizePickerViewControllerDelegate <NSObject>
- (void)richTextEditorFontSizePickerViewControllerDidSelectFontSize:(NSNumber *)fontSize;
- (void)richTextEditorFontSizePickerViewControllerDidSelectClose;
@end
@protocol RichTextEditorFontSizePickerViewControllerDataSource <NSObject>
- (BOOL)richTextEditorFontSizePickerViewControllerShouldDisplayToolbar;
- (NSArray *)richTextEditorFontSizePickerViewControllerCustomFontSizesForSelection;
@end
@interface RichTextEditorFontSizePickerViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, weak) id<RichTextEditorFontSizePickerViewControllerDelegate> delegate;
@property (nonatomic, weak) id<RichTextEditorFontSizePickerViewControllerDataSource> dataSource;
@property (nonatomic, strong) UITableView *tableview;
@property (nonatomic, strong) NSArray *fontSizes;
@end
@@ -1,122 +0,0 @@
//
// RichTextEditorFontSizePickerViewController.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "RichTextEditorFontSizePickerViewController.h"
@implementation RichTextEditorFontSizePickerViewController
- (void)viewDidLoad
{
[super viewDidLoad];
NSArray *customizedFontSizes = [self.dataSource richTextEditorFontSizePickerViewControllerCustomFontSizesForSelection];
if (customizedFontSizes)
self.fontSizes = customizedFontSizes;
else
self.fontSizes = @[@8, @10, @12, @14, @16, @18, @20, @22, @24, @26, @28, @30];
if ([self.dataSource richTextEditorFontSizePickerViewControllerShouldDisplayToolbar])
{
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:toolbar];
UIBarButtonItem *flexibleSpaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
UIBarButtonItem *closeItem = [[UIBarButtonItem alloc] initWithTitle:@"Close"
style:UIBarButtonItemStyleDone
target:self
action:@selector(closeSelected:)];
[toolbar setItems:@[flexibleSpaceItem , closeItem]];
self.tableview.frame = CGRectMake(0, 44, self.view.frame.size.width, self.view.frame.size.height - 44);
}
else
{
self.tableview.frame = self.view.bounds;
}
[self.view addSubview:self.tableview];
self.contentSizeForViewInPopover = CGSizeMake(100, 400);
}
#pragma mark - IBActions -
- (void)closeSelected:(id)sender
{
[self.delegate richTextEditorFontSizePickerViewControllerDidSelectClose];
}
#pragma mark - UITableView Delegate & Datasrouce -
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.fontSizes.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"FontSizeCell";
NSNumber *fontSize = [self.fontSizes objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.textLabel.text = fontSize.stringValue;
cell.textLabel.font = [UIFont boldSystemFontOfSize:fontSize.intValue];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSNumber *fontSize = [self.fontSizes objectAtIndex:indexPath.row];
[self.delegate richTextEditorFontSizePickerViewControllerDidSelectFontSize:fontSize];
}
#pragma mark - Setter & Getter -
- (UITableView *)tableview
{
if (!_tableview)
{
_tableview = [[UITableView alloc] initWithFrame:self.view.bounds];
_tableview.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_tableview.delegate = self;
_tableview.dataSource = self;
}
return _tableview;
}
@end
@@ -1,36 +0,0 @@
//
// RichTextEditorTogleButton.h
// RichTextEditor
//
// Created by Aryan Gh on 7/27/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface RichTextEditorToggleButton : UIButton
@property (nonatomic, assign) BOOL on;
- (id)init;
@end
@@ -1,55 +0,0 @@
//
// RichTextEditorTogleButton.m
// RichTextEditor
//
// Created by Aryan Gh on 7/27/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "RichTextEditorToggleButton.h"
@implementation RichTextEditorToggleButton
- (id)init
{
if (self = [super init])
{
self.on = NO;
[self setBackgroundImage:[UIImage imageNamed:@"buttonSelected.png"] forState:UIControlStateHighlighted];
}
return self;
}
- (void)setOn:(BOOL)on
{
_on = on;
[self setBackgroundImage:[self imageForState] forState:UIControlStateNormal];
}
- (UIImage *)imageForState
{
return (self.on) ? [UIImage imageNamed:@"buttonSelected.png"] :nil;
}
@end
@@ -1,90 +0,0 @@
//
// RichTextEditorToolbar.h
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
typedef enum{
RichTextEditorToolbarPresentationStyleModal,
RichTextEditorToolbarPresentationStylePopover
}RichTextEditorToolbarPresentationStyle;
typedef enum{
ParagraphIndentationIncrease,
ParagraphIndentationDecrease
}ParagraphIndentation;
typedef enum{
RichTextEditorFeatureNone = 0,
RichTextEditorFeatureFont = 1 << 0,
RichTextEditorFeatureFontSize = 1 << 1,
RichTextEditorFeatureBold = 1 << 2,
RichTextEditorFeatureItalic = 1 << 3,
RichTextEditorFeatureUnderline = 1 << 4,
RichTextEditorFeatureStrikeThrough = 1 << 5,
RichTextEditorFeatureTextAlignmentLeft = 1 << 6,
RichTextEditorFeatureTextAlignmentCenter = 1 << 7,
RichTextEditorFeatureTextAlignmentRight = 1 << 8,
RichTextEditorFeatureTextAlignmentJustified = 1 << 9,
RichTextEditorFeatureTextBackgroundColor = 1 << 10,
RichTextEditorFeatureTextForegroundColor = 1 << 11,
RichTextEditorFeatureParagraphIndentation = 1 << 12,
RichTextEditorFeatureAll = 1 << 13
}RichTextEditorFeature;
@protocol RichTextEditorToolbarDelegate <UIScrollViewDelegate>
- (void)richTextEditorToolbarDidSelectBold;
- (void)richTextEditorToolbarDidSelectItalic;
- (void)richTextEditorToolbarDidSelectUnderline;
- (void)richTextEditorToolbarDidSelectStrikeThrough;
- (void)richTextEditorToolbarDidSelectBulletPoint;
- (void)richTextEditorToolbarDidSelectParagraphIndentation:(ParagraphIndentation)paragraphIndentation;
- (void)richTextEditorToolbarDidSelectFontSize:(NSNumber *)fontSize;
- (void)richTextEditorToolbarDidSelectFontWithName:(NSString *)fontName;
- (void)richTextEditorToolbarDidSelectTextBackgroundColor:(UIColor *)color;
- (void)richTextEditorToolbarDidSelectTextForegroundColor:(UIColor *)color;
- (void)richTextEditorToolbarDidSelectTextAlignment:(NSTextAlignment)textAlignment;
@end
@protocol RichTextEditorToolbarDataSource <NSObject>
- (NSArray *)fontSizeSelectionForRichTextEditorToolbar;
- (NSArray *)fontFamilySelectionForRichTextEditorToolbar;
- (RichTextEditorToolbarPresentationStyle)presentarionStyleForRichTextEditorToolbar;
- (UIModalPresentationStyle)modalPresentationStyleForRichTextEditorToolbar;
- (UIModalTransitionStyle)modalTransitionStyleForRichTextEditorToolbar;
- (UIViewController *)firsAvailableViewControllerForRichTextEditorToolbar;
- (RichTextEditorFeature)featuresEnabledForRichTextEditorToolbar;
@end
@interface RichTextEditorToolbar : UIScrollView
@property (nonatomic, weak) id <RichTextEditorToolbarDelegate> delegate;
@property (nonatomic, weak) id <RichTextEditorToolbarDataSource> dataSource;
- (id)initWithFrame:(CGRect)frame delegate:(id <RichTextEditorToolbarDelegate>)delegate dataSource:(id <RichTextEditorToolbarDataSource>)dataSource;
- (void)updateStateWithAttributes:(NSDictionary *)attributes;
@end
@@ -1,571 +0,0 @@
//
// RichTextEditorToolbar.m
// RichTextEdtor
//
// Created by Aryan Gh on 7/21/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
// https://github.com/aryaxt/iOS-Rich-Text-Editor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "RichTextEditorToolbar.h"
#import <CoreText/CoreText.h>
#import "RichTextEditorPopover.h"
#import "RichTextEditorFontSizePickerViewController.h"
#import "RichTextEditorFontPickerViewController.h"
#import "RichTextEditorColorPickerViewController.h"
#import "WEPopoverController.h"
#import "RichTextEditorToggleButton.h"
#import "UIFont+RichTextEditor.h"
#define ITEM_SEPARATOR_SPACE 5
#define ITEM_TOP_AND_BOTTOM_BORDER 5
#define ITEM_WITH 40
@interface RichTextEditorToolbar() <RichTextEditorFontSizePickerViewControllerDelegate, RichTextEditorFontSizePickerViewControllerDataSource, RichTextEditorFontPickerViewControllerDelegate, RichTextEditorFontPickerViewControllerDataSource, RichTextEditorColorPickerViewControllerDataSource, RichTextEditorColorPickerViewControllerDelegate>
@property (nonatomic, strong) id <RichTextEditorPopover> popover;
@property (nonatomic, strong) RichTextEditorToggleButton *btnBold;
@property (nonatomic, strong) RichTextEditorToggleButton *btnItalic;
@property (nonatomic, strong) RichTextEditorToggleButton *btnUnderline;
@property (nonatomic, strong) RichTextEditorToggleButton *btnStrikeThrough;
@property (nonatomic, strong) RichTextEditorToggleButton *btnFontSize;
@property (nonatomic, strong) RichTextEditorToggleButton *btnFont;
@property (nonatomic, strong) RichTextEditorToggleButton *btnBackgroundColor;
@property (nonatomic, strong) RichTextEditorToggleButton *btnForegroundColor;
@property (nonatomic, strong) RichTextEditorToggleButton *btnTextAlignmentLeft;
@property (nonatomic, strong) RichTextEditorToggleButton *btnTextAlignmentCenter;
@property (nonatomic, strong) RichTextEditorToggleButton *btnTextAlignmentRight;
@property (nonatomic, strong) RichTextEditorToggleButton *btnTextAlignmentJustified;
@property (nonatomic, strong) RichTextEditorToggleButton *btnParagraphIndent;
@property (nonatomic, strong) RichTextEditorToggleButton *btnParagraphOutdent;
@property (nonatomic, strong) RichTextEditorToggleButton *btnBulletPoint;
@end
@implementation RichTextEditorToolbar
#pragma mark - Initialization -
- (id)initWithFrame:(CGRect)frame delegate:(id <RichTextEditorToolbarDelegate>)delegate dataSource:(id <RichTextEditorToolbarDataSource>)dataSource
{
if (self = [super initWithFrame:frame])
{
self.delegate = delegate;
self.dataSource = dataSource;
self.backgroundColor = [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1];
self.layer.borderWidth = .7;
self.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.btnFont = [self buttonWithImageNamed:@"dropDownTriangle.png"
width:120
andSelector:@selector(fontSelected:)];
[self.btnFont setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 10)];
[self.btnFont setTitle:@"Font" forState:UIControlStateNormal];
self.btnFontSize = [self buttonWithImageNamed:@"dropDownTriangle.png"
width:50
andSelector:@selector(fontSizeSelected:)];
[self.btnFontSize setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 10)];
[self.btnFontSize setTitle:@"14" forState:UIControlStateNormal];
self.btnBold = [self buttonWithImageNamed:@"bold.png"
andSelector:@selector(boldSelected:)];
self.btnItalic = [self buttonWithImageNamed:@"italic.png"
andSelector:@selector(italicSelected:)];
self.btnUnderline = [self buttonWithImageNamed:@"underline.png"
andSelector:@selector(underLineSelected:)];
self.btnStrikeThrough = [self buttonWithImageNamed:@"strikethrough"
andSelector:@selector(strikeThroughSelected:)];
self.btnTextAlignmentLeft = [self buttonWithImageNamed:@"justifyleft.png"
andSelector:@selector(textAlignmentSelected:)];
self.btnTextAlignmentCenter = [self buttonWithImageNamed:@"justifycenter.png"
andSelector:@selector(textAlignmentSelected:)];
self.btnTextAlignmentRight = [self buttonWithImageNamed:@"justifyright.png"
andSelector:@selector(textAlignmentSelected:)];
self.btnTextAlignmentJustified = [self buttonWithImageNamed:@"justifyfull.png"
andSelector:@selector(textAlignmentSelected:)];
self.btnForegroundColor = [self buttonWithImageNamed:@"forecolor.png"
andSelector:@selector(textForegroundColorSelected:)];
self.btnBackgroundColor = [self buttonWithImageNamed:@"backcolor.png"
andSelector:@selector(textBackgroundColorSelected:)];
self.btnBulletPoint = [self buttonWithImageNamed:@"bullist.png"
andSelector:@selector(bulletPointSelected:)];
self.btnParagraphIndent = [self buttonWithImageNamed:@"indent.png"
andSelector:@selector(paragraphIndentSelected:)];
self.btnParagraphOutdent = [self buttonWithImageNamed:@"outdent.png"
andSelector:@selector(paragraphOutdentSelected:)];
RichTextEditorFeature features = [self.dataSource featuresEnabledForRichTextEditorToolbar];
UIView *lastAddedView = nil;
self.hidden = (features & RichTextEditorFeatureNone) ? YES : NO;
// Add Font
if (features & RichTextEditorFeatureFont || features & RichTextEditorFeatureAll)
{
UIView *separatorView = [self separatorView];
[self addView:self.btnFont afterView:lastAddedView withSpacing:YES];
[self addView:separatorView afterView:self.btnFont withSpacing:YES];
lastAddedView = separatorView;
}
if (features & RichTextEditorFeatureFontSize || features & RichTextEditorFeatureAll)
{
UIView *separatorView = [self separatorView];
[self addView:self.btnFontSize afterView:lastAddedView withSpacing:YES];
[self addView:separatorView afterView:self.btnFontSize withSpacing:YES];
lastAddedView = separatorView;
}
if (features & RichTextEditorFeatureBold || features & RichTextEditorFeatureAll)
{
[self addView:self.btnBold afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnBold;
}
if (features & RichTextEditorFeatureItalic || features & RichTextEditorFeatureAll)
{
[self addView:self.btnItalic afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnItalic;
}
if (features & RichTextEditorFeatureUnderline || features & RichTextEditorFeatureAll)
{
[self addView:self.btnUnderline afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnUnderline;
}
if (features & RichTextEditorFeatureStrikeThrough || features & RichTextEditorFeatureAll)
{
[self addView:self.btnStrikeThrough afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnStrikeThrough;
}
if (features & RichTextEditorFeatureBold || features & RichTextEditorFeatureItalic || features & RichTextEditorFeatureUnderline || features & RichTextEditorFeatureStrikeThrough || features & RichTextEditorFeatureAll)
{
UIView *separatorView = [self separatorView];
[self addView:separatorView afterView:lastAddedView withSpacing:YES];
lastAddedView = separatorView;
}
if (features & RichTextEditorFeatureTextAlignmentLeft || features & RichTextEditorFeatureAll)
{
[self addView:self.btnTextAlignmentLeft afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnTextAlignmentLeft;
}
if (features & RichTextEditorFeatureTextAlignmentCenter || features & RichTextEditorFeatureAll)
{
[self addView:self.btnTextAlignmentCenter afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnTextAlignmentCenter;
}
if (features & RichTextEditorFeatureTextAlignmentRight || features & RichTextEditorFeatureAll)
{
[self addView:self.btnTextAlignmentRight afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnTextAlignmentRight;
}
if (features & RichTextEditorFeatureTextAlignmentJustified || features & RichTextEditorFeatureAll)
{
[self addView:self.btnTextAlignmentJustified afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnTextAlignmentJustified;
}
if (features & RichTextEditorFeatureTextAlignmentLeft || features & RichTextEditorFeatureTextAlignmentCenter || features & RichTextEditorFeatureTextAlignmentRight || features & RichTextEditorFeatureTextAlignmentJustified || features & RichTextEditorFeatureAll)
{
UIView *separatorView = [self separatorView];
[self addView:separatorView afterView:lastAddedView withSpacing:YES];
lastAddedView = separatorView;
}
if (features & RichTextEditorFeatureParagraphIndentation || features & RichTextEditorFeatureAll)
{
[self addView:self.btnParagraphOutdent afterView:lastAddedView withSpacing:YES];
[self addView:self.btnParagraphIndent afterView:self.btnParagraphOutdent withSpacing:YES];
UIView *separatorView = [self separatorView];
[self addView:separatorView afterView:self.btnParagraphIndent withSpacing:YES];
lastAddedView = separatorView;
}
if (features & RichTextEditorFeatureTextBackgroundColor || features & RichTextEditorFeatureAll)
{
[self addView:self.btnBackgroundColor afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnBackgroundColor;
}
if (features & RichTextEditorFeatureTextForegroundColor || features & RichTextEditorFeatureAll)
{
[self addView:self.btnForegroundColor afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnForegroundColor;
}
if (features & RichTextEditorFeatureTextBackgroundColor || features & RichTextEditorFeatureTextForegroundColor || features & RichTextEditorFeatureAll)
{
UIView *separatorView = [self separatorView];
[self addView:separatorView afterView:lastAddedView withSpacing:YES];
lastAddedView = separatorView;
}
/*if (features & RichTextEditorFeatureBulletPoint || features & RichTextEditorFeatureAll)
{
[self addView:self.btnBulletPoint afterView:lastAddedView withSpacing:YES];
lastAddedView = self.btnBulletPoint;
}*/
}
return self;
}
#pragma mark - Public Methods -
- (void)updateStateWithAttributes:(NSDictionary *)attributes
{
UIFont *font = [attributes objectForKey:NSFontAttributeName];
NSParagraphStyle *paragraphTyle = [attributes objectForKey:NSParagraphStyleAttributeName];
[self.btnFontSize setTitle:[NSString stringWithFormat:@"%.f", font.pointSize] forState:UIControlStateNormal];
[self.btnFont setTitle:font.familyName forState:UIControlStateNormal];
self.btnBold.on = [font isBold];
self.btnItalic.on = [font isItalic];
self.btnTextAlignmentLeft.on = NO;
self.btnTextAlignmentCenter.on = NO;
self.btnTextAlignmentRight.on = NO;
self.btnTextAlignmentJustified.on = NO;
switch (paragraphTyle.alignment)
{
case NSTextAlignmentLeft:
self.btnTextAlignmentLeft.on = YES;
break;
case NSTextAlignmentCenter:
self.btnTextAlignmentCenter.on = YES;
break;
case NSTextAlignmentRight:
self.btnTextAlignmentRight.on = YES;
break;
case NSTextAlignmentJustified:
self.btnTextAlignmentJustified.on = YES;
break;
default:
self.btnTextAlignmentLeft.on = YES;
break;
}
NSNumber *existingUnderlineStyle = [attributes objectForKey:NSUnderlineStyleAttributeName];
self.btnUnderline.on = (!existingUnderlineStyle || existingUnderlineStyle.intValue == NSUnderlineStyleNone) ? NO :YES;
NSNumber *existingStrikeThrough = [attributes objectForKey:NSStrikethroughStyleAttributeName];
self.btnStrikeThrough.on = (!existingStrikeThrough || existingStrikeThrough.intValue == NSUnderlineStyleNone) ? NO :YES;
}
#pragma mark - IBActions -
- (void)boldSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectBold];
}
- (void)italicSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectItalic];
}
- (void)underLineSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectUnderline];
}
- (void)strikeThroughSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectStrikeThrough];
}
- (void)bulletPointSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectBulletPoint];
}
- (void)paragraphIndentSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectParagraphIndentation:ParagraphIndentationIncrease];
}
- (void)paragraphOutdentSelected:(UIButton *)sender
{
[self.delegate richTextEditorToolbarDidSelectParagraphIndentation:ParagraphIndentationDecrease];
}
- (void)fontSizeSelected:(UIButton *)sender
{
RichTextEditorFontSizePickerViewController *fontSizePicker = [[RichTextEditorFontSizePickerViewController alloc] init];
fontSizePicker.delegate = self;
fontSizePicker.dataSource = self;
[self presentViewController:fontSizePicker fromView:sender];
}
- (void)fontSelected:(UIButton *)sender
{
RichTextEditorFontPickerViewController *fontPicker= [[RichTextEditorFontPickerViewController alloc] init];
fontPicker.fontNames = [self.dataSource fontFamilySelectionForRichTextEditorToolbar];
fontPicker.delegate = self;
fontPicker.dataSource = self;
[self presentViewController:fontPicker fromView:sender];
}
- (void)textBackgroundColorSelected:(UIButton *)sender
{
RichTextEditorColorPickerViewController *colorPicker = [[RichTextEditorColorPickerViewController alloc] init];
colorPicker.action = RichTextEditorColorPickerActionTextBackgroundColor;
colorPicker.delegate = self;
colorPicker.dataSource = self;
[self presentViewController:colorPicker fromView:sender];
}
- (void)textForegroundColorSelected:(UIButton *)sender
{
RichTextEditorColorPickerViewController *colorPicker = [[RichTextEditorColorPickerViewController alloc] init];
colorPicker.action = RichTextEditorColorPickerActionTextForegroudColor;
colorPicker.delegate = self;
colorPicker.dataSource = self;
[self presentViewController:colorPicker fromView:sender];
}
- (void)textAlignmentSelected:(UIButton *)sender
{
NSTextAlignment textAlignment;
if (sender == self.btnTextAlignmentLeft)
textAlignment = NSTextAlignmentLeft;
else if (sender == self.btnTextAlignmentCenter)
textAlignment = NSTextAlignmentCenter;
else if (sender == self.btnTextAlignmentRight)
textAlignment = NSTextAlignmentRight;
else if (sender == self.btnTextAlignmentJustified)
textAlignment = NSTextAlignmentJustified;
[self.delegate richTextEditorToolbarDidSelectTextAlignment:textAlignment];
}
#pragma mark - Private Methods -
- (RichTextEditorToggleButton *)buttonWithImageNamed:(NSString *)image width:(NSInteger)width andSelector:(SEL)selector
{
RichTextEditorToggleButton *button = [[RichTextEditorToggleButton alloc] init];
[button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(0, 0, width, 0)];
[button.titleLabel setFont:[UIFont boldSystemFontOfSize:10]];
[button.titleLabel setTextColor:[UIColor blackColor]];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
return button;
}
- (RichTextEditorToggleButton *)buttonWithImageNamed:(NSString *)image andSelector:(SEL)selector
{
return [self buttonWithImageNamed:image width:ITEM_WITH andSelector:selector];
}
- (UIView *)separatorView
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, self.frame.size.height)];
view.backgroundColor = [UIColor lightGrayColor];
return view;
}
- (void)addView:(UIView *)view afterView:(UIView *)otherView withSpacing:(BOOL)space
{
CGRect otherViewRect = (otherView) ? otherView.frame : CGRectZero;
CGRect rect = view.frame;
rect.origin.x = otherViewRect.size.width + otherViewRect.origin.x;
if (space)
rect.origin.x += ITEM_SEPARATOR_SPACE;
rect.origin.y = ITEM_TOP_AND_BOTTOM_BORDER;
rect.size.height = self.frame.size.height - (2*ITEM_TOP_AND_BOTTOM_BORDER);
view.frame = rect;
view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
[self addSubview:view];
[self updateContentSize];
}
- (void)updateContentSize
{
NSInteger maxViewlocation = 0;
for (UIView *view in self.subviews)
{
NSInteger endLocation = view.frame.size.width + view.frame.origin.x;
if (endLocation > maxViewlocation)
maxViewlocation = endLocation;
}
self.contentSize = CGSizeMake(maxViewlocation+ITEM_SEPARATOR_SPACE, self.frame.size.height);
}
- (void)presentViewController:(UIViewController *)viewController fromView:(UIView *)view
{
if ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStyleModal)
{
viewController.modalPresentationStyle = [self.dataSource modalPresentationStyleForRichTextEditorToolbar];
viewController.modalTransitionStyle = [self.dataSource modalTransitionStyleForRichTextEditorToolbar];
[[self.dataSource firsAvailableViewControllerForRichTextEditorToolbar] presentViewController:viewController animated:YES completion:nil];
}
else if ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStylePopover)
{
id <RichTextEditorPopover> popover = [self popoverWithViewController:viewController];
[popover presentPopoverFromRect:view.frame inView:self permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
}
- (id <RichTextEditorPopover>)popoverWithViewController:(UIViewController *)viewController
{
id <RichTextEditorPopover> popover;
if (!popover)
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
popover = (id<RichTextEditorPopover>) [[UIPopoverController alloc] initWithContentViewController:viewController];
}
else
{
popover = (id<RichTextEditorPopover>) [[WEPopoverController alloc] initWithContentViewController:viewController];
}
}
[self.popover dismissPopoverAnimated:YES];
self.popover = popover;
return popover;
}
- (void)dismissViewController
{
if ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStyleModal)
{
[[self.dataSource firsAvailableViewControllerForRichTextEditorToolbar] dismissViewControllerAnimated:YES completion:NO];
}
else if ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStylePopover)
{
[self.popover dismissPopoverAnimated:YES];
}
}
#pragma mark - RichTextEditorColorPickerViewControllerDelegate & RichTextEditorColorPickerViewControllerDataSource Methods -
- (void)richTextEditorColorPickerViewControllerDidSelectColor:(UIColor *)color withAction:(RichTextEditorColorPickerAction)action
{
if (action == RichTextEditorColorPickerActionTextBackgroundColor)
{
[self.delegate richTextEditorToolbarDidSelectTextBackgroundColor:color];
}
else
{
[self.delegate richTextEditorToolbarDidSelectTextForegroundColor:color];
}
[self dismissViewController];
}
- (void)richTextEditorColorPickerViewControllerDidSelectClose
{
[self dismissViewController];
}
- (BOOL)richTextEditorColorPickerViewControllerShouldDisplayToolbar
{
return ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStyleModal) ? YES: NO;
}
#pragma mark - RichTextEditorFontSizePickerViewControllerDelegate & RichTextEditorFontSizePickerViewControllerDataSource Methods -
- (void)richTextEditorFontSizePickerViewControllerDidSelectFontSize:(NSNumber *)fontSize
{
[self.delegate richTextEditorToolbarDidSelectFontSize:fontSize];
[self dismissViewController];
}
- (void)richTextEditorFontSizePickerViewControllerDidSelectClose
{
[self dismissViewController];
}
- (BOOL)richTextEditorFontSizePickerViewControllerShouldDisplayToolbar
{
return ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStyleModal) ? YES: NO;
}
- (NSArray *)richTextEditorFontSizePickerViewControllerCustomFontSizesForSelection
{
return [self.dataSource fontSizeSelectionForRichTextEditorToolbar];
}
#pragma mark - RichTextEditorFontPickerViewControllerDelegate & RichTextEditorFontPickerViewControllerDataSource Methods -
- (void)richTextEditorFontPickerViewControllerDidSelectFontWithName:(NSString *)fontName
{
[self.delegate richTextEditorToolbarDidSelectFontWithName:fontName];
[self dismissViewController];
}
- (void)richTextEditorFontPickerViewControllerDidSelectClose
{
[self dismissViewController];
}
- (NSArray *)richTextEditorFontPickerViewControllerCustomFontFamilyNamesForSelection
{
return [self.dataSource fontFamilySelectionForRichTextEditorToolbar];
}
- (BOOL)richTextEditorFontPickerViewControllerShouldDisplayToolbar
{
return ([self.dataSource presentarionStyleForRichTextEditorToolbar] == RichTextEditorToolbarPresentationStyleModal) ? YES: NO;
}
@end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Some files were not shown because too many files have changed in this diff Show More