当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript quill.Quill类代码示例

本文整理汇总了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,
        });
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:7,代码来源:quill-tests.ts

示例2: test_formatText2

function test_formatText2() {
    const quillEditor = new Quill('#editor');
    quillEditor.formatText(0, 5, {
        bold: false,
        color: 'rgb(0, 0, 255)'
    });
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:7,代码来源:quill-tests.ts

示例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();
}
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:7,代码来源:quill-tests.ts

示例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' }
    ]}));
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:8,代码来源:quill-tests.ts

示例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)'
    });
}
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:8,代码来源:quill-tests.ts

示例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
        ]
    }));
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:11,代码来源:quill-tests.ts

示例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');
    }
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:14,代码来源:quill-tests.ts

示例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);
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:17,代码来源:quill-tests.ts

示例9: test_formatText

function test_formatText() {
    const quillEditor = new Quill('#editor');
    quillEditor.formatText(0, 5, 'bold', true);
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:4,代码来源:quill-tests.ts

示例10: test_insertText

function test_insertText() {
    const quillEditor = new Quill('#editor');
    quillEditor.insertText(0, "Hello World");
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:4,代码来源:quill-tests.ts


注:本文中的quill.Quill类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。