()
| 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 } }); |
nothing calls this directly
no test coverage detected