Browse Source

编辑器修复

feature
dai 3 years ago
parent
commit
a29823a6fc
  1. 4
      package.json
  2. 24
      src/views/components/tinymce2/index.vue
  3. 2
      src/views/modules/communityParty/article/index.vue

4
package.json

@ -59,7 +59,7 @@
},
"devDependencies": {
"@antv/f2": "^3.8.10-beta.1",
"@tinymce/tinymce-vue": "^3.2.8",
"@tinymce/tinymce-vue": "3.2.8",
"@vue/cli-plugin-babel": "^3.10.0",
"@vue/cli-plugin-eslint": "^3.10.0",
"@vue/cli-service": "^3.10.0",
@ -70,7 +70,7 @@
"ol": "^6.9.0",
"sass-loader": "^7.3.1",
"script-loader": "^0.7.2",
"tinymce": "^5.8.2",
"tinymce": "5.8.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {

24
src/views/components/tinymce2/index.vue

@ -87,11 +87,12 @@ export default {
toolbar_mode: "none",
toolbar_drawer: "sliding",
toolbar_mode: "sliding",
outputFormat: 'p',
outputFormat: "p",
plugins:
"wordcount visualchars visualblocks toc textpattern template tabfocus spellchecker searchreplace save quickbars print preview paste pagebreak noneditable nonbreaking media insertdatetime importcss imagetools image hr help fullscreen fullpage directionality codesample code charmap link code table lists advlist anchor autolink autoresize autosave", // import
toolbar:
"formats undo redo paste print fontsizeselect fontselect template fullpage|wordcount ltr rtl visualchars visualblocks toc spellchecker searchreplace|save preview pagebreak nonbreaking|media image|outdent indent aligncenter alignleft alignright alignjustify lineheight underline quicklink h2 h3 blockquote numlist bullist table removeformat forecolor backcolor bold italic strikethrough hr charmap link insertdatetime|subscript superscript cut codesample code |anchor preview fullscreen|help",
// "formats undo redo paste print fontsizeselect fontselect template fullpage|wordcount ltr rtl visualchars visualblocks toc spellchecker searchreplace|save preview pagebreak nonbreaking|media image|outdent indent aligncenter alignleft alignright alignjustify lineheight underline quicklink h2 h3 blockquote numlist bullist table removeformat forecolor backcolor bold italic strikethrough hr charmap link insertdatetime|subscript superscript cut codesample code |anchor preview fullscreen|help",
"formats undo redo|fontsizeselect|fontselect|forecolor backcolor bold italic underline strikethrough removeformat|image media link|outdent indent|aligncenter alignleft alignright alignjustify lineheight quicklink h2 h3 blockquote numlist bullist table|subscript superscript codesample code|preview fullscreen|wordcount|help",
content_style: "p {margin: 5px 0; font-size: 14px}",
fontsize_formats: "12px 14px 16px 18px 24px 36px 48px 56px 72px",
font_formats:
@ -171,17 +172,16 @@ export default {
if (editor && val !== prevVal && val !== editor.getContent()) {
if (typeof val !== "string") val = val.toString();
debounceSetContent.call(editor, val);
return
return;
}
// debounceSetContent.call(editor, this.dormatHtml(val));
});
editor.on("change keyup undo redo", () => {
// console.log('editor.getContent()---', editor.getContent({ format : 'p' }))
const c = editor.getContent({ format : 'p' })
const c = editor.getContent({ format: "p" });
this.$emit("input", editor.getContent());
// debounce(500, this.$emit("input", editor.getContent({ format : 'p' })));
;
});
editor.on("blur", () => {
// console.log('editor.blur--', editor.getContent({ format : 'p' }))
@ -190,12 +190,12 @@ export default {
});
},
dormatHtml(content) {
let c = ''
if (content.indexOf('DOCTYPE') != -1) {
let c = "";
if (content.indexOf("DOCTYPE") != -1) {
c = content.slice(45, -16);
}
console.log('content', typeof content)
return c || content
console.log("content", typeof content);
return c || content;
},
getUserToken() {
return localStorage.getItem("token");
@ -211,3 +211,9 @@ export default {
},
};
</script>
<style lang="scss">
.tox-tinymce-aux {
z-index: 5000 !important;
}
</style>

2
src/views/modules/communityParty/article/index.vue

@ -51,6 +51,7 @@
<template v-slot:listBtnbefore="{ item }">
<el-button
v-if="item.isTop == '1'"
v-show="item.statusFlag == 'published'"
@click="handleCancleTopArticle(item, 'cancel_top')"
type="text"
size="small"
@ -58,6 +59,7 @@
>取消置顶</el-button
>
<el-button
v-show="item.statusFlag == 'published'"
v-else
@click="handleTopArticle(item, 'top')"
type="text"

Loading…
Cancel
Save