We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
下面以新增自定义行高为例:
import Quill from 'quill'; const Parchment = Quill.import('parchment'); class lineHeightAttributor extends Parchment.Attributor.Style {} const lineHeightStyle = new lineHeightAttributor('lineHeight', 'line-height', { scope: Parchment.Scope.INLINE, whitelist: ['1', '1.25', '1.5', '1.75', '2', '3'], }); export default lineHeightStyle;
import Vue from "vue"; import Quill from 'quill' import VueQuillEditor from 'vue-quill-editor' import LineHeight from './line-height'; Quill.register("formats/lineHeight", LineHeight, true); Vue.use(VueQuillEditor)
3.使用时(.vue文件):
<quill-editor ref="myTextEditor" v-model="model" :options="editorOption"> <el-tooltip class="item" effect="dark" content="行高" placement="top"> <span> <select class="ql-lineHeight"> <option value="1"></option> <option value="1.25"></option> <option value="1.5"></option> <option value="1.75"></option> <option value="2"></option> <option value="3"></option> </select> </span> </el-tooltip> </quill-editor>
data() { return { editorOption: { placeholder: '请输入文本', modules: { toolbar: { container: '#toolbar', // 下面不写也可以 // handlers: { // lineHeight: function (value) { // if (value) { // this.quill.format('lineHeight', value); // } //}, }, }, }, }, }; },
.ql-picker.ql-lineHeight>.ql-picker-label { &::before { position: absolute; top: 0; bottom: 0; left: 0; right: 0; color: #333; font-size: 20px; } &>svg { display: none; } } .ql-lineHeight>.ql-picker-label::before { content: 'L'; } .ql-picker.ql-lineHeight .ql-picker-item:before { content: attr(data-value); }
注意:有几个值必须对应,不然无效
const lineHeightStyle = new lineHeightAttributor('lineHeight', 'line-height', { scope: Parchment.Scope.INLINE, whitelist: ['1', '1.25', '1.5', '1.75', '2', '3'], }); // lineHeight
<select class="ql-lineHeight"> <option value="1"></option> <option value="1.25"></option> <option value="1.5"></option> <option value="1.75"></option> <option value="2"></option> <option value="3"></option> </select> // ql-lineHeight 的 lineHeight
handlers: { lineHeight: function (value) { /** xxx */ }, // lineHeight
上面三个 lineHeight 必须一样
The text was updated successfully, but these errors were encountered:
No branches or pull requests
下面以新增自定义行高为例:
3.使用时(.vue文件):
上面三个 lineHeight 必须一样
The text was updated successfully, but these errors were encountered: