當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。