@haklex/rich-compose 0.34.0 → 0.35.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.
@@ -164895,12 +164895,54 @@ TTD mermaid definition render errror: ${M.message}`, "color: yellow"), le("ai",
164895
164895
  return (0, import_react$185.use)(NestedEditorPluginsContext)?.plugins ?? null;
164896
164896
  }
164897
164897
  //#endregion
164898
+ //#region ../rich-editor/src/plugins/PasteLinkPlugin.tsx
164899
+ init_LexicalLink_prod();
164900
+ init_LexicalComposerContext_prod();
164901
+ init_Lexical_prod();
164902
+ var LINK_PROTOCOLS = /* @__PURE__ */ new Set([
164903
+ "http:",
164904
+ "https:",
164905
+ "mailto:",
164906
+ "tel:"
164907
+ ]);
164908
+ function toPureUrl(raw) {
164909
+ const text = raw?.trim();
164910
+ if (!text || /\s/.test(text)) return null;
164911
+ try {
164912
+ return LINK_PROTOCOLS.has(new URL(text).protocol) ? text : null;
164913
+ } catch {
164914
+ return null;
164915
+ }
164916
+ }
164917
+ function PasteLinkPlugin() {
164918
+ const [editor] = o$50();
164919
+ (0, import_react$185.useEffect)(() => {
164920
+ return editor.registerCommand(Je$5, (event) => {
164921
+ if (!(event instanceof ClipboardEvent)) return false;
164922
+ const selection = Kr$1();
164923
+ if (!ur(selection) || selection.isCollapsed()) return false;
164924
+ const url = toPureUrl(event.clipboardData?.getData("text/plain"));
164925
+ if (!url) return false;
164926
+ const textNodes = selection.getNodes().filter(Xo$2);
164927
+ if (textNodes.length === 0) return false;
164928
+ if (textNodes.some((node) => !node.isSimpleText())) return false;
164929
+ const block = textNodes[0].getTopLevelElement();
164930
+ if (!block || textNodes.some((node) => node.getTopLevelElement() !== block)) return false;
164931
+ event.preventDefault();
164932
+ editor.dispatchCommand(nt$6, url);
164933
+ return true;
164934
+ }, 3);
164935
+ }, [editor]);
164936
+ return null;
164937
+ }
164938
+ //#endregion
164898
164939
  //#region ../rich-editor/src/components/decorators/NestedEditorCorePlugins.tsx
164899
164940
  function NestedEditorCorePlugins() {
164900
164941
  const nestedEditorPlugins = useNestedEditorPlugins();
164901
164942
  return /* @__PURE__ */ (0, import_jsx_runtime$231.jsxs)(import_jsx_runtime$231.Fragment, { children: [
164902
164943
  /* @__PURE__ */ (0, import_jsx_runtime$231.jsx)(l, {}),
164903
164944
  /* @__PURE__ */ (0, import_jsx_runtime$231.jsx)(l$1, {}),
164945
+ /* @__PURE__ */ (0, import_jsx_runtime$231.jsx)(PasteLinkPlugin, {}),
164904
164946
  nestedEditorPlugins
164905
164947
  ] });
164906
164948
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-compose",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "Compose primitives for haklex rich content renderers — Gundam-style assembly of Lexical nodes, sync/lazy renderers, and Provider stacks.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -281,27 +281,27 @@
281
281
  ],
282
282
  "dependencies": {
283
283
  "@lexical/headless": "^0.49.0",
284
- "@haklex/rich-ext-code-snippet": "0.34.0",
285
- "@haklex/rich-ext-dynamic": "0.34.0",
286
- "@haklex/rich-ext-chat": "0.34.0",
287
- "@haklex/rich-ext-gallery": "0.34.0",
288
- "@haklex/rich-ext-excalidraw": "0.34.0",
289
- "@haklex/rich-ext-poll": "0.34.0",
290
- "@haklex/rich-litexml": "0.34.0",
291
- "@haklex/rich-ext-embed": "0.34.0",
292
- "@haklex/rich-ext-nested-doc": "0.34.0",
293
- "@haklex/rich-renderer-image": "0.34.0",
294
- "@haklex/rich-renderer-codeblock": "0.34.0",
295
- "@haklex/rich-renderer-katex": "0.34.0",
296
- "@haklex/rich-plugin-slash-menu": "0.34.0",
297
- "@haklex/rich-renderer-alert": "0.34.0",
298
- "@haklex/rich-renderer-linkcard": "0.34.0",
299
- "@haklex/rich-renderer-banner": "0.34.0",
300
- "@haklex/rich-renderer-mention": "0.34.0",
301
- "@haklex/rich-renderer-video": "0.34.0",
302
- "@haklex/rich-style-token": "0.34.0",
303
- "@haklex/rich-renderer-ruby": "0.34.0",
304
- "@haklex/rich-renderer-mermaid": "0.34.0"
284
+ "@haklex/rich-ext-chat": "0.35.0",
285
+ "@haklex/rich-ext-code-snippet": "0.35.0",
286
+ "@haklex/rich-ext-dynamic": "0.35.0",
287
+ "@haklex/rich-ext-excalidraw": "0.35.0",
288
+ "@haklex/rich-ext-nested-doc": "0.35.0",
289
+ "@haklex/rich-ext-embed": "0.35.0",
290
+ "@haklex/rich-ext-gallery": "0.35.0",
291
+ "@haklex/rich-ext-poll": "0.35.0",
292
+ "@haklex/rich-litexml": "0.35.0",
293
+ "@haklex/rich-plugin-slash-menu": "0.35.0",
294
+ "@haklex/rich-renderer-alert": "0.35.0",
295
+ "@haklex/rich-renderer-banner": "0.35.0",
296
+ "@haklex/rich-renderer-codeblock": "0.35.0",
297
+ "@haklex/rich-renderer-linkcard": "0.35.0",
298
+ "@haklex/rich-renderer-katex": "0.35.0",
299
+ "@haklex/rich-renderer-image": "0.35.0",
300
+ "@haklex/rich-renderer-mermaid": "0.35.0",
301
+ "@haklex/rich-renderer-mention": "0.35.0",
302
+ "@haklex/rich-renderer-ruby": "0.35.0",
303
+ "@haklex/rich-style-token": "0.35.0",
304
+ "@haklex/rich-renderer-video": "0.35.0"
305
305
  },
306
306
  "devDependencies": {
307
307
  "@lexical/react": "^0.49.0",
@@ -317,7 +317,7 @@
317
317
  "unplugin-dts": "^1.0.3",
318
318
  "vite": "^8.2.0",
319
319
  "vitest": "^4.1.10",
320
- "@haklex/rich-editor": "0.34.0"
320
+ "@haklex/rich-editor": "0.35.0"
321
321
  },
322
322
  "peerDependencies": {
323
323
  "@lexical/react": "^0.49.0",
@@ -325,7 +325,7 @@
325
325
  "lucide-react": "^1.0.0",
326
326
  "react": ">=19",
327
327
  "react-dom": ">=19",
328
- "@haklex/rich-editor": "^0.34.0"
328
+ "@haklex/rich-editor": "^0.35.0"
329
329
  },
330
330
  "publishConfig": {
331
331
  "access": "public"