forked from JakHuang/form-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
576 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-disable max-len */ | ||
|
||
export const plugins = [ | ||
'advlist anchor autolink autosave code codesample directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textpattern visualblocks visualchars wordcount' | ||
] | ||
export const toolbar = [ | ||
'code searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript codesample hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<textarea :id="tinymceId" class="textarea" /> | ||
</template> | ||
|
||
<script> | ||
import loadTinymce from '@/utils/loadTinymce' | ||
import { plugins, toolbar } from './config' | ||
let num = 1 | ||
export default { | ||
props: { | ||
id: { | ||
type: String, | ||
default: () => { | ||
num === 10000 && (num = 1) | ||
return `tinymce${+new Date()}${num++}` | ||
} | ||
}, | ||
value: { | ||
type: String, | ||
default: '' | ||
} | ||
}, | ||
data() { | ||
return { | ||
tinymceId: this.id | ||
} | ||
}, | ||
computed: { | ||
}, | ||
watch: { | ||
}, | ||
mounted() { | ||
loadTinymce(tinymce => { | ||
import('./zh_CN') | ||
tinymce.init({ | ||
selector: `#${this.tinymceId}`, | ||
language: 'zh_CN', | ||
menubar: 'file edit insert view format table', | ||
plugins, | ||
toolbar, | ||
height: this.$attrs.height || 300, | ||
branding: this.$attrs.branding || false, | ||
object_resizing: false, | ||
end_container_on_empty_block: true, | ||
powerpaste_word_import: 'clean', | ||
code_dialog_height: 450, | ||
code_dialog_width: 1000, | ||
advlist_bullet_styles: 'square', | ||
advlist_number_styles: 'default', | ||
default_link_target: '_blank', | ||
link_title: false, | ||
nonbreaking_force_tab: true, | ||
init_instance_callback: editor => { | ||
if (this.value) { | ||
editor.setContent(this.value) | ||
} | ||
} | ||
}) | ||
}) | ||
}, | ||
methods: { | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.textarea{ | ||
visibility: hidden; | ||
} | ||
</style> |
Oops, something went wrong.