美文网首页富文本
ZSSRichTextEditor setFontSize

ZSSRichTextEditor setFontSize

作者: NieFeng1024 | 来源:发表于2018-05-11 18:41 被阅读51次

ZSSRichTextEditor 设置字号

CSS 文档 fontSize 在插入点或者选中文字部分修改字体大小. 需要提供一个HTML字体尺寸 (1-7) 作为参数。

1. 在ZSSRichTextEditor.m 文件添加接口
/** font 1-7 */
- (void)setFontSize:(int)font {
    NSString *normal = [NSString stringWithFormat:@"zss_editor.setFontSize(\"%d\");",font];
    [self.editorView stringByEvaluatingJavaScriptFromString:normal];
}
2. ZSSRichTextEditor.js 文件中添加接口
zss_editor.setFontSize = function(aFontSize) {
    
    document.execCommand("styleWithCSS", null, true);
    document.execCommand('fontSize', false, aFontSize);
    document.execCommand("styleWithCSS", null, false);
    zss_editor.enabledEditingItems();
    
}

CSS-SetFontSize文档

相关文章

网友评论

    本文标题:ZSSRichTextEditor setFontSize

    本文链接:https://www.haomeiwen.com/subject/jzhqdftx.html