tianyun hace 1 año
padre
commit
4b46191482
Se han modificado 1 ficheros con 10 adiciones y 11 borrados
  1. 10 11
      simple-demo/send_memos.html

+ 10 - 11
simple-demo/send_memos.html

@@ -19,7 +19,7 @@
         }
 
         .editor {
-            height: 130px;
+            min-height: 50px;
             padding: 10px;
         }
 
@@ -69,11 +69,11 @@
         <input style="margin-left: 30px; width: 70vw; padding-left: 10px" placeholder="搜索" type="text" id="search" class="border" onkeydown="if(event.keyCode===13) {search()}">
         <br><br>
         <div></div>
-        <div style="display: flex">
+        <div style="display: flex;align-items:stretch">
             <!-- 创建一个用于编辑的容器 -->
-            <textarea id="editor" class="editor border" rows="4" style="width: 80%" onchange="localStorage.setItem(contentStr, getEditContent())"></textarea>
+            <div id="editor" class="editor border" style="width: 80%" contenteditable="true" oninput="localStorage.setItem(contentStr, getEditContent())"></div>
             <!-- 添加发送按钮 -->
-            <button id="log" style="margin-left: 20px; height: 100px;width: 10%; font-size: 40px" onclick="sendData()">记录</button>
+            <button id="log" style="margin-left: 20px; width: 10%; font-size: 2rem" onclick="sendData()">记录</button>
         </div>
 
 
@@ -82,7 +82,7 @@
     </div>
 
 
-    <div style="margin-top: 230px"></div>
+    <div style="margin-top: 150px"></div>
 
 
 
@@ -98,7 +98,7 @@
             <label for="created_ts">创建时间</label>
             <input id="created_ts"></input>
         </div>
-        <textarea id="editorModel" class="editor" rows="4" style="width: 95%"></textarea>
+        <div id="editorModel" contenteditable="true" class="editor border"  style="width: 95%"></div>
         <br>
         <!--    取消 和 确认按钮-->
         <button onclick="hideModel()" style="margin-right: 50px">取消</button>
@@ -193,11 +193,11 @@
     const model = document.querySelector('#editorModel');
 
     function getEditContent() {
-        return myEdit.value;
+        return myEdit.innerText;
     }
 
     function getModelContent() {
-        return model.value;
+        return model.innerText;
     }
 
     let contentStr = 'content';
@@ -264,7 +264,7 @@
 
             logBtn.disabled = false;
             logBtn.innerText = '记录';
-            myEdit.value = '';
+            myEdit.innerHTML = '';
 
             localStorage.removeItem(contentStr);
             search();
@@ -423,10 +423,9 @@
                 tmpDiv.style.display = 'inline-block';
                 tmpDiv.ondblclick = function () {
                     tmpId = id;
-                    model.value = document.getElementById(id).innerText;
+                    model.innerText = document.getElementById(id).innerText;
                     document.getElementById('created_ts').value = document.getElementById('time_' + id).innerText;
                     showModel();
-                    model.focus();
                 };
                 // 根据id,查找是否存在资源
                 if (resourceMap[id]) {