@fluentui-copilot/react-chat-input-plugins 0.0.0-nightly-20250130-0405-8f570bff.1 → 0.0.0-nightly-20250203-0407-925d2b9c.1
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/CHANGELOG.json +9 -9
- package/CHANGELOG.md +7 -7
- package/dist/index.d.ts +1 -0
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js +4 -3
- package/lib/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js +4 -3
- package/lib-commonjs/plugins/BasicFunctionality/BasicFunctionality.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Mon, 03 Feb 2025 04:15:44 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
7
|
+
"version": "0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
{
|
|
17
17
|
"author": "beachball",
|
|
18
18
|
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
19
|
-
"comment": "Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
19
|
+
"comment": "Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
20
|
+
"commit": "c5be1fdcdb657df2471ecb53d289f6c85e7fc4a9"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"author": "beachball",
|
|
24
24
|
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
25
|
-
"comment": "Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
25
|
+
"comment": "Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
26
|
+
"commit": "c5be1fdcdb657df2471ecb53d289f6c85e7fc4a9"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"author": "beachball",
|
|
30
30
|
"package": "@fluentui-copilot/react-chat-input-plugins",
|
|
31
|
-
"comment": "Bump @fluentui-copilot/text-editor to v0.0.0-nightly-
|
|
32
|
-
"commit": "
|
|
31
|
+
"comment": "Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
32
|
+
"commit": "c5be1fdcdb657df2471ecb53d289f6c85e7fc4a9"
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-chat-input-plugins
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 03 Feb 2025 04:15:44 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20250203-0407-925d2b9c.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-20250203-0407-925d2b9c.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.4.0..@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-
|
|
9
|
+
Mon, 03 Feb 2025 04:15:44 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-chat-input-plugins_v0.4.0..@fluentui-copilot/react-chat-input-plugins_v0.0.0-nightly-20250203-0407-925d2b9c.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly ([commit](https://github.com/microsoft/fluentai/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui-copilot/text-editor to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui-copilot/chat-input-plugins to v0.0.0-nightly-20250203-0407-925d2b9c.1 ([commit](https://github.com/microsoft/fluentai/commit/c5be1fdcdb657df2471ecb53d289f6c85e7fc4a9) by beachball)
|
|
16
|
+
- Bump @fluentui-copilot/react-text-editor to v0.0.0-nightly-20250203-0407-925d2b9c.1 ([commit](https://github.com/microsoft/fluentai/commit/c5be1fdcdb657df2471ecb53d289f6c85e7fc4a9) by beachball)
|
|
17
|
+
- Bump @fluentui-copilot/text-editor to v0.0.0-nightly-20250203-0407-925d2b9c.1 ([commit](https://github.com/microsoft/fluentai/commit/c5be1fdcdb657df2471ecb53d289f6c85e7fc4a9) by beachball)
|
|
18
18
|
|
|
19
19
|
## [0.4.0](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-chat-input-plugins_v0.4.0)
|
|
20
20
|
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare type BasicFunctionalityPluginProps = {
|
|
|
38
38
|
onCountChanged?: (count: number) => void;
|
|
39
39
|
onContentChange?: (value: string) => void;
|
|
40
40
|
onPaste?: (event: ClipboardEvent) => void;
|
|
41
|
+
isSentinelNodeEnabled?: boolean;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
export declare type BasicFunctionalityPluginRef = {
|
|
@@ -8,19 +8,20 @@ export const BasicFunctionalityPlugin = React.forwardRef((props, ref) => {
|
|
|
8
8
|
trimWhitespace,
|
|
9
9
|
onCountChanged,
|
|
10
10
|
onContentChange,
|
|
11
|
-
onPaste
|
|
11
|
+
onPaste,
|
|
12
|
+
isSentinelNodeEnabled
|
|
12
13
|
} = props;
|
|
13
14
|
const [editor] = useLexicalComposerContext();
|
|
14
15
|
const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState(null);
|
|
15
16
|
useIsomorphicLayoutEffect(() => {
|
|
16
|
-
setBasicFunctionalityImpl(new BasicFunctionalityBase(editor));
|
|
17
|
+
setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));
|
|
17
18
|
return () => {
|
|
18
19
|
setBasicFunctionalityImpl(prev => {
|
|
19
20
|
prev === null || prev === void 0 ? void 0 : prev.cleanup();
|
|
20
21
|
return null;
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
|
-
}, [editor]);
|
|
24
|
+
}, [editor, isSentinelNodeEnabled]);
|
|
24
25
|
React.useImperativeHandle(ref, () => ({
|
|
25
26
|
setIsDisabled(isDisabled) {
|
|
26
27
|
basicFunctionalityImpl === null || basicFunctionalityImpl === void 0 ? void 0 : basicFunctionalityImpl.setIsDisabled(isDisabled);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(\n ref,\n () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl?.setIsDisabled(isDisabled);\n },\n }),\n [basicFunctionalityImpl],\n );\n\n // useIsomorphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl?.insertDefaultValue(defaultValue);\n }\n // We only want to insert the defaultValue if the `editor` object is recreated, not the `basicFunctionalityImpl`\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl?.deactivateContentCallbacks();\n }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl?.deactivatePasteCallback();\n }, [basicFunctionalityImpl, editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl?.deactivateTrimWhitespace();\n }, [basicFunctionalityImpl, editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","onPaste","editor","basicFunctionalityImpl","setBasicFunctionalityImpl","useState","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n isSentinelNodeEnabled?: boolean;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor, isSentinelNodeEnabled]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(\n ref,\n () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl?.setIsDisabled(isDisabled);\n },\n }),\n [basicFunctionalityImpl],\n );\n\n // useIsomorphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl?.insertDefaultValue(defaultValue);\n }\n // We only want to insert the defaultValue if the `editor` object is recreated, not the `basicFunctionalityImpl`\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl?.deactivateContentCallbacks();\n }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl?.deactivatePasteCallback();\n }, [basicFunctionalityImpl, editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl?.deactivateTrimWhitespace();\n }, [basicFunctionalityImpl, editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["React","useLexicalComposerContext","useIsomorphicLayoutEffect","BasicFunctionalityBase","BasicFunctionalityPlugin","forwardRef","props","ref","defaultValue","trimWhitespace","onCountChanged","onContentChange","onPaste","isSentinelNodeEnabled","editor","basicFunctionalityImpl","setBasicFunctionalityImpl","useState","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","deactivateContentCallbacks","activatePasteCallback","deactivatePasteCallback","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,SAASC,sBAAsB,QAAQ,uCAAuC;AAgB9E,OAAO,MAAMC,2BAA2BJ,MAAMK,UAAU,CACtD,CAAC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;IAC/D,GAAG;QAACf;QAAwBD;QAAQL;KAAe;IAEnD,OAAO;AACT,GACA"}
|
|
@@ -14,11 +14,11 @@ const _reacttexteditor = require("@fluentui-copilot/react-text-editor");
|
|
|
14
14
|
const _reactcomponents = require("@fluentui/react-components");
|
|
15
15
|
const _chatinputplugins = require("@fluentui-copilot/chat-input-plugins");
|
|
16
16
|
const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
|
-
const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;
|
|
17
|
+
const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;
|
|
18
18
|
const [editor] = (0, _reacttexteditor.useLexicalComposerContext)();
|
|
19
19
|
const [basicFunctionalityImpl, setBasicFunctionalityImpl] = _react.useState(null);
|
|
20
20
|
(0, _reactcomponents.useIsomorphicLayoutEffect)(()=>{
|
|
21
|
-
setBasicFunctionalityImpl(new _chatinputplugins.BasicFunctionalityBase(editor));
|
|
21
|
+
setBasicFunctionalityImpl(new _chatinputplugins.BasicFunctionalityBase(editor, isSentinelNodeEnabled));
|
|
22
22
|
return ()=>{
|
|
23
23
|
setBasicFunctionalityImpl((prev)=>{
|
|
24
24
|
prev === null || prev === void 0 ? void 0 : prev.cleanup();
|
|
@@ -26,7 +26,8 @@ const BasicFunctionalityPlugin = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
}, [
|
|
29
|
-
editor
|
|
29
|
+
editor,
|
|
30
|
+
isSentinelNodeEnabled
|
|
30
31
|
]);
|
|
31
32
|
_react.useImperativeHandle(ref, ()=>({
|
|
32
33
|
setIsDisabled (isDisabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(\n ref,\n () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl?.setIsDisabled(isDisabled);\n },\n }),\n [basicFunctionalityImpl],\n );\n\n // useIsomorphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl?.insertDefaultValue(defaultValue);\n }\n // We only want to insert the defaultValue if the `editor` object is recreated, not the `basicFunctionalityImpl`\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl?.deactivateContentCallbacks();\n }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl?.deactivatePasteCallback();\n }, [basicFunctionalityImpl, editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl?.deactivateTrimWhitespace();\n }, [basicFunctionalityImpl, editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["BasicFunctionalityPlugin","React","forwardRef","props","ref","defaultValue","editor","trimWhitespace","basicFunctionalityImpl","useIsomorphicLayoutEffect","setBasicFunctionalityImpl","
|
|
1
|
+
{"version":3,"sources":["BasicFunctionality.ts"],"sourcesContent":["import * as React from 'react';\nimport { useLexicalComposerContext } from '@fluentui-copilot/react-text-editor';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-components';\nimport type { IBasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\nimport { BasicFunctionalityBase } from '@fluentui-copilot/chat-input-plugins';\n\nexport type BasicFunctionalityPluginProps = {\n defaultValue?: string;\n // Whether or not to clear the input when only whitespace is remaining\n trimWhitespace?: boolean;\n onCountChanged?: (count: number) => void;\n onContentChange?: (value: string) => void;\n onPaste?: (event: ClipboardEvent) => void;\n isSentinelNodeEnabled?: boolean;\n};\n\nexport type BasicFunctionalityPluginRef = {\n setIsDisabled: (isDisabled: boolean) => void;\n};\n\nexport const BasicFunctionalityPlugin = React.forwardRef<BasicFunctionalityPluginRef, BasicFunctionalityPluginProps>(\n (props, ref) => {\n const { defaultValue, trimWhitespace, onCountChanged, onContentChange, onPaste, isSentinelNodeEnabled } = props;\n\n const [editor] = useLexicalComposerContext();\n\n const [basicFunctionalityImpl, setBasicFunctionalityImpl] = React.useState<IBasicFunctionalityBase | null>(null);\n\n useIsomorphicLayoutEffect(() => {\n setBasicFunctionalityImpl(new BasicFunctionalityBase(editor, isSentinelNodeEnabled));\n\n return () => {\n setBasicFunctionalityImpl(prev => {\n prev?.cleanup();\n return null;\n });\n };\n }, [editor, isSentinelNodeEnabled]);\n\n React.useImperativeHandle<BasicFunctionalityPluginRef, BasicFunctionalityPluginRef>(\n ref,\n () => ({\n setIsDisabled(isDisabled: boolean) {\n basicFunctionalityImpl?.setIsDisabled(isDisabled);\n },\n }),\n [basicFunctionalityImpl],\n );\n\n // useIsomorphicLayoutEffect is used to avoid flickering on first render\n useIsomorphicLayoutEffect(() => {\n if (defaultValue) {\n basicFunctionalityImpl?.insertDefaultValue(defaultValue);\n }\n // We only want to insert the defaultValue if the `editor` object is recreated, not the `basicFunctionalityImpl`\n }, [editor]);\n\n React.useEffect(() => {\n basicFunctionalityImpl?.activateContentCallbacks(onContentChange, onCountChanged);\n return () => basicFunctionalityImpl?.deactivateContentCallbacks();\n }, [basicFunctionalityImpl, editor, onContentChange, onCountChanged]);\n\n React.useEffect(() => {\n if (onPaste) {\n basicFunctionalityImpl?.activatePasteCallback(onPaste);\n }\n return () => basicFunctionalityImpl?.deactivatePasteCallback();\n }, [basicFunctionalityImpl, editor, onPaste]);\n\n React.useEffect(() => {\n if (trimWhitespace) {\n basicFunctionalityImpl?.activateTrimWhitespace();\n }\n return () => basicFunctionalityImpl?.deactivateTrimWhitespace();\n }, [basicFunctionalityImpl, editor, trimWhitespace]);\n\n return null;\n },\n);\n"],"names":["BasicFunctionalityPlugin","React","forwardRef","props","ref","defaultValue","editor","trimWhitespace","basicFunctionalityImpl","useIsomorphicLayoutEffect","setBasicFunctionalityImpl","useLexicalComposerContext","useState","BasicFunctionalityBase","isSentinelNodeEnabled","prev","cleanup","useImperativeHandle","setIsDisabled","isDisabled","insertDefaultValue","useEffect","activateContentCallbacks","onContentChange","deactivateContentCallbacks","onCountChanged","deactivatePasteCallback","onPaste","activateTrimWhitespace","deactivateTrimWhitespace"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBaA;;;eAAAA;;;;iEApBU;iCACmB;iCACA;kCAEH;AAgBhC,MAAM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AEF,OAAG,IAAApB,2BAAA,QAAAA,2BAAA,KAAA,IAAA,KAAA,IAAAA,uBAAAqB,wBAAA;;;QAACrB;QAAAA;KAAAA;WAAwBF;kDAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-chat-input-plugins",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
4
4
|
"description": "A Fluent AI package for React-based ChatInput plugins.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/chat-input-plugins": "0.0.0-nightly-
|
|
16
|
-
"@fluentui-copilot/react-text-editor": "0.0.0-nightly-
|
|
17
|
-
"@fluentui-copilot/text-editor": "0.0.0-nightly-
|
|
15
|
+
"@fluentui-copilot/chat-input-plugins": "0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
16
|
+
"@fluentui-copilot/react-text-editor": "0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
17
|
+
"@fluentui-copilot/text-editor": "0.0.0-nightly-20250203-0407-925d2b9c.1",
|
|
18
18
|
"@swc/helpers": "^0.5.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|