Quill: Multiple toolbars in a single editor

Created on 22 Aug 2018  路  4Comments  路  Source: quilljs/quill

I'm currently using the bubble theme so the toolbar appears when I highlight some text in the editor. Does quill allow another toolbar so that when the user is on a new line, the toolbar appears as well (without highlighting text)?

Most helpful comment

+1

Same use case, we're displaying a contextual toolbar on selection of text and another static toolbar.

All 4 comments

And within an editor, how can I check if the cursor is on a new line? When I use getSelection, the index is relative to the entire editor rather than the index of each line.

Github issues are for bugs. Please ask questions on StackOverflow.
Please don't mix multiple subjects on the same issue.

I don't think multiple toolbars for the same editor makes sense.

To check if the cursor is on a new line you can check if the char in selectionIndex-1 == "\n"
Something like this (untested):

checkNewLine() {
  var range = quill.getSelection();
  if(range.index == 0) {
    return true;
  }
  var delta = quill.getContents(range.index-1, 1);
  var op = delta.ops[0];
  return op.insert && op.insert == "\n";
}

i think that multiple toolbars for the Editor really makes sense since you have done a custom tooltip using the toolbar container and his actions and behaviours, and you like to have ALSO a toolbar.

+1

Same use case, we're displaying a contextual toolbar on selection of text and another static toolbar.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scottfr picture scottfr  路  3Comments

ouhman picture ouhman  路  3Comments

rsdrsd picture rsdrsd  路  3Comments

markstewie picture markstewie  路  3Comments

benbro picture benbro  路  3Comments