tiptap-markdown-react 0.14.0 → 0.14.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
@@ -258,7 +258,6 @@ Override any of these CSS variables on an ancestor (e.g. `:root` or the editor c
258
258
  | `--tmr-line-height` | `1.7` | Content line height |
259
259
  | `--tmr-min-height` | `420px` | Editor min height |
260
260
  | `--tmr-code-bg` | `#f4f4f4` | Inline code background |
261
- | `--tmr-code-max-height` | `480px` | Readonly code block max height (long blocks scroll internally; the header toggle expands to full height; `none` disables the cap). Editable code blocks are never capped |
262
261
  | `--tmr-table-header-bg` | `#f7f7f7` | Table header background |
263
262
  | `--tmr-comment-ring` | `rgba(219, 171, 10, 0.55)` | Active mark / block outline ring |
264
263
  | `--tmr-comment-gutter-bg` | `#f4b400` | Gutter bubble background |
package/dist/index.js CHANGED
@@ -1292,25 +1292,25 @@ function createChart(options = {}) {
1292
1292
  }
1293
1293
  });
1294
1294
  }
1295
- const wrapper = "_wrapper_16490_2";
1296
- const header$1 = "_header_16490_18";
1297
- const langTrigger = "_langTrigger_16490_28";
1298
- const langChevron = "_langChevron_16490_50";
1299
- const readonlyHeader = "_readonlyHeader_16490_56";
1300
- const langBadge = "_langBadge_16490_64";
1301
- const langMenu = "_langMenu_16490_78";
1302
- const langItem = "_langItem_16490_91";
1303
- const langItemSelected = "_langItemSelected_16490_110";
1304
- const langItemCheck = "_langItemCheck_16490_115";
1305
- const deleteBtn = "_deleteBtn_16490_123";
1306
- const pre = "_pre_16490_143";
1307
- const readonly = "_readonly_16490_56";
1308
- const expanded = "_expanded_16490_162";
1309
- const gutter = "_gutter_16490_168";
1310
- const gutterLine = "_gutterLine_16490_185";
1311
- const readonlyActions = "_readonlyActions_16490_189";
1312
- const actionBtn = "_actionBtn_16490_195";
1313
- const langBraces = "_langBraces_16490_214";
1295
+ const wrapper = "_wrapper_k8th1_2";
1296
+ const header$1 = "_header_k8th1_18";
1297
+ const langTrigger = "_langTrigger_k8th1_28";
1298
+ const langChevron = "_langChevron_k8th1_50";
1299
+ const readonlyHeader = "_readonlyHeader_k8th1_56";
1300
+ const langBadge = "_langBadge_k8th1_64";
1301
+ const langMenu = "_langMenu_k8th1_78";
1302
+ const langItem = "_langItem_k8th1_91";
1303
+ const langItemSelected = "_langItemSelected_k8th1_110";
1304
+ const langItemCheck = "_langItemCheck_k8th1_115";
1305
+ const deleteBtn = "_deleteBtn_k8th1_123";
1306
+ const pre = "_pre_k8th1_143";
1307
+ const readonly = "_readonly_k8th1_56";
1308
+ const folded = "_folded_k8th1_161";
1309
+ const gutter = "_gutter_k8th1_167";
1310
+ const gutterLine = "_gutterLine_k8th1_184";
1311
+ const readonlyActions = "_readonlyActions_k8th1_188";
1312
+ const actionBtn = "_actionBtn_k8th1_194";
1313
+ const langBraces = "_langBraces_k8th1_213";
1314
1314
  const styles$4 = {
1315
1315
  wrapper,
1316
1316
  header: header$1,
@@ -1325,7 +1325,7 @@ const styles$4 = {
1325
1325
  deleteBtn,
1326
1326
  pre,
1327
1327
  readonly,
1328
- expanded,
1328
+ folded,
1329
1329
  gutter,
1330
1330
  gutterLine,
1331
1331
  readonlyActions,
@@ -1370,8 +1370,7 @@ function CodeBlockView({
1370
1370
  const editable = editor.isEditable;
1371
1371
  const readonly2 = !editable;
1372
1372
  const [copied, setCopied] = useState(false);
1373
- const [expanded2, setExpanded] = useState(false);
1374
- const [scrollable, setScrollable] = useState(false);
1373
+ const [folded2, setFolded] = useState(false);
1375
1374
  const [lineCount, setLineCount] = useState(
1376
1375
  () => Math.max((node.textContent ?? "").split("\n").length, 1)
1377
1376
  );
@@ -1382,17 +1381,12 @@ function CodeBlockView({
1382
1381
  if (!pre2) return;
1383
1382
  const update = () => {
1384
1383
  setLineCount(Math.max((pre2.textContent ?? "").split("\n").length, 1));
1385
- setScrollable(pre2.scrollHeight > pre2.clientHeight + 2);
1386
1384
  };
1387
1385
  update();
1388
1386
  const mo = new MutationObserver(update);
1389
1387
  mo.observe(pre2, { childList: true, subtree: true, characterData: true });
1390
- window.addEventListener("resize", update);
1391
- return () => {
1392
- mo.disconnect();
1393
- window.removeEventListener("resize", update);
1394
- };
1395
- }, [readonly2, expanded2]);
1388
+ return () => mo.disconnect();
1389
+ }, [readonly2]);
1396
1390
  const handleCopy = () => {
1397
1391
  var _a2;
1398
1392
  const text = node.textContent ?? "";
@@ -1419,7 +1413,7 @@ function CodeBlockView({
1419
1413
  const wrapperClass = [
1420
1414
  styles$4.wrapper,
1421
1415
  readonly2 ? styles$4.readonly : "",
1422
- expanded2 ? styles$4.expanded : ""
1416
+ folded2 ? styles$4.folded : ""
1423
1417
  ].filter(Boolean).join(" ");
1424
1418
  return /* @__PURE__ */ jsxs(NodeViewWrapper, { className: wrapperClass, children: [
1425
1419
  editable ? /* @__PURE__ */ jsxs("div", { className: styles$4.header, contentEditable: false, children: [
@@ -1473,7 +1467,7 @@ function CodeBlockView({
1473
1467
  }
1474
1468
  )
1475
1469
  ] }) : (
1476
- // 只读头部:左侧语言标签,右侧复制 + 展开收起(内容不超限高时隐藏展开钮)
1470
+ // 只读头部:左侧语言标签,右侧复制 + 展开收起(展开后按钮保留,供收回)
1477
1471
  /* @__PURE__ */ jsxs("div", { className: styles$4.readonlyHeader, contentEditable: false, children: [
1478
1472
  /* @__PURE__ */ jsxs("span", { className: styles$4.langBadge, children: [
1479
1473
  /* @__PURE__ */ jsx("span", { className: styles$4.langBraces, children: "{}" }),
@@ -1491,18 +1485,18 @@ function CodeBlockView({
1491
1485
  children: copied ? /* @__PURE__ */ jsx(CheckIcon, { size: 14 }) : /* @__PURE__ */ jsx(CopyIcon, { size: 14 })
1492
1486
  }
1493
1487
  ),
1494
- scrollable ? /* @__PURE__ */ jsx(
1488
+ /* @__PURE__ */ jsx(
1495
1489
  "button",
1496
1490
  {
1497
1491
  type: "button",
1498
1492
  className: styles$4.actionBtn,
1499
- onClick: () => setExpanded((v) => !v),
1500
- "aria-label": expanded2 ? labels.collapse : labels.expand,
1501
- title: expanded2 ? labels.collapse : labels.expand,
1502
- "aria-expanded": expanded2,
1493
+ onClick: () => setFolded((v) => !v),
1494
+ "aria-label": folded2 ? labels.expand : labels.collapse,
1495
+ title: folded2 ? labels.expand : labels.collapse,
1496
+ "aria-expanded": !folded2,
1503
1497
  children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, { size: 14 })
1504
1498
  }
1505
- ) : null
1499
+ )
1506
1500
  ] })
1507
1501
  ] })
1508
1502
  ),