@haklex/rich-plugin-mention 0.0.94 → 0.0.95
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,17 +1,17 @@
|
|
|
1
1
|
import { MenuOption } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
2
|
-
import {
|
|
2
|
+
import { JSX } from 'react';
|
|
3
3
|
export type MentionMenuItemType = 'platform' | 'confirm';
|
|
4
4
|
export declare class MentionMenuItem extends MenuOption {
|
|
5
5
|
type: MentionMenuItemType;
|
|
6
6
|
platformKey: string;
|
|
7
|
-
icon:
|
|
7
|
+
icon: JSX.Element | undefined;
|
|
8
8
|
label: string;
|
|
9
9
|
description: string;
|
|
10
10
|
handleText: string;
|
|
11
11
|
constructor(options: {
|
|
12
12
|
type: MentionMenuItemType;
|
|
13
13
|
platformKey: string;
|
|
14
|
-
icon?:
|
|
14
|
+
icon?: JSX.Element;
|
|
15
15
|
label: string;
|
|
16
16
|
description?: string;
|
|
17
17
|
handleText?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionMenuItem.d.ts","sourceRoot":"","sources":["../src/MentionMenuItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,
|
|
1
|
+
{"version":3,"file":"MentionMenuItem.d.ts","sourceRoot":"","sources":["../src/MentionMenuItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;gBAEP,OAAO,EAAE;QACnB,IAAI,EAAE,mBAAmB,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;CASF"}
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { $createMentionNode } from "@haklex/rich-editor/nodes";
|
|
|
7
7
|
import { PortalThemeWrapper } from "@haklex/rich-style-token";
|
|
8
8
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
9
9
|
import { $createTextNode } from "lexical";
|
|
10
|
-
import { useState, useMemo, useCallback } from "react";
|
|
10
|
+
import { useState, useMemo, useCallback, isValidElement } from "react";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
12
|
import { platformMetaMap } from "@haklex/rich-renderer-mention";
|
|
13
13
|
class MentionMenuItem extends MenuOption {
|
|
@@ -21,7 +21,7 @@ class MentionMenuItem extends MenuOption {
|
|
|
21
21
|
__publicField(this, "handleText");
|
|
22
22
|
this.type = options.type;
|
|
23
23
|
this.platformKey = options.platformKey;
|
|
24
|
-
this.icon = options.icon
|
|
24
|
+
this.icon = options.icon;
|
|
25
25
|
this.label = options.label;
|
|
26
26
|
this.description = options.description ?? "";
|
|
27
27
|
this.handleText = options.handleText ?? "";
|
|
@@ -125,7 +125,7 @@ function parseQueryPhase(query, platforms) {
|
|
|
125
125
|
const confirmItem = new MentionMenuItem({
|
|
126
126
|
type: "confirm",
|
|
127
127
|
platformKey,
|
|
128
|
-
icon: platform.icon,
|
|
128
|
+
icon: isValidElement(platform.icon) ? platform.icon : void 0,
|
|
129
129
|
label: handle ? `@${handle}` : "Type username...",
|
|
130
130
|
description: `${platform.label} — Enter to confirm`,
|
|
131
131
|
handleText: handle
|
|
@@ -140,7 +140,7 @@ function parseQueryPhase(query, platforms) {
|
|
|
140
140
|
(p) => new MentionMenuItem({
|
|
141
141
|
type: "platform",
|
|
142
142
|
platformKey: p.key,
|
|
143
|
-
icon: p.icon,
|
|
143
|
+
icon: isValidElement(p.icon) ? p.icon : void 0,
|
|
144
144
|
label: p.label,
|
|
145
145
|
description: `@${p.key}:username`
|
|
146
146
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-mention",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"description": "Mention typeahead plugin with platform selection",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@haklex/rich-editor": "0.0.
|
|
25
|
-
"@haklex/rich-renderer-mention": "0.0.
|
|
26
|
-
"@haklex/rich-style-token": "0.0.
|
|
24
|
+
"@haklex/rich-editor": "0.0.95",
|
|
25
|
+
"@haklex/rich-renderer-mention": "0.0.95",
|
|
26
|
+
"@haklex/rich-style-token": "0.0.95"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lexical/react": "^0.42.0",
|