@fluentui-copilot/chat-input-plugins 0.3.1 → 0.3.2
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 +16 -1
- package/CHANGELOG.md +11 -2
- package/lib/PasteUnfurling/PasteUnfurling.base.js +8 -5
- package/lib/PasteUnfurling/PasteUnfurling.base.js.map +1 -1
- package/lib-commonjs/PasteUnfurling/PasteUnfurling.base.js +8 -5
- package/lib-commonjs/PasteUnfurling/PasteUnfurling.base.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/chat-input-plugins",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 20 Nov 2024 23:38:32 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/chat-input-plugins_v0.3.2",
|
|
7
|
+
"version": "0.3.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "owcampbe@microsoft.com",
|
|
12
|
+
"package": "@fluentui-copilot/chat-input-plugins",
|
|
13
|
+
"commit": "0b973dffa7a48e7ea5f2ebca45c1992f83c20b12",
|
|
14
|
+
"comment": "chore: Fix Paste Unfurling default handlers."
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Thu, 31 Oct 2024 17:41:08 GMT",
|
|
6
21
|
"tag": "@fluentui-copilot/chat-input-plugins_v0.3.1",
|
|
7
22
|
"version": "0.3.1",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/chat-input-plugins
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 20 Nov 2024 23:38:32 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.3.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/chat-input-plugins_v0.3.2)
|
|
8
|
+
|
|
9
|
+
Wed, 20 Nov 2024 23:38:32 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/chat-input-plugins_v0.3.1..@fluentui-copilot/chat-input-plugins_v0.3.2)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: Fix Paste Unfurling default handlers. ([PR #2408](https://github.com/microsoft/fluentai/pull/2408) by owcampbe@microsoft.com)
|
|
15
|
+
|
|
7
16
|
## [0.3.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/chat-input-plugins_v0.3.1)
|
|
8
17
|
|
|
9
|
-
Thu, 31 Oct 2024 17:
|
|
18
|
+
Thu, 31 Oct 2024 17:41:08 GMT
|
|
10
19
|
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/chat-input-plugins_v0.3.0..@fluentui-copilot/chat-input-plugins_v0.3.1)
|
|
11
20
|
|
|
12
21
|
### Patches
|
|
@@ -46,12 +46,15 @@ export function registerPasteUnfurlingPlugin(editor, props) {
|
|
|
46
46
|
const commandsMap = editor._commands;
|
|
47
47
|
const defaultEditorListeners = (_commandsMap_get = commandsMap.get(PASTE_COMMAND)) === null || _commandsMap_get === void 0 ? void 0 : _commandsMap_get[COMMAND_PRIORITY_EDITOR];
|
|
48
48
|
if (defaultEditorListeners) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
// After the promises have resolved, we're not guaranteed to be in the same update state as the original command
|
|
50
|
+
editor.update(() => {
|
|
51
|
+
for (const listener of defaultEditorListeners) {
|
|
52
|
+
const defaultHandled = listener(event, editor);
|
|
53
|
+
if (defaultHandled) {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
|
-
}
|
|
57
|
+
});
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PasteUnfurling.base.ts"],"sourcesContent":["import type { LexicalEditor } from '@fluentui-copilot/text-editor';\nimport {\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n PASTE_COMMAND,\n $insertNodes,\n $createTextNode,\n} from '@fluentui-copilot/text-editor';\nimport type {\n PasteUnfurlingPluginBaseProps,\n PasteUnfurlingTransformedPart,\n PasteUnfurlingTransformResult,\n} from './PasteUnfurling.types';\n\nfunction unhandledPart(part: never): never {\n throw new Error(`Unhandled part: ${part}`);\n}\n\nexport function registerPasteUnfurlingPlugin<ExtraDataType, NodePropsType>(\n editor: LexicalEditor,\n props: PasteUnfurlingPluginBaseProps<ExtraDataType, NodePropsType>,\n): () => void {\n const { entityPluginId, transforms, $createEntityNode } = props;\n\n function insertParts(parts: PasteUnfurlingTransformedPart<ExtraDataType, NodePropsType>[]) {\n editor.update(() => {\n const nodes = parts.map(part => {\n switch (part.type) {\n case 'entity':\n return $createEntityNode(entityPluginId, part.value.text, part.value.data, part.value.entityProps);\n case 'text':\n return $createTextNode(part.value);\n }\n return unhandledPart(part);\n });\n $insertNodes(nodes);\n });\n }\n\n function handlePaste(event: ClipboardEvent): boolean {\n const transformPromises: Promise<PasteUnfurlingTransformResult<ExtraDataType, NodePropsType>>[] = [];\n\n for (const transform of transforms) {\n transformPromises.push(Promise.resolve(transform(event, editor)));\n }\n\n Promise.allSettled(transformPromises).then(results => {\n let handledPaste = false;\n\n for (const result of results) {\n if (result.status === 'fulfilled') {\n const transformResult = result.value;\n if (transformResult.transformedParts) {\n insertParts(transformResult.transformedParts);\n }\n\n if (transformResult.handled) {\n handledPaste = true;\n break;\n }\n }\n }\n\n if (!handledPaste) {\n const commandsMap = editor._commands;\n const defaultEditorListeners = commandsMap.get(PASTE_COMMAND)?.[COMMAND_PRIORITY_EDITOR];\n if (defaultEditorListeners) {\n for (const listener of defaultEditorListeners) {\n
|
|
1
|
+
{"version":3,"sources":["PasteUnfurling.base.ts"],"sourcesContent":["import type { LexicalEditor } from '@fluentui-copilot/text-editor';\nimport {\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n PASTE_COMMAND,\n $insertNodes,\n $createTextNode,\n} from '@fluentui-copilot/text-editor';\nimport type {\n PasteUnfurlingPluginBaseProps,\n PasteUnfurlingTransformedPart,\n PasteUnfurlingTransformResult,\n} from './PasteUnfurling.types';\n\nfunction unhandledPart(part: never): never {\n throw new Error(`Unhandled part: ${part}`);\n}\n\nexport function registerPasteUnfurlingPlugin<ExtraDataType, NodePropsType>(\n editor: LexicalEditor,\n props: PasteUnfurlingPluginBaseProps<ExtraDataType, NodePropsType>,\n): () => void {\n const { entityPluginId, transforms, $createEntityNode } = props;\n\n function insertParts(parts: PasteUnfurlingTransformedPart<ExtraDataType, NodePropsType>[]) {\n editor.update(() => {\n const nodes = parts.map(part => {\n switch (part.type) {\n case 'entity':\n return $createEntityNode(entityPluginId, part.value.text, part.value.data, part.value.entityProps);\n case 'text':\n return $createTextNode(part.value);\n }\n return unhandledPart(part);\n });\n $insertNodes(nodes);\n });\n }\n\n function handlePaste(event: ClipboardEvent): boolean {\n const transformPromises: Promise<PasteUnfurlingTransformResult<ExtraDataType, NodePropsType>>[] = [];\n\n for (const transform of transforms) {\n transformPromises.push(Promise.resolve(transform(event, editor)));\n }\n\n Promise.allSettled(transformPromises).then(results => {\n let handledPaste = false;\n\n for (const result of results) {\n if (result.status === 'fulfilled') {\n const transformResult = result.value;\n if (transformResult.transformedParts) {\n insertParts(transformResult.transformedParts);\n }\n\n if (transformResult.handled) {\n handledPaste = true;\n break;\n }\n }\n }\n\n if (!handledPaste) {\n const commandsMap = editor._commands;\n const defaultEditorListeners = commandsMap.get(PASTE_COMMAND)?.[COMMAND_PRIORITY_EDITOR];\n if (defaultEditorListeners) {\n // After the promises have resolved, we're not guaranteed to be in the same update state as the original command\n editor.update(() => {\n for (const listener of defaultEditorListeners) {\n const defaultHandled = listener(event, editor);\n if (defaultHandled) {\n break;\n }\n }\n });\n }\n }\n });\n\n return true;\n }\n\n return editor.registerCommand(PASTE_COMMAND, handlePaste, COMMAND_PRIORITY_LOW);\n}\n"],"names":["COMMAND_PRIORITY_EDITOR","COMMAND_PRIORITY_LOW","PASTE_COMMAND","$insertNodes","$createTextNode","unhandledPart","part","Error","registerPasteUnfurlingPlugin","editor","props","entityPluginId","transforms","$createEntityNode","insertParts","parts","update","nodes","map","type","value","text","data","entityProps","handlePaste","event","transformPromises","transform","push","Promise","resolve","allSettled","then","results","handledPaste","result","status","transformResult","transformedParts","handled","commandsMap","_commands","defaultEditorListeners","get","listener","defaultHandled","registerCommand"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SACEA,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,EACbC,YAAY,EACZC,eAAe,QACV,gCAAgC;AAOvC,SAASC,cAAcC,IAAW;IAChC,MAAM,IAAIC,MAAM,CAAC,gBAAgB,EAAED,KAAK,CAAC;AAC3C;AAEA,OAAO,SAASE,6BACdC,MAAqB,EACrBC,KAAkE;IAElE,MAAM,EAAEC,cAAc,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGH;IAE1D,SAASI,YAAYC,KAAoE;QACvFN,OAAOO,MAAM,CAAC;YACZ,MAAMC,QAAQF,MAAMG,GAAG,CAACZ,CAAAA;gBACtB,OAAQA,KAAKa,IAAI;oBACf,KAAK;wBACH,OAAON,kBAAkBF,gBAAgBL,KAAKc,KAAK,CAACC,IAAI,EAAEf,KAAKc,KAAK,CAACE,IAAI,EAAEhB,KAAKc,KAAK,CAACG,WAAW;oBACnG,KAAK;wBACH,OAAOnB,gBAAgBE,KAAKc,KAAK;gBACrC;gBACA,OAAOf,cAAcC;YACvB;YACAH,aAAac;QACf;IACF;IAEA,SAASO,YAAYC,KAAqB;QACxC,MAAMC,oBAA4F,EAAE;QAEpG,KAAK,MAAMC,aAAaf,WAAY;YAClCc,kBAAkBE,IAAI,CAACC,QAAQC,OAAO,CAACH,UAAUF,OAAOhB;QAC1D;QAEAoB,QAAQE,UAAU,CAACL,mBAAmBM,IAAI,CAACC,CAAAA;YACzC,IAAIC,eAAe;YAEnB,KAAK,MAAMC,UAAUF,QAAS;gBAC5B,IAAIE,OAAOC,MAAM,KAAK,aAAa;oBACjC,MAAMC,kBAAkBF,OAAOf,KAAK;oBACpC,IAAIiB,gBAAgBC,gBAAgB,EAAE;wBACpCxB,YAAYuB,gBAAgBC,gBAAgB;oBAC9C;oBAEA,IAAID,gBAAgBE,OAAO,EAAE;wBAC3BL,eAAe;wBACf;oBACF;gBACF;YACF;YAEA,IAAI,CAACA,cAAc;oBAEcM;gBAD/B,MAAMA,cAAc/B,OAAOgC,SAAS;gBACpC,MAAMC,0BAAyBF,mBAAAA,YAAYG,GAAG,CAACzC,4BAAhBsC,uCAAAA,gBAAgC,CAACxC,wBAAwB;gBACxF,IAAI0C,wBAAwB;oBAC1B,gHAAgH;oBAChHjC,OAAOO,MAAM,CAAC;wBACZ,KAAK,MAAM4B,YAAYF,uBAAwB;4BAC7C,MAAMG,iBAAiBD,SAASnB,OAAOhB;4BACvC,IAAIoC,gBAAgB;gCAClB;4BACF;wBACF;oBACF;gBACF;YACF;QACF;QAEA,OAAO;IACT;IAEA,OAAOpC,OAAOqC,eAAe,CAAC5C,eAAesB,aAAavB;AAC5D"}
|
|
@@ -52,12 +52,15 @@ function registerPasteUnfurlingPlugin(editor, props) {
|
|
|
52
52
|
const commandsMap = editor._commands;
|
|
53
53
|
const defaultEditorListeners = (_commandsMap_get = commandsMap.get(_texteditor.PASTE_COMMAND)) === null || _commandsMap_get === void 0 ? void 0 : _commandsMap_get[_texteditor.COMMAND_PRIORITY_EDITOR];
|
|
54
54
|
if (defaultEditorListeners) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
// After the promises have resolved, we're not guaranteed to be in the same update state as the original command
|
|
56
|
+
editor.update(()=>{
|
|
57
|
+
for (const listener of defaultEditorListeners){
|
|
58
|
+
const defaultHandled = listener(event, editor);
|
|
59
|
+
if (defaultHandled) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
59
62
|
}
|
|
60
|
-
}
|
|
63
|
+
});
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PasteUnfurling.base.ts"],"sourcesContent":["import type { LexicalEditor } from '@fluentui-copilot/text-editor';\nimport {\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n PASTE_COMMAND,\n $insertNodes,\n $createTextNode,\n} from '@fluentui-copilot/text-editor';\nimport type {\n PasteUnfurlingPluginBaseProps,\n PasteUnfurlingTransformedPart,\n PasteUnfurlingTransformResult,\n} from './PasteUnfurling.types';\n\nfunction unhandledPart(part: never): never {\n throw new Error(`Unhandled part: ${part}`);\n}\n\nexport function registerPasteUnfurlingPlugin<ExtraDataType, NodePropsType>(\n editor: LexicalEditor,\n props: PasteUnfurlingPluginBaseProps<ExtraDataType, NodePropsType>,\n): () => void {\n const { entityPluginId, transforms, $createEntityNode } = props;\n\n function insertParts(parts: PasteUnfurlingTransformedPart<ExtraDataType, NodePropsType>[]) {\n editor.update(() => {\n const nodes = parts.map(part => {\n switch (part.type) {\n case 'entity':\n return $createEntityNode(entityPluginId, part.value.text, part.value.data, part.value.entityProps);\n case 'text':\n return $createTextNode(part.value);\n }\n return unhandledPart(part);\n });\n $insertNodes(nodes);\n });\n }\n\n function handlePaste(event: ClipboardEvent): boolean {\n const transformPromises: Promise<PasteUnfurlingTransformResult<ExtraDataType, NodePropsType>>[] = [];\n\n for (const transform of transforms) {\n transformPromises.push(Promise.resolve(transform(event, editor)));\n }\n\n Promise.allSettled(transformPromises).then(results => {\n let handledPaste = false;\n\n for (const result of results) {\n if (result.status === 'fulfilled') {\n const transformResult = result.value;\n if (transformResult.transformedParts) {\n insertParts(transformResult.transformedParts);\n }\n\n if (transformResult.handled) {\n handledPaste = true;\n break;\n }\n }\n }\n\n if (!handledPaste) {\n const commandsMap = editor._commands;\n const defaultEditorListeners = commandsMap.get(PASTE_COMMAND)?.[COMMAND_PRIORITY_EDITOR];\n if (defaultEditorListeners) {\n for (const listener of defaultEditorListeners) {\n
|
|
1
|
+
{"version":3,"sources":["PasteUnfurling.base.ts"],"sourcesContent":["import type { LexicalEditor } from '@fluentui-copilot/text-editor';\nimport {\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n PASTE_COMMAND,\n $insertNodes,\n $createTextNode,\n} from '@fluentui-copilot/text-editor';\nimport type {\n PasteUnfurlingPluginBaseProps,\n PasteUnfurlingTransformedPart,\n PasteUnfurlingTransformResult,\n} from './PasteUnfurling.types';\n\nfunction unhandledPart(part: never): never {\n throw new Error(`Unhandled part: ${part}`);\n}\n\nexport function registerPasteUnfurlingPlugin<ExtraDataType, NodePropsType>(\n editor: LexicalEditor,\n props: PasteUnfurlingPluginBaseProps<ExtraDataType, NodePropsType>,\n): () => void {\n const { entityPluginId, transforms, $createEntityNode } = props;\n\n function insertParts(parts: PasteUnfurlingTransformedPart<ExtraDataType, NodePropsType>[]) {\n editor.update(() => {\n const nodes = parts.map(part => {\n switch (part.type) {\n case 'entity':\n return $createEntityNode(entityPluginId, part.value.text, part.value.data, part.value.entityProps);\n case 'text':\n return $createTextNode(part.value);\n }\n return unhandledPart(part);\n });\n $insertNodes(nodes);\n });\n }\n\n function handlePaste(event: ClipboardEvent): boolean {\n const transformPromises: Promise<PasteUnfurlingTransformResult<ExtraDataType, NodePropsType>>[] = [];\n\n for (const transform of transforms) {\n transformPromises.push(Promise.resolve(transform(event, editor)));\n }\n\n Promise.allSettled(transformPromises).then(results => {\n let handledPaste = false;\n\n for (const result of results) {\n if (result.status === 'fulfilled') {\n const transformResult = result.value;\n if (transformResult.transformedParts) {\n insertParts(transformResult.transformedParts);\n }\n\n if (transformResult.handled) {\n handledPaste = true;\n break;\n }\n }\n }\n\n if (!handledPaste) {\n const commandsMap = editor._commands;\n const defaultEditorListeners = commandsMap.get(PASTE_COMMAND)?.[COMMAND_PRIORITY_EDITOR];\n if (defaultEditorListeners) {\n // After the promises have resolved, we're not guaranteed to be in the same update state as the original command\n editor.update(() => {\n for (const listener of defaultEditorListeners) {\n const defaultHandled = listener(event, editor);\n if (defaultHandled) {\n break;\n }\n }\n });\n }\n }\n });\n\n return true;\n }\n\n return editor.registerCommand(PASTE_COMMAND, handlePaste, COMMAND_PRIORITY_LOW);\n}\n"],"names":["registerPasteUnfurlingPlugin","unhandledPart","part","Error","editor","props","entityPluginId","insertParts","nodes","parts","map","$createEntityNode","$insertNodes","transformPromises","handlePaste","event","Promise","transform","handledPaste","result","results","transformResult","handled","transformedParts","defaultEditorListeners","update","_commands","listener","get","PASTE_COMMAND","_commandsMap_get","COMMAND_PRIORITY_EDITOR","defaultHandled"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBgBA;;;eAAAA;;;4BAXT;AAOP,SAASC,cAAcC,IAAW;UAChC,IAAMC,MAAIA,CAAAA,gBAAO,EAAgBD,KAAEA,CAAAA;AACrC;AAEO,SAASF,6BACdI,MAAqB,EACrBC,KAAkE;UAElE,EAEAC,cAASC,YACPH,mBACQI;yBAEFC,KAAK;;0BAELA,MAAKC,GAAA,CAAAR,CAAAA;gCACH;;+BAEJS,kBAAqBT,gBAAAA,KAAAA,KAAAA,CAAAA,IAAAA,EAAAA,KAAAA,KAAAA,CAAAA,IAAAA,EAAAA,KAAAA,KAAAA,CAAAA,WAAAA;yBACvB;wBACAU,OAAAA,IAAAA,2BAAaJ,EAAAA,KAAAA,KAAAA;gBACf;gBACF,OAAAP,cAAAC;YAEA;wCACQW,EAAAA;;;aAINC,YAAAC,KAAA;cAEAC,oBAAmBH,EAAAA;mBACjBI,aAAIC,WAAe;8BAERC,IAAAA,CAAAA,QAAUC,OAAS,CAAAH,UAAAF,OAAAX;;0BAE1B,CAAAS,mBAAMQ,IAAkBF,CAAAA,CAAAA;+BACpBE;iCACFd,QAAYc;iCACd,KAAA,aAAA;4CAEIA,OAAgBC,KAAAA;wCAClBJ,gBAAe,EAAA;oCACfG,gBAAAE,gBAAA;;wCAEJD,OAAA,EAAA;wBACFJ,eAAA;wBAEA;;;;+BAGMM;;oCAEKC,OAAOC,SAAA;+CACDC,CAAAA,mBAAYH,YAAwBI,GAAA,CAAAC,yBAAA,CAAA,MAAA,QAAAC,qBAAA,KAAA,IAAA,KAAA,IAAAA,gBAAA,CAAAC,mCAAA,CAAA;4CACvCC;oIACc;;+CAEpBR,uBAAA;mDACFG,SAAAZ,OAAAX;gDACF;gCACF;4BACF;wBACF;oBAEA;gBACF;YAEA;QACF"}
|
package/package.json
CHANGED