-
Notifications
You must be signed in to change notification settings - Fork 15
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
16 changed files
with
447 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"extends": "stylelint-config-standard", | ||
"rules": { | ||
"no-empty-source": null | ||
"no-empty-source": null, | ||
"selector-pseudo-element-no-unknown": [true, { | ||
"ignorePseudoElements": ["v-deep"] | ||
}] | ||
} | ||
} |
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,25 @@ | ||
设置自适应内容高度 | ||
|
||
```vue | ||
<template> | ||
<div> | ||
autosize: {{autosize}} | ||
<v-editor v-model="content" :autosize="autosize"/> | ||
<el-button @click="autosize.maxRows++">增加maxRows</el-button> | ||
<el-button @click="autosize.minRows++">增加minRows</el-button> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
data() { | ||
return { | ||
content: '', | ||
autosize:{ | ||
maxRows:5, | ||
minRows:3 | ||
} | ||
} | ||
}, | ||
} | ||
</script> | ||
``` |
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,58 @@ | ||
@import url('~github-markdown-css/github-markdown.css'); | ||
|
||
.v-editor .markdown-body, | ||
.v-editor.markdown-body { | ||
hr { | ||
background-color: #e8e8e8; | ||
height: 2px; | ||
margin: 12px 0; | ||
} | ||
|
||
p { | ||
margin-bottom: 0; | ||
} | ||
|
||
ol, | ||
ul { | ||
padding-left: 1.5em; | ||
display: block; | ||
margin-block-start: 1em; | ||
margin-block-end: 1em; | ||
margin-inline-start: 0; | ||
margin-inline-end: 0; | ||
padding-inline-start: 40px; | ||
} | ||
|
||
ul:not(.todo-list) { | ||
list-style-type: disc; | ||
} | ||
|
||
ol { | ||
list-style-type: decimal; | ||
} | ||
|
||
li { | ||
display: list-item; | ||
text-align: -webkit-match-parent; | ||
} | ||
|
||
ol ol { | ||
list-style-type: lower-alpha; | ||
|
||
& ol { | ||
list-style-type: lower-roman; | ||
} | ||
} | ||
|
||
i { | ||
font-style: italic; | ||
} | ||
|
||
// 图片、表格默认靠左 | ||
figure { | ||
&.image, | ||
&.table { | ||
margin: 1em 0; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,32 @@ | ||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin' | ||
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview' | ||
|
||
import imageIcon from '../assets/zoom.svg' | ||
|
||
export default previewFunc => | ||
class ImagePreview extends Plugin { | ||
static get pluginName() { | ||
return 'imagePreview' | ||
} | ||
init() { | ||
const editor = this.editor | ||
|
||
editor.ui.componentFactory.add('imagePreview', locale => { | ||
const view = new ButtonView(locale) | ||
view.set({ | ||
label: editor.t('Preview'), | ||
icon: imageIcon, | ||
tooltip: true | ||
}) | ||
|
||
// Callback executed once the image preview button is clicked. | ||
view.on('execute', () => { | ||
const el = this.editor.model.document.selection.getSelectedElement() | ||
const picUrl = el && el.getAttribute('src') | ||
previewFunc(picUrl) | ||
}) | ||
|
||
return view | ||
}) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin' | ||
import {UploadAdapter} from '../utils/adapter' | ||
|
||
export default uploadImg => | ||
class ImageUploadAdaptor extends Plugin { | ||
/** | ||
* @param {function} uploadFunc upload function for upload image and attachment | ||
*/ | ||
export default uploadFunc => | ||
class Uploader extends Plugin { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
static get pluginName() { | ||
return 'ImageUploadAdaptor' | ||
return 'Uploader' | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
init() { | ||
const {editor} = this | ||
const options = editor.config.get('imageUploadOption') | ||
editor.plugins.get('FileRepository').createUploadAdapter = loader => { | ||
return new UploadAdapter(loader, options, uploadImg) | ||
return new UploadAdapter(loader, uploadFunc) | ||
} | ||
} | ||
} |
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,5 @@ | ||
import {add} from '@ckeditor/ckeditor5-utils/src/translation-service.js' | ||
|
||
add('en', { | ||
Preview: 'Preview' | ||
}) |
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,2 @@ | ||
import './en.js' | ||
import './zh-cn.js' |
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,5 @@ | ||
import {add} from '@ckeditor/ckeditor5-utils/src/translation-service.js' | ||
|
||
add('zh-cn', { | ||
Preview: '预览' | ||
}) |
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
Oops, something went wrong.