本文整理汇总了TypeScript中quill.Quill类的典型用法代码示例。如果您正苦于以下问题:TypeScript Quill类的具体用法?TypeScript Quill怎么用?TypeScript Quill使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Quill类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test_formatLine3
function test_formatLine3() {
const quillEditor = new Quill('#editor');
quillEditor.formatLine(1, 3, {
align: 'right',
bold: false,
});
}
示例2: test_formatText2
function test_formatText2() {
const quillEditor = new Quill('#editor');
quillEditor.formatText(0, 5, {
bold: false,
color: 'rgb(0, 0, 255)'
});
}
示例3: test_setHtmlContents
function test_setHtmlContents() {
const quillEditor = new Quill('#editor');
const html = "<b>this is a bold text</b>";
const delta = quillEditor.clipboard.convert(html);
quillEditor.setContents(delta);
quillEditor.clipboard.convert();
}
示例4: test_setContents
function test_setContents() {
const quillEditor = new Quill('#editor');
quillEditor.setContents(new Delta({ ops: [
{ insert: 'Hello ' },
{ insert: 'World!', attributes: { bold: true } },
{ insert: '\n' }
]}));
}
示例5: test_formatText4
function test_formatText4() {
const quillEditor = new Quill('#editor');
const range = {index: 0, length: 5};
quillEditor.formatText(range, {
bold: false,
color: 'rgb(0, 0, 255)'
});
}
示例6: test_updateContents
function test_updateContents() {
const quillEditor = new Quill('#editor');
quillEditor.updateContents(new Delta({
ops: [
{ retain: 6 }, // Keep 'Hello '
{ delete: 5 }, // 'World' is deleted
{ insert: 'Quill' }, // Insert 'Quill'
{ retain: 1, attributes: { bold: true } } // Apply bold to exclamation mark
]
}));
}
示例7: test_getSelection
function test_getSelection() {
const quillEditor = new Quill('#editor');
const range = quillEditor.getSelection();
if (range) {
if (range.index === range.length) {
console.log('User cursor is at index', range.index);
} else {
const text = quillEditor.getText(range.index, range.length);
console.log('User has highlighted: ', text);
}
} else {
console.log('User cursor is not in editor');
}
}
示例8: test_on_Events
function test_on_Events() {
const textChangeHandler = (newDelta: DeltaStatic, oldDelta: DeltaStatic, source: string) => { };
const selectionChangeHandler = (newRange: RangeStatic, oldRange: RangeStatic, source: string) => { };
const editorChangeHandler = (name: string, ...args: any[]) => { };
const quillEditor = new Quill('#editor');
quillEditor
.on('text-change', textChangeHandler)
.off('text-change', textChangeHandler)
.once('text-change', textChangeHandler)
.on('selection-change', selectionChangeHandler)
.off('selection-change', selectionChangeHandler)
.once('selection-change', selectionChangeHandler)
.on('editor-change', editorChangeHandler)
.off('editor-change', editorChangeHandler)
.once('editor-change', editorChangeHandler);
}
示例9: test_formatText
function test_formatText() {
const quillEditor = new Quill('#editor');
quillEditor.formatText(0, 5, 'bold', true);
}
示例10: test_insertText
function test_insertText() {
const quillEditor = new Quill('#editor');
quillEditor.insertText(0, "Hello World");
}