Skip to content

Latest commit

 

History

History
104 lines (69 loc) · 2.73 KB

model.md

File metadata and controls

104 lines (69 loc) · 2.73 KB

Model

find experimental {#find-experimental}

Static method returning the Quill or Blot instance for the given DOM node. In the latter case, passing in true for the bubble parameter will search up the given DOM's ancestors until it finds a corresponding Blot.

Methods

DevExpress.Quill.find(domNode: Node, bubble: boolean = false): Blot | Quill

Examples

var container = document.querySelector("#container");
var quill = new DevExpress.Quill(container);
console.log(DevExpress.Quill.find(container) === quill);   // Should be true

quill.insertText(0, 'Hello', 'link', 'https://world.com');
var linkNode = document.querySelector('#container a');
var linkBlot = DevExpress.Quill.find(linkNode);

getIndex experimental {#getindex-experimental}

Returns the distance between the beginning of document to the occurrence of the given Blot.

Methods

getIndex(blot: Blot): Number

Examples

let [line, offset] = quill.getLine(10);
let index = quill.getIndex(line);   // index + offset should == 10

getLeaf experimental {#getleaf-experimental}

Returns the leaf Blot at the specified index within the document.

Methods

getLeaf(index: Number): Blot

Examples

quill.setText('Hello Good World!');
quill.formatText(6, 4, "bold", true);

let [leaf, offset] = quill.getLeaf(7);
// leaf should be a Text Blot with value "Good"
// offset should be 1, since the returned leaf started at index 6

getLine experimental {#getline-experimental}

Returns the line Blot at the specified index within the document.

Methods

getLine(index: Number): [Blot, Number]

Examples

quill.setText('Hello\nWorld!');

let [line, offset] = quill.getLine(7);
// line should be a Block Blot representing the 2nd "World!" line
// offset should be 1, since the returned line started at index 6

getLines experimental {#getlines-experimental}

Returns the lines contained within the specified location.

Methods

getLines(index: Number = 0, length: Number = remaining): Blot[]
getLines(range: Range): Blot[]

Examples

quill.setText('Hello\nGood\nWorld!');
quill.formatLine(1, 1, 'list', 'bullet');

let lines = quill.getLines(2, 5);
// array with a ListItem and Block Blot,
// representing the first two lines