可以对资源进行增删改
This commit is contained in:
@@ -53,19 +53,18 @@
|
||||
<div id="blog-content">
|
||||
<div id="editor-toolbar"></div>
|
||||
<div id="editor-text-area" style="height: 400px;border: 1px solid lightgrey"></div>
|
||||
<textarea id="blog-textarea" name="content" style="display: none;"></textarea>
|
||||
<textarea id="content-textarea" name="content" style="display: none;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit">发布文章</button>
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="this.disabled=true; this.form.submit();" >发布文章</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div th:replace="~{common/footer::footer}"></div>
|
||||
|
||||
<a class="to-top">返回顶部</a>
|
||||
@@ -76,58 +75,9 @@
|
||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
||||
|
||||
<script th:src="@{/wangedit/js/wang.min.js}"></script>
|
||||
<script type="text/javascript">
|
||||
const E = window.wangEditor
|
||||
|
||||
// 切换语言
|
||||
const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
|
||||
E.i18nChangeLanguage(LANG)
|
||||
|
||||
const editorConfig = {
|
||||
placeholder: '请输入...',
|
||||
scroll: true, // 禁止编辑器滚动
|
||||
MENU_CONF: {
|
||||
uploadImage: {
|
||||
fieldName: 'your-fileName',
|
||||
base64LimitSize: 10 * 1024 * 1024 // 10M 以下插入 base64
|
||||
}
|
||||
},
|
||||
onChange(editor) {
|
||||
// console.log(editor.getHtml())
|
||||
// $('#blog-textarea').value = editor.getHtml()
|
||||
const content = editor.children
|
||||
// const contentStr = JSON.stringify(content)
|
||||
// document.getElementById('blog-textarea').value = contentStr
|
||||
const html = editor.getHtml()
|
||||
$('#blog-textarea').val(html)
|
||||
}
|
||||
}
|
||||
|
||||
// 先创建 editor
|
||||
const editor = E.createEditor({
|
||||
selector: '#editor-text-area',
|
||||
content: [],
|
||||
// html: '',
|
||||
config: editorConfig
|
||||
})
|
||||
|
||||
// 创建 toolbar
|
||||
const toolbar = E.createToolbar({
|
||||
editor,
|
||||
selector: '#editor-toolbar',
|
||||
config: {
|
||||
excludeKeys: 'fullScreen',
|
||||
}
|
||||
})
|
||||
|
||||
// 点击空白处 focus 编辑器
|
||||
$('#editor-text-area').addEventListener('click', e => {
|
||||
if (e.target.id === 'editor-text-area') {
|
||||
editor.blur()
|
||||
editor.focus(true) // focus 到末尾
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script th:src="@{/wangedit/js/wang.init.js}"></script>
|
||||
<script th:src="@{/layer/layer.js}"></script>
|
||||
<script th:src="@{/js/axios.js}"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user