@scrider/formatter 1.10.7 → 1.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4183,6 +4183,12 @@ function htmlToDelta(html, options = {}) {
4183
4183
  pendingText = "";
4184
4184
  }
4185
4185
  }
4186
+ function beginBlockEmbedLine() {
4187
+ flushText();
4188
+ if (!atLineStart) {
4189
+ context.pushNewline();
4190
+ }
4191
+ }
4186
4192
  function processNode(node) {
4187
4193
  if (node.nodeType === NODE_TYPE.TEXT_NODE) {
4188
4194
  const text = node.textContent ?? "";
@@ -4549,7 +4555,7 @@ function htmlToDelta(html, options = {}) {
4549
4555
  };
4550
4556
  const data = footnotesHandler.fromHtml(section, blockContext);
4551
4557
  if (data) {
4552
- flushText();
4558
+ beginBlockEmbedLine();
4553
4559
  delta.insert({ block: data });
4554
4560
  delta.insert("\n");
4555
4561
  atLineStart = true;
@@ -4571,7 +4577,7 @@ function htmlToDelta(html, options = {}) {
4571
4577
  };
4572
4578
  const data = alertHandler.fromHtml(element, blockContext);
4573
4579
  if (data) {
4574
- flushText();
4580
+ beginBlockEmbedLine();
4575
4581
  delta.insert({ block: data });
4576
4582
  delta.insert("\n");
4577
4583
  atLineStart = true;
@@ -4593,7 +4599,7 @@ function htmlToDelta(html, options = {}) {
4593
4599
  };
4594
4600
  const data = columnsHandler.fromHtml(element, blockContext);
4595
4601
  if (data) {
4596
- flushText();
4602
+ beginBlockEmbedLine();
4597
4603
  delta.insert({ block: data });
4598
4604
  delta.insert("\n");
4599
4605
  atLineStart = true;
@@ -4615,7 +4621,7 @@ function htmlToDelta(html, options = {}) {
4615
4621
  };
4616
4622
  const data = boxHandler.fromHtml(element, blockContext);
4617
4623
  if (data) {
4618
- flushText();
4624
+ beginBlockEmbedLine();
4619
4625
  const opAttrs = {};
4620
4626
  const dataFloat = element.getAttribute("data-float");
4621
4627
  if (dataFloat) opAttrs.float = dataFloat;
@@ -4664,7 +4670,7 @@ function htmlToDelta(html, options = {}) {
4664
4670
  let data = tableHandler.fromHtml(table, makeTableBlockParseContext());
4665
4671
  if (!data) return false;
4666
4672
  if (host) data = enrichTableBlockFromHost(data, host);
4667
- flushText();
4673
+ beginBlockEmbedLine();
4668
4674
  delta.insert({ block: data });
4669
4675
  delta.insert("\n");
4670
4676
  atLineStart = true;