rich-text-tool-editor
v1.1.0
Published
富文本编辑器。1.IE浏览器不支持,2.可以自定义事件,3.加载速度不算慢
Downloads
10
Maintainers
Readme
#########使用说明############
###富文本编辑器,IE 浏览器不支持
###安装###
npm i rich-text-tool-editor
###服务启动 html(live server)###;
###########方法引入###########
import {initRichText, RichTextTool} from "rich-text-tool-editor";
###富文本节点,可设置宽度,高度,不设为默认。必须设置 ID,唯一;###
<div id="test" style="width:700px;height:700px;"></div>
############初始化 dom 执行#########
initRichText("test");
###自定义头部点击图标、事件###
let obj = {
name: "一键排版",
type: "typeMy",
img: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAAYRJREFUeF7t3FENBCEUxVBQO34xMg54m3Fxki0Kmlsa/tgz864Os8CemWFoAlkJwS5BQhKCLYDhVEhCsAUwnApJCLYAhlMhCcEWwHAqJCHYAhhOhSQEWwDDqZCEYAtgOBWSEGwBDKdCEoItgOFUSEKwBTCcCkkItgCGUyEJwRbAcCokIdgCGE6FJARbAMOpkIRgC2A4FZIQbAEMp0ISgi2A4VRIQrAFMJwKSQi2AIZTIQnBFsBwKiQh2AIYToUkBFsAw6kQTcg5p++ZICn7eZ6ESEL6wAyysdba994KgZz0qEMyPpSEJARbAMOpkIRgC2A4FZIQbAEMp0ISgi2A4VRIQrAFMJwKSQi2AIZTIQnBFsBwKiQh2AIYToUkBFsAw6mQhGALYDgVkhBsAQynQhKCLYDhVEhCsAUwnApJCLYAhlMhCcEWwHAqJCHYAhhOhSQEWwDDqZCEYAtgOBWSEGwBDKdCEoItgOFUSEKwBTCcCkkItgCGUyEJwRbAcL5CXozpr3F+lc+Mco7GNHsAAAAASUVORK5CYII=",
};
#########obj.img 图片除了 base64 码,也可为地址############
RichTextTool.bindClick("test", obj, function (e) {
console.log("e", e);
});
###获取富文本 dom###
RichTextTool.getDocument("test");
RichTextTool.getWindow("test");
###获取、设置富文本 html###
RichTextTool.getHtml("test");
RichTextTool.setHtml("test","<p>示例文本</p>");
###是否编辑,initRichText 第二参数,默认 true 开启,false 只读###
###模板,initRichText 第三参数,默认 true 使用,false 不使用###
initRichText("test",true,true);
###头部 defaultHeader,initRichText 第四参数,默认 []都使用,列出多少使用多少###
let defaultHeader=["showHtml","doBack","doRecover","doPrint", "doCut", "doCopy","doPaste","doPasteUnformat","justifyLeft","justifyCenter","justifyRight","justifyFull","insertOrderedList","insertUnorderedList","doIndent", "doOutdent","doSubscript", "doSuperscript","removeFormat", "selectAll","doHeading", "fontName","fontSize", "foreColor","hiliteColor","doBold","doItalic","doUnderline","strikeThrough","createLink","unlink","anchorPoint", "insertHorizontalRule", "insertHorizontalRuleDashed","doLineHeight", "doTable","insertImage",]
initRichText("test",true,true,defaultHeader);