tianyun 1 rok temu
rodzic
commit
f9eacebe6a
2 zmienionych plików z 83 dodań i 1 usunięć
  1. 37 1
      simple-demo/edit_online.html
  2. 46 0
      tmp/tmp.html

+ 37 - 1
simple-demo/edit_online.html

@@ -7,7 +7,43 @@
     <link rel="stylesheet" href="//cdn.quilljs.com/1.3.6/quill.snow.css">
     <style>
         #editor {
-            height: calc(100vh - 70px); /* 假设其他元素的高度是100px */
+            height: calc(100vh - 20px); /* 假设其他元素的高度是100px */
+        }
+        .ql-editor ol, .ql-editor ul {
+            padding-left: 0em;
+        }
+        .ql-editor li.ql-indent-1:not(.ql-direction-rtl) {
+            padding-left: 3em;
+        }
+        .ql-editor li.ql-indent-2:not(.ql-direction-rtl) {
+            padding-left: 5em;
+        }
+        .ql-editor li.ql-indent-3:not(.ql-direction-rtl) {
+            padding-left: 7em;
+        }
+        .ql-editor li.ql-indent-4:not(.ql-direction-rtl) {
+            padding-left: 9em;
+        }
+        .ql-editor li.ql-indent-5:not(.ql-direction-rtl) {
+            padding-left: 11em;
+        }
+        .ql-editor li.ql-indent-6:not(.ql-direction-rtl) {
+            padding-left: 13em;
+        }
+        .ql-editor li.ql-indent-7:not(.ql-direction-rtl) {
+            padding-left: 15em;
+        }
+        .ql-editor li.ql-indent-8:not(.ql-direction-rtl) {
+            padding-left: 17em;
+        }
+        .ql-editor li.ql-indent-9:not(.ql-direction-rtl) {
+            padding-left: 19em;
+        }
+        .ql-editor li.ql-indent-10:not(.ql-direction-rtl) {
+            padding-left: 21em;
+        }
+        .ql-editor li.ql-indent-11:not(.ql-direction-rtl) {
+            padding-left: 23em;
         }
     </style>
     <script src="js/axios.min.js"></script>

+ 46 - 0
tmp/tmp.html

@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+    <style>
+        body{
+            background: #00FFFF;
+        }
+    </style>
+</head>
+<body>
+<!--下载按钮-->
+<button onclick="downloadDivContent('#test123')">下载</button>
+<div id="test123">
+    <h1>测试</h1>
+    <p>测试内容</p>
+</div>
+<script>
+    function downloadDivContent(selector) {
+        // 获取目标div的内容
+        var targetDiv = document.querySelector(selector).innerHTML;
+
+        // 创建Blob对象
+        var blob = new Blob([targetDiv], { type: 'text/html' });
+
+        // 创建下载链接
+        var downloadLink = document.createElement('a');
+        downloadLink.href = URL.createObjectURL(blob);
+
+        // 设置下载链接的属性
+        downloadLink.download = 'div_content.html'; // 设置文件名
+        downloadLink.style.display = 'none'; // 隐藏下载链接
+
+        // 将下载链接添加到页面中
+        document.body.appendChild(downloadLink);
+
+        // 模拟用户点击下载链接
+        downloadLink.click();
+
+        // 清理下载链接
+        document.body.removeChild(downloadLink);
+    }
+</script>
+</body>
+</html>