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

Method handleStartClip

src/scripts/clipperUI/clipper.tsx:638–665  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

636 }
637
638 private handleStartClip(): void {
639 Clipper.logger.logUserFunnel(Log.Funnel.Label.ClipAttempted);
640
641 this.state.setState({ userResult: { status: Status.InProgress, data: this.state.userResult.data } });
642 Clipper.getExtensionCommunicator().callRemoteFunction(Constants.FunctionKeys.ensureFreshUserBeforeClip, { callback: (updatedUser: UserInfo) => {
643 if (updatedUser && updatedUser.user) {
644 let currentMode = this.state.currentMode.get();
645 if (currentMode === ClipMode.FullPage) {
646 // A page info refresh needs to be triggered if the url has changed right before the clip action
647 Clipper.getInjectCommunicator().callRemoteFunction(Constants.FunctionKeys.updatePageInfoIfUrlChanged, {
648 callback: () => {
649 this.startClip();
650 }
651 });
652 } else if (currentMode === ClipMode.Bookmark) {
653 // set the rendered bookmark preview HTML as the exact HTML to send to OneNote
654 let previewBodyHtml = document.getElementById("previewBody").innerHTML;
655 this.state.setState({
656 bookmarkPreviewInfo: { previewBodyHtml: previewBodyHtml }
657 });
658
659 this.startClip();
660 } else {
661 this.startClip();
662 }
663 }
664 }});
665 }
666
667 private startClip(): void {
668 this.state.setState({ oneNoteApiResult: { status: Status.InProgress } });

Callers

nothing calls this directly

Calls 7

startClipMethod · 0.95
setStateMethod · 0.80
callRemoteFunctionMethod · 0.80
getInjectCommunicatorMethod · 0.80
logUserFunnelMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected