|
@@ -13,6 +13,7 @@
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
+<a href="https://memos.tianyunperfect.cn/">memos主页</a><br><br>
|
|
|
<!-- 创建一个用于编辑的容器 -->
|
|
|
<div id="editor"></div>
|
|
|
|
|
@@ -28,8 +29,10 @@
|
|
|
<input type="checkbox" id="daily" name="category" value="日常">
|
|
|
<label for="daily">日常</label>
|
|
|
|
|
|
+<br>
|
|
|
+<br>
|
|
|
<!-- 添加发送按钮 -->
|
|
|
-<button onclick="sendData()">发送</button>
|
|
|
+<button id="log" style="float: right; height: 100px;width: 200px; font-size: 40px" onclick="sendData()">记录</button>
|
|
|
|
|
|
<!-- 引入Quill库 -->
|
|
|
<script src="./js/cdn.quilljs.com_1.3.6_quill.js"></script>
|
|
@@ -45,6 +48,20 @@
|
|
|
]
|
|
|
}
|
|
|
});
|
|
|
+ quill.focus();
|
|
|
+
|
|
|
+ let contentStr = 'content';
|
|
|
+
|
|
|
+ // 从localStorage中获取内容
|
|
|
+ let item = localStorage.getItem(contentStr);
|
|
|
+ if (item != null) {
|
|
|
+ quill.root.innerHTML = item;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ quill.on('text-change', function (delta, oldDelta, source) {
|
|
|
+ localStorage.setItem(contentStr, quill.root.innerHTML);
|
|
|
+ });
|
|
|
|
|
|
async function convertToWebPAsync(base64Image) {
|
|
|
// 检查图像格式是否为WebP
|
|
@@ -101,6 +118,11 @@
|
|
|
// }
|
|
|
// 发送数据
|
|
|
async function sendData() {
|
|
|
+ // 使id=log 不可用
|
|
|
+ let logBtn = document.getElementById('log');
|
|
|
+ logBtn.disabled = true;
|
|
|
+ logBtn.innerText = '正在发送...';
|
|
|
+
|
|
|
const content = await deltaToMarkdown(quill.getContents());
|
|
|
const categories = getSelectedCategories();
|
|
|
|
|
@@ -124,6 +146,11 @@
|
|
|
if (res['name']) {
|
|
|
window.location.href = `https://memos.tianyunperfect.cn/m/${res['name']}`;
|
|
|
}
|
|
|
+
|
|
|
+ logBtn.disabled = false;
|
|
|
+ logBtn.innerText = '记录';
|
|
|
+
|
|
|
+ localStorage.removeItem(contentStr);
|
|
|
});
|
|
|
}
|
|
|
|