著者名モジュールはテキストの背景を強調表示して、誰が誰であるかを示します。 何を書いたのか。
このモジュールを有効にすると、新しいフォーマットも追加されますauthor
認識されたリストへフォーマット。の値は、author
format は作成者の ID です。変更点
Quill エディターに作成されたものには、ローカルの作成者のメタデータも添付されます。
パラメータ | タイプ | 説明 |
---|---|---|
authorId |
弦 | 現在の作成者のID。 |
button |
弦 | 著者の色を切り替えるボタンの CSS セレクター オンオフ。 |
color |
弦 | 現在の作者に対応する色。任意の有効な CSS を使用できます 色。 |
addAuthor(id, color)
パラメータ | タイプ | 説明 |
---|---|---|
id |
弦 | 追加する作成者のID。 |
color |
弦 | 著者IDに対応する色。任意の有効な CSS を使用できます 色。 |
var editor = new Quill('#editor');
var module = editor.addModule('authorship', {
authorId: 'id-1234',
button: '#author-button',
color: 'rgb(255, 0, 255)'
});
module.addAuthor('id-5678', 'rgb(255, 255, 0)'); // Set external authors
editor.on('text-update', function(delta) {
// If the user types an 'a' into the editor, normally we would get:
// delta.ops = [{ 'a' }]
// But with the author module enabled we would now get:
// delta.ops = [{ value: 'a', attributes: { author: 'id-1234' } }]
});