完成编辑的提交;

This commit is contained in:
2022-03-04 14:22:24 +08:00
parent 1a7718be0c
commit f3439ad45b

View File

@@ -94,6 +94,9 @@
<div id="editor-text-area"></div>
</div>
</div>
<div id="content-state" style="height: 30px;line-height: 30px;padding-left: 15px;border-top: 1px solid #e8e8e8;color: #666;">
内容变动自动提交
</div>
<div id="content-data" style="display: none;">{:urlencode($post->content_html)}</div>
</div>
</div>
@@ -118,23 +121,25 @@
if (contentSaveLock) {
setTimeout(() => {
autoSaveContent();
}, 5000);
}, 2600);
} else {
contentSaveLock = true;
$.post('{:url("update")}', {
content_html: editor.getHtml(),
id: '{$post->id}'
}, function (result) {
$('#content-state').text('自动提交成功')
setTimeout(() => {
autoSaveContent();
}, 5000);
}, 2600);
})
}
}
autoSaveContent();
const E = window.wangEditor;
const editorConfig = { MENU_CONF: {} }
@@ -146,6 +151,8 @@
editorConfig.onChange = (editor) => {
console.log('content', editor)
contentSaveLock = false;
$('#content-state').text('等待自动提交')
}
// 先创建 editor
@@ -167,7 +174,7 @@
})
setTimeout(() => {
$('#content').height(window.innerHeight - $('#editor-toolbar').outerHeight() - 30 - 45 - 7)
$('#content').height(window.innerHeight - $('#editor-toolbar').outerHeight() - 30 - 45 - 7 - 31)
}, 300);