vue3 quill
v0.3.0
vue3의 퀼 편집기
vue3- quill github-page
npm i vue3 - quill // global
import { quillEditor } from 'vue3-quill'
app . use ( quillEditor ) // single file
import { quillEditor } from 'vue3-quill'
export default {
components : {
quillEditor
}
} // global
import { quillEditor , Quill } from 'vue3-quill'
// Attention:
// customQuillModule means 'custom module name of Quill',
// not a package's name called 'customQuillModule'.
// Such as:
// import ImageUploader from "quill.imageUploader.js";
// Quill.register("modules/imageUploader", ImageUploader);
import customQuillModule from 'customQuillModule'
Quill . register ( 'modules/customQuillModule' , customQuillModule )
app . use ( quillEditor ) import { quillEditor , Quill } from 'vue3-quill'
// Attention:
// customQuillModule means 'custom module name of Quill',
// not a package's name called 'customQuillModule'.
// Such as:
// import ImageUploader from "quill.imageUploader.js";
// Quill.register("modules/imageUploader", ImageUploader);
import customQuillModule from 'customQuillModule'
Quill . register ( 'modules/customQuillModule' , customQuillModule )
export default {
components : {
quillEditor
}
}< template >
< quill-editor
v-model:value = " state.content "
:options = " state.editorOption "
:disabled = " state.disabled "
@blur = " onEditorBlur($event) "
@focus = " onEditorFocus($event) "
@ready = " onEditorReady($event) "
@change = " onEditorChange($event) "
/>
</ template >
< script >
import { reactive } from ' vue '
export default {
name : ' App ' ,
setup () {
const state = reactive ({
content : ' <p>2333</p> ' ,
_content : ' ' ,
editorOption : {
placeholder : ' core ' ,
modules : {
// toolbars: [
// custom toolbars options
// will override the default configuration
// ],
// other moudle options here
// otherMoudle: {}
},
// more options
},
disabled : false
})
const onEditorBlur = ( quill ) => {
console . log ( ' editor blur! ' , quill)
}
const onEditorFocus = ( quill ) => {
console . log ( ' editor focus! ' , quill)
}
const onEditorReady = ( quill ) => {
console . log ( ' editor ready! ' , quill)
}
const onEditorChange = ({ quill, html, text }) => {
console . log ( ' editor change! ' , quill, html, text)
state . _content = html
}
setTimeout (() => {
state . disabled = true
}, 2000 )
return { state, onEditorBlur, onEditorFocus, onEditorReady, onEditorChange }
}
}
</ script >V- 모델 지침은 양방향 데이터 바인딩을 생성하는 데 사용될 수 있습니다. 예를 들어:
< quill-editor v-model : value = " state . content " ></ quill-editor >< quill-editor
v-model : value = " state . content "
@ blur = " onEditorBlur ( $event ) "
@ focus = " onEditorFocus ( $event ) "
@ ready = " onEditorReady ( $event ) "
@ change = " onEditorChange ( $event ) "
/>다음 이벤트를 사용할 수 있습니다.
modules: {
toolbar : [ ]
}falsetrue 설정하십시오. 초기화 될 때 readOnly 의 값으로. 가치 변경은 초기화 후 퀼의 API 퀼 문서를 호출합니다.modules: {
toolbar : [
[ 'bold' , 'italic' , 'underline' , 'strike' ] ,
[ 'blockquote' , 'code-block' ] ,
[ { header : 1 } , { header : 2 } ] ,
[ { list : 'ordered' } , { list : 'bullet' } ] ,
[ { script : 'sub' } , { script : 'super' } ] ,
[ { indent : '-1' } , { indent : '+1' } ] ,
[ { direction : 'rtl' } ] ,
[ { size : [ 'small' , false , 'large' , 'huge' ] } ] ,
[ { header : [ 1 , 2 , 3 , 4 , 5 , 6 , false ] } ] ,
[ { color : [ ] } , { background : [ ] } ] ,
[ { font : [ ] } ] ,
[ { align : [ ] } ] ,
[ 'clean' ] ,
[ 'link' , 'image' , 'video' ]
]
}차입 : Vue-Quill-editor에서 영감을 얻은 Vue-Quill-editor.
퀼 ImageHandler 모듈
...
# root dir
yarn serve오픈 소스 덕분에. ❤️