编辑器例子

<!DOCTYPE html>
<html lang="zh-Hans-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="SiteName" content="网站的规范名称">
  <meta name="SiteDomain" content="网站的英文域名">
  <meta name="SiteIDCode" content="网站合法身份的标识">
  <!-- 栏目页面 -->
  <meta name="ColumnName" content="栏目名称/频道/专题">
  <meta name="ColumnDescription" content="栏目描述">
  <meta name="ColumnKeywords" content="栏目关键词">
  <meta name="ColumnType" content="栏目类别">
  <!-- 内容页面 -->
  <meta name="ArticleTitle" content="标题">
  <meta name="PubDate" content="发布时间:YYYY—MM—DD HH∶MM">
  <meta name="ContentSource" content="来源">
  <meta name="Keywords" content="关键词">
  <meta name="Author" content="作者">
  <meta name="Description" content="摘要">
  <meta name="Image" content="图片">
  <meta name="Url" content="网址">
  <title>例子</title>
  <style>
    html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
    }

    #app {
      background-color: #f8f8f8;
      width: 100%;
      height: 100%;
    }

    .translateDocContainer {
      position: relative;
      width: 180px;
      height: 220px;
      background-color: #fff;
      -webkit-box-shadow: 0 1px 7px 0 rgb(0 0 0 / 8%);
      box-shadow: 0 1px 7px 0 rgb(0 0 0 / 8%);
      border-radius: 8px;
      margin: 20px;
      cursor: pointer;
    }

    #editorjs {
      width: 300px;
      background-color: blue;
    }
  </style>
  <script>
    window.onload = function () {
      var wrap = document.getElementById('wrapper');
      wrap.style.display = 'none';
      var li = document.getElementsByTagName('li');

      for (var i = 0; i < li.length; i++) {
        li.onmouseover = function () {
          this.classname = "active";
        }
        li.onmouseout = function () {
          this.classname = "";
        }
      }

      document.oncontextmenu = function (e) {
        var e = event || window.event;
        wrap.style.display = "block";
        wrap.style.left = e.clientX + 'px';
        wrap.style.right = e.clientY + 'px';
        return false;//取消右键点击的默认事件
      }
      document.onclick = function () {
        wrap.style.display = 'block';
      }
    }
  </script>

</head>

<div id="app">
  <div id="left">
    left
  </div>
  <div id="right">
    <div id="editorjs">
      <!-- 鼠标右键 -->
      <ul id="wrapper">
        <li><a>一级</a></li>
        <li><a>二级</a></li>
        <li><a>三级</a></li>
      </ul>
    </div>
  </div>
</div>




<body>

</body>

</html>

  

<!DOCTYPE html>
<html lang="zh-Hans-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="SiteName" content="网站的规范名称">
  <meta name="SiteDomain" content="网站的英文域名">
  <meta name="SiteIDCode" content="网站合法身份的标识">
  <!-- 栏目页面 -->
  <meta name="ColumnName" content="栏目名称/频道/专题">
  <meta name="ColumnDescription" content="栏目描述">
  <meta name="ColumnKeywords" content="栏目关键词">
  <meta name="ColumnType" content="栏目类别">
  <!-- 内容页面 -->
  <meta name="ArticleTitle" content="标题">
  <meta name="PubDate" content="发布时间:YYYY—MM—DD HH∶MM">
  <meta name="ContentSource" content="来源">
  <meta name="Keywords" content="关键词">
  <meta name="Author" content="作者">
  <meta name="Description" content="摘要">
  <meta name="Image" content="图片">
  <meta name="Url" content="网址">
  <title>例子</title>
  <style>
    html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
    }

    #app {
      background-color: #f8f8f8;
      width: 100%;
      height: 100%;
    }

    .translateDocContainer {
      position: relative;
      width: 180px;
      height: 220px;
      background-color: #fff;
      -webkit-box-shadow: 0 1px 7px 0 rgb(0 0 0 / 8%);
      box-shadow: 0 1px 7px 0 rgb(0 0 0 / 8%);
      border-radius: 8px;
      margin: 20px;
      cursor: pointer;
    }

    #editorjs {
      width: 300px;
      background-color: blue;
    }
  </style>
  <script>
    window.onload = function () {
      var wrap = document.getElementById('wrapper');
      wrap.style.display = 'none';
      var li = document.getElementsByTagName('li');

      for (var i = 0; i < li.length; i++) {
        li.onmouseover = function () {
          this.classname = "active";
        }
        li.onmouseout = function () {
          this.classname = "";
        }
      }

      document.oncontextmenu = function (e) {
        var e = event || window.event;
        wrap.style.display = "block";
        wrap.style.left = e.clientX + 'px';
        wrap.style.right = e.clientY + 'px';
        return false;//取消右键点击的默认事件
      }
      document.onclick = function () {
        wrap.style.display = 'block';
      }
    }
  </script>

</head>

<div id="app">
  <div id="left">
    left
  </div>
  <div id="right">
    <div id="editorjs">
      <!-- 鼠标右键 -->
      <ul id="wrapper">
        <li><a>一级</a></li>
        <li><a>二级</a></li>
        <li><a>三级</a></li>
      </ul>
    </div>
  </div>
</div>




<body>

</body>

</html>
posted @ 2022-09-01 18:40  飞雪飘鸿  阅读(28)  评论(0编辑  收藏  举报
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL