<commit_before>import {Pos} from "../model"
import {toDOM, nodeToDOM} from "../format"
import {elt} from "../dom"

import {DIRTY_REDRAW} from "./main"
import {childContainer} from "./dompos"

// FIXME clean up threading of path and offset, maybe remove from DOM renderer entirely

function options(path, ranges) {
  return {
    onRender(node, dom, offset) {
      if (node.isBlock) {
        if (node.type.contains == null)
          dom.setAttribute("pm-leaf", "true")
        if (offset != null)
          dom.setAttribute("pm-offset", offset)
        if (node.isTextblock)
          adjustTrailingHacks(dom, node)
        if (dom.contentEditable == "false")
          dom = elt("div", dom)
      }

      return dom
    },
    onContainer(node) {
      node.setAttribute("pm-container", true)
    },
    // : (Node, DOMNode, number) → DOMNode
    renderInlineFlat(node, dom, offset) {
      ranges.advanceTo(new Pos(path, offset))
      let end = new Pos(path, offset + node.width)
      let nextCut = ranges.nextChangeBefore(end)<commit_msg>Properly call `elt` in draw.js<commit_after>import {Pos} from "../model"
import {toDOM, nodeToDOM} from "../format"
import {elt} from "../dom"

import {DIRTY_REDRAW} from "./main"
import {childContainer} from "./dompos"

// FIXME clean up threading of path and offset, maybe remove from DOM renderer entirely

function options(path, ranges) {
  return {
    onRender(node, dom, offset) {
      if (node.isBlock) {
        if (node.type.contains == null)
          dom.setAttribute("pm-leaf", "true")
        if (offset != null)
          dom.setAttribute("pm-offset", offset)
        if (node.isTextblock)
          adjustTrailingHacks(dom, node)
        if (dom.contentEditable == "false")
          dom = elt("div", null, dom)
      }

      return dom
    },
    onContainer(node) {
      node.setAttribute("pm-container", true)
    },
    // : (Node, DOMNode, number) → DOMNode
    renderInlineFlat(node, dom, offset) {
      ranges.advanceTo(new Pos(path, offset))
      let end = new Pos(path, offset + node.width)
      let nextCut = ranges.nextChangeBefore(end)
{'fraction_non_alphanumeric': 0.13711583924349882, 'fraction_numerical': 0.0, 'mean_word_length': 2.7057793345008756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5676447', 'n_tokens_mistral': 653, 'n_tokens_neox': 659, 'n_words': 182}