v-notion-editor 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -10,10 +10,11 @@ A powerful, feature-rich Vue 3 rich text editor component inspired by Notion, It
10
10
  - **Masonry Grid Support**: Design and control masonry grids with column resizing, grid controls, and item-level customization.
11
11
  - **Image Handling**: Drag-and-drop image uploads with customizable upload functions.
12
12
  - **File Handler**: Smart paste handling for images and rich content
13
- - **Image Resizing & Alignment**: Smoothly resize images with interactive handles and align them left, right, or center.
14
13
  - **Embed Handling**: Embed videos OR websites supports YouTube, Vimeo, Google Maps, Facebook, and more.
15
14
  - **Math Rendering**: Inline and block math support with KaTeX
16
15
  - **CSV Import**: Import CSV files data into tables
16
+ - **Image Resizing & Alignment**: Smoothly resize images with interactive handles and align them left, right, or center.
17
+ - **Responsive Design**: Optimized for screen sizes, including responsive tables and smart masonry grid layouts for tablets and mobile devices.
17
18
  - **Drag & Drop**: Reorder content blocks with visual drag handles
18
19
  - **Slash Commands**: Quick content insertion with "/" command menu
19
20
  - **Link Management**: Smart link insertion and editing with bubble menu
@@ -35079,7 +35079,7 @@ const gz = /* @__PURE__ */ Ae({
35079
35079
  }, e.click();
35080
35080
  }), n6 = async (t) => new Promise(async (e, n) => {
35081
35081
  try {
35082
- (await import("./papaparse.min-EiJr4k3N.js").then((i) => i.p)).default.parse(t, {
35082
+ (await import("./papaparse.min-BPvsfuSc.js").then((i) => i.p)).default.parse(t, {
35083
35083
  complete: (i) => {
35084
35084
  try {
35085
35085
  const s = i.data;
@@ -37893,12 +37893,12 @@ const TF = { class: "masonry-item-controls" }, AF = {
37893
37893
  return [{ tag: 'div[data-type="masonry-grid-item"]' }];
37894
37894
  },
37895
37895
  renderHTML({ HTMLAttributes: t, node: e }) {
37896
- const n = e.attrs.backgroundColor, r = n ? `vEditor-bg-${n}` : "";
37896
+ const n = e.attrs.backgroundColor, i = `masonry-grid-item-wrapper ${n ? `vEditor-bg-${n}` : ""}`.trim();
37897
37897
  return [
37898
37898
  "div",
37899
37899
  ct(t, {
37900
37900
  "data-type": "masonry-grid-item",
37901
- class: r,
37901
+ class: i,
37902
37902
  ...n && { "data-background-color": n }
37903
37903
  }),
37904
37904
  0
@@ -65572,65 +65572,88 @@ const WW = ["innerHTML"], cj = /* @__PURE__ */ Ae({
65572
65572
  if (!n.value) return;
65573
65573
  n.value.querySelectorAll(
65574
65574
  '.tiptap-mathematics-render, [data-type="inline-math"]'
65575
- ).forEach((l) => {
65576
- const c = l.getAttribute("data-latex");
65577
- if (c)
65575
+ ).forEach((u) => {
65576
+ const d = u.getAttribute("data-latex");
65577
+ if (d)
65578
65578
  try {
65579
- uk.render(c, l, {
65579
+ uk.render(d, u, {
65580
65580
  throwOnError: !1
65581
65581
  });
65582
- } catch (u) {
65583
- console.error("KaTeX rendering error:", u);
65582
+ } catch (h) {
65583
+ console.error("KaTeX rendering error:", h);
65584
65584
  }
65585
65585
  });
65586
65586
  }, s = () => {
65587
65587
  if (!n.value) return;
65588
- n.value.querySelectorAll("pre code").forEach((l) => {
65589
- const c = l.parentElement;
65590
- if (!c) return;
65591
- if (c.hasAttribute("data-syntax-highlighting")) {
65592
- const f = (l.className || "").match(/language-([\w-]+)/), p = f ? f[1] : null;
65588
+ n.value.querySelectorAll("pre code").forEach((u) => {
65589
+ const d = u.parentElement;
65590
+ if (!d) return;
65591
+ if (d.hasAttribute("data-syntax-highlighting")) {
65592
+ const m = (u.className || "").match(/language-([\w-]+)/), g = m ? m[1] : null;
65593
65593
  try {
65594
- const m = l.textContent || "";
65595
- let g;
65596
- p && p !== "auto" && r.listLanguages().includes(p) ? g = r.highlight(p, m) : g = r.highlightAuto(m);
65597
- const b = Eu(g);
65598
- l.innerHTML = b, l.classList.add("hljs");
65599
- } catch (m) {
65600
- console.warn("Failed to highlight code block:", m);
65594
+ const b = u.textContent || "";
65595
+ let x;
65596
+ g && g !== "auto" && r.listLanguages().includes(g) ? x = r.highlight(g, b) : x = r.highlightAuto(b);
65597
+ const S = Eu(x);
65598
+ u.innerHTML = S, u.classList.add("hljs");
65599
+ } catch (b) {
65600
+ console.warn("Failed to highlight code block:", b);
65601
65601
  }
65602
65602
  } else
65603
- l.classList.add("hljs-plain");
65604
- if (c.querySelector(".code-block-copy-btn")) return;
65605
- const d = document.createElement("button");
65606
- d.className = "code-block-copy-btn", d.setAttribute("aria-label", "Copy code"), d.title = "Copy", d.innerHTML = Ro.copy, d.addEventListener("click", async () => {
65607
- const h = l.textContent || "";
65603
+ u.classList.add("hljs-plain");
65604
+ if (d.querySelector(".code-block-copy-btn")) return;
65605
+ const f = document.createElement("button");
65606
+ f.className = "code-block-copy-btn", f.setAttribute("aria-label", "Copy code"), f.title = "Copy", f.innerHTML = Ro.copy, f.addEventListener("click", async () => {
65607
+ const p = u.textContent || "";
65608
65608
  try {
65609
- await navigator.clipboard.writeText(h), d.innerHTML = Ro.check, d.classList.add("text-green-600"), setTimeout(() => {
65610
- d.innerHTML = Ro.copy, d.classList.remove("text-green-600");
65609
+ await navigator.clipboard.writeText(p), f.innerHTML = Ro.check, f.classList.add("text-green-600"), setTimeout(() => {
65610
+ f.innerHTML = Ro.copy, f.classList.remove("text-green-600");
65611
65611
  }, 2e3);
65612
- } catch (f) {
65613
- console.error("Failed to copy text: ", f);
65612
+ } catch (m) {
65613
+ console.error("Failed to copy text: ", m);
65614
65614
  }
65615
- }), c.appendChild(d);
65615
+ }), d.appendChild(f);
65616
65616
  });
65617
65617
  }, o = () => {
65618
+ if (!n.value) return;
65619
+ n.value.querySelectorAll('[data-type="masonry-grid"]').forEach((u) => {
65620
+ const d = Array.from(u.children).filter(
65621
+ (f) => f.getAttribute("data-type") === "masonry-grid-column"
65622
+ ), h = d.length;
65623
+ h !== 0 && d.forEach((f, p) => {
65624
+ Array.from(f.children).filter(
65625
+ (g) => g.getAttribute("data-type") === "masonry-grid-item"
65626
+ ).forEach((g, b) => {
65627
+ const x = b * h + p;
65628
+ g.style.setProperty("--mobile-order", x.toString());
65629
+ });
65630
+ });
65631
+ });
65632
+ }, a = () => {
65633
+ if (!n.value) return;
65634
+ n.value.querySelectorAll("table").forEach((u) => {
65635
+ var h, f;
65636
+ if ((h = u.parentElement) != null && h.classList.contains("table-container")) return;
65637
+ const d = document.createElement("div");
65638
+ d.className = "table-container", (f = u.parentNode) == null || f.insertBefore(d, u), d.appendChild(u);
65639
+ });
65640
+ }, l = () => {
65618
65641
  an(() => {
65619
- i(), s();
65642
+ a(), i(), s(), o();
65620
65643
  });
65621
65644
  };
65622
65645
  return Vt(() => {
65623
- o();
65646
+ l();
65624
65647
  }), ir(
65625
65648
  () => e.content,
65626
65649
  () => {
65627
- o();
65650
+ l();
65628
65651
  }
65629
- ), (a, l) => (W(), ce("div", {
65652
+ ), (c, u) => (W(), ce("div", {
65630
65653
  ref_key: "containerRef",
65631
65654
  ref: n,
65632
- class: We(["v-notion-editor read-mode", a.className]),
65633
- innerHTML: a.content
65655
+ class: We(["v-notion-editor read-mode", c.className]),
65656
+ innerHTML: c.content
65634
65657
  }, null, 10, WW));
65635
65658
  }
65636
65659
  });
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as t, b as i, a as r } from "./index-hDwO4nW3.js";
1
+ import { _ as t, b as i, a as r } from "./index-BIQMg69M.js";
2
2
  export {
3
3
  t as NotionEditor,
4
4
  i as NotionReadMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-notion-editor",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A Notion-style Vue 3 editor.",
5
5
  "type": "module",
6
6
  "author": "safdar-azeem",
@@ -1,4 +1,4 @@
1
- import { g as me, c as ye } from "./index-hDwO4nW3.js";
1
+ import { g as me, c as ye } from "./index-BIQMg69M.js";
2
2
  var ce = { exports: {} };
3
3
  /* @license
4
4
  Papa Parse