How to use the parchment.Container function in parchment

To help you get started, we’ve selected a few parchment examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / Webiny / Js / Webiny / Assets / node_modules / quill / core / selection.js View on Github external
let indexes = positions.map((position) => {
      let [node, offset] = position;
      let blot = Parchment.find(node, true);
      let index = blot.offset(this.scroll);
      if (offset === 0) {
        return index;
      } else if (blot instanceof Parchment.Container) {
        return index + blot.length();
      } else {
        return index + blot.index(node, offset);
      }
    });
    let start = Math.min(...indexes), end = Math.max(...indexes);
github webiny / Webiny / Js / Webiny / Assets / node_modules / quill / blots / scroll.js View on Github external
blot.children.forEachAt(index, length, function(child, index, length) {
        if (isLine(child)) {
          lines.push(child);
        } else if (child instanceof Parchment.Container) {
          lines = lines.concat(getLines(child, index, lengthLeft));
        }
        lengthLeft -= length;
      });
      return lines;
github quilljs / quill / blots / container.js View on Github external
import Parchment from 'parchment';
import Block, { BlockEmbed } from './block';


class Container extends Parchment.Container { }
Container.allowedChildren = [Block, BlockEmbed, Container];


export default Container;