@lv-x-software-house/x_view 1.2.6-dev.11 → 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 +29 -4
- package/dist/index.mjs +29 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12961,6 +12961,8 @@ function MentionPopover({ query, items, position, onSelect, onClose }) {
|
|
|
12961
12961
|
if (filtered[activeIndex]) onSelect(filtered[activeIndex]);
|
|
12962
12962
|
} else if (e.key === "Escape") {
|
|
12963
12963
|
e.preventDefault();
|
|
12964
|
+
e.stopPropagation();
|
|
12965
|
+
e.stopImmediatePropagation();
|
|
12964
12966
|
onClose();
|
|
12965
12967
|
}
|
|
12966
12968
|
};
|
|
@@ -13077,6 +13079,7 @@ function RichGroupEditor({
|
|
|
13077
13079
|
}) {
|
|
13078
13080
|
const editorRef = (0, import_react28.useRef)(null);
|
|
13079
13081
|
const isMountedRef = (0, import_react28.useRef)(false);
|
|
13082
|
+
const dismissedTriggerRef = (0, import_react28.useRef)(null);
|
|
13080
13083
|
const [mentionState, setMentionState] = (0, import_react28.useState)(null);
|
|
13081
13084
|
const [isEmpty, setIsEmpty] = (0, import_react28.useState)(true);
|
|
13082
13085
|
(0, import_react28.useEffect)(() => {
|
|
@@ -13092,10 +13095,17 @@ function RichGroupEditor({
|
|
|
13092
13095
|
const selection = window.getSelection();
|
|
13093
13096
|
if (!selection || selection.rangeCount === 0) return null;
|
|
13094
13097
|
const range = selection.getRangeAt(0);
|
|
13095
|
-
|
|
13096
|
-
|
|
13098
|
+
const node = range.startContainer;
|
|
13099
|
+
if (node.nodeType !== Node.TEXT_NODE) return null;
|
|
13100
|
+
const textBefore = node.textContent.substring(0, range.startOffset);
|
|
13097
13101
|
const atIndex = textBefore.lastIndexOf("@");
|
|
13098
|
-
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
|
+
}
|
|
13099
13109
|
const query = textBefore.substring(atIndex + 1);
|
|
13100
13110
|
if (query.includes(" ") || query.includes(".") || query.includes(",") || query.length > 40) {
|
|
13101
13111
|
return null;
|
|
@@ -13230,6 +13240,21 @@ function RichGroupEditor({
|
|
|
13230
13240
|
const handleBlur = (0, import_react28.useCallback)(() => {
|
|
13231
13241
|
setTimeout(() => setMentionState(null), 200);
|
|
13232
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
|
+
}, []);
|
|
13233
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(
|
|
13234
13259
|
"div",
|
|
13235
13260
|
{
|
|
@@ -13251,7 +13276,7 @@ function RichGroupEditor({
|
|
|
13251
13276
|
items: searchItems || [],
|
|
13252
13277
|
position: mentionState.position,
|
|
13253
13278
|
onSelect: insertMention,
|
|
13254
|
-
onClose:
|
|
13279
|
+
onClose: handleMentionDismiss
|
|
13255
13280
|
}
|
|
13256
13281
|
));
|
|
13257
13282
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -13007,6 +13007,8 @@ function MentionPopover({ query, items, position, onSelect, onClose }) {
|
|
|
13007
13007
|
if (filtered[activeIndex]) onSelect(filtered[activeIndex]);
|
|
13008
13008
|
} else if (e.key === "Escape") {
|
|
13009
13009
|
e.preventDefault();
|
|
13010
|
+
e.stopPropagation();
|
|
13011
|
+
e.stopImmediatePropagation();
|
|
13010
13012
|
onClose();
|
|
13011
13013
|
}
|
|
13012
13014
|
};
|
|
@@ -13123,6 +13125,7 @@ function RichGroupEditor({
|
|
|
13123
13125
|
}) {
|
|
13124
13126
|
const editorRef = useRef19(null);
|
|
13125
13127
|
const isMountedRef = useRef19(false);
|
|
13128
|
+
const dismissedTriggerRef = useRef19(null);
|
|
13126
13129
|
const [mentionState, setMentionState] = useState26(null);
|
|
13127
13130
|
const [isEmpty, setIsEmpty] = useState26(true);
|
|
13128
13131
|
useEffect22(() => {
|
|
@@ -13138,10 +13141,17 @@ function RichGroupEditor({
|
|
|
13138
13141
|
const selection = window.getSelection();
|
|
13139
13142
|
if (!selection || selection.rangeCount === 0) return null;
|
|
13140
13143
|
const range = selection.getRangeAt(0);
|
|
13141
|
-
|
|
13142
|
-
|
|
13144
|
+
const node = range.startContainer;
|
|
13145
|
+
if (node.nodeType !== Node.TEXT_NODE) return null;
|
|
13146
|
+
const textBefore = node.textContent.substring(0, range.startOffset);
|
|
13143
13147
|
const atIndex = textBefore.lastIndexOf("@");
|
|
13144
|
-
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
|
+
}
|
|
13145
13155
|
const query = textBefore.substring(atIndex + 1);
|
|
13146
13156
|
if (query.includes(" ") || query.includes(".") || query.includes(",") || query.length > 40) {
|
|
13147
13157
|
return null;
|
|
@@ -13276,6 +13286,21 @@ function RichGroupEditor({
|
|
|
13276
13286
|
const handleBlur = useCallback4(() => {
|
|
13277
13287
|
setTimeout(() => setMentionState(null), 200);
|
|
13278
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
|
+
}, []);
|
|
13279
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(
|
|
13280
13305
|
"div",
|
|
13281
13306
|
{
|
|
@@ -13297,7 +13322,7 @@ function RichGroupEditor({
|
|
|
13297
13322
|
items: searchItems || [],
|
|
13298
13323
|
position: mentionState.position,
|
|
13299
13324
|
onSelect: insertMention,
|
|
13300
|
-
onClose:
|
|
13325
|
+
onClose: handleMentionDismiss
|
|
13301
13326
|
}
|
|
13302
13327
|
));
|
|
13303
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",
|