diff --git a/Example/RZRichTextView/HowToUseDemo.swift b/Example/RZRichTextView/HowToUseDemo.swift index a1fc61e..85b3778 100644 --- a/Example/RZRichTextView/HowToUseDemo.swift +++ b/Example/RZRichTextView/HowToUseDemo.swift @@ -45,6 +45,10 @@ public extension RZRichTextViewModel { let viewModel = RZRichTextViewModel.init() viewModel.canEdit = edit + viewModel.ulSymbol = "•" + //viewModel.ulSymbol = "*" + viewModel.ulSymbolAlignment = .center + /// 链接颜色 viewModel.defaultLinkTypingAttributes = [.foregroundColor: UIColor.qhex(0x307bf6), .underlineColor: UIColor.qhex(0x307bf6), .underlineStyle: NSUnderlineStyle.styleSingle.rawValue] /// 显示音频文件名字 diff --git a/RZRichTextView/Classes/RZRichTextView.swift b/RZRichTextView/Classes/RZRichTextView.swift index 7688715..4aaeb1c 100644 --- a/RZRichTextView/Classes/RZRichTextView.swift +++ b/RZRichTextView/Classes/RZRichTextView.swift @@ -631,7 +631,7 @@ public extension RZRichTextView { index = 1 } lastType = .ul - temp.append(("·", range, p, dict)) + temp.append((viewModel.ulSymbol, range, p, dict)) } else { lastType = .none index = 0 @@ -648,6 +648,7 @@ public extension RZRichTextView { .qfont((dict[.font] as? UIFont) ?? .systemFont(ofSize: 16)) .qtextColor((dict[.foregroundColor] as? UIColor) ?? .black) .qtext("\(index)") + .qtextAliginment(viewModel.ulSymbolAlignment) self.addSubview(view) } } diff --git a/RZRichTextView/Classes/RZRichTextViewModel.swift b/RZRichTextView/Classes/RZRichTextViewModel.swift index 0c7fc1b..c9fe2a4 100644 --- a/RZRichTextView/Classes/RZRichTextViewModel.swift +++ b/RZRichTextView/Classes/RZRichTextViewModel.swift @@ -132,6 +132,9 @@ open class RZRichTextViewModel: NSObject { /// 初始化的时候配置此项,在编辑过程中,如果想禁用编辑,直接设置textView.isEditable = false open var canEdit: Bool = true + open var ulSymbol:String = "·" + open var ulSymbolAlignment:NSTextAlignment = .right + public override init() { super.init() /// 默认居左