synapse-react-client 4.0.3 → 4.0.5
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/dist/SWC.index.js +1 -1
- package/dist/assets/DefaultColorfulPortalCardBackground.svg +14 -0
- package/dist/assets/DefaultColorfulPortalCardBackground.svg.js +7 -0
- package/dist/assets/DefaultColorfulPortalCardBackground.svg.js.map +1 -0
- package/dist/assets/homepage/nih-aging.svg +27 -27
- package/dist/assets/homepage/nih-aging.svg.js +1 -1
- package/dist/assets/homepage/nih-aging.svg.js.map +1 -1
- package/dist/assets/homepage/nih-heart.svg +39 -46
- package/dist/assets/homepage/nih-heart.svg.js +3 -3
- package/dist/assets/homepage/nih-heart.svg.js.map +1 -1
- package/dist/assets/homepage/nih-nci.svg +6 -0
- package/dist/assets/homepage/nih-nci.svg.js +7 -0
- package/dist/assets/homepage/nih-nci.svg.js.map +1 -0
- package/dist/assets/homepage/nih-nimh.svg +14 -0
- package/dist/assets/homepage/nih-nimh.svg.js +7 -0
- package/dist/assets/homepage/nih-nimh.svg.js.map +1 -0
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementList.js +4 -4
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.js +8 -7
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js +4 -4
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.js +11 -11
- package/dist/components/AccessRequirementList/RequirementItem/RequirementItem.js +1 -1
- package/dist/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.js +9 -9
- package/dist/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.js +5 -5
- package/dist/components/AcknowledgementsPage/AcknowledgementsPage.d.ts.map +1 -1
- package/dist/components/AcknowledgementsPage/AcknowledgementsPage.js +33 -32
- package/dist/components/AcknowledgementsPage/AcknowledgementsPage.js.map +1 -1
- package/dist/components/AclEditor/AclEditor.js +8 -8
- package/dist/components/AclEditor/AclEditor.js.map +1 -1
- package/dist/components/AclEditor/AclEditor.test-utils.js +34 -34
- package/dist/components/AclEditor/AclEditor.test-utils.js.map +1 -1
- package/dist/components/Authentication/AuthenticationMethodSelection.js +1 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.d.ts.map +1 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js +6 -5
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js.map +1 -1
- package/dist/components/BasePortalCard/BasePortalCard.css +1 -1
- package/dist/components/BasePortalCard/BasePortalCard.d.ts +1 -1
- package/dist/components/BasePortalCard/BasePortalCard.d.ts.map +1 -1
- package/dist/components/BasePortalCard/BasePortalCard.js +12 -12
- package/dist/components/BasePortalCard/BasePortalCard.js.map +1 -1
- package/dist/components/BasePortalCard/BasePortalCard.module.scss +6 -0
- package/dist/components/BasePortalCard/BasePortalCard.module.scss.js +1 -1
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.css +1 -1
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.d.ts.map +1 -1
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.js +24 -23
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.js.map +1 -1
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.module.scss +15 -5
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.module.scss.js +1 -1
- package/dist/components/CardContainer/CardLink.d.ts +12 -0
- package/dist/components/CardContainer/CardLink.d.ts.map +1 -1
- package/dist/components/ChallengeSubmission/AvailableEvaluationQueueList.js +12 -12
- package/dist/components/ChallengeTeamWizard/CreateChallengeTeam.d.ts.map +1 -1
- package/dist/components/ChallengeTeamWizard/CreateChallengeTeam.js +7 -7
- package/dist/components/ChallengeTeamWizard/CreateChallengeTeam.js.map +1 -1
- package/dist/components/CitationPopover/CitationPopoverContent.d.ts.map +1 -1
- package/dist/components/CitationPopover/CitationPopoverContent.js +13 -12
- package/dist/components/CitationPopover/CitationPopoverContent.js.map +1 -1
- package/dist/components/CookiesNotification/CookiesNotification.js +1 -1
- package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.js +3 -4
- package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.js.map +1 -1
- package/dist/components/DataGrid/MergeGridWithSourceTableButton.js +2 -2
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +35 -35
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/components/UploadCsvToGridDialog.js +2 -2
- package/dist/components/DataGrid/hooks/useExportDataGridToCsv.d.ts.map +1 -1
- package/dist/components/DataGrid/hooks/useExportDataGridToCsv.js +9 -7
- package/dist/components/DataGrid/hooks/useExportDataGridToCsv.js.map +1 -1
- package/dist/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.js +1 -1
- package/dist/components/DownloadCart/RequestDownloadCard.js +1 -1
- package/dist/components/Ecosystem/EcosystemSkeleton.js +2 -2
- package/dist/components/Ecosystem/TableQueryEcosystem.js +1 -1
- package/dist/components/EntityAclEditor/EntityAclEditorModal.js +1 -1
- package/dist/components/EntityAclEditor/OpenData.js +1 -1
- package/dist/components/EntityBadgeIcons/EntityBadgeIcons.d.ts.map +1 -1
- package/dist/components/EntityBadgeIcons/EntityBadgeIcons.js +113 -127
- package/dist/components/EntityBadgeIcons/EntityBadgeIcons.js.map +1 -1
- package/dist/components/EntityCitation/EntityCitation.js +1 -1
- package/dist/components/EntityFinder/details/view/table/AddToDownloadListCell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/CreatedOnCell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/EntityNameCell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/FileEntityMD5Cell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/FileEntitySizeCell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/ModifiedByCell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/ModifiedOnCell.js +1 -1
- package/dist/components/EntityFinder/details/view/table/ParentProjectCell.js +1 -1
- package/dist/components/EntityFinder/tree/EntityTree.js +1 -1
- package/dist/components/EntityHeaderTable/EntityHeaderTable.d.ts.map +1 -1
- package/dist/components/EntityHeaderTable/EntityHeaderTable.js +39 -39
- package/dist/components/EntityHeaderTable/EntityHeaderTable.js.map +1 -1
- package/dist/components/Evaluation/DeleteEvaluationQueueConfirmationDialog.d.ts +8 -0
- package/dist/components/Evaluation/DeleteEvaluationQueueConfirmationDialog.d.ts.map +1 -0
- package/dist/components/Evaluation/DeleteEvaluationQueueConfirmationDialog.js +46 -0
- package/dist/components/Evaluation/DeleteEvaluationQueueConfirmationDialog.js.map +1 -0
- package/dist/components/Evaluation/EvaluationCard.d.ts.map +1 -1
- package/dist/components/Evaluation/EvaluationCard.js +35 -41
- package/dist/components/Evaluation/EvaluationCard.js.map +1 -1
- package/dist/components/Evaluation/EvaluationEditor.d.ts.map +1 -1
- package/dist/components/Evaluation/EvaluationEditor.js +95 -90
- package/dist/components/Evaluation/EvaluationEditor.js.map +1 -1
- package/dist/components/Evaluation/EvaluationRoundEditor.d.ts.map +1 -1
- package/dist/components/Evaluation/EvaluationRoundEditor.js +133 -124
- package/dist/components/Evaluation/EvaluationRoundEditor.js.map +1 -1
- package/dist/components/FilePreview/EntityPreview.js +1 -1
- package/dist/components/Forum/DiscussionReply.js +10 -10
- package/dist/components/Forum/DiscussionThread.js +21 -21
- package/dist/components/GenericCard/CardUtils.d.ts.map +1 -1
- package/dist/components/GenericCard/CardUtils.js +36 -36
- package/dist/components/GenericCard/CardUtils.js.map +1 -1
- package/dist/components/GenericCard/CollapsibleDescription.js +25 -25
- package/dist/components/GenericCard/SynapseCardLabel.d.ts.map +1 -1
- package/dist/components/GenericCard/SynapseCardLabel.js +72 -67
- package/dist/components/GenericCard/SynapseCardLabel.js.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.d.ts +4 -1
- package/dist/components/GenericCard/TableRowGenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.js +98 -96
- package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
- package/dist/components/GoalsV2/GoalsV2.Desktop.d.ts.map +1 -1
- package/dist/components/GoalsV2/GoalsV2.Desktop.js +14 -15
- package/dist/components/GoalsV2/GoalsV2.Desktop.js.map +1 -1
- package/dist/components/GoogleAnalytics/GoogleAnalytics.js +1 -1
- package/dist/components/HasAccess/HasAccessV2.js +1 -1
- package/dist/components/HasAccess/useHasAccess.js +1 -1
- package/dist/components/IDUReport/IDUReportSubmissionInfo.js +23 -23
- package/dist/components/IDUReport/IDUReportSubmissionInfo.js.map +1 -1
- package/dist/components/JSONArrayEditor/useParseCsv.d.ts +1 -1
- package/dist/components/JSONArrayEditor/useParseCsv.d.ts.map +1 -1
- package/dist/components/JSONArrayEditor/useParseCsv.js +9 -9
- package/dist/components/JSONArrayEditor/useParseCsv.js.map +1 -1
- package/dist/components/Markdown/MarkdownCollapse.js +7 -7
- package/dist/components/Markdown/MarkdownEditor.js +11 -11
- package/dist/components/Markdown/MarkdownGithub.js +1 -1
- package/dist/components/Markdown/MarkdownPopover.js +6 -6
- package/dist/components/Markdown/MarkdownPopover.js.map +1 -1
- package/dist/components/Markdown/MarkdownSynapse.d.ts.map +1 -1
- package/dist/components/Markdown/MarkdownSynapse.js +139 -135
- package/dist/components/Markdown/MarkdownSynapse.js.map +1 -1
- package/dist/components/Markdown/MarkdownUtils.d.ts +8 -0
- package/dist/components/Markdown/MarkdownUtils.d.ts.map +1 -1
- package/dist/components/Markdown/MarkdownUtils.js +139 -65
- package/dist/components/Markdown/MarkdownUtils.js.map +1 -1
- package/dist/components/Markdown/UserMentionModal.js +18 -18
- package/dist/components/Markdown/UserMentionModal.js.map +1 -1
- package/dist/components/Markdown/widget/MarkdownButton.js +3 -3
- package/dist/components/Markdown/widget/MarkdownButton.js.map +1 -1
- package/dist/components/MissingQueryResultsWarning/MissingQueryResultsWarning.d.ts.map +1 -1
- package/dist/components/MissingQueryResultsWarning/MissingQueryResultsWarning.js +9 -8
- package/dist/components/MissingQueryResultsWarning/MissingQueryResultsWarning.js.map +1 -1
- package/dist/components/Plot/SynapsePlot.css +1 -0
- package/dist/components/Plot/SynapsePlot.d.ts +2 -0
- package/dist/components/Plot/SynapsePlot.d.ts.map +1 -1
- package/dist/components/Plot/SynapsePlot.js +43 -39
- package/dist/components/Plot/SynapsePlot.js.map +1 -1
- package/dist/components/Plot/SynapsePlot.scss +8 -0
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +114 -113
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.d.ts +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.js.map +1 -1
- package/dist/components/Resources/Resources.Desktop.js +7 -7
- package/dist/components/Resources/Resources.Mobile.js +6 -6
- package/dist/components/SubsectionRowRenderer/SubsectionRowRenderer.js +3 -3
- package/dist/components/SustainabilityScorecard/SustainabilityScorecardSummary.js +10 -10
- package/dist/components/SynapseChat/SynapseChatInteraction.js +5 -5
- package/dist/components/SynapseForm/WarningDialog.d.ts +1 -0
- package/dist/components/SynapseForm/WarningDialog.d.ts.map +1 -1
- package/dist/components/SynapseForm/WarningDialog.js +18 -16
- package/dist/components/SynapseForm/WarningDialog.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageNavBar.js +1 -1
- package/dist/components/SynapseHomepageV2/SynapsePartners.d.ts.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapsePartners.js +17 -12
- package/dist/components/SynapseHomepageV2/SynapsePartners.js.map +1 -1
- package/dist/components/SynapsePortalBanners/SynapsePortalBanners.d.ts.map +1 -1
- package/dist/components/SynapsePortalBanners/SynapsePortalBanners.js +39 -39
- package/dist/components/SynapsePortalBanners/SynapsePortalBanners.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/HasAccessChip.js +1 -1
- package/dist/components/SynapseSearchPageResults/SearchPagePortalBanners.d.ts.map +1 -1
- package/dist/components/SynapseSearchPageResults/SearchPagePortalBanners.js +21 -22
- package/dist/components/SynapseSearchPageResults/SearchPagePortalBanners.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.js +5 -5
- package/dist/components/SynapseTable/ExpandableTableDataCell.d.ts.map +1 -1
- package/dist/components/SynapseTable/ExpandableTableDataCell.js +3 -1
- package/dist/components/SynapseTable/ExpandableTableDataCell.js.map +1 -1
- package/dist/components/SynapseTable/SynapseTable.js +4 -4
- package/dist/components/SynapseTable/SynapseTableCell/SynapseTableCell.d.ts.map +1 -1
- package/dist/components/SynapseTable/SynapseTableCell/SynapseTableCell.js +122 -122
- package/dist/components/SynapseTable/SynapseTableCell/SynapseTableCell.js.map +1 -1
- package/dist/components/SynapseTable/datasets/DatasetItemsEditor.js +5 -5
- package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditor.js +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js +1 -1
- package/dist/components/TableFeedCards/TableFeedCards.js +9 -9
- package/dist/components/TermsAndConditions/TermsAndConditionsItem.js +10 -10
- package/dist/components/TimelinePlot/TimelinePlotSpeciesSelector.js +9 -9
- package/dist/components/UserSearchBox/UserSearchBox.d.ts +23 -0
- package/dist/components/UserSearchBox/UserSearchBox.d.ts.map +1 -0
- package/dist/components/UserSearchBox/UserSearchBox.js +146 -0
- package/dist/components/UserSearchBox/UserSearchBox.js.map +1 -0
- package/dist/components/WikiMarkdownEditorButton/WikiMarkdownEditorButton.js +13 -13
- package/dist/components/WizardChoiceButton/WizardChoiceButton.js +3 -3
- package/dist/components/dataaccess/AccessHistoryDashboard.js +5 -5
- package/dist/components/dataaccess/AccessHistoryDashboard.js.map +1 -1
- package/dist/components/dataaccess/AccessRequirementDashboard.js +4 -4
- package/dist/components/dataaccess/AccessRequirementDashboard.js.map +1 -1
- package/dist/components/dataaccess/AccessSubmissionDashboard.js +1 -1
- package/dist/components/dataaccess/AccessSubmissionDashboard.js.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js +5 -5
- package/dist/components/dataaccess/UseAccessRequirementTable.js +3 -3
- package/dist/components/dataaccess/UseAccessRequirementTable.js.map +1 -1
- package/dist/components/doi/CreateOrUpdateDoiModal.js +1 -1
- package/dist/components/download_list/AddToDownloadListConfirmationAlert/AddToDownloadListConfirmationAlert.js +2 -2
- package/dist/components/entity/metadata/EntityModal.js +1 -1
- package/dist/components/entity/metadata/MetadataTable.js +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +1 -1
- package/dist/components/entity/page/title_bar/EntityTitleBarVersionInfo.js +1 -1
- package/dist/components/entity/page/title_bar/TitleBarProperties.js +1 -1
- package/dist/components/entity/page/title_bar/useGetEntityTitleBarProperties.d.ts.map +1 -1
- package/dist/components/entity/page/title_bar/useGetEntityTitleBarProperties.js +27 -26
- package/dist/components/entity/page/title_bar/useGetEntityTitleBarProperties.js.map +1 -1
- package/dist/components/index.js +109 -107
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/InfiniteTableLayout.js +1 -1
- package/dist/components/styled/HoverPopover.css +1 -0
- package/dist/components/styled/HoverPopover.d.ts +28 -0
- package/dist/components/styled/HoverPopover.d.ts.map +1 -0
- package/dist/components/styled/HoverPopover.js +103 -0
- package/dist/components/styled/HoverPopover.js.map +1 -0
- package/dist/components/styled/HoverPopover.module.scss +9 -0
- package/dist/components/styled/HoverPopover.module.scss.js +10 -0
- package/dist/components/styled/HoverPopover.module.scss.js.map +1 -0
- package/dist/components/styled/index.d.ts +2 -0
- package/dist/components/styled/index.d.ts.map +1 -1
- package/dist/components/styled/index.js +11 -9
- package/dist/components/styled/index.js.map +1 -1
- package/dist/components/table/CsvPreview/CsvPreview.js +2 -2
- package/dist/components/table/CsvPreview/CsvPreviewDialog.js +2 -2
- package/dist/components/widgets/Range.js +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.js +35 -32
- package/dist/components/widgets/facet-nav/FacetNavPanel.js.map +1 -1
- package/dist/components/widgets/facet-nav/PlotsContainer.d.ts +1 -1
- package/dist/components/widgets/facet-nav/PlotsContainer.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/PlotsContainer.js +69 -68
- package/dist/components/widgets/facet-nav/PlotsContainer.js.map +1 -1
- package/dist/components/widgets/facet-nav/useFacetPlots.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/useFacetPlots.js +24 -21
- package/dist/components/widgets/facet-nav/useFacetPlots.js.map +1 -1
- package/dist/components/widgets/query-filter/FacetFilterControls.js +3 -3
- package/dist/features/curator/GridPage/GridPage.js +2 -2
- package/dist/features/curator/GridPage/components/GridPageTitle.js +2 -2
- package/dist/features/entity/metadata-task/hooks/useMetadataTaskTable.js +1 -1
- package/dist/index.js +157 -155
- package/dist/index.js.map +1 -1
- package/dist/mocks/msw/handlers/accessRequirementHandlers.js +5 -5
- package/dist/mocks/msw/handlers/projectStorageHandlers.js +5 -5
- package/dist/mocks/msw/handlers/wikiHandlers.js +1 -1
- package/dist/mocks/msw/handlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers.js +67 -59
- package/dist/mocks/msw/handlers.js.map +1 -1
- package/dist/style/base/_core.scss +0 -1
- package/dist/style/components/_all.scss +0 -1
- package/dist/style/components/_entity-badge.scss +0 -2
- package/dist/style/components/_expandable_table_data.scss +3 -3
- package/dist/style/components/facet_nav/_facet-nav-panel.scss +3 -0
- package/dist/style/components/facet_nav/_facet-nav.scss +4 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-client/SynapseClient.js +118 -118
- package/dist/synapse-client/SynapseClient.js.map +1 -1
- package/dist/synapse-queries/auth/useOIDC.js +1 -1
- package/dist/synapse-queries/auth/useTwoFactorEnrollment.js +1 -1
- package/dist/synapse-queries/entity/index.js +6 -6
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.js +1 -1
- package/dist/synapse-queries/index.js +1 -1
- package/dist/synapse-queries/user/usePersonalAccessToken.js +1 -1
- package/dist/testutils/vitest.setup.js +10 -11
- package/dist/testutils/vitest.setup.js.map +1 -1
- package/dist/theme/DefaultTheme.js +1 -1
- package/dist/theme/ThemeProvider.d.ts +2 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +11 -10
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/mergeTheme.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/AppUtils/AppUtils.js +1 -1
- package/dist/utils/functions/SanitizeHtmlUtils.d.ts.map +1 -1
- package/dist/utils/functions/SanitizeHtmlUtils.js +34 -40
- package/dist/utils/functions/SanitizeHtmlUtils.js.map +1 -1
- package/dist/utils/functions/deepLinkingUtils.js +10 -10
- package/dist/utils/functions/deepLinkingUtils.js.map +1 -1
- package/dist/utils/hooks/index.js +6 -6
- package/dist/utils/hooks/useDetectSSOCode.js +3 -3
- package/dist/utils/hooks/useGetEntityMetadata.js +1 -1
- package/dist/utils/hooks/useNativeSearchParams.d.ts.map +1 -1
- package/dist/utils/hooks/useNativeSearchParams.js +1 -1
- package/dist/utils/hooks/useNativeSearchParams.js.map +1 -1
- package/dist/utils/hooks/useOneSageURL.d.ts.map +1 -1
- package/dist/utils/hooks/useOneSageURL.js +15 -15
- package/dist/utils/hooks/useOneSageURL.js.map +1 -1
- package/dist/utils/hooks/useSourceAppConfigs.d.ts +1 -0
- package/dist/utils/hooks/useSourceAppConfigs.d.ts.map +1 -1
- package/dist/utils/hooks/useSourceAppConfigs.js +79 -77
- package/dist/utils/hooks/useSourceAppConfigs.js.map +1 -1
- package/dist/utils/index.js +4 -4
- package/package.json +14 -15
- package/dist/_virtual/index.js +0 -6
- package/dist/_virtual/index.js.map +0 -1
- package/dist/_virtual/index2.js +0 -5
- package/dist/_virtual/index2.js.map +0 -1
- package/dist/_virtual/index3.js +0 -5
- package/dist/_virtual/index3.js.map +0 -1
- package/dist/_virtual/index4.js +0 -5
- package/dist/_virtual/index4.js.map +0 -1
- package/dist/_virtual/index5.js +0 -5
- package/dist/_virtual/index5.js.map +0 -1
- package/dist/assets/homepage/nci.svg +0 -6
- package/dist/assets/homepage/nci.svg.js +0 -7
- package/dist/assets/homepage/nci.svg.js.map +0 -1
- package/dist/assets/homepage/nih-mental.svg +0 -9
- package/dist/assets/homepage/nih-mental.svg.js +0 -7
- package/dist/assets/homepage/nih-mental.svg.js.map +0 -1
- package/dist/components/UserSearchBox/UserSearchBoxV2.d.ts +0 -21
- package/dist/components/UserSearchBox/UserSearchBoxV2.d.ts.map +0 -1
- package/dist/components/UserSearchBox/UserSearchBoxV2.js +0 -144
- package/dist/components/UserSearchBox/UserSearchBoxV2.js.map +0 -1
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js +0 -53
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js.map +0 -1
- package/dist/node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js +0 -948
- package/dist/node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js.map +0 -1
- package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js +0 -30
- package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js.map +0 -1
- package/dist/node_modules/.pnpm/vite-plugin-node-polyfills@0.17.0_rollup@4.55.1_vite@7.3.1_@types_node@22.19.13_sass@1._2da6e8f78437c36f3eb7db51bdd4d89e/node_modules/vite-plugin-node-polyfills/shims/dist/index.js +0 -15
- package/dist/node_modules/.pnpm/vite-plugin-node-polyfills@0.17.0_rollup@4.55.1_vite@7.3.1_@types_node@22.19.13_sass@1._2da6e8f78437c36f3eb7db51bdd4d89e/node_modules/vite-plugin-node-polyfills/shims/dist/index.js.map +0 -1
- package/dist/style/components/_user-search-box.scss +0 -30
|
@@ -1,161 +1,165 @@
|
|
|
1
1
|
import { jsx as n, jsxs as C, Fragment as O } from "react/jsx-runtime";
|
|
2
|
-
import { handleLinkClicks as
|
|
3
|
-
import { useGetWikiPage as H, useGetWikiAttachments as
|
|
4
|
-
import { sanitize as
|
|
5
|
-
import { Typography as p, Link as
|
|
6
|
-
import
|
|
7
|
-
import { ObjectType as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
2
|
+
import { handleLinkClicks as _, processMath as R, addIdsToReferenceWidgets as j, addIdsToTocWidgets as A, fixInvalidNesting as B, decodeXml as D } from "./MarkdownUtils.js";
|
|
3
|
+
import { useGetWikiPage as H, useGetWikiAttachments as F } from "../../synapse-queries/wiki/useWiki.js";
|
|
4
|
+
import { sanitize as G } from "../../utils/functions/SanitizeHtmlUtils.js";
|
|
5
|
+
import { Typography as p, Link as J } from "@mui/material";
|
|
6
|
+
import X from "@sage-bionetworks/markdown-it-container";
|
|
7
|
+
import { ObjectType as Y } from "@sage-bionetworks/synapse-types";
|
|
8
|
+
import q from "markdown-it";
|
|
9
|
+
import z from "markdown-it-br";
|
|
10
|
+
import K from "markdown-it-center-text";
|
|
11
|
+
import U from "markdown-it-inline-comments";
|
|
12
|
+
import Q from "markdown-it-strikethrough-alt";
|
|
13
|
+
import V from "markdown-it-sub-alt";
|
|
14
|
+
import Z from "markdown-it-sup-alt";
|
|
15
15
|
import * as b from "markdown-it-synapse";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { useRef as
|
|
21
|
-
import { ErrorBanner as
|
|
16
|
+
import $ from "markdown-it-synapse";
|
|
17
|
+
import ee from "markdown-it-synapse-heading";
|
|
18
|
+
import te from "markdown-it-synapse-math";
|
|
19
|
+
import ne from "markdown-it-synapse-table";
|
|
20
|
+
import { useRef as re, useEffect as I, useMemo as N } from "react";
|
|
21
|
+
import { ErrorBanner as oe } from "../error/ErrorBanner.js";
|
|
22
22
|
import "@mui/material/Skeleton";
|
|
23
|
-
import { SkeletonTable as
|
|
23
|
+
import { SkeletonTable as ie } from "../Skeleton/SkeletonTable.js";
|
|
24
24
|
import "lodash-es";
|
|
25
|
-
import
|
|
26
|
-
import { SynapseWikiContextProvider as
|
|
27
|
-
import
|
|
28
|
-
const
|
|
25
|
+
import E from "./MarkdownWidget.js";
|
|
26
|
+
import { SynapseWikiContextProvider as ae } from "./SynapseWikiContext.js";
|
|
27
|
+
import se from "./widget/Bookmarks.js";
|
|
28
|
+
const de = "There is no content.", y = q({ html: !0 });
|
|
29
29
|
b.init_markdown_it(
|
|
30
30
|
y,
|
|
31
|
-
Q,
|
|
32
31
|
V,
|
|
33
|
-
|
|
34
|
-
$,
|
|
35
|
-
te,
|
|
36
|
-
U,
|
|
37
|
-
J,
|
|
32
|
+
Z,
|
|
38
33
|
K,
|
|
39
|
-
q
|
|
40
|
-
);
|
|
41
|
-
const E = "";
|
|
42
|
-
y.use(Z, E, "https://synapse.org").use(
|
|
43
34
|
ee,
|
|
44
|
-
|
|
35
|
+
ne,
|
|
36
|
+
Q,
|
|
37
|
+
X,
|
|
38
|
+
U,
|
|
39
|
+
z
|
|
40
|
+
);
|
|
41
|
+
const S = "";
|
|
42
|
+
y.use($, S, "https://synapse.org").use(
|
|
43
|
+
te,
|
|
44
|
+
S
|
|
45
45
|
);
|
|
46
|
-
function me(
|
|
47
|
-
const { markdown: t, renderInline:
|
|
48
|
-
return e.length > 0 ? /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
|
|
46
|
+
function me(m) {
|
|
47
|
+
const { markdown: t, renderInline: o } = m, e = N(() => (b.resetFootnotes(), T(o, t), T(o, b.footnotes()).__html), [t, o]);
|
|
48
|
+
return e.length > 0 ? /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(se, { footnotes: e }) }) : null;
|
|
49
49
|
}
|
|
50
|
-
function T(
|
|
50
|
+
function T(m, t) {
|
|
51
51
|
if (!t)
|
|
52
52
|
return { __html: "" };
|
|
53
|
-
const
|
|
54
|
-
return { __html:
|
|
53
|
+
const o = m ? y.renderInline(t) : y.render(t);
|
|
54
|
+
return { __html: G(o) };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const { widgetParams: t, originalMarkup:
|
|
58
|
-
if (
|
|
56
|
+
function ce(m) {
|
|
57
|
+
const { widgetParams: t, originalMarkup: o } = m, e = D(t), c = e.indexOf("?");
|
|
58
|
+
if (c === -1)
|
|
59
59
|
return /* @__PURE__ */ n(
|
|
60
|
-
|
|
60
|
+
E,
|
|
61
61
|
{
|
|
62
62
|
widgetType: e,
|
|
63
63
|
widgetParamsMapped: {},
|
|
64
|
-
originalMarkup:
|
|
64
|
+
originalMarkup: o
|
|
65
65
|
},
|
|
66
66
|
JSON.stringify(e)
|
|
67
67
|
);
|
|
68
|
-
const
|
|
69
|
-
return e.substring(
|
|
70
|
-
let [
|
|
71
|
-
r = decodeURIComponent(r),
|
|
68
|
+
const i = e.substring(0, c), a = {};
|
|
69
|
+
return e.substring(c + 1).split("&").forEach((s) => {
|
|
70
|
+
let [l, r] = s.split("=");
|
|
71
|
+
r = decodeURIComponent(r), a[l] = r;
|
|
72
72
|
}), /* @__PURE__ */ n(
|
|
73
|
-
|
|
73
|
+
E,
|
|
74
74
|
{
|
|
75
|
-
widgetType:
|
|
76
|
-
widgetParamsMapped:
|
|
77
|
-
originalMarkup:
|
|
75
|
+
widgetType: i,
|
|
76
|
+
widgetParamsMapped: a,
|
|
77
|
+
originalMarkup: o
|
|
78
78
|
},
|
|
79
79
|
JSON.stringify(e)
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const { renderInline: t, markdown:
|
|
84
|
-
let
|
|
85
|
-
return
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
function le(m) {
|
|
83
|
+
const { renderInline: t, markdown: o, isLoading: e, showPlaceholderIfNoWikiContent: c } = m, i = N(() => {
|
|
84
|
+
let s = T(t, o).__html;
|
|
85
|
+
return s = j(s), s = A(s), s;
|
|
86
|
+
}, [o, t]), a = N(() => {
|
|
87
|
+
if (i.length > 0) {
|
|
88
|
+
const l = new DOMParser().parseFromString(i, "text/html");
|
|
89
|
+
return B(l.body), l.body;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}, [i]);
|
|
93
|
+
if (a)
|
|
94
|
+
return /* @__PURE__ */ n(W, { element: a, markdown: i });
|
|
95
|
+
if (!e && c && i === "")
|
|
96
|
+
return /* @__PURE__ */ n(p, { variant: "body1Italic", sx: { mb: 1 }, children: de });
|
|
93
97
|
}
|
|
94
|
-
function W(
|
|
95
|
-
const { element: t, markdown:
|
|
98
|
+
function W(m) {
|
|
99
|
+
const { element: t, markdown: o } = m;
|
|
96
100
|
if (t.nodeType === Node.TEXT_NODE)
|
|
97
101
|
return /* @__PURE__ */ n(O, { children: t.textContent });
|
|
98
102
|
if (t.nodeType === Node.ELEMENT_NODE && t instanceof HTMLElement) {
|
|
99
|
-
const e = t.tagName.toLowerCase(),
|
|
100
|
-
if (
|
|
103
|
+
const e = t.tagName.toLowerCase(), c = t.getAttribute("data-widgetparams");
|
|
104
|
+
if (c)
|
|
101
105
|
return /* @__PURE__ */ n(
|
|
102
|
-
|
|
106
|
+
ce,
|
|
103
107
|
{
|
|
104
|
-
widgetParams:
|
|
105
|
-
originalMarkup:
|
|
108
|
+
widgetParams: c,
|
|
109
|
+
originalMarkup: o
|
|
106
110
|
}
|
|
107
111
|
);
|
|
108
|
-
const
|
|
109
|
-
for (let
|
|
110
|
-
let
|
|
111
|
-
const g =
|
|
112
|
-
g && (
|
|
112
|
+
const i = t.attributes, a = {};
|
|
113
|
+
for (let f = 0; f < i.length; f++) {
|
|
114
|
+
let k = "", w = "";
|
|
115
|
+
const g = i.item(f);
|
|
116
|
+
g && (k = g.name, w = g.value), k && w && (a[k] = w);
|
|
113
117
|
}
|
|
114
|
-
const { style:
|
|
115
|
-
if (r.className =
|
|
118
|
+
const { style: s, class: l, ...r } = a;
|
|
119
|
+
if (r.className = l, s && (r.STYLE = s), t.childNodes.length === 0)
|
|
116
120
|
return /* @__PURE__ */ n(e, { ...r });
|
|
117
|
-
const
|
|
121
|
+
const d = Array.from(t.childNodes).map((f, k) => /* @__PURE__ */ n(W, { element: f, markdown: o }, k));
|
|
118
122
|
switch (e) {
|
|
119
123
|
case "p":
|
|
120
|
-
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children:
|
|
124
|
+
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children: d });
|
|
121
125
|
case "span":
|
|
122
|
-
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children:
|
|
126
|
+
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children: d });
|
|
123
127
|
case "h1":
|
|
124
|
-
return /* @__PURE__ */ n(p, { variant: "headline1", ...r, component: e, children:
|
|
128
|
+
return /* @__PURE__ */ n(p, { variant: "headline1", ...r, component: e, children: d });
|
|
125
129
|
case "h2":
|
|
126
|
-
return /* @__PURE__ */ n(p, { variant: "headline2", ...r, component: e, children:
|
|
130
|
+
return /* @__PURE__ */ n(p, { variant: "headline2", ...r, component: e, children: d });
|
|
127
131
|
case "h3":
|
|
128
|
-
return /* @__PURE__ */ n(p, { variant: "headline3", ...r, component: e, children:
|
|
132
|
+
return /* @__PURE__ */ n(p, { variant: "headline3", ...r, component: e, children: d });
|
|
129
133
|
case "ol":
|
|
130
|
-
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children:
|
|
134
|
+
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children: d });
|
|
131
135
|
case "ul":
|
|
132
|
-
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children:
|
|
136
|
+
return /* @__PURE__ */ n(p, { variant: "body1", ...r, component: e, children: d });
|
|
133
137
|
case "a":
|
|
134
|
-
return /* @__PURE__ */ n(
|
|
138
|
+
return /* @__PURE__ */ n(J, { ...r, component: e, children: d });
|
|
135
139
|
default:
|
|
136
|
-
return e === "body" ?
|
|
140
|
+
return e === "body" ? d : /* @__PURE__ */ n(e, { ...r, children: d });
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
return null;
|
|
140
144
|
}
|
|
141
|
-
function
|
|
145
|
+
function Be(m) {
|
|
142
146
|
const {
|
|
143
147
|
ownerId: t,
|
|
144
|
-
wikiId:
|
|
145
|
-
objectType: e =
|
|
146
|
-
markdown:
|
|
147
|
-
onMarkdownProcessingDone:
|
|
148
|
-
renderInline:
|
|
149
|
-
loadingSkeletonRowCount:
|
|
150
|
-
showPlaceholderIfNoWikiContent:
|
|
151
|
-
} =
|
|
152
|
-
data:
|
|
153
|
-
isLoading:
|
|
154
|
-
error:
|
|
148
|
+
wikiId: o,
|
|
149
|
+
objectType: e = Y.ENTITY,
|
|
150
|
+
markdown: c,
|
|
151
|
+
onMarkdownProcessingDone: i,
|
|
152
|
+
renderInline: a = !1,
|
|
153
|
+
loadingSkeletonRowCount: s,
|
|
154
|
+
showPlaceholderIfNoWikiContent: l = !1
|
|
155
|
+
} = m, r = re(null), {
|
|
156
|
+
data: d,
|
|
157
|
+
isLoading: f,
|
|
158
|
+
error: k
|
|
155
159
|
} = H(
|
|
156
160
|
{
|
|
157
161
|
ownerObjectId: t,
|
|
158
|
-
wikiPageId:
|
|
162
|
+
wikiPageId: o,
|
|
159
163
|
ownerObjectType: e
|
|
160
164
|
},
|
|
161
165
|
{ enabled: !!t }
|
|
@@ -163,69 +167,69 @@ function Ae(s) {
|
|
|
163
167
|
data: w,
|
|
164
168
|
isLoading: g,
|
|
165
169
|
error: x
|
|
166
|
-
} =
|
|
170
|
+
} = F(
|
|
167
171
|
{
|
|
168
172
|
ownerObjectId: t,
|
|
169
|
-
wikiPageId:
|
|
173
|
+
wikiPageId: o,
|
|
170
174
|
ownerObjectType: e
|
|
171
175
|
},
|
|
172
176
|
{
|
|
173
177
|
enabled: !!t
|
|
174
178
|
}
|
|
175
|
-
),
|
|
179
|
+
), P = f || g, M = k || x;
|
|
176
180
|
I(() => {
|
|
177
181
|
const h = r.current;
|
|
178
|
-
return h && h.addEventListener("click",
|
|
179
|
-
h && h.removeEventListener("click",
|
|
182
|
+
return h && h.addEventListener("click", _), () => {
|
|
183
|
+
h && h.removeEventListener("click", _);
|
|
180
184
|
};
|
|
181
185
|
}, []);
|
|
182
|
-
const
|
|
186
|
+
const u = c || d?.markdown || "";
|
|
183
187
|
I(() => {
|
|
184
|
-
|
|
185
|
-
}, [
|
|
186
|
-
|
|
187
|
-
}, [
|
|
188
|
-
const L =
|
|
189
|
-
if (
|
|
190
|
-
return /* @__PURE__ */ n(
|
|
191
|
-
const
|
|
192
|
-
|
|
188
|
+
u && i && i(T(a, u).__html);
|
|
189
|
+
}, [d, i, a]), I(() => {
|
|
190
|
+
u && R(r);
|
|
191
|
+
}, [u]);
|
|
192
|
+
const L = s ? /* @__PURE__ */ n(ie, { numCols: 1, numRows: s }) : /* @__PURE__ */ n("span", { className: "spinner" });
|
|
193
|
+
if (M)
|
|
194
|
+
return /* @__PURE__ */ n(oe, { error: M });
|
|
195
|
+
const v = /* @__PURE__ */ C(
|
|
196
|
+
ae,
|
|
193
197
|
{
|
|
194
198
|
wikiContext: {
|
|
195
|
-
ownerId:
|
|
196
|
-
wikiId:
|
|
197
|
-
wikiPage:
|
|
199
|
+
ownerId: m.ownerId,
|
|
200
|
+
wikiId: m.wikiId,
|
|
201
|
+
wikiPage: d,
|
|
198
202
|
fileHandles: w
|
|
199
203
|
},
|
|
200
204
|
children: [
|
|
201
|
-
|
|
202
|
-
(
|
|
203
|
-
|
|
205
|
+
P && L,
|
|
206
|
+
(u || l) && /* @__PURE__ */ n(
|
|
207
|
+
le,
|
|
204
208
|
{
|
|
205
|
-
markdown:
|
|
206
|
-
renderInline:
|
|
207
|
-
isLoading:
|
|
208
|
-
showPlaceholderIfNoWikiContent:
|
|
209
|
+
markdown: u,
|
|
210
|
+
renderInline: a,
|
|
211
|
+
isLoading: P,
|
|
212
|
+
showPlaceholderIfNoWikiContent: l
|
|
209
213
|
}
|
|
210
214
|
),
|
|
211
|
-
|
|
215
|
+
u && /* @__PURE__ */ n(me, { renderInline: a, markdown: u })
|
|
212
216
|
]
|
|
213
217
|
}
|
|
214
218
|
);
|
|
215
|
-
return
|
|
219
|
+
return a ? /* @__PURE__ */ n(
|
|
216
220
|
"span",
|
|
217
221
|
{
|
|
218
222
|
"data-testid": "markdown",
|
|
219
223
|
className: "markdown markdown-inline",
|
|
220
224
|
ref: r,
|
|
221
|
-
children:
|
|
225
|
+
children: v
|
|
222
226
|
}
|
|
223
|
-
) : /* @__PURE__ */ n("div", { "data-testid": "markdown", className: "markdown", ref: r, children:
|
|
227
|
+
) : /* @__PURE__ */ n("div", { "data-testid": "markdown", className: "markdown", ref: r, children: v });
|
|
224
228
|
}
|
|
225
229
|
export {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
+
Be as Markdown,
|
|
231
|
+
Be as MarkdownSynapse,
|
|
232
|
+
de as NO_WIKI_CONTENT,
|
|
233
|
+
Be as default
|
|
230
234
|
};
|
|
231
235
|
//# sourceMappingURL=MarkdownSynapse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownSynapse.js","sources":["../../../src/components/Markdown/MarkdownSynapse.tsx"],"sourcesContent":["import {\n addIdsToReferenceWidgets,\n addIdsToTocWidgets,\n decodeXml,\n handleLinkClicks,\n processMath,\n} from '@/components/Markdown/MarkdownUtils'\nimport {\n useGetWikiPage,\n useGetWikiAttachments,\n} from '@/synapse-queries/wiki/useWiki'\nimport { sanitize } from '@/utils/functions/SanitizeHtmlUtils'\nimport { Link, Typography } from '@mui/material'\nimport markdownitContainer from '@sage-bionetworks/markdown-it-container'\nimport { ObjectType } from '@sage-bionetworks/synapse-types'\nimport MarkdownIt from 'markdown-it'\nimport markdownitBr from 'markdown-it-br'\nimport markdownitCentertext from 'markdown-it-center-text'\nimport markdownitInlineComments from 'markdown-it-inline-comments'\nimport markdownitStrikethroughAlt from 'markdown-it-strikethrough-alt'\nimport markdownitSub from 'markdown-it-sub-alt'\nimport markdownitSup from 'markdown-it-sup-alt'\nimport * as markdownitSynapse from 'markdown-it-synapse'\nimport markdownitSynapsePlugin from 'markdown-it-synapse'\nimport markdownitSynapseHeading from 'markdown-it-synapse-heading'\nimport markdownitMath from 'markdown-it-synapse-math'\nimport markdownitSynapseTable from 'markdown-it-synapse-table'\nimport { JSX, useEffect, useMemo, useRef } from 'react'\nimport { ErrorBanner } from '../error/ErrorBanner'\nimport { SkeletonTable } from '../Skeleton'\nimport MarkdownWidget from './MarkdownWidget'\nimport { SynapseWikiContextProvider } from './SynapseWikiContext'\nimport Bookmarks from './widget/Bookmarks'\n\nexport const NO_WIKI_CONTENT = 'There is no content.'\n\nexport type MarkdownSynapseProps = {\n ownerId?: string\n wikiId?: string\n markdown?: string\n renderInline?: boolean\n objectType?: ObjectType\n loadingSkeletonRowCount?: number\n onMarkdownProcessingDone?: (htmlContent: string | null | undefined) => void\n showPlaceholderIfNoWikiContent?: boolean\n}\n\n// Configure markdown-it\nconst md = MarkdownIt({ html: true })\nmarkdownitSynapse.init_markdown_it(\n md,\n markdownitSub,\n markdownitSup,\n markdownitCentertext,\n markdownitSynapseHeading,\n markdownitSynapseTable,\n markdownitStrikethroughAlt,\n markdownitContainer,\n markdownitInlineComments,\n markdownitBr,\n)\nconst mathSuffix = ''\nmd.use(markdownitSynapsePlugin, mathSuffix, 'https://synapse.org').use(\n markdownitMath,\n mathSuffix,\n)\n\n/**\n * Process all the corresponding bookmark tags of the references made throughout the page and renders footnotes, if any exist.\n */\nfunction AddBookmarks(props: { renderInline: boolean; markdown: string }) {\n const { markdown, renderInline } = props\n const footnotesHtml = useMemo(() => {\n markdownitSynapse.resetFootnotes()\n createHTML(renderInline, markdown)\n return createHTML(renderInline, markdownitSynapse.footnotes()).__html\n }, [markdown, renderInline])\n\n if (footnotesHtml.length > 0) {\n return (\n <div>\n <Bookmarks footnotes={footnotesHtml} />\n </div>\n )\n }\n return null\n}\n\n/**\n * Given input text, generate markdown object to be passed onto inner html of some container.\n * @param {String} markdown The text being written in plain markdown\n * @returns {Object} Dictionary to be passed into dangerouslySetInnerHTML with markdown text\n */\nfunction createHTML(renderInline: boolean, markdown?: string) {\n if (!markdown) {\n return { __html: '' }\n }\n // Note - renderInline parses out any block level elements contained in the markdown\n const initText = renderInline\n ? md.renderInline(markdown)\n : md.render(markdown)\n const cleanText = sanitize(initText)\n return { __html: cleanText }\n}\n\n/**\n * Given widgetMap renders it in a React component (or originalMarkup in special cases.)\n *\n * @param {string} widgetParams The params of the widget to render\n * @param {string} originalMarkup The original markup text, this is a special case for widgets that\n * are html specific.\n * @returns the rendered markdown widget\n */\nfunction MapParamsToMarkdownWidget(props: {\n widgetParams: string\n originalMarkup: string\n}) {\n const { widgetParams, originalMarkup } = props\n // General workflow -\n // 1. Capture widget parameters\n // 2. Transform any widget xml parameters to standard text\n // 3. Split those parameters into a map\n // 4. Render that widget based on its parameters\n\n // steps 1,2\n const decodedWidgetParams = decodeXml(widgetParams)\n\n // decodedWidgetParams look like {<widget>?param1=xxx¶m2=yyy}\n const questionIndex = decodedWidgetParams.indexOf('?')\n if (questionIndex === -1) {\n // e.g. toc is passed, there are no params\n return (\n <MarkdownWidget\n key={JSON.stringify(decodedWidgetParams)}\n widgetType={decodedWidgetParams as any}\n widgetParamsMapped={{}}\n originalMarkup={originalMarkup}\n />\n )\n }\n const widgetType = decodedWidgetParams.substring(0, questionIndex)\n const widgetParamsMapped: Record<string, string> = {}\n // map out params and their values\n decodedWidgetParams\n .substring(questionIndex + 1)\n .split('&')\n .forEach(keyPair => {\n let [key, value] = keyPair.split('=')\n value = decodeURIComponent(value)\n widgetParamsMapped[key] = value\n })\n return (\n <MarkdownWidget\n key={JSON.stringify(decodedWidgetParams)}\n widgetType={widgetType as any}\n widgetParamsMapped={widgetParamsMapped}\n originalMarkup={originalMarkup}\n />\n )\n}\n\n/**\n * Component that process all the markdown and transforms it to the appropriate Synapse widgets.\n *\n * @returns JSX of the markdown into widgets\n */\nfunction RenderMarkdown(props: {\n renderInline: boolean\n markdown: string\n isLoading: boolean\n showPlaceholderIfNoWikiContent: boolean\n}) {\n const { renderInline, markdown, isLoading, showPlaceholderIfNoWikiContent } =\n props\n\n const markup = useMemo(() => {\n // create initial markup\n let markup = createHTML(renderInline, markdown).__html\n // process reference widgets\n markup = addIdsToReferenceWidgets(markup)\n // process table of contents widgets\n markup = addIdsToTocWidgets(markup)\n\n return markup\n }, [markdown, renderInline])\n\n if (markup.length > 0) {\n const domParser = new DOMParser()\n const document = domParser.parseFromString(markup, 'text/html')\n return <RecursiveRender element={document.body} markdown={markup} />\n }\n\n if (!isLoading && showPlaceholderIfNoWikiContent && markup === '') {\n return (\n <Typography variant=\"body1Italic\" sx={{ mb: 1 }}>\n {NO_WIKI_CONTENT}\n </Typography>\n )\n }\n\n return\n}\n\n/**\n * recursiveRender will render react tree from HTML tree\n *\n * @param {Node} element This will be either a text Node or an HTMLElement\n * @param {string} markdown The original markdown, its kept as a special case for the table of contents widget\n * @returns {*}\n */\nfunction RecursiveRender(props: { element: Node; markdown: string }) {\n const { element, markdown } = props\n /*\n Recursively render the html tree created from the markdown, there are a few cases:\n 1. element is Node and is text in which case it is simply rendered\n 2. element is an HTMLElement and is: a self closing tag, has no children (e.g. <br>), or its a synapse widget and is\n rendered accordingly\n 3. element is an HTMLElement and has children so we loop through its childNodes, recurively render those, and then render its own tag\n as the parent of those child nodes. Note - childNodes was specifically chosen over .children because text Nodes\n would not come through .children\n */\n if (element.nodeType === Node.TEXT_NODE) {\n // case 1.\n return <>{element.textContent}</>\n } else if (\n element.nodeType === Node.ELEMENT_NODE &&\n element instanceof HTMLElement\n ) {\n const Tag: keyof JSX.IntrinsicElements =\n element.tagName.toLowerCase() as keyof JSX.IntrinsicElements\n const widgetParams = element.getAttribute('data-widgetparams')\n if (widgetParams) {\n // case 2\n // process widget\n return (\n <MapParamsToMarkdownWidget\n widgetParams={widgetParams}\n originalMarkup={markdown}\n />\n )\n }\n // manually add on props, depending on what comes through the markdown their could\n // be unforseen issues with attributes being misnamed according to what react will respect\n // e.g. class instead of className\n const attributes = element.attributes\n const rawProps: Record<string, string> = {}\n for (let i = 0; i < attributes.length; i++) {\n let name = ''\n let value = ''\n const attribute = attributes.item(i)\n if (attribute) {\n name = attribute.name\n value = attribute.value\n }\n if (name && value) {\n rawProps[name] = value\n }\n }\n\n const { style: styleString, class: className, ...props } = rawProps\n // Remap class to className\n props.className = className\n if (styleString) {\n // React expects the `style` prop to be an object, not a string, so use\n // the all-caps STYLE to pass the style string as a custom attribute\n props.STYLE = styleString\n }\n\n if (element.childNodes.length === 0) {\n // case 2\n // e.g. self closing tag like <br/> or <img>\n return <Tag {...props} />\n }\n // case 3\n // recursively render children\n const children = Array.from(element.childNodes).map((el, index) => {\n return <RecursiveRender key={index} element={el} markdown={markdown} />\n })\n // Render tagName as parent element of the children below\n switch (Tag) {\n case 'p':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'span':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'h1':\n return (\n <Typography variant={'headline1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'h2':\n return (\n <Typography variant={'headline2'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'h3':\n return (\n <Typography variant={'headline3'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'ol':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'ul':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'a':\n return (\n <Link {...props} component={Tag}>\n {children}\n </Link>\n )\n default:\n if (Tag === 'body') {\n // The component ultimately wraps this content, so if the tag is 'body', just render the children.\n return children\n }\n return <Tag {...props}>{children}</Tag>\n }\n }\n return null\n}\n\n/**\n * Basic Markdown functionality for Synapse, supporting Images/Plots/References/Bookmarks/buttonlinks\n *\n * @class Markdown\n * @extends {Component}\n */\nfunction MarkdownSynapse(props: MarkdownSynapseProps) {\n const {\n ownerId,\n wikiId,\n objectType = ObjectType.ENTITY,\n markdown: markdownFromProps,\n onMarkdownProcessingDone,\n renderInline = false,\n loadingSkeletonRowCount,\n showPlaceholderIfNoWikiContent = false,\n } = props\n\n const markupRef = useRef<HTMLDivElement>(null)\n\n const {\n data: wikiPage,\n isLoading: isLoadingWikiPage,\n error: getWikiPageError,\n } = useGetWikiPage(\n {\n ownerObjectId: ownerId!,\n wikiPageId: wikiId!,\n ownerObjectType: objectType,\n },\n { enabled: Boolean(ownerId) },\n )\n\n const {\n data: wikiAttachments,\n isLoading: isLoadingWikiAttachments,\n error: getWikiAttachmentsError,\n } = useGetWikiAttachments(\n {\n ownerObjectId: ownerId!,\n wikiPageId: wikiId!,\n ownerObjectType: objectType,\n },\n {\n enabled: Boolean(ownerId),\n },\n )\n\n const isLoading = isLoadingWikiPage || isLoadingWikiAttachments\n const error = getWikiPageError || getWikiAttachmentsError\n\n /* Add click handler to the markdown area to handle clicking refs, ToC, etc. */\n useEffect(() => {\n const currentMarkupNode = markupRef.current\n if (currentMarkupNode) {\n currentMarkupNode.addEventListener('click', handleLinkClicks)\n }\n return () => {\n if (currentMarkupNode) {\n currentMarkupNode.removeEventListener('click', handleLinkClicks)\n }\n }\n }, [])\n\n const markdown = markdownFromProps || wikiPage?.markdown || ''\n\n /* When the markdown changes, call the `onMarkdownProcessingDone` callback */\n useEffect(() => {\n if (markdown && onMarkdownProcessingDone) {\n onMarkdownProcessingDone(createHTML(renderInline, markdown).__html)\n }\n }, [wikiPage, onMarkdownProcessingDone, renderInline])\n\n /* When the markdown changes, re-run the math processor */\n useEffect(() => {\n if (markdown) {\n processMath(markupRef)\n }\n }, [markdown])\n\n const loader = loadingSkeletonRowCount ? (\n <SkeletonTable numCols={1} numRows={loadingSkeletonRowCount} />\n ) : (\n <span className=\"spinner\" />\n )\n\n if (error) {\n return <ErrorBanner error={error} />\n }\n const content = (\n <SynapseWikiContextProvider\n wikiContext={{\n ownerId: props.ownerId,\n wikiId: props.wikiId,\n wikiPage: wikiPage,\n fileHandles: wikiAttachments,\n }}\n >\n {isLoading && loader}\n {(markdown || showPlaceholderIfNoWikiContent) && (\n <RenderMarkdown\n markdown={markdown}\n renderInline={renderInline}\n isLoading={isLoading}\n showPlaceholderIfNoWikiContent={showPlaceholderIfNoWikiContent}\n />\n )}\n {markdown && (\n <AddBookmarks renderInline={renderInline} markdown={markdown} />\n )}\n </SynapseWikiContextProvider>\n )\n if (renderInline) {\n return (\n <span\n data-testid=\"markdown\"\n className=\"markdown markdown-inline\"\n ref={markupRef}\n >\n {content}\n </span>\n )\n }\n return (\n <div data-testid=\"markdown\" className=\"markdown\" ref={markupRef}>\n {content}\n </div>\n )\n}\n\nexport { MarkdownSynapse, MarkdownSynapse as Markdown }\n\nexport default MarkdownSynapse\n"],"names":["NO_WIKI_CONTENT","md","MarkdownIt","markdownitSynapse","markdownitSub","markdownitSup","markdownitCentertext","markdownitSynapseHeading","markdownitSynapseTable","markdownitStrikethroughAlt","markdownitContainer","markdownitInlineComments","markdownitBr","mathSuffix","markdownitSynapsePlugin","markdownitMath","AddBookmarks","props","markdown","renderInline","footnotesHtml","useMemo","createHTML","jsx","Bookmarks","initText","sanitize","MapParamsToMarkdownWidget","widgetParams","originalMarkup","decodedWidgetParams","decodeXml","questionIndex","MarkdownWidget","widgetType","widgetParamsMapped","keyPair","key","value","RenderMarkdown","isLoading","showPlaceholderIfNoWikiContent","markup","addIdsToReferenceWidgets","addIdsToTocWidgets","document","RecursiveRender","Typography","element","Fragment","Tag","attributes","rawProps","i","name","attribute","styleString","className","children","el","index","Link","MarkdownSynapse","ownerId","wikiId","objectType","ObjectType","markdownFromProps","onMarkdownProcessingDone","loadingSkeletonRowCount","markupRef","useRef","wikiPage","isLoadingWikiPage","getWikiPageError","useGetWikiPage","wikiAttachments","isLoadingWikiAttachments","getWikiAttachmentsError","useGetWikiAttachments","error","useEffect","currentMarkupNode","handleLinkClicks","processMath","loader","SkeletonTable","ErrorBanner","content","jsxs","SynapseWikiContextProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAkB,wBAczBC,IAAKC,EAAW,EAAE,MAAM,IAAM;AACpCC,EAAkB;AAAA,EAChBF;AAAA,EACAG;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACF;AACA,MAAMC,IAAa;AACnBZ,EAAG,IAAIa,GAAyBD,GAAY,qBAAqB,EAAE;AAAA,EACjEE;AAAA,EACAF;AACF;AAKA,SAASG,GAAaC,GAAoD;AACxE,QAAM,EAAE,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B,EAAA,CACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"MarkdownSynapse.js","sources":["../../../src/components/Markdown/MarkdownSynapse.tsx"],"sourcesContent":["import {\n addIdsToReferenceWidgets,\n addIdsToTocWidgets,\n decodeXml,\n handleLinkClicks,\n processMath,\n fixInvalidNesting,\n} from '@/components/Markdown/MarkdownUtils'\nimport {\n useGetWikiPage,\n useGetWikiAttachments,\n} from '@/synapse-queries/wiki/useWiki'\nimport { sanitize } from '@/utils/functions/SanitizeHtmlUtils'\nimport { Link, Typography } from '@mui/material'\nimport markdownitContainer from '@sage-bionetworks/markdown-it-container'\nimport { ObjectType } from '@sage-bionetworks/synapse-types'\nimport MarkdownIt from 'markdown-it'\nimport markdownitBr from 'markdown-it-br'\nimport markdownitCentertext from 'markdown-it-center-text'\nimport markdownitInlineComments from 'markdown-it-inline-comments'\nimport markdownitStrikethroughAlt from 'markdown-it-strikethrough-alt'\nimport markdownitSub from 'markdown-it-sub-alt'\nimport markdownitSup from 'markdown-it-sup-alt'\nimport * as markdownitSynapse from 'markdown-it-synapse'\nimport markdownitSynapsePlugin from 'markdown-it-synapse'\nimport markdownitSynapseHeading from 'markdown-it-synapse-heading'\nimport markdownitMath from 'markdown-it-synapse-math'\nimport markdownitSynapseTable from 'markdown-it-synapse-table'\nimport { JSX, useEffect, useMemo, useRef } from 'react'\nimport { ErrorBanner } from '../error/ErrorBanner'\nimport { SkeletonTable } from '../Skeleton'\nimport MarkdownWidget from './MarkdownWidget'\nimport { SynapseWikiContextProvider } from './SynapseWikiContext'\nimport Bookmarks from './widget/Bookmarks'\n\nexport const NO_WIKI_CONTENT = 'There is no content.'\n\nexport type MarkdownSynapseProps = {\n ownerId?: string\n wikiId?: string\n markdown?: string\n renderInline?: boolean\n objectType?: ObjectType\n loadingSkeletonRowCount?: number\n onMarkdownProcessingDone?: (htmlContent: string | null | undefined) => void\n showPlaceholderIfNoWikiContent?: boolean\n}\n\n// Configure markdown-it\nconst md = MarkdownIt({ html: true })\nmarkdownitSynapse.init_markdown_it(\n md,\n markdownitSub,\n markdownitSup,\n markdownitCentertext,\n markdownitSynapseHeading,\n markdownitSynapseTable,\n markdownitStrikethroughAlt,\n markdownitContainer,\n markdownitInlineComments,\n markdownitBr,\n)\nconst mathSuffix = ''\nmd.use(markdownitSynapsePlugin, mathSuffix, 'https://synapse.org').use(\n markdownitMath,\n mathSuffix,\n)\n\n/**\n * Process all the corresponding bookmark tags of the references made throughout the page and renders footnotes, if any exist.\n */\nfunction AddBookmarks(props: { renderInline: boolean; markdown: string }) {\n const { markdown, renderInline } = props\n const footnotesHtml = useMemo(() => {\n markdownitSynapse.resetFootnotes()\n createHTML(renderInline, markdown)\n return createHTML(renderInline, markdownitSynapse.footnotes()).__html\n }, [markdown, renderInline])\n\n if (footnotesHtml.length > 0) {\n return (\n <div>\n <Bookmarks footnotes={footnotesHtml} />\n </div>\n )\n }\n return null\n}\n\n/**\n * Given input text, generate markdown object to be passed onto inner html of some container.\n * @param {String} markdown The text being written in plain markdown\n * @returns {Object} Dictionary to be passed into dangerouslySetInnerHTML with markdown text\n */\nfunction createHTML(renderInline: boolean, markdown?: string) {\n if (!markdown) {\n return { __html: '' }\n }\n // Note - renderInline parses out any block level elements contained in the markdown\n const initText = renderInline\n ? md.renderInline(markdown)\n : md.render(markdown)\n const cleanText = sanitize(initText)\n return { __html: cleanText }\n}\n\n/**\n * Given widgetMap renders it in a React component (or originalMarkup in special cases.)\n *\n * @param {string} widgetParams The params of the widget to render\n * @param {string} originalMarkup The original markup text, this is a special case for widgets that\n * are html specific.\n * @returns the rendered markdown widget\n */\nfunction MapParamsToMarkdownWidget(props: {\n widgetParams: string\n originalMarkup: string\n}) {\n const { widgetParams, originalMarkup } = props\n // General workflow -\n // 1. Capture widget parameters\n // 2. Transform any widget xml parameters to standard text\n // 3. Split those parameters into a map\n // 4. Render that widget based on its parameters\n\n // steps 1,2\n const decodedWidgetParams = decodeXml(widgetParams)\n\n // decodedWidgetParams look like {<widget>?param1=xxx¶m2=yyy}\n const questionIndex = decodedWidgetParams.indexOf('?')\n if (questionIndex === -1) {\n // e.g. toc is passed, there are no params\n return (\n <MarkdownWidget\n key={JSON.stringify(decodedWidgetParams)}\n widgetType={decodedWidgetParams as any}\n widgetParamsMapped={{}}\n originalMarkup={originalMarkup}\n />\n )\n }\n const widgetType = decodedWidgetParams.substring(0, questionIndex)\n const widgetParamsMapped: Record<string, string> = {}\n // map out params and their values\n decodedWidgetParams\n .substring(questionIndex + 1)\n .split('&')\n .forEach(keyPair => {\n let [key, value] = keyPair.split('=')\n value = decodeURIComponent(value)\n widgetParamsMapped[key] = value\n })\n return (\n <MarkdownWidget\n key={JSON.stringify(decodedWidgetParams)}\n widgetType={widgetType as any}\n widgetParamsMapped={widgetParamsMapped}\n originalMarkup={originalMarkup}\n />\n )\n}\n\n/**\n * Component that process all the markdown and transforms it to the appropriate Synapse widgets.\n *\n * @returns JSX of the markdown into widgets\n */\nfunction RenderMarkdown(props: {\n renderInline: boolean\n markdown: string\n isLoading: boolean\n showPlaceholderIfNoWikiContent: boolean\n}) {\n const { renderInline, markdown, isLoading, showPlaceholderIfNoWikiContent } =\n props\n\n const markup = useMemo(() => {\n // create initial markup\n let markup = createHTML(renderInline, markdown).__html\n // process reference widgets\n markup = addIdsToReferenceWidgets(markup)\n // process table of contents widgets\n markup = addIdsToTocWidgets(markup)\n\n return markup\n }, [markdown, renderInline])\n\n const processedDocuments = useMemo(() => {\n if (markup.length > 0) {\n const domParser = new DOMParser()\n const document = domParser.parseFromString(markup, 'text/html')\n\n fixInvalidNesting(document.body)\n\n return document.body\n }\n return null\n }, [markup])\n\n if (processedDocuments) {\n return <RecursiveRender element={processedDocuments} markdown={markup} />\n }\n\n if (!isLoading && showPlaceholderIfNoWikiContent && markup === '') {\n return (\n <Typography variant=\"body1Italic\" sx={{ mb: 1 }}>\n {NO_WIKI_CONTENT}\n </Typography>\n )\n }\n\n return\n}\n\n/**\n * recursiveRender will render react tree from HTML tree\n *\n * @param {Node} element This will be either a text Node or an HTMLElement\n * @param {string} markdown The original markdown, its kept as a special case for the table of contents widget\n * @returns {*}\n */\n\nfunction RecursiveRender(props: { element: Node; markdown: string }) {\n const { element, markdown } = props\n /*\n Recursively render the html tree created from the markdown, there are a few cases:\n 1. element is Node and is text in which case it is simply rendered\n 2. element is an HTMLElement and is: a self closing tag, has no children (e.g. <br>), or its a synapse widget and is\n rendered accordingly\n 3. element is an HTMLElement and has children so we loop through its childNodes, recurively render those, and then render its own tag\n as the parent of those child nodes. Note - childNodes was specifically chosen over .children because text Nodes\n would not come through .children\n */\n if (element.nodeType === Node.TEXT_NODE) {\n // case 1.\n return <>{element.textContent}</>\n } else if (\n element.nodeType === Node.ELEMENT_NODE &&\n element instanceof HTMLElement\n ) {\n const Tag: keyof JSX.IntrinsicElements =\n element.tagName.toLowerCase() as keyof JSX.IntrinsicElements\n const widgetParams = element.getAttribute('data-widgetparams')\n\n if (widgetParams) {\n // case 2\n // process widget\n return (\n <MapParamsToMarkdownWidget\n widgetParams={widgetParams}\n originalMarkup={markdown}\n />\n )\n }\n // manually add on props, depending on what comes through the markdown their could\n // be unforseen issues with attributes being misnamed according to what react will respect\n // e.g. class instead of className\n const attributes = element.attributes\n const rawProps: Record<string, string> = {}\n for (let i = 0; i < attributes.length; i++) {\n let name = ''\n let value = ''\n const attribute = attributes.item(i)\n if (attribute) {\n name = attribute.name\n value = attribute.value\n }\n if (name && value) {\n rawProps[name] = value\n }\n }\n\n const { style: styleString, class: className, ...props } = rawProps\n // Remap class to className\n props.className = className\n if (styleString) {\n // React expects the `style` prop to be an object, not a string, so use\n // the all-caps STYLE to pass the style string as a custom attribute\n props.STYLE = styleString\n }\n\n if (element.childNodes.length === 0) {\n // case 2\n // e.g. self closing tag like <br/> or <img>\n return <Tag {...props} />\n }\n\n // case 3\n // recursively render children\n const children = Array.from(element.childNodes).map((el, index) => {\n return <RecursiveRender key={index} element={el} markdown={markdown} />\n })\n // Render tagName as parent element of the children below\n switch (Tag) {\n case 'p':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'span':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'h1':\n return (\n <Typography variant={'headline1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'h2':\n return (\n <Typography variant={'headline2'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'h3':\n return (\n <Typography variant={'headline3'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'ol':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'ul':\n return (\n <Typography variant={'body1'} {...props} component={Tag}>\n {children}\n </Typography>\n )\n case 'a':\n return (\n <Link {...props} component={Tag}>\n {children}\n </Link>\n )\n default:\n if (Tag === 'body') {\n // The component ultimately wraps this content, so if the tag is 'body', just render the children.\n return children\n }\n return <Tag {...props}>{children}</Tag>\n }\n }\n return null\n}\n\n/**\n * Basic Markdown functionality for Synapse, supporting Images/Plots/References/Bookmarks/buttonlinks\n *\n * @class Markdown\n * @extends {Component}\n */\nfunction MarkdownSynapse(props: MarkdownSynapseProps) {\n const {\n ownerId,\n wikiId,\n objectType = ObjectType.ENTITY,\n markdown: markdownFromProps,\n onMarkdownProcessingDone,\n renderInline = false,\n loadingSkeletonRowCount,\n showPlaceholderIfNoWikiContent = false,\n } = props\n\n const markupRef = useRef<HTMLDivElement>(null)\n\n const {\n data: wikiPage,\n isLoading: isLoadingWikiPage,\n error: getWikiPageError,\n } = useGetWikiPage(\n {\n ownerObjectId: ownerId!,\n wikiPageId: wikiId!,\n ownerObjectType: objectType,\n },\n { enabled: Boolean(ownerId) },\n )\n\n const {\n data: wikiAttachments,\n isLoading: isLoadingWikiAttachments,\n error: getWikiAttachmentsError,\n } = useGetWikiAttachments(\n {\n ownerObjectId: ownerId!,\n wikiPageId: wikiId!,\n ownerObjectType: objectType,\n },\n {\n enabled: Boolean(ownerId),\n },\n )\n\n const isLoading = isLoadingWikiPage || isLoadingWikiAttachments\n const error = getWikiPageError || getWikiAttachmentsError\n\n /* Add click handler to the markdown area to handle clicking refs, ToC, etc. */\n useEffect(() => {\n const currentMarkupNode = markupRef.current\n if (currentMarkupNode) {\n currentMarkupNode.addEventListener('click', handleLinkClicks)\n }\n return () => {\n if (currentMarkupNode) {\n currentMarkupNode.removeEventListener('click', handleLinkClicks)\n }\n }\n }, [])\n\n const markdown = markdownFromProps || wikiPage?.markdown || ''\n\n /* When the markdown changes, call the `onMarkdownProcessingDone` callback */\n useEffect(() => {\n if (markdown && onMarkdownProcessingDone) {\n onMarkdownProcessingDone(createHTML(renderInline, markdown).__html)\n }\n }, [wikiPage, onMarkdownProcessingDone, renderInline])\n\n /* When the markdown changes, re-run the math processor */\n useEffect(() => {\n if (markdown) {\n processMath(markupRef)\n }\n }, [markdown])\n\n const loader = loadingSkeletonRowCount ? (\n <SkeletonTable numCols={1} numRows={loadingSkeletonRowCount} />\n ) : (\n <span className=\"spinner\" />\n )\n\n if (error) {\n return <ErrorBanner error={error} />\n }\n const content = (\n <SynapseWikiContextProvider\n wikiContext={{\n ownerId: props.ownerId,\n wikiId: props.wikiId,\n wikiPage: wikiPage,\n fileHandles: wikiAttachments,\n }}\n >\n {isLoading && loader}\n {(markdown || showPlaceholderIfNoWikiContent) && (\n <RenderMarkdown\n markdown={markdown}\n renderInline={renderInline}\n isLoading={isLoading}\n showPlaceholderIfNoWikiContent={showPlaceholderIfNoWikiContent}\n />\n )}\n {markdown && (\n <AddBookmarks renderInline={renderInline} markdown={markdown} />\n )}\n </SynapseWikiContextProvider>\n )\n if (renderInline) {\n return (\n <span\n data-testid=\"markdown\"\n className=\"markdown markdown-inline\"\n ref={markupRef}\n >\n {content}\n </span>\n )\n }\n return (\n <div data-testid=\"markdown\" className=\"markdown\" ref={markupRef}>\n {content}\n </div>\n )\n}\n\nexport { MarkdownSynapse, MarkdownSynapse as Markdown }\n\nexport default MarkdownSynapse\n"],"names":["NO_WIKI_CONTENT","md","MarkdownIt","markdownitSynapse","markdownitSub","markdownitSup","markdownitCentertext","markdownitSynapseHeading","markdownitSynapseTable","markdownitStrikethroughAlt","markdownitContainer","markdownitInlineComments","markdownitBr","mathSuffix","markdownitSynapsePlugin","markdownitMath","AddBookmarks","props","markdown","renderInline","footnotesHtml","useMemo","createHTML","jsx","Bookmarks","initText","sanitize","MapParamsToMarkdownWidget","widgetParams","originalMarkup","decodedWidgetParams","decodeXml","questionIndex","MarkdownWidget","widgetType","widgetParamsMapped","keyPair","key","value","RenderMarkdown","isLoading","showPlaceholderIfNoWikiContent","markup","addIdsToReferenceWidgets","addIdsToTocWidgets","processedDocuments","document","fixInvalidNesting","RecursiveRender","Typography","element","Fragment","Tag","attributes","rawProps","i","name","attribute","styleString","className","children","el","index","Link","MarkdownSynapse","ownerId","wikiId","objectType","ObjectType","markdownFromProps","onMarkdownProcessingDone","loadingSkeletonRowCount","markupRef","useRef","wikiPage","isLoadingWikiPage","getWikiPageError","useGetWikiPage","wikiAttachments","isLoadingWikiAttachments","getWikiAttachmentsError","useGetWikiAttachments","error","useEffect","currentMarkupNode","handleLinkClicks","processMath","loader","SkeletonTable","ErrorBanner","content","jsxs","SynapseWikiContextProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,KAAkB,wBAczBC,IAAKC,EAAW,EAAE,MAAM,IAAM;AACpCC,EAAkB;AAAA,EAChBF;AAAA,EACAG;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACF;AACA,MAAMC,IAAa;AACnBZ,EAAG,IAAIa,GAAyBD,GAAY,qBAAqB,EAAE;AAAA,EACjEE;AAAA,EACAF;AACF;AAKA,SAASG,GAAaC,GAAoD;AACxE,QAAM,EAAE,UAAAC,GAAU,cAAAC,EAAA,IAAiBF,GAC7BG,IAAgBC,EAAQ,OAC5BlB,EAAkB,eAAA,GAClB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AAnE,EAAC,SAAI,eAAY,YAAW,WAAU,YAAW,KAAKiD,GACnD,UAAAkB,EAAA,CACH;AAEJ;"}
|
|
@@ -21,4 +21,12 @@ export declare function handleLinkClicks(event: MouseEvent): void;
|
|
|
21
21
|
export declare function stripHTML(myHtmlString: string): string;
|
|
22
22
|
export declare function transformStringIntoMarkdownProps(value: string, isRawMarkdown?: boolean): MarkdownSynapseProps;
|
|
23
23
|
export declare const markdownToPlainText: (markdown: string, maxLength?: number) => string;
|
|
24
|
+
export declare const isBlockLevelElement: (node: Node) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Fixes invalid HTML nesting (e.g., <div> inside <p>) in a single O(n) pass.
|
|
27
|
+
* It compares the current 'node' against a stack of its 'ancestors'.
|
|
28
|
+
* @param node - The current DOM node being inspected.
|
|
29
|
+
* @param ancestors - An array of the current node's parent elements
|
|
30
|
+
*/
|
|
31
|
+
export declare function fixInvalidNesting(node: Node, ancestors?: HTMLElement[]): void;
|
|
24
32
|
//# sourceMappingURL=MarkdownUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownUtils.d.ts","sourceRoot":"","sources":["../../../src/components/Markdown/MarkdownUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAIxD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAoBnE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,UAapC;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,UAWpD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,UAe9C;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,QAuCjD;AAED,wBAAgB,SAAS,CAAC,YAAY,EA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