@lv-x-software-house/x_view 1.2.6-dev.12 → 1.2.6-dev.13
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.js +27 -4
- package/dist/index.mjs +27 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13079,6 +13079,7 @@ function RichGroupEditor({
|
|
|
13079
13079
|
}) {
|
|
13080
13080
|
const editorRef = (0, import_react28.useRef)(null);
|
|
13081
13081
|
const isMountedRef = (0, import_react28.useRef)(false);
|
|
13082
|
+
const dismissedTriggerRef = (0, import_react28.useRef)(null);
|
|
13082
13083
|
const [mentionState, setMentionState] = (0, import_react28.useState)(null);
|
|
13083
13084
|
const [isEmpty, setIsEmpty] = (0, import_react28.useState)(true);
|
|
13084
13085
|
(0, import_react28.useEffect)(() => {
|
|
@@ -13094,10 +13095,17 @@ function RichGroupEditor({
|
|
|
13094
13095
|
const selection = window.getSelection();
|
|
13095
13096
|
if (!selection || selection.rangeCount === 0) return null;
|
|
13096
13097
|
const range = selection.getRangeAt(0);
|
|
13097
|
-
|
|
13098
|
-
|
|
13098
|
+
const node = range.startContainer;
|
|
13099
|
+
if (node.nodeType !== Node.TEXT_NODE) return null;
|
|
13100
|
+
const textBefore = node.textContent.substring(0, range.startOffset);
|
|
13099
13101
|
const atIndex = textBefore.lastIndexOf("@");
|
|
13100
|
-
if (atIndex === -1)
|
|
13102
|
+
if (atIndex === -1) {
|
|
13103
|
+
dismissedTriggerRef.current = null;
|
|
13104
|
+
return null;
|
|
13105
|
+
}
|
|
13106
|
+
if (dismissedTriggerRef.current && dismissedTriggerRef.current.node === node && dismissedTriggerRef.current.atIndex === atIndex) {
|
|
13107
|
+
return null;
|
|
13108
|
+
}
|
|
13101
13109
|
const query = textBefore.substring(atIndex + 1);
|
|
13102
13110
|
if (query.includes(" ") || query.includes(".") || query.includes(",") || query.length > 40) {
|
|
13103
13111
|
return null;
|
|
@@ -13232,6 +13240,21 @@ function RichGroupEditor({
|
|
|
13232
13240
|
const handleBlur = (0, import_react28.useCallback)(() => {
|
|
13233
13241
|
setTimeout(() => setMentionState(null), 200);
|
|
13234
13242
|
}, []);
|
|
13243
|
+
const handleMentionDismiss = (0, import_react28.useCallback)(() => {
|
|
13244
|
+
const selection = window.getSelection();
|
|
13245
|
+
if (selection && selection.rangeCount > 0) {
|
|
13246
|
+
const range = selection.getRangeAt(0);
|
|
13247
|
+
const node = range.startContainer;
|
|
13248
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
13249
|
+
const textBefore = node.textContent.substring(0, range.startOffset);
|
|
13250
|
+
const atIndex = textBefore.lastIndexOf("@");
|
|
13251
|
+
if (atIndex !== -1) {
|
|
13252
|
+
dismissedTriggerRef.current = { node, atIndex };
|
|
13253
|
+
}
|
|
13254
|
+
}
|
|
13255
|
+
}
|
|
13256
|
+
setMentionState(null);
|
|
13257
|
+
}, []);
|
|
13235
13258
|
return /* @__PURE__ */ import_react28.default.createElement("div", { className: "relative" }, isEmpty && !readOnly && /* @__PURE__ */ import_react28.default.createElement("div", { className: "absolute top-0 left-0 text-sm text-slate-600 pointer-events-none select-none" }, placeholder || "Escreva sobre este grupo\u2026 ou digite @ para mencionar"), /* @__PURE__ */ import_react28.default.createElement(
|
|
13236
13259
|
"div",
|
|
13237
13260
|
{
|
|
@@ -13253,7 +13276,7 @@ function RichGroupEditor({
|
|
|
13253
13276
|
items: searchItems || [],
|
|
13254
13277
|
position: mentionState.position,
|
|
13255
13278
|
onSelect: insertMention,
|
|
13256
|
-
onClose:
|
|
13279
|
+
onClose: handleMentionDismiss
|
|
13257
13280
|
}
|
|
13258
13281
|
));
|
|
13259
13282
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -13125,6 +13125,7 @@ function RichGroupEditor({
|
|
|
13125
13125
|
}) {
|
|
13126
13126
|
const editorRef = useRef19(null);
|
|
13127
13127
|
const isMountedRef = useRef19(false);
|
|
13128
|
+
const dismissedTriggerRef = useRef19(null);
|
|
13128
13129
|
const [mentionState, setMentionState] = useState26(null);
|
|
13129
13130
|
const [isEmpty, setIsEmpty] = useState26(true);
|
|
13130
13131
|
useEffect22(() => {
|
|
@@ -13140,10 +13141,17 @@ function RichGroupEditor({
|
|
|
13140
13141
|
const selection = window.getSelection();
|
|
13141
13142
|
if (!selection || selection.rangeCount === 0) return null;
|
|
13142
13143
|
const range = selection.getRangeAt(0);
|
|
13143
|
-
|
|
13144
|
-
|
|
13144
|
+
const node = range.startContainer;
|
|
13145
|
+
if (node.nodeType !== Node.TEXT_NODE) return null;
|
|
13146
|
+
const textBefore = node.textContent.substring(0, range.startOffset);
|
|
13145
13147
|
const atIndex = textBefore.lastIndexOf("@");
|
|
13146
|
-
if (atIndex === -1)
|
|
13148
|
+
if (atIndex === -1) {
|
|
13149
|
+
dismissedTriggerRef.current = null;
|
|
13150
|
+
return null;
|
|
13151
|
+
}
|
|
13152
|
+
if (dismissedTriggerRef.current && dismissedTriggerRef.current.node === node && dismissedTriggerRef.current.atIndex === atIndex) {
|
|
13153
|
+
return null;
|
|
13154
|
+
}
|
|
13147
13155
|
const query = textBefore.substring(atIndex + 1);
|
|
13148
13156
|
if (query.includes(" ") || query.includes(".") || query.includes(",") || query.length > 40) {
|
|
13149
13157
|
return null;
|
|
@@ -13278,6 +13286,21 @@ function RichGroupEditor({
|
|
|
13278
13286
|
const handleBlur = useCallback4(() => {
|
|
13279
13287
|
setTimeout(() => setMentionState(null), 200);
|
|
13280
13288
|
}, []);
|
|
13289
|
+
const handleMentionDismiss = useCallback4(() => {
|
|
13290
|
+
const selection = window.getSelection();
|
|
13291
|
+
if (selection && selection.rangeCount > 0) {
|
|
13292
|
+
const range = selection.getRangeAt(0);
|
|
13293
|
+
const node = range.startContainer;
|
|
13294
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
13295
|
+
const textBefore = node.textContent.substring(0, range.startOffset);
|
|
13296
|
+
const atIndex = textBefore.lastIndexOf("@");
|
|
13297
|
+
if (atIndex !== -1) {
|
|
13298
|
+
dismissedTriggerRef.current = { node, atIndex };
|
|
13299
|
+
}
|
|
13300
|
+
}
|
|
13301
|
+
}
|
|
13302
|
+
setMentionState(null);
|
|
13303
|
+
}, []);
|
|
13281
13304
|
return /* @__PURE__ */ React27.createElement("div", { className: "relative" }, isEmpty && !readOnly && /* @__PURE__ */ React27.createElement("div", { className: "absolute top-0 left-0 text-sm text-slate-600 pointer-events-none select-none" }, placeholder || "Escreva sobre este grupo\u2026 ou digite @ para mencionar"), /* @__PURE__ */ React27.createElement(
|
|
13282
13305
|
"div",
|
|
13283
13306
|
{
|
|
@@ -13299,7 +13322,7 @@ function RichGroupEditor({
|
|
|
13299
13322
|
items: searchItems || [],
|
|
13300
13323
|
position: mentionState.position,
|
|
13301
13324
|
onSelect: insertMention,
|
|
13302
|
-
onClose:
|
|
13325
|
+
onClose: handleMentionDismiss
|
|
13303
13326
|
}
|
|
13304
13327
|
));
|
|
13305
13328
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.6-dev.
|
|
3
|
+
"version": "1.2.6-dev.13",
|
|
4
4
|
"description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
|
|
5
5
|
"author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
|
|
6
6
|
"license": "UNLICENSED",
|