fix: repair tiptap patch integrity

This commit is contained in:
lucaronin
2026-04-22 00:21:46 +02:00
parent bf442646f5
commit d52362ad9b
2 changed files with 62 additions and 59 deletions

View File

@@ -1,31 +1,46 @@
diff --git a/src/link.ts b/src/link.ts
--- a/src/link.ts
+++ b/src/link.ts
@@ -6,6 +6,21 @@ import { autolink } from './helpers/autolink.js'
import { clickHandler } from './helpers/clickHandler.js'
import { pasteHandler } from './helpers/pasteHandler.js'
import { UNICODE_WHITESPACE_REGEX_GLOBAL } from './helpers/whitespace.js'
+
+const PRE_REGISTERED_PROTOCOLS = ['tel', 'callto', 'sms', 'cid', 'xmpp'] as const
+const linkifyProtocolFlag = '__tolariaTiptapLinkifyProtocolsRegistered'
+const linkifyGlobalObject = typeof globalThis === 'undefined'
+ ? undefined
+ : (globalThis as Record<string, boolean | undefined>)
+
diff --git a/dist/index.cjs b/dist/index.cjs
index b7357fa..c2c59cb 100644
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -36,6 +36,16 @@ var import_core = require("@tiptap/core");
var import_state = require("@tiptap/pm/state");
var import_linkifyjs = require("linkifyjs");
+var PRE_REGISTERED_PROTOCOLS = ["tel", "callto", "sms", "cid", "xmpp"];
+var linkifyProtocolFlag = "__tolariaTiptapLinkifyProtocolsRegistered";
+var linkifyGlobalObject = typeof globalThis === "undefined" ? void 0 : globalThis;
+if (linkifyGlobalObject && !linkifyGlobalObject[linkifyProtocolFlag]) {
+ PRE_REGISTERED_PROTOCOLS.forEach((protocol) => {
+ registerCustomProtocol(protocol)
+ })
+
+ linkifyGlobalObject[linkifyProtocolFlag] = true
+ (0, import_linkifyjs.registerCustomProtocol)(protocol);
+ });
+ linkifyGlobalObject[linkifyProtocolFlag] = true;
+}
export interface LinkProtocolOptions {
/**
+
// src/helpers/whitespace.ts
var UNICODE_WHITESPACE_PATTERN = "[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]";
var UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);
@@ -253,7 +263,8 @@ var Link = import_core3.Mark.create({
});
},
onDestroy() {
- (0, import_linkifyjs3.reset)();
+ // Tolaria keeps a single editor shell alive across note swaps, so linkify's
+ // protocol registry must survive editor teardown and remount cycles.
},
inclusive() {
return this.options.autolink;
@@ -472,4 +483,4 @@ var index_default = Link;
isAllowedUri,
pasteRegex
});
-//# sourceMappingURL=index.cjs.map
\ No newline at end of file
+//# sourceMappingURL=index.cjs.map
diff --git a/dist/index.js b/dist/index.js
index d486894..cb8e256 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -8,6 +8,18 @@ var UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);
@@ -13,6 +13,16 @@ var UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);
var UNICODE_WHITESPACE_REGEX_END = new RegExp(`${UNICODE_WHITESPACE_PATTERN}$`);
var UNICODE_WHITESPACE_REGEX_GLOBAL = new RegExp(UNICODE_WHITESPACE_PATTERN, "g");
@@ -42,7 +57,7 @@ diff --git a/dist/index.js b/dist/index.js
// src/helpers/autolink.ts
function isValidLinkStructure(tokens) {
if (tokens.length === 1) {
@@ -224,7 +236,8 @@ var Link = Mark.create({
@@ -224,7 +234,8 @@ var Link = Mark.create({
});
},
onDestroy() {
@@ -52,47 +67,35 @@ diff --git a/dist/index.js b/dist/index.js
},
inclusive() {
return this.options.autolink;
@@ -443,4 +444,4 @@ export {
@@ -443,4 +454,4 @@ export {
isAllowedUri,
pasteRegex
};
-//# sourceMappingURL=index.js.map
\ No newline at end of file
+//# sourceMappingURL=index.js.map
diff --git a/dist/index.cjs b/dist/index.cjs
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -10,6 +10,18 @@ var import_state3 = require("@tiptap/pm/state");
var import_linkifyjs2 = require("linkifyjs");
var import_whitespace = require("./helpers/whitespace.cjs");
diff --git a/src/link.ts b/src/link.ts
index 839a575..bbef783 100644
--- a/src/link.ts
+++ b/src/link.ts
@@ -8,6 +8,20 @@ import { clickHandler } from './helpers/clickHandler.js'
import { pasteHandler } from './helpers/pasteHandler.js'
import { UNICODE_WHITESPACE_REGEX_GLOBAL } from './helpers/whitespace.js'
+var PRE_REGISTERED_PROTOCOLS = ["tel", "callto", "sms", "cid", "xmpp"];
+var linkifyProtocolFlag = "__tolariaTiptapLinkifyProtocolsRegistered";
+var linkifyGlobalObject = typeof globalThis === "undefined" ? void 0 : globalThis;
+const PRE_REGISTERED_PROTOCOLS = ['tel', 'callto', 'sms', 'cid', 'xmpp'] as const
+const linkifyProtocolFlag = '__tolariaTiptapLinkifyProtocolsRegistered'
+const linkifyGlobalObject = typeof globalThis === 'undefined'
+ ? undefined
+ : (globalThis as Record<string, boolean | undefined>)
+
+if (linkifyGlobalObject && !linkifyGlobalObject[linkifyProtocolFlag]) {
+ PRE_REGISTERED_PROTOCOLS.forEach((protocol) => {
+ (0, import_linkifyjs.registerCustomProtocol)(protocol);
+ });
+ linkifyGlobalObject[linkifyProtocolFlag] = true;
+ registerCustomProtocol(protocol)
+ })
+
+ linkifyGlobalObject[linkifyProtocolFlag] = true
+}
+
// src/helpers/autolink.ts
function isValidLinkStructure(tokens) {
if (tokens.length === 1) {
@@ -253,7 +265,8 @@ var Link = import_core3.Mark.create({
});
},
onDestroy() {
- (0, import_linkifyjs3.reset)();
+ // Tolaria keeps a single editor shell alive across note swaps, so linkify's
+ // protocol registry must survive editor teardown and remount cycles.
},
inclusive() {
return this.options.autolink;
@@ -472,4 +473,4 @@ var index_default = Link;
isAllowedUri,
pasteRegex
});
-//# sourceMappingURL=index.cjs.map
\ No newline at end of file
+//# sourceMappingURL=index.cjs.map
export interface LinkProtocolOptions {
/**
* The protocol scheme to be registered.

6
pnpm-lock.yaml generated
View File

@@ -12,7 +12,7 @@ patchedDependencies:
hash: e3726d75ed65e07adb1fd48262d6a15f8e52b1cc257177aaf632937830170c97
path: patches/@blocknote__react@0.46.2.patch
'@tiptap/extension-link@3.19.0':
hash: 9bc08d5f05c6bb2ca803ed64cec4c0cccfc6a6482147131488e3426324f587de
hash: fbe59b1b8b798ba3fefa371c0729b5aa3458e1ea70a4b86cd5267f9f62529284
path: patches/@tiptap__extension-link@3.19.0.patch
prosemirror-tables@1.8.5:
hash: cd456f0d1d88a3ce11bcf53122a0e0575c0d82810eddd887adae21d6ec570a8b
@@ -4535,7 +4535,7 @@ snapshots:
'@tiptap/extension-code': 3.19.0(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))
'@tiptap/extension-horizontal-rule': 3.19.0(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))(@tiptap/pm@3.19.0)
'@tiptap/extension-italic': 3.19.0(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))
'@tiptap/extension-link': 3.19.0(patch_hash=9bc08d5f05c6bb2ca803ed64cec4c0cccfc6a6482147131488e3426324f587de)(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))(@tiptap/pm@3.19.0)
'@tiptap/extension-link': 3.19.0(patch_hash=fbe59b1b8b798ba3fefa371c0729b5aa3458e1ea70a4b86cd5267f9f62529284)(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))(@tiptap/pm@3.19.0)
'@tiptap/extension-paragraph': 3.19.0(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))
'@tiptap/extension-strike': 3.19.0(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))
'@tiptap/extension-text': 3.19.0(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))
@@ -6291,7 +6291,7 @@ snapshots:
dependencies:
'@tiptap/core': 3.19.0(@tiptap/pm@3.19.0)
'@tiptap/extension-link@3.19.0(patch_hash=9bc08d5f05c6bb2ca803ed64cec4c0cccfc6a6482147131488e3426324f587de)(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))(@tiptap/pm@3.19.0)':
'@tiptap/extension-link@3.19.0(patch_hash=fbe59b1b8b798ba3fefa371c0729b5aa3458e1ea70a4b86cd5267f9f62529284)(@tiptap/core@3.19.0(@tiptap/pm@3.19.0))(@tiptap/pm@3.19.0)':
dependencies:
'@tiptap/core': 3.19.0(@tiptap/pm@3.19.0)
'@tiptap/pm': 3.19.0