quill-placeholder-autocomplete
brings autocomplete to quill-placeholder-module
CI status
Install
Usage
import getPlaceholderModule from 'quill-placeholder-module';
import getAutocompleteModule from 'quill-placeholder-autocomplete-module';
Quill.register('modules/placeholder', getPlaceholderModule(Quill, {
className: 'ql-placeholder-content',
}));
Quill.register('modules/autocomplete', getAutocompleteModule(Quill));
const placeholders = [
{id: 'foo', label: 'Foo'},
{id: 'required', label: 'Required', required: true}
]
var quill = new Quill('#editor', {
modules: {
toolbar: {container: `#toolbar`},
placeholder: {
delimiters: ['{', '}'],
placeholders
},
autocomplete: {
getPlaceholders: () => placeholders
container: '#completions',
triggerKey: '#',
endKey: '#',
debounceTime: 0,
onOpen: () => console.log('opened'),
onClose: (placeholder) => console.log('user choosed:', placeholder),
fetchPlaceholders: (query) => fetch(...).then(...)
onFetchStarted: (query) => console.log('user searching for:', query),
onFetchFinished: (results) => console.log('possible results:', results),
}
},
placeholder: 'Compose an epic...',
theme: 'snow'
});