帖子
帖子
用户
博客
课程
显示全部楼层
216
帖子
5
勋章
5909
Y币

richText模块demo示例

[复制链接]
发表于 2019-7-8 11:21:01
用原生代码实现手机上的富文本编辑器,可以对文字进行排版布局,样式调整,仅iOS支持:插入图片,超链接。

备注:安卓和iOS部分功能存在差异。iOS支持iphone6以上的机型。

点击进入模块详情





  1. <!DOCTYPE html>
  2. <html>
  3.         <head>
  4.                 <title>Module Develop</title>
  5.                 <meta charset="utf-8">
  6.                 <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  7.                 <style type="text/css">
  8.                         html, body {
  9.                                 height: 100%
  10.                         }
  11.                         body {
  12.                                 background-color: #fff;
  13.                                 margin: 0;
  14.                         }
  15.                         #wrap {
  16.                                 height: 100%;
  17.                                 position: relative;
  18.                         }
  19.                         #header {
  20.                                 padding-top: 20px;
  21.                                 background-color: #5082c2;
  22.                                 height: 44px;
  23.                                 position: relative;
  24.                         }
  25.                         #header h1 {
  26.                                 font-size: 20px;
  27.                                 height: 44px;
  28.                                 line-height: 44px;
  29.                                 margin: 0em;
  30.                                 color: #fff;
  31.                                 margin-left: 100px;
  32.                                 margin-right: 100px;
  33.                                 text-align: center;
  34.                         }
  35.                         #main {
  36.                                 display: -webkit-box;
  37.                                 -webkit-box-orient: vertical;
  38.                                 -webkit-box-pack: center;
  39.                         }
  40.                         a.button {
  41.                                 display: -webkit-box;
  42.                                 -webkit-box-orient: vertical;
  43.                                 -webkit-box-pack: center;
  44.                                 -webkit-box-align: center;
  45.                                 height: 32px;
  46.                                 margin: 8px;
  47.                                 background-color: rgba(240,240,240,1.0);
  48.                                 border-color: rgba(220,220,220,1.0);
  49.                                 border-width: 2px;
  50.                                 border-style: solid;
  51.                         }
  52.                         a.active {
  53.                                 background-color: rgba(240,240,240,0.7);
  54.                         }
  55.                 </style>
  56.         </head>
  57.         <body>
  58.                 <div id="wrap">
  59.                         <div id="main">
  60.                                 <a class="button" tapmode="active" onclick="openTextEditor()">打开富文本编辑框</a>
  61.                         </div>
  62.                 </div>
  63.         </body>
  64.         <script type="text/javascript">
  65.                 var demo = null;
  66.                 apiready = function() {
  67.                         demo = api.require('richText');
  68.                         if (!demo) {
  69.                                 alert("请添加模块后编译");
  70.                                 return;
  71.                         }
  72.                 }
  73.                 function openTextEditor() {
  74.                         demo.openTextEditor({
  75.                                 title : "我是富文本编辑器",
  76.                                 html : "",
  77.                                 placeholder : "你想说点什么?",
  78.                         },function(ret, err) {
  79.                                 alert(JSON.stringify(ret) + " " + JSON.stringify(err));
  80.                         });
  81.                 }
  82.         </script>
  83. </html>
复制代码


10
帖子
7
勋章
1220
Y币
感谢分享
5
帖子
0
勋章
19
Y币
怎么看不到图片上传
166
帖子
2
勋章
1642
Y币
这是假的。根本不是图片上的效果。没有图片上传功能的
您需要登录后才可以回帖 登录

本版积分规则