本文整理匯總了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");
}