MCPcopy Index your code
hub / github.com/OneNoteDev/WebClipper / setInvokeOptions

Method setInvokeOptions

src/scripts/clipperUI/clipper.tsx:346–375  ·  view source on GitHub ↗
(options: InvokeOptions)

Source from the content-addressed store, hash-verified

344 }
345
346 private setInvokeOptions(options: InvokeOptions) {
347 this.setState({ invokeOptions: options });
348
349 // This needs to happen after the invokeOptions set as it is reliant on that order
350 this.setState({ currentMode: this.state.currentMode.set(this.getDefaultClipMode()) });
351
352 // We assume that invokeDataForMode is always a non-undefined value where it makes sense
353 // and that it's the background's responsibility to ensure that is the case
354 switch (options.invokeMode) {
355 case InvokeMode.ContextImage:
356 // invokeDataForMode is the src url
357 this.setState({
358 regionResult: {
359 data: [options.invokeDataForMode],
360 status: Status.Succeeded
361 }
362 });
363 break;
364 case InvokeMode.ContextTextSelection:
365 // invokeDataForMode is scrubbed selected html as a string
366 this.state.setState({
367 selectionPreviewInfo: {
368 previewBodyHtml: options.invokeDataForMode
369 }
370 });
371 break;
372 default:
373 break;
374 }
375 }
376
377 private initializeExtensionCommunicator(clientInfo: SmartValue<ClientInfo>) {
378 // Clear the extension no-op tracker

Callers 1

Calls 3

getDefaultClipModeMethod · 0.95
setStateMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected