您当前的位置: 首页 >  编辑器

28分布式电商项目 - 商品录入(富文本编辑器)

杨林伟 发布时间:2019-07-04 11:52:58 ,浏览量:4

需求分析

实现商品介绍的录入,要求使用富文本编辑器 在这里插入图片描述

富文本编辑器介绍

富文本编辑器,Rich Text Editor, 简称 RTE, 它提供类似于 Microsoft Word 的编辑功能。常用的富文本编辑器:

KindEditor http://kindeditor.net/ UEditor http://ueditor.baidu.com/website/ CKEditor http://ckeditor.com/

使用 kindeditor 完成商品介绍的录入 1.初始化 kindeditor 编辑器

在页面中添加 JS 代码,用于初始化 kindeditor


	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="content"]', {
			allowFileManager : true
		});
	});

2.提取 kindeditor 编辑器的内容

在 goodsController.js 中的 save()方法中添加

$scope.entity.goodsDesc.introduction=editor.html();
3.清空 kindeditor 编辑器的内容

修改 goodsController.js 的 save 方法

function(response){
	if(response.success){
		alert("保存成功");
		$scope.entity={};
		editor.html('');//清空富文本编辑器
	}else{
		alert(response.message);
	}
}
关注
打赏
1688896170
查看更多评论

杨林伟

暂无认证

  • 4浏览

    0关注

    3183博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0871s