index.html 9.7 KB
Newer Older
璃白.'s avatar
fix  
璃白. 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .md_container {
        /* width: 600px !important; */
        margin: 40px auto;
        /* margin-top: 600px; */
      }
      body {
        /* background-color: #222226; */
      }
      .text {
        width: 100%;
        /* height: 200px; */
        border: 1px solid red;
        overflow-y: auto;
        padding: 10px;
        box-sizing: border-box;
      }
    </style>
  </head>
  <body>
    <div id="app"></div>
    <!-- <textarea class="text" name="" id="" cols="30" rows="10"></textarea> -->
    <!-- <div contenteditable="true" class="text"></div> -->
    <button id="a">111111</button>
    <button id="b">2222222</button>
    <script src="./markdown-editor.js"></script>
郭维嘉 已提交
34 35
    <script>
      // setTimeout(() => {
fix  
郭维嘉 已提交
36 37 38 39
      try {
        const ee = new MdEditor({
          el: "#app", // required
          value: `\`\`\`java
璃白.'s avatar
fix  
璃白. 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
      #include "stdio.h"
      void main()
      {
          /*
              完数:所有的因子相加等于这个数本身
              6=1+2+3
          */
          int i,j,a,b,c;
          printf("1000以内的完数如下:\n");
          for(i=6;i<=1000;i++)
          {
                 a=0;
                 //求i对应的所有的因子
              for(j=2;j<=i;j++)
              {
                  if(i%j==0)
                  {
                      a+=i/j;
                  }
              }
              if(i==a){
                  //该循环语句的作用就是打印结果
                  for(j=2;j<=i;j++)
                  {
                      if(i%j==0)
                      {
                          if(i==j){
                              printf("%d",i/j);
                          }else{
                              printf("%d+",i/j);
                          }
                      }
                  }
                  printf("=%d\n",i);
              }
          }
      }
      \`\`\`
              `,
fix  
郭维嘉 已提交
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
          //         value: `
          // ![pic](https://img2.baidu.com/it/u=3681880960,455182084&fm=26&fmt=auto&gp=0.jpg=40x40)
          //         `,
          //         value: `
          // const aaa = $(".left .title").hover(function() {
          //   aaa.remove()
          // })
          //         `,
          value:
            "## edswgdfgdfgdfg\n**dfgdfgdfg**\n_ergdfgdfg_\n> ergergdfg\n```\nwefgdfsfdgdf\n```\n- efwefsdfsdf\n\n\nsdgfdfgdfgdfg\n\n\nedrfgdfgdfg\n\n\n\nergergergergerg\nergergergerg\n\n\nedrfgdfgdfg\n\n\n\nergergergergerg\nergergergerg\n\n\nedrfgdfgdfg\n\n\n\nergergergergerg\nergergergerg",
          value:
            "[link](https://img2.baidu.com/it/u=3681880960,455182084&fm=26&fmt=auto&gp=0.jpg)",
          // value: "当前问题已结题,不再开放新的回答。",
          value: "(http://www.baidu.com)\n(http://www.baidu.com)",
          value: "",
          disabled: false,
          themeOptions: {
            dark: false,
            borderColorActive: "#409eff",
            textColor: "#303030",
            // textColorActive: "#000",
            codeTheme: "atom-one-dark"
          },
          height: 400,
          // rows: 'auto',
          // height: 40,
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
          toolsOptions: {
            // call: true,
            format: true,
            bold: true,
            italic: true,
            quote: true,
            code: true,
            link: true,
            ul: true,
            ol: true,
            task: true,
            table: true,
            img: false,
            file: false,
            test1: true,
            // help: false,
            fullScreen: true
          },
fix  
郭维嘉 已提交
123 124 125 126
          zIndex: 7000,
          // maxLength: 20000,
          showWordLimit: true,
          // height: "600",
璃白.'s avatar
fix  
璃白. 已提交
127

fix  
郭维嘉 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
          filePathRule: /^https:\/\/ss2\.bdstatic\.com/,
          canPreview: true,
          // canAttachFile: true,
          placeholder: "请输入内容",
          // throttle: 1000,
          // onFocus: function(res) {
          //   console.log(res);
          // },
          onLoad: function(res) {
            // console.log("load", res);
          },
          onBlur: function(res) {
            // console.log(res);
          },
          onInput: function(res) {
            // console.log("input", res);
          },
          onChange: function(res) {
            // console.log("change", res);
          },
          onSubmit: function(res) {
            // console.log(res);
          },
          onUpload: function(file, type, callback) {
            if (type === "video" || type === "img") {
              let time = 0;
              const timeObj = setInterval(() => {
                time++;
                if (time >= 100) {
                  callback("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
                  clearInterval(timeObj);
                  return;
                }
                callback(time);
              }, 20);
              return;
璃白.'s avatar
fix  
璃白. 已提交
164
            }
fix  
郭维嘉 已提交
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
            new Promise((res, rej) => {
              setTimeout(() => {
                res(file);
              }, 1000);
            }).then(res => {
              var reader = new FileReader();
              reader.readAsDataURL(res);
              reader.onload = () => {
                callback(reader.result);
              };
            });
          },
          renderLinks: function(val, callback) {
            setTimeout(() => {
              callback(
                val.map(item => {
                  item.title = "如何搭建一个完整的vue生态";
                  item.description =
                    "相信9月18日尤大大的关于Vue3.0的发表演讲大家一定有所关注,现在Vue3.0 也已经进入RC阶段(最终产品的候选版本,如果没有问题则可发布成为正式版本)。所以Vue3.0的学习是我们必然的趋势,今天,主要分享一下Vue3.0的详细搭建过程,希望可以为初入Vue3的小伙伴有所帮助。";
                  item.icon = "https://g.csdnimg.cn/static/logo/favicon32.ico";
                  return item;
                })
              );
            }, 0);
          },
          queryUserList: function(val, callback) {
            const list = [
              {
                id: 1,
                nickname: "cpongo1",
                username: "cpongo1",
                url: "https://weibo.com/u/5492443184",
                avatar:
                  "https://img2.baidu.com/it/u=2380211986,3979961921&fm=26&fmt=auto&gp=0.jpg"
              },
              {
                id: 2,
                nickname: "CPongo2",
                username: "cpongo2",
                url: "https://weibo.com/u/5492443184",
                avatar:
                  "https://img0.baidu.com/it/u=777620324,2343967729&fm=26&fmt=auto&gp=0.jpg"
              },
              {
                id: 3,
                nickname: "马奎斯",
                username: "cpongo3",
                url: "https://weibo.com/u/5492443184",
                avatar:
                  "https://img2.baidu.com/it/u=1297316011,1869565258&fm=26&fmt=auto&gp=0.jpg"
              },
              {
                id: 4,
                nickname: "王一博",
                username: "cpongo4",
                url: "https://weibo.com/u/5492443184",
                avatar:
                  "https://img2.baidu.com/it/u=298051053,3773223854&fm=26&fmt=auto&gp=0.jpg"
              },
              {
                id: 5,
                nickname: "王俊凯",
                username: "cpongo5",
                url: "https://weibo.com/tfwangjunkai",
                avatar:
                  "https://img1.baidu.com/it/u=2378425879,2273515018&fm=26&fmt=auto&gp=0.jpg"
              },
              {
                id: 6,
                nickname: "易烊千玺",
                username: "cpongo6",
                url: "https://weibo.com/tfyiyangqianxi",
                avatar:
                  "https://img0.baidu.com/it/u=2227200088,1939721201&fm=26&fmt=auto&gp=0.jpg"
              },
              {
                id: 7,
                nickname: "白敬亭",
                username: "cpongo7",
                url: "https://weibo.com/u/2112496475",
                avatar:
                  "https://img1.baidu.com/it/u=3265411836,2089649447&fm=11&fmt=auto&gp=0.jpg"
              }
            ];
璃白.'s avatar
fix  
璃白. 已提交
249

fix  
郭维嘉 已提交
250 251 252
            callback(list);
          }
        });
郭维嘉 已提交
253 254
      } catch (e) {}
      // }, 3000);
fix  
郭维嘉 已提交
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
      //       ee.registerTools([
      //         {
      //           name: "test",
      //           icon:
      //             "https://img1.baidu.com/it/u=1522221441,2900868227&fm=26&fmt=auto&gp=0.jpg",
      //           tip: "自定义的按钮",
      //           click: function() {}
      //         }
      //       ]);
      //       function test() {
      //         return ee.getVideoList();
      //       }
      //       document.querySelector("#a").onclick = async function() {
      //         ee.setValue(`
      // # 一级标题
      // ## 二级标题
      // ### 三级标题
      // #### 四级标题
      // #### 四级标题2四级标题2四级标题2四级标题2四级标题2四级标题2四级标题2四级标题2
      // #### 四级标题3
      // #### 四级标题4
      // ### 三级标题2
      // ### 三级标题3
      // ## 二级标题2
      // ## 二级标题3
      // ## 二级标题4
      // ## 二级标题5
      // ### 三级标题4
郭维嘉 已提交
283

fix  
郭维嘉 已提交
284
      // [toc]
郭维嘉 已提交
285

fix  
郭维嘉 已提交
286
      //         `);
璃白.'s avatar
fix  
璃白. 已提交
287

fix  
郭维嘉 已提交
288 289 290 291 292 293 294 295
      //         // ee.disable();
      //         // ee.getVideoList(list => {
      //         //   console.log("list", list);
      //         // });
      //       };
      //       document.querySelector("#b").onclick = function() {
      //         ee.enable();
      //       };
璃白.'s avatar
fix  
璃白. 已提交
296 297 298
    </script>
  </body>
</html>