@estiva-app/ui 0.68.0 → 0.69.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"LinkChips.d.ts","sourceRoot":"","sources":["../src/LinkChips.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAuC,KAAK,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAExG,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,WAAW,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,CAAA;IACzD,sFAAsF;IACtF,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;IACzD;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAUD,iEAAiE;AACjE,eAAO,MAAM,UAAU,kBAAkB,CAAA;AA4BzC,UAAU,KAAK;IACb,iDAAiD;IACjD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;IACjG,kEAAkE;IAClE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACrC,gEAAgE;IAChE,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,2H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,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;IACjG,kEAAkE;IAClE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACrC,gEAAgE;IAChE,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,2HAA2H;AAC3H,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAE,SAAS,WAAW,EAAO,GAAG,KAAK,CAwChK;AAuBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,kCAyEpB,CAAA"}
package/dist/editor.js CHANGED
@@ -1081,6 +1081,7 @@ import { IconCheck } from "@tabler/icons-react";
1081
1081
 
1082
1082
  // src/LinkChips.ts
1083
1083
  import { Extension as Extension4 } from "@tiptap/core";
1084
+ import { closeHistory } from "@tiptap/pm/history";
1084
1085
  import { Plugin as Plugin3, PluginKey as PluginKey4 } from "@tiptap/pm/state";
1085
1086
  var key = new PluginKey4("linkChips");
1086
1087
  var CHIPS_MADE = "linkChipsMade";
@@ -1115,15 +1116,18 @@ function findLinkChips(doc, selection, referenceOf, pasted = []) {
1115
1116
  return false;
1116
1117
  }
1117
1118
  if (!node.isText || !node.text) return true;
1118
- if (node.marks.some((m) => m.type.spec.code || m.type.name === "code" || m.type.name === "link")) return false;
1119
- for (const run of urlRuns(node.text)) {
1119
+ if (node.marks.some((m) => m.type.spec.code || m.type.name === "code")) return false;
1120
+ const link = node.marks.find((m) => m.type.name === "link");
1121
+ if (link && !(link.attrs.href === node.text && /^https?:\/\//.test(node.text))) return false;
1122
+ const runs = link ? [{ url: node.text, from: 0, to: node.text.length, end: node.text.length }] : urlRuns(node.text);
1123
+ for (const run of runs) {
1120
1124
  const from = pos + run.from;
1121
1125
  const to = pos + run.to;
1122
1126
  const wasPasted = pasted.some((range) => range.from <= from && pos + run.end <= range.to);
1123
1127
  const typing = selection && selection.to > from && selection.from <= pos + run.end;
1124
1128
  if (typing && !(selection.empty && wasPasted)) continue;
1125
1129
  const uri = referenceOf?.(run.url);
1126
- if (uri) found.chips.push({ from, to, url: run.url, uri, marks: node.marks.map((m) => m.type.name), pasted: wasPasted });
1130
+ if (uri) found.chips.push({ from, to, url: run.url, uri, marks: node.marks.filter((m) => m !== link).map((m) => m.type.name), pasted: wasPasted });
1127
1131
  else open.add(run.url);
1128
1132
  }
1129
1133
  return false;
@@ -1143,7 +1147,9 @@ function apply(state, found) {
1143
1147
  for (const chip of [...found.chips].reverse()) {
1144
1148
  tr.replaceWith(chip.from, chip.to, type.create({ uri: chip.uri, href: chip.url, marks: chip.marks }));
1145
1149
  }
1146
- return tr.setMeta("addToHistory", false).setMeta(CHIPS_MADE, { pasted: found.chips.some((chip) => chip.pasted) });
1150
+ const pasted = found.chips.some((chip) => chip.pasted);
1151
+ tr.setMeta(CHIPS_MADE, { pasted });
1152
+ return pasted ? closeHistory(tr) : tr.setMeta("addToHistory", false);
1147
1153
  }
1148
1154
  function refreshLinkChips(editor) {
1149
1155
  if (editor.isDestroyed) return;