diff --git a/Example/Podfile.lock b/Example/Podfile.lock index c840883..04545c5 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -35,7 +35,7 @@ PODS: - NSObject-SafeExpectations (0.0.2) - Specta (1.0.5) - UIAlertView+Blocks (0.9) - - WordPress-Editor-iOS-Extension (0.1.2): + - WordPress-Editor-iOS-Extension (0.1.3): - NSObject-SafeExpectations - UIAlertView+Blocks - WordPress-iOS-Shared @@ -67,7 +67,7 @@ SPEC CHECKSUMS: NSObject-SafeExpectations: 7d7f48df90df4e11da7cfe86b64f45eff7a7f521 Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 UIAlertView+Blocks: a46c99c5144f6c5dbc7d62fd2a0678daceec89a3 - WordPress-Editor-iOS-Extension: b0be70c3215bb285596f56d25278f69cd664b246 + WordPress-Editor-iOS-Extension: 03bb68160766a8c12df9080ae0119de9da1f6b83 WordPress-iOS-Shared: 50a7bd7056b8721e86c3cbe167eab49ef85ec07b WordPressCom-Analytics-iOS: 5daf418f358bf6ae72f14824e7e90c74d95631a6 WYPopoverController: a9db25ac2841a686acdc0f3a99bdb21545db32f4 diff --git a/Example/Pods/Local Podspecs/WordPress-Editor-iOS-Extension.podspec.json b/Example/Pods/Local Podspecs/WordPress-Editor-iOS-Extension.podspec.json index 79bbcbc..934f6e9 100644 --- a/Example/Pods/Local Podspecs/WordPress-Editor-iOS-Extension.podspec.json +++ b/Example/Pods/Local Podspecs/WordPress-Editor-iOS-Extension.podspec.json @@ -1,6 +1,6 @@ { "name": "WordPress-Editor-iOS-Extension", - "version": "0.1.2", + "version": "0.1.3", "summary": "Reusable component rich text editor for WordPress.com in an iOS application.", "description": "Reusable component rich text editor for WordPress.com in an iOS application.And can allow users to customize the editor toolbar.", "homepage": "https://github.com/pzhtpf/WordPress-Editor-iOS-Extension", @@ -10,7 +10,7 @@ }, "source": { "git": "https://github.com/pzhtpf/WordPress-Editor-iOS-Extension.git", - "tag": "0.1.2" + "tag": "0.1.3" }, "platforms": { "ios": "8.0" diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index c840883..04545c5 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -35,7 +35,7 @@ PODS: - NSObject-SafeExpectations (0.0.2) - Specta (1.0.5) - UIAlertView+Blocks (0.9) - - WordPress-Editor-iOS-Extension (0.1.2): + - WordPress-Editor-iOS-Extension (0.1.3): - NSObject-SafeExpectations - UIAlertView+Blocks - WordPress-iOS-Shared @@ -67,7 +67,7 @@ SPEC CHECKSUMS: NSObject-SafeExpectations: 7d7f48df90df4e11da7cfe86b64f45eff7a7f521 Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 UIAlertView+Blocks: a46c99c5144f6c5dbc7d62fd2a0678daceec89a3 - WordPress-Editor-iOS-Extension: b0be70c3215bb285596f56d25278f69cd664b246 + WordPress-Editor-iOS-Extension: 03bb68160766a8c12df9080ae0119de9da1f6b83 WordPress-iOS-Shared: 50a7bd7056b8721e86c3cbe167eab49ef85ec07b WordPressCom-Analytics-iOS: 5daf418f358bf6ae72f14824e7e90c74d95631a6 WYPopoverController: a9db25ac2841a686acdc0f3a99bdb21545db32f4 diff --git a/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/Info.plist b/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/Info.plist index 7c241fa..9fb50da 100644 --- a/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/Info.plist +++ b/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.1.2 + 0.1.3 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/ResourceBundle-WordPress-Editor-iOS-Extension-Info.plist b/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/ResourceBundle-WordPress-Editor-iOS-Extension-Info.plist index 1c9272a..79719ac 100644 --- a/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/ResourceBundle-WordPress-Editor-iOS-Extension-Info.plist +++ b/Example/Pods/Target Support Files/WordPress-Editor-iOS-Extension/ResourceBundle-WordPress-Editor-iOS-Extension-Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.1.2 + 0.1.3 CFBundleSignature ???? CFBundleVersion diff --git a/Example/WordPress-Editor-iOS-Extension/WPViewController.m b/Example/WordPress-Editor-iOS-Extension/WPViewController.m index a6e8cf8..773db2f 100755 --- a/Example/WordPress-Editor-iOS-Extension/WPViewController.m +++ b/Example/WordPress-Editor-iOS-Extension/WPViewController.m @@ -107,28 +107,31 @@ - (IBAction)publishedAction:(id)sender { if(_viewModel.title.length == 0){ -// _alartViewController = [[AlartViewController alloc] initTitle:NSLocalizedString(@"pleaseInputTitle",@"请输入标题") positiveButton:nil negativeButton:NSLocalizedString(@"sure", @"确认") showCloseButton:NO]; -// _alartViewController.expendAbleAlartViewDelegate = self; -// _alartViewController.view.tag = 3; -// [_alartViewController showView:^(BOOL finished){}]; + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"pleaseInputTitle",@"请输入标题") message:NSLocalizedString(@"pleaseInputTitle",@"请输入标题") delegate:nil cancelButtonTitle:NSLocalizedString(@"sure", @"确认") otherButtonTitles:nil, nil]; + + [alertView show]; return; } - if(_viewModel.content.length>0){ + if(_viewModel.content.length==0){ + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"pleaseInputMessage",@"请输入内容") message:NSLocalizedString(@"pleaseInputMessage",@"请输入内容") delegate:nil cancelButtonTitle:NSLocalizedString(@"sure", @"确认") otherButtonTitles:nil, nil]; + + [alertView show]; + return; } else{ - - - return; + _viewModel.cover_image_url = [self.editorView getCoverImage]; + NSArray *allImage = [self.editorView getAllImage]; + NSLog(@"Image Count:%ld",allImage.count); } diff --git a/WordPress-Editor-iOS-Extension/Assets/ZSSRichTextEditor.js b/WordPress-Editor-iOS-Extension/Assets/ZSSRichTextEditor.js index d85374c..9aa7ae5 100755 --- a/WordPress-Editor-iOS-Extension/Assets/ZSSRichTextEditor.js +++ b/WordPress-Editor-iOS-Extension/Assets/ZSSRichTextEditor.js @@ -2785,7 +2785,23 @@ ZSSEditor.getCoverImage = function(){ coverImageUrl = coverImage.attr("src"); return coverImageUrl; -} +}; + +ZSSEditor.getAllImage = function(){ + + var imageUrl = ""; + + $("img").each(function(){ + + imageUrl = imageUrl + $(this).attr("src")+";"; + + }); + + return imageUrl; +}; + + + // MARK: - Wrapped Object diff --git a/WordPress-Editor-iOS-Extension/Assets/editor.html b/WordPress-Editor-iOS-Extension/Assets/editor.html index c0fbb9d..b5a556e 100755 --- a/WordPress-Editor-iOS-Extension/Assets/editor.html +++ b/WordPress-Editor-iOS-Extension/Assets/editor.html @@ -75,5 +75,6 @@
+ diff --git a/WordPress-Editor-iOS-Extension/Classes/WPEditorToolbarButton.m b/WordPress-Editor-iOS-Extension/Classes/WPEditorToolbarButton.m index 14a264a..015fc19 100644 --- a/WordPress-Editor-iOS-Extension/Classes/WPEditorToolbarButton.m +++ b/WordPress-Editor-iOS-Extension/Classes/WPEditorToolbarButton.m @@ -1,5 +1,4 @@ #import "WPEditorToolbarButton.h" -//#import @import WordPressShared; static NSString* const CircleLayerKey = @"circleLayer"; diff --git a/WordPress-Editor-iOS-Extension/Classes/WPEditorView.h b/WordPress-Editor-iOS-Extension/Classes/WPEditorView.h index 22e0b1c..728b285 100644 --- a/WordPress-Editor-iOS-Extension/Classes/WPEditorView.h +++ b/WordPress-Editor-iOS-Extension/Classes/WPEditorView.h @@ -474,4 +474,5 @@ stylesForCurrentSelection:(NSArray*)styles; - (void)heading6; - (void)removeFormat; - (NSString *)getCoverImage; +- (NSArray *)getAllImage; @end diff --git a/WordPress-Editor-iOS-Extension/Classes/WPEditorView.m b/WordPress-Editor-iOS-Extension/Classes/WPEditorView.m index 416e0a2..1c9c05a 100644 --- a/WordPress-Editor-iOS-Extension/Classes/WPEditorView.m +++ b/WordPress-Editor-iOS-Extension/Classes/WPEditorView.m @@ -1992,7 +1992,26 @@ - (NSString *)getCoverImage return [self.webView stringByEvaluatingJavaScriptFromString:trigger]; } - +- (NSArray *)getAllImage +{ + NSString *trigger = @"ZSSEditor.getAllImage();"; + + [self callDelegateEditorTextDidChange]; + + NSString *imageUrl = [self.webView stringByEvaluatingJavaScriptFromString:trigger]; + + NSArray *arrayUrl = [imageUrl componentsSeparatedByString:@";"]; + + NSMutableArray *mutableArrayUrl = [NSMutableArray new]; + + for (NSString *url in arrayUrl) { + + if(url.length>0) + [mutableArrayUrl addObject:url]; + } + + return mutableArrayUrl; +} #pragma mark - UITextViewDelegate diff --git a/WordPress-Editor-iOS-Extension/Classes/WPEditorViewController.m b/WordPress-Editor-iOS-Extension/Classes/WPEditorViewController.m index 80d88c6..ab4e411 100644 --- a/WordPress-Editor-iOS-Extension/Classes/WPEditorViewController.m +++ b/WordPress-Editor-iOS-Extension/Classes/WPEditorViewController.m @@ -554,7 +554,7 @@ - (ZSSBarButtonItem*)alignLeftBarButton { ZSSBarButtonItem *barButtonItem = [self barButtonItemWithTag:kWPEditorViewControllerElementTagJustifyLeftBarButton htmlProperty:@"justifyLeft" - imageName:@"ZSSleftjustify" + imageName:@"ZSSleftjustify@2x" target:self selector:@selector(alignLeft) accessibilityLabel:nil]; @@ -566,7 +566,7 @@ - (UIBarButtonItem*)alignCenterBarButton { ZSSBarButtonItem *barButtonItem = [self barButtonItemWithTag:kWPEditorViewControllerElementTagJustifyCenterBarButton htmlProperty:@"justifyCenter" - imageName:@"ZSScenterjustify" + imageName:@"ZSScenterjustify@2x" target:self selector:@selector(alignCenter) accessibilityLabel:nil]; @@ -578,7 +578,7 @@ - (UIBarButtonItem*)alignFullBarButton { ZSSBarButtonItem *barButtonItem = [self barButtonItemWithTag:kWPEditorViewControllerElementTagJustifyFullBarButton htmlProperty:@"justifyFull" - imageName:@"ZSSforcejustify" + imageName:@"ZSSforcejustify@2x" target:self selector:@selector(alignFull) accessibilityLabel:nil]; @@ -590,7 +590,7 @@ - (UIBarButtonItem*)alignRightBarButton { ZSSBarButtonItem *barButtonItem = [self barButtonItemWithTag:kWPEditorViewControllerElementTagJustifyRightBarButton htmlProperty:@"justifyRight" - imageName:@"ZSSrightjustify" + imageName:@"ZSSrightjustify@2x" target:self selector:@selector(alignRight) accessibilityLabel:nil]; @@ -632,7 +632,7 @@ - (UIBarButtonItem*)boldBarButton ZSSBarButtonItem *barButtonItem = [self barButtonItemWithTag:kWPEditorViewControllerElementTagBoldBarButton htmlProperty:@"bold" - imageName:@"icon_format_bold" + imageName:@"icon_format_bold@2x" target:self selector:@selector(setBold) accessibilityLabel:accessibilityLabel]; @@ -644,7 +644,7 @@ - (UIBarButtonItem*)header1BarButton { ZSSBarButtonItem *barButtonItem = [self barButtonItemWithTag:kWPEditorViewControllerElementTagH1BarButton htmlProperty:@"h1" - imageName:@"ZSSh1" + imageName:@"ZSSh1@2x" target:self selector:@selector(heading1) accessibilityLabel:nil];