Quill: First line always as h1?

Created on 21 Dec 2016  路  3Comments  路  Source: quilljs/quill

I want to implement a solution, such that the first line is always a h1-tag. I have the following tried myself:

quill.on(Quill.events.TEXT_CHANGE, function(delta, oldDelta, source) {
  let range = quill.getSelection(true);
  let d = quill.formatLine(0, 0, 'header', 1);
  quill.setSelection(range.index, range.length);
  quill.update();
});

It kind of works, but I've the feeling that this isn't a proper solution, because it still is possible to insert images on the first line.

It would be cool if QuillJS had some method to determine the line.

All 3 comments

A simple solution might be to separate the header from the editor

<input type="text">
<div id="editor-container"></div>

Closing inactive issue.

has anyone been able to implement this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yves-K picture Yves-K  路  3Comments

scottfr picture scottfr  路  3Comments

benbro picture benbro  路  3Comments

ouhman picture ouhman  路  3Comments

stas-kh picture stas-kh  路  3Comments