Skip to content

Commit 305d659

Browse files
committed
perf[tinymce]: perf tinymce demo
1 parent 55c08ab commit 305d659

File tree

6 files changed

+35
-25
lines changed

6 files changed

+35
-25
lines changed

src/components/Tinymce/components/editorImage.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="upload-container">
3-
<el-button icon='upload' :style="{background:color,borderColor:color}" @click=" dialogVisible=true" type="primary">上传图片
3+
<el-button icon='el-icon-upload' size="mini" :style="{background:color,borderColor:color}" @click=" dialogVisible=true" type="primary">上传图片
44
</el-button>
55
<el-dialog :visible.sync="dialogVisible">
66
<el-upload class="editor-slide-upload" action="https://httpbin.org/post" :multiple="true" :file-list="fileList" :show-file-list="true"
@@ -21,7 +21,7 @@ export default {
2121
props: {
2222
color: {
2323
type: String,
24-
default: '#20a0ff'
24+
default: '#1890ff'
2525
}
2626
},
2727
data() {
@@ -87,9 +87,9 @@ export default {
8787
</script>
8888

8989
<style rel="stylesheet/scss" lang="scss" scoped>
90-
.upload-container {
91-
.editor-slide-upload {
92-
margin-bottom: 20px;
93-
}
94-
}
90+
.upload-container {
91+
.editor-slide-upload {
92+
margin-bottom: 20px;
93+
}
94+
}
9595
</style>

src/components/Tinymce/index.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
<div class="tinymce-container editor-container">
33
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
44
<div class="editor-custom-btn-container">
5-
<editorImage color="#20a0ff" class="editor-upload-btn" @successCBK="imageSuccessCBK"></editorImage>
6-
</div>
5+
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK"></editorImage>
6+
</div>
77
</div>
88
</template>
99

1010
<script>
1111
import editorImage from './components/editorImage'
12+
import plugins from './plugins'
13+
import toolbar from './toolbar'
1214
1315
export default {
1416
name: 'tinymce',
@@ -25,11 +27,11 @@ export default {
2527
type: Array,
2628
required: false,
2729
default() {
28-
return ['removeformat undo redo | bullist numlist | outdent indent | forecolor | fullscreen code', 'bold italic blockquote | h2 p media link | alignleft aligncenter alignright']
30+
return []
2931
}
3032
},
3133
menubar: {
32-
default: ''
34+
default: 'file edit insert view format table'
3335
},
3436
height: {
3537
type: Number,
@@ -68,17 +70,16 @@ export default {
6870
height: this.height,
6971
body_class: 'panel-body ',
7072
object_resizing: false,
71-
toolbar: this.toolbar,
73+
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
7274
menubar: this.menubar,
73-
plugins: 'advlist,autolink,code,paste,textcolor, colorpicker,fullscreen,link,lists,media,wordcount, imagetools',
75+
plugins: plugins,
7476
end_container_on_empty_block: true,
7577
powerpaste_word_import: 'clean',
7678
code_dialog_height: 450,
7779
code_dialog_width: 1000,
7880
advlist_bullet_styles: 'square',
7981
advlist_number_styles: 'default',
80-
imagetools_cors_hosts: ['wpimg.wallstcn.com', 'wallstreetcn.com'],
81-
imagetools_toolbar: 'watermark',
82+
imagetools_cors_hosts: ['www.tinymce.com', 'codepen.io'],
8283
default_link_target: '_blank',
8384
link_title: false,
8485
init_instance_callback: editor => {
@@ -160,9 +161,9 @@ export default {
160161
}
161162
.editor-custom-btn-container {
162163
position: absolute;
163-
right: 15px;
164+
right: 4px;
165+
top: 4px;
164166
/*z-index: 2005;*/
165-
top: 18px;
166167
}
167168
.editor-upload-btn {
168169
display: inline-block;

src/components/Tinymce/plugins.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Any plugins you want to use has to be imported
2+
// Detail plugins list see https://www.tinymce.com/docs/plugins/
3+
// Custom builds see https://www.tinymce.com/download/custom-builds/
4+
5+
const plugins = ['advlist anchor autolink autoresize autosave bbcode code codesample colorpicker colorpicker contextmenu directionality emoticons fullpage fullscreen hr image imagetools importcss insertdatetime legacyoutput link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount']
6+
7+
export default plugins

src/components/Tinymce/toolbar.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Here is a list of the toolbar
2+
// Detail list see https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
3+
4+
const toolbar = ['bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak fullscreen insertdatetime media table emoticons forecolor backcolor']
5+
6+
export default toolbar

src/views/components-demo/tinymce.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@ export default {
2020
data() {
2121
return {
2222
content:
23-
`<h1 style="text-align: center;">Welcome to the TinyMCE demo!</h1>
24-
<ul>
25-
<li>Our <a href="//www.tinymce.com/docs/">documentation</a> is a great resource for learning how to configure TinyMCE.</li>
26-
<li>Have a specific question? Visit the <a href="https://community.tinymce.com/forum/">Community Forum</a>.</li>
27-
<li>We also offer enterprise grade support as part of <a href="https://tinymce.com/pricing">TinyMCE premium subscriptions</a>.</li>
28-
</ul>
29-
`
23+
`<h1 style="text-align: center;">Welcome to the TinyMCE demo!</h1><p style="text-align: center; font-size: 15px;"><img title="TinyMCE Logo" src="//www.tinymce.com/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="110" height="97" /><ul>
24+
<li>Our <a href="//www.tinymce.com/docs/">documentation</a> is a great resource for learning how to configure TinyMCE.</li><li>Have a specific question? Visit the <a href="https://community.tinymce.com/forum/">Community Forum</a>.</li><li>We also offer enterprise grade support as part of <a href="https://tinymce.com/pricing">TinyMCE premium subscriptions</a>.</li>
25+
</ul>`
3026
}
3127
}
3228
}

static/tinymce4.7.5/skins/lightgray/content.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)