富文本编辑器 iOS

https://gitee.com/klkxxy/WGEditor-mobile#wgeditor-mobile

采用iOS系统浏览器做的一款富文本编辑器工具。 原理就是使用WKWebView加载一个本地的一个html文件,从而达到编辑器功能的效果! 由于浏览器的一些特性等,富文本编辑器手机端很难做的完美,慢慢完善,欢迎提出好的建议。

一、Installation 安装

#import "RichEditor.h"

二、Example 例子

  • 常用函数
  • (void)titleTextHandleCallback:(void (^)(id _Nullable obj, NSError * _Nullable error))callback;
  • (void)setupTitle:(NSString *)title;
  • (void)contentTextHandleCallback:(void (^)(id _Nullable obj, NSError * _Nullable error))callback;
  • (void)contentHtmlTextHandleCallback:(void (^)(id _Nullable obj, NSError * _Nullable error))callback;
  • (void)setupContent:(NSString *)content;
  • (void)updatePlaceHolderStatu;
  • (void)placeHolderWithHidden:(BOOL)isHidden;

//撤销

  • (void)undo;
  • (void)redo; //加粗
  • (void)bold; //下划线
  • (void)underline; //斜体
  • (void)italic; //左对齐
  • (void)justifyLeft; //居中对齐
  • (void)justifyCenter; .....

三、上传图片

复制代码
实现思路:图片上传七牛服务器举例

https://github.com/study123456/WGEditor-mobile/blob/master/design_up.png

//插入本地图片

  • (void)insetImage:(NSData *)imageData key:(NSString *)key; //上传中

  • (void)insetImageKey:(NSString *)imageKey progress:(CGFloat)progress; //图片上传成功

  • (void)insetSuccessImageKey:(NSString *)imageKey imgUrl:(NSString *)imgUrl; //删除图片

  • (void)deleteImageKey:(NSString *)key; // 上传失败

  • (void)uploadErrorKey:(NSString *)key;

  • (void)removeBtnErrorKey:(NSString *)key isHide:(BOOL)isHide;

    实现效果

四、More 更多

如果你发现了bug,请先在Issues中搜索答案。 没有请提一个issues。 欢迎给我提pull requests。 请尽可能详细地描述系统版本、手机型号、库的版本、崩溃日志和复现步骤,请先更新到最新版再测试一下,如果新版还存在再提~如果已有开启的类似issue,请直接在该issue下评论说出你的问题

五、Other 其它

近期更新 1、由于iOSUIWebView被弃用,修改UIWebview替换成WKWebView,性能更优 2、工具条可扩展 3、易集成 封装基类

常见问题

音视频排期中

相关推荐
用户0914 小时前
SwiftUI Charts 函数绘图完全指南
ios·swiftui·swift
YungFan14 小时前
iOS26适配指南之UIColor
ios·swift
权咚1 天前
阿权的开发经验小集
git·ios·xcode
用户091 天前
TipKit与CloudKit同步完全指南
ios·swift
小溪彼岸1 天前
macOS自带截图命令ScreenCapture
macos
法的空间2 天前
Flutter JsonToDart 支持 JsonSchema
android·flutter·ios
2501_915918412 天前
iOS 上架全流程指南 iOS 应用发布步骤、App Store 上架流程、uni-app 打包上传 ipa 与审核实战经验分享
android·ios·小程序·uni-app·cocoa·iphone·webview
TESmart碲视2 天前
Mac 真正多显示器支持:TESmart USB-C KVM(搭载 DisplayLink 技术)如何实现
macos·计算机外设·电脑
00后程序员张2 天前
iOS App 混淆与加固对比 源码混淆与ipa文件混淆的区别、iOS代码保护与应用安全场景最佳实践
android·安全·ios·小程序·uni-app·iphone·webview
Magnetic_h2 天前
【iOS】设计模式复习
笔记·学习·ios·设计模式·objective-c·cocoa