@tiptap/core 3.20.6 → 3.22.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.
package/dist/index.cjs CHANGED
@@ -49,9 +49,11 @@ __export(index_exports, {
49
49
  createMappablePosition: () => createMappablePosition,
50
50
  createNodeFromContent: () => createNodeFromContent,
51
51
  createStyleTag: () => createStyleTag,
52
+ decodeHtmlEntities: () => decodeHtmlEntities,
52
53
  defaultBlockAt: () => defaultBlockAt,
53
54
  deleteProps: () => deleteProps,
54
55
  elementFromString: () => elementFromString,
56
+ encodeHtmlEntities: () => encodeHtmlEntities,
55
57
  escapeForRegEx: () => escapeForRegEx,
56
58
  extensions: () => extensions_exports,
57
59
  findChildren: () => findChildren,
@@ -535,7 +537,6 @@ function isMarkInSet(marks, type, attributes = {}) {
535
537
  return !!findMarkInSet(marks, type, attributes);
536
538
  }
537
539
  function getMarkRange($pos, type, attributes) {
538
- var _a;
539
540
  if (!$pos || !type) {
540
541
  return;
541
542
  }
@@ -546,7 +547,12 @@ function getMarkRange($pos, type, attributes) {
546
547
  if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
547
548
  return;
548
549
  }
549
- attributes = attributes || ((_a = start.node.marks[0]) == null ? void 0 : _a.attrs);
550
+ if (!attributes) {
551
+ const firstMark = start.node.marks.find((mark2) => mark2.type === type);
552
+ if (firstMark) {
553
+ attributes = firstMark.attrs;
554
+ }
555
+ }
550
556
  const mark = findMarkInSet([...start.node.marks], type, attributes);
551
557
  if (!mark) {
552
558
  return;
@@ -581,7 +587,7 @@ function getMarkType(nameOrType, schema) {
581
587
  }
582
588
 
583
589
  // src/commands/extendMarkRange.ts
584
- var extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
590
+ var extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
585
591
  const type = getMarkType(typeOrName, state.schema);
586
592
  const { doc, selection } = tr;
587
593
  const { $from, from, to } = selection;
@@ -4150,7 +4156,7 @@ var Delete = Extension.create({
4150
4156
  const newEnd = mapping.slice(index).map(step.to);
4151
4157
  const oldStart = mapping.invert().map(newStart, -1);
4152
4158
  const oldEnd = mapping.invert().map(newEnd);
4153
- const foundBeforeMark = (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark));
4159
+ const foundBeforeMark = newStart > 0 ? (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark)) : false;
4154
4160
  const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));
4155
4161
  this.editor.emit("delete", {
4156
4162
  type: "mark",
@@ -5724,7 +5730,7 @@ var ResizableNodeView = class {
5724
5730
  const element = document.createElement("div");
5725
5731
  element.dataset.resizeContainer = "";
5726
5732
  element.dataset.node = this.node.type.name;
5727
- element.style.display = "flex";
5733
+ element.style.display = this.node.type.isInline ? "inline-flex" : "flex";
5728
5734
  if (this.classNames.container) {
5729
5735
  element.className = this.classNames.container;
5730
5736
  }
@@ -6075,6 +6081,14 @@ function escapeForRegEx(string) {
6075
6081
  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
6076
6082
  }
6077
6083
 
6084
+ // src/utilities/htmlEntities.ts
6085
+ function decodeHtmlEntities(text) {
6086
+ return text.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
6087
+ }
6088
+ function encodeHtmlEntities(text) {
6089
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6090
+ }
6091
+
6078
6092
  // src/utilities/isFirefox.ts
6079
6093
  function isFirefox() {
6080
6094
  return typeof navigator !== "undefined" ? /Firefox/.test(navigator.userAgent) : false;
@@ -7032,9 +7046,11 @@ var Tracker = class {
7032
7046
  createMappablePosition,
7033
7047
  createNodeFromContent,
7034
7048
  createStyleTag,
7049
+ decodeHtmlEntities,
7035
7050
  defaultBlockAt,
7036
7051
  deleteProps,
7037
7052
  elementFromString,
7053
+ encodeHtmlEntities,
7038
7054
  escapeForRegEx,
7039
7055
  extensions,
7040
7056
  findChildren,