microboard-ui-temp 0.0.3
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/.github/workflows/npm-publish.yml +66 -0
- package/Dockerfile +15 -0
- package/LICENSE.txt +17 -0
- package/MicroboardLicense.txt +84 -0
- package/README.md +23 -0
- package/bun.lock +1079 -0
- package/bunPlugins/copyPlugin.ts +81 -0
- package/bunfig.toml +1 -0
- package/docker-compose.yml +7 -0
- package/package.json +49 -0
- package/scripts/buildPkg.ts +29 -0
- package/scripts/buildSpa.ts +29 -0
- package/server.ts +18 -0
- package/src/App/App.ts +502 -0
- package/src/App/BoardsList.ts +752 -0
- package/src/App/Clipboard.ts +22 -0
- package/src/App/Connection.ts +758 -0
- package/src/App/Location.ts +23 -0
- package/src/App/MediaHelpers.ts +221 -0
- package/src/App/Paste/index.ts +5 -0
- package/src/App/Paste/pasteTextToTheBoard.ts +19 -0
- package/src/App/Paste/tryToGetMarkdownFromDataTransfer.ts +60 -0
- package/src/App/Paste/tryToPasteAsItemOrReturnText.ts +72 -0
- package/src/App/Paste/tryToPasteAudioByLink.ts +35 -0
- package/src/App/Paste/tryToPasteFromMicroboard.ts +15 -0
- package/src/App/Paste/tryToPasteFromMiro.ts +75 -0
- package/src/App/Paste/tryToPasteImages.ts +44 -0
- package/src/App/Paste/tryToPasteVideoByLink.ts +68 -0
- package/src/App/Permissions.ts +43 -0
- package/src/App/README.md +58 -0
- package/src/App/SessionStorage.ts +248 -0
- package/src/App/Storage.ts +122 -0
- package/src/App/Wheel/Wheel.spec.ts +40 -0
- package/src/App/Wheel/Wheel.ts +229 -0
- package/src/App/Wheel/WheelEventLogger.ts +70 -0
- package/src/App/Wheel/WheelEvents.spec.ts +418 -0
- package/src/App/Wheel/index.ts +1 -0
- package/src/App/Wheel/mockedWheelData.ts +77658 -0
- package/src/App/getController.ts +878 -0
- package/src/App/getSubscriptions.ts +155 -0
- package/src/App/index.ts +1 -0
- package/src/App/isFirefox.ts +3 -0
- package/src/App/isMacos.ts +2 -0
- package/src/App/isSafari.ts +17 -0
- package/src/App/router.tsx +149 -0
- package/src/App/testRecorder.ts +393 -0
- package/src/App/throttlePointerEvent.ts +27 -0
- package/src/App/useAccount.ts +19 -0
- package/src/App/useBoardSubscription.ts +14 -0
- package/src/App/useBoardsList.ts +18 -0
- package/src/App/useDomMbr.ts +65 -0
- package/src/Config.ts +41 -0
- package/src/Globals.d.ts +6 -0
- package/src/WhiteBoardModule/Readme.md +21 -0
- package/src/WhiteBoardModule/WhiteBoardModuleNative.tsx +60 -0
- package/src/WhiteBoardModule/WhiteboardModuleReact.tsx +61 -0
- package/src/development.entrypoint.ts +38 -0
- package/src/entities/AIInput/AIContext.tsx +377 -0
- package/src/entities/AIInput/AIDropdown.tsx +296 -0
- package/src/entities/AIInput/AIGenerationButton.tsx +54 -0
- package/src/entities/AIInput/AIInput.module.css +488 -0
- package/src/entities/AIInput/AIInput.tsx +427 -0
- package/src/entities/AIInput/StarIcon.tsx +201 -0
- package/src/entities/AIInput/index.ts +12 -0
- package/src/entities/AIInput/utils.ts +384 -0
- package/src/entities/BoardMenu/BoardMenu.module.css +38 -0
- package/src/entities/BoardMenu/BoardMenu.tsx +86 -0
- package/src/entities/BoardMenu/MouseOrTracpadModal/MouseOrTrackpadModal.tsx +138 -0
- package/src/entities/BoardMenu/MouseOrTracpadModal/MouseOrTracpadModal.module.css +93 -0
- package/src/entities/BoardMenu/index.ts +1 -0
- package/src/entities/BoardMenu/sections/Comments.tsx +65 -0
- package/src/entities/BoardMenu/sections/Items.tsx +85 -0
- package/src/entities/BoardMenu/sections/MouseOrTrackpad.tsx +108 -0
- package/src/entities/BoardName/BoardName.module.css +61 -0
- package/src/entities/BoardName/BoardName.tsx +66 -0
- package/src/entities/BoardName/BoardRename.module.css +15 -0
- package/src/entities/BoardName/BoardRename.tsx +93 -0
- package/src/entities/BoardName/index.ts +3 -0
- package/src/entities/Canvas/Canvas.tsx +250 -0
- package/src/entities/Canvas/CanvasNoRouter.tsx +216 -0
- package/src/entities/Canvas/index.ts +2 -0
- package/src/entities/Folder/DragOverlay.tsx +52 -0
- package/src/entities/Folder/DragPlaceholder.module.css +5 -0
- package/src/entities/Folder/DragPlaceholder.tsx +6 -0
- package/src/entities/Folder/DraggingItem.module.css +8 -0
- package/src/entities/Folder/DraggingWrapper.tsx +18 -0
- package/src/entities/Folder/Folder.module.css +113 -0
- package/src/entities/Folder/Folder.tsx +356 -0
- package/src/entities/Folder/FolderItem.module.css +89 -0
- package/src/entities/Folder/FolderItem.tsx +165 -0
- package/src/entities/Folder/FoldersDndContext.tsx +129 -0
- package/src/entities/Folder/OpenedFoldersContext.tsx +33 -0
- package/src/entities/Folder/index.ts +8 -0
- package/src/entities/account/Account.ts +542 -0
- package/src/entities/account/AuthForm.module.css +150 -0
- package/src/entities/account/AuthForm.tsx +48 -0
- package/src/entities/account/AuthGuard.tsx +17 -0
- package/src/entities/account/AuthInterceptor.ts +21 -0
- package/src/entities/account/UnauthGuard.tsx +17 -0
- package/src/entities/account/index.ts +5 -0
- package/src/entities/comments/Cluster/Cluster.module.css +43 -0
- package/src/entities/comments/Cluster/Cluster.tsx +100 -0
- package/src/entities/comments/CommentContainer/CommentContainer.module.css +51 -0
- package/src/entities/comments/CommentContainer/CommentContainer.tsx +232 -0
- package/src/entities/comments/CommentContainer/CommentPreview/CommentPreview.module.css +89 -0
- package/src/entities/comments/CommentContainer/CommentPreview/CommentPreview.tsx +92 -0
- package/src/entities/comments/CommentInput/CommentInput.module.css +69 -0
- package/src/entities/comments/CommentInput/CommentInput.tsx +122 -0
- package/src/entities/comments/CommentsContext.tsx +65 -0
- package/src/entities/comments/CommentsPanel/CommentCard/CommentCard.module.css +36 -0
- package/src/entities/comments/CommentsPanel/CommentCard/CommentCard.tsx +132 -0
- package/src/entities/comments/CommentsPanel/CommentCard/Message/Message.module.css +73 -0
- package/src/entities/comments/CommentsPanel/CommentCard/Message/Message.tsx +72 -0
- package/src/entities/comments/CommentsPanel/CommentsPanel.module.css +143 -0
- package/src/entities/comments/CommentsPanel/CommentsPanel.tsx +278 -0
- package/src/entities/comments/CommentsPanel/CommentsPanelContext.tsx +37 -0
- package/src/entities/comments/CommentsProvider.module.css +4 -0
- package/src/entities/comments/CommentsProvider.tsx +73 -0
- package/src/entities/comments/CreateComment/CreateComment.module.css +8 -0
- package/src/entities/comments/CreateComment/CreateComment.tsx +66 -0
- package/src/entities/comments/Thread/ExtraOptions/ExtraOptions.module.css +44 -0
- package/src/entities/comments/Thread/ExtraOptions/ExtraOptions.tsx +127 -0
- package/src/entities/comments/Thread/OptionsPanel/OptionsPanel.module.css +32 -0
- package/src/entities/comments/Thread/OptionsPanel/OptionsPanel.tsx +38 -0
- package/src/entities/comments/Thread/ThreadPanel.module.css +82 -0
- package/src/entities/comments/Thread/ThreadPanel.tsx +298 -0
- package/src/entities/comments/Thread/message/Message.module.css +71 -0
- package/src/entities/comments/Thread/message/Message.tsx +137 -0
- package/src/entities/comments/index.ts +7 -0
- package/src/entities/comments/lib.ts +22 -0
- package/src/entities/comments/useCommentsMerge.ts +88 -0
- package/src/entities/comments/useIntersectionObserver.ts +58 -0
- package/src/entities/comments/useScrollToUnreadMessage.ts +24 -0
- package/src/env.d.ts +12 -0
- package/src/features/AccessDeniedModal/AccessDeniedModal.module.css +56 -0
- package/src/features/AccessDeniedModal/AccessDeniedModal.tsx +94 -0
- package/src/features/AccessDeniedModal/index.ts +1 -0
- package/src/features/AiUnavailableModal/AiUnavailableModal.module.css +52 -0
- package/src/features/AiUnavailableModal/AiUnavailableModal.tsx +59 -0
- package/src/features/AiUnavailableModal/index.ts +1 -0
- package/src/features/AppContext.tsx +17 -0
- package/src/features/AppView/AppView.module.css +18 -0
- package/src/features/AppView/AppView.tsx +302 -0
- package/src/features/AppView/InactiveBoardHidder.tsx +14 -0
- package/src/features/AppView/LocalAppView.tsx +177 -0
- package/src/features/AppView/NoBoardIsOpen.module.css +29 -0
- package/src/features/AppView/NoBoardIsOpen.tsx +69 -0
- package/src/features/AppView/QuickAddPanel/QuickAddPanel.module.css +12 -0
- package/src/features/AppView/QuickAddPanel/QuickAddPanel.tsx +171 -0
- package/src/features/AppView/QuickAddPanel/index.ts +1 -0
- package/src/features/AppView/index.ts +2 -0
- package/src/features/AppView/listeners.ts +0 -0
- package/src/features/AudioPlayer/AudioPlayer.module.css +213 -0
- package/src/features/AudioPlayer/AudioPlayer.tsx +517 -0
- package/src/features/AudioPlayer/index.ts +1 -0
- package/src/features/ChangePasswordModal/ChangePassword.module.css +129 -0
- package/src/features/ChangePasswordModal/ChangePasswordModal.tsx +247 -0
- package/src/features/ChangePasswordModal/index.ts +4 -0
- package/src/features/ContextMenu/ContextMenu.module.css +38 -0
- package/src/features/ContextMenu/ContextMenu.tsx +507 -0
- package/src/features/ContextMenu/ContextMenuContext.tsx +77 -0
- package/src/features/ContextMenu/index.ts +5 -0
- package/src/features/ContextPanel/Buttons/AIGeneration.tsx +72 -0
- package/src/features/ContextPanel/Buttons/AIModel/AIModel.module.css +5 -0
- package/src/features/ContextPanel/Buttons/AIModel/AIModel.tsx +97 -0
- package/src/features/ContextPanel/Buttons/AIModel/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/AIModel.tsx +95 -0
- package/src/features/ContextPanel/Buttons/AddList/AddList.tsx +83 -0
- package/src/features/ContextPanel/Buttons/AddList/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/ButtonWithMenu/ButtonWithMenu.tsx +107 -0
- package/src/features/ContextPanel/Buttons/ButtonWithMenu/UiButtonWithMenu.module.css +49 -0
- package/src/features/ContextPanel/Buttons/ButtonWithMenu/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/CardGame/Card/CreateDeck.tsx +65 -0
- package/src/features/ContextPanel/Buttons/CardGame/Card/FlipCard.tsx +41 -0
- package/src/features/ContextPanel/Buttons/CardGame/Deck/GetCard.tsx +61 -0
- package/src/features/ContextPanel/Buttons/CardGame/Deck/ShuffleDeck.tsx +39 -0
- package/src/features/ContextPanel/Buttons/CardGame/Dice/ChangeRange/ChangeRange.module.css +53 -0
- package/src/features/ContextPanel/Buttons/CardGame/Dice/ChangeRange/ChangeRange.tsx +133 -0
- package/src/features/ContextPanel/Buttons/CardGame/Dice/ThrowDice.tsx +38 -0
- package/src/features/ContextPanel/Buttons/ConnectorAddText.tsx +55 -0
- package/src/features/ContextPanel/Buttons/ConnectorFontStyle.tsx +28 -0
- package/src/features/ContextPanel/Buttons/ConnectorLineColor.tsx +96 -0
- package/src/features/ContextPanel/Buttons/ConnectorTextColor.tsx +22 -0
- package/src/features/ContextPanel/Buttons/ConnectorTextHighlight.tsx +28 -0
- package/src/features/ContextPanel/Buttons/ConnectorType/ConnectorType.module.css +5 -0
- package/src/features/ContextPanel/Buttons/ConnectorType/ConnectorType.tsx +108 -0
- package/src/features/ContextPanel/Buttons/ConnectorType/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/ContextPanelButton.module.css +19 -0
- package/src/features/ContextPanel/Buttons/Delete.tsx +32 -0
- package/src/features/ContextPanel/Buttons/DrawFillStyle.tsx +107 -0
- package/src/features/ContextPanel/Buttons/DrawStrokeWidth/DrawStrokeWidth.module.css +4 -0
- package/src/features/ContextPanel/Buttons/DrawStrokeWidth/DrawStrokeWidth.tsx +32 -0
- package/src/features/ContextPanel/Buttons/DrawStrokeWidth/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/Duplicate.tsx +25 -0
- package/src/features/ContextPanel/Buttons/Edit.tsx +23 -0
- package/src/features/ContextPanel/Buttons/EndPointer/EndPointer.module.css +14 -0
- package/src/features/ContextPanel/Buttons/EndPointer/EndPointer.tsx +80 -0
- package/src/features/ContextPanel/Buttons/EndPointer/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/FillStyle.tsx +91 -0
- package/src/features/ContextPanel/Buttons/FontSize/ConnectorFontSize.tsx +34 -0
- package/src/features/ContextPanel/Buttons/FontSize/FontSize.module.css +53 -0
- package/src/features/ContextPanel/Buttons/FontSize/FontSize.tsx +217 -0
- package/src/features/ContextPanel/Buttons/FontSize/index.ts +2 -0
- package/src/features/ContextPanel/Buttons/FontStyle.tsx +68 -0
- package/src/features/ContextPanel/Buttons/FrameFill.tsx +91 -0
- package/src/features/ContextPanel/Buttons/FrameNavNext.tsx +33 -0
- package/src/features/ContextPanel/Buttons/FrameNavPrev.tsx +37 -0
- package/src/features/ContextPanel/Buttons/FrameRatio/FrameRatio.module.css +14 -0
- package/src/features/ContextPanel/Buttons/FrameRatio/FrameRatio.tsx +113 -0
- package/src/features/ContextPanel/Buttons/FrameRatio/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/HyperLinkBtn.tsx +53 -0
- package/src/features/ContextPanel/Buttons/ItemType/ItemType.module.css +15 -0
- package/src/features/ContextPanel/Buttons/ItemType/ItemType.tsx +115 -0
- package/src/features/ContextPanel/Buttons/ItemType/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/Lock.tsx +98 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/BringToFront.tsx +28 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/CopyFrameLink.tsx +50 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/CopyItemLink.tsx +48 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/ExportFrame.tsx +32 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/SaveImg.tsx +32 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/SaveVideoOrAudio.tsx +45 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/SendToBack.tsx +28 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/SetLinkTo.tsx +35 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/getLinkToItem.tsx +3 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/Items/index.ts +5 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/RestOptionsMenu.module.css +51 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/RestOptionsMenu.tsx +96 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/RestOptionsMenuItem.tsx +29 -0
- package/src/features/ContextPanel/Buttons/RestOptionsMenu/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/StartPointer/StartPointer.module.css +18 -0
- package/src/features/ContextPanel/Buttons/StartPointer/StartPointer.tsx +87 -0
- package/src/features/ContextPanel/Buttons/StartPointer/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/StickerFillStyle.tsx +74 -0
- package/src/features/ContextPanel/Buttons/StrokeStyle/StrokeStyle.module.css +19 -0
- package/src/features/ContextPanel/Buttons/StrokeStyle/StrokeStyle.tsx +144 -0
- package/src/features/ContextPanel/Buttons/StrokeStyle/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/SwitchPointers.tsx +28 -0
- package/src/features/ContextPanel/Buttons/TextAlignment/TextAlignment.module.css +6 -0
- package/src/features/ContextPanel/Buttons/TextAlignment/TextAlignment.tsx +98 -0
- package/src/features/ContextPanel/Buttons/TextAlignment/index.ts +1 -0
- package/src/features/ContextPanel/Buttons/TextAlignmentSticker.tsx +87 -0
- package/src/features/ContextPanel/Buttons/TextColor.tsx +86 -0
- package/src/features/ContextPanel/Buttons/TextHighlight.tsx +85 -0
- package/src/features/ContextPanel/Buttons/ToggleFrameRatio.tsx +38 -0
- package/src/features/ContextPanel/Buttons/ToggleIsShining.tsx +36 -0
- package/src/features/ContextPanel/ContextPanel.module.css +9 -0
- package/src/features/ContextPanel/ContextPanel.tsx +531 -0
- package/src/features/ContextPanel/PanelContext.ts +17 -0
- package/src/features/ContextPanel/index.ts +1 -0
- package/src/features/ContextWrapper.tsx +47 -0
- package/src/features/Counter/Counter.module.css +20 -0
- package/src/features/Counter/Counter.tsx +49 -0
- package/src/features/CryptoWrapper/CryptoWrapper.tsx +79 -0
- package/src/features/CryptoWrapper/index.ts +1 -0
- package/src/features/Cursors/comment.svg +22 -0
- package/src/features/Cursors/customCursors.ts +31 -0
- package/src/features/Cursors/eraser.svg +3 -0
- package/src/features/Cursors/index.ts +1 -0
- package/src/features/Cursors/pencil.svg +3 -0
- package/src/features/Cursors/sticker/sticker-black.svg +27 -0
- package/src/features/Cursors/sticker/sticker-blue.svg +27 -0
- package/src/features/Cursors/sticker/sticker-gray.svg +27 -0
- package/src/features/Cursors/sticker/sticker-green.svg +27 -0
- package/src/features/Cursors/sticker/sticker-light-blue.svg +28 -0
- package/src/features/Cursors/sticker/sticker-light-gray.svg +27 -0
- package/src/features/Cursors/sticker/sticker-light-green.svg +27 -0
- package/src/features/Cursors/sticker/sticker-orange.svg +27 -0
- package/src/features/Cursors/sticker/sticker-pink.svg +27 -0
- package/src/features/Cursors/sticker/sticker-purple.svg +27 -0
- package/src/features/Cursors/sticker/sticker-sky-blue.svg +27 -0
- package/src/features/Cursors/sticker/sticker-yellow.svg +27 -0
- package/src/features/ErrorBoundary/ErrorBoundary.module.css +64 -0
- package/src/features/ErrorBoundary/ErrorBoundary.tsx +112 -0
- package/src/features/ErrorBoundary/index.ts +1 -0
- package/src/features/ExportPanel/ExportPanel.module.css +55 -0
- package/src/features/ExportPanel/ExportPanel.tsx +73 -0
- package/src/features/ExportPanel/ExportVisible.tsx +18 -0
- package/src/features/ExportPanel/index.ts +1 -0
- package/src/features/GameItems/CreateCardsModal.tsx +178 -0
- package/src/features/GameItems/CreateDiceModal.tsx +213 -0
- package/src/features/GameItems/Modal.module.css +148 -0
- package/src/features/GameItems/index.ts +1 -0
- package/src/features/GenerateChart/AIChat.module.css +162 -0
- package/src/features/GenerateChart/AIChat.tsx +198 -0
- package/src/features/GenerateChart/AIChatPanel.module.css +34 -0
- package/src/features/GenerateChart/AIChatPanel.tsx +72 -0
- package/src/features/GenerateChart/lib/engine/index.ts +616 -0
- package/src/features/GenerateChart/lib/transformOutput.ts +338 -0
- package/src/features/GoogleAuthBtn/GoogleAuthBtn.module.css +19 -0
- package/src/features/GoogleAuthBtn/GoogleAuthBtn.tsx +19 -0
- package/src/features/GoogleAuthBtn/icons.tsx +301 -0
- package/src/features/GoogleAuthBtn/index.ts +1 -0
- package/src/features/ImportMiro/AuthClipboardModal/AuthClipboardModal.module.css +26 -0
- package/src/features/ImportMiro/AuthClipboardModal/AuthClipboardModal.tsx +38 -0
- package/src/features/ImportMiro/ImgAuthClipboardModal/ImgAuthClipboardModal.module.css +36 -0
- package/src/features/ImportMiro/ImgAuthClipboardModal/ImgAuthClipboardModal.tsx +74 -0
- package/src/features/ImportMiro/ImportMiroBoards/ImportBoardItem/MiroClipboardTransformer.ts +765 -0
- package/src/features/ImportMiro/ImportMiroBoards/ImportBoardItem/index.ts +1 -0
- package/src/features/ImportMiro/ImportMiroBoards/ImportBoardItem/useCopyBoardItems.tsx +1156 -0
- package/src/features/ImportMiro/ImportMiroBoards/ImportMiro.module.css +157 -0
- package/src/features/ImportMiro/ImportMiroBoards/ImportMiro.tsx +95 -0
- package/src/features/ImportMiro/ImportMiroBoards/MiroModels.ts +250 -0
- package/src/features/ImportMiro/ImportMiroBoards/Notifications/ErrorNotification.tsx +48 -0
- package/src/features/ImportMiro/ImportMiroBoards/Notifications/LoadingNotification.tsx +53 -0
- package/src/features/ImportMiro/ImportMiroBoards/Notifications/SuccessNotification.tsx +54 -0
- package/src/features/ImportMiro/ImportMiroBoards/Notifications/WarnClipboardNotification.tsx +57 -0
- package/src/features/ImportMiro/ImportMiroBoards/Notifications/WarnNotification.tsx +68 -0
- package/src/features/ImportMiro/ImportMiroBoards/Notifications/index.ts +5 -0
- package/src/features/ImportMiro/ImportMiroStartModal/ImportMiroStartModal.module.css +35 -0
- package/src/features/ImportMiro/ImportMiroStartModal/ImportMiroStartModal.tsx +47 -0
- package/src/features/ImportMiro/index.ts +5 -0
- package/src/features/ItemTooltip/ItemTooltip.tsx +77 -0
- package/src/features/ItemTooltip/index.ts +1 -0
- package/src/features/ItemsProvider/ItemsProvider.tsx +45 -0
- package/src/features/ItemsProvider/index.ts +1 -0
- package/src/features/LandingMenu/LandingMenu.module.css +54 -0
- package/src/features/LandingMenu/LandingMenu.tsx +88 -0
- package/src/features/LandingMenu/MobileLandingMenu.module.css +78 -0
- package/src/features/LandingMenu/MobileLandingMenu.tsx +133 -0
- package/src/features/LandingMenu/const.ts +2 -0
- package/src/features/LandingMenu/index.ts +2 -0
- package/src/features/LinksProvider/LinkToButton/LinkToButton.module.css +34 -0
- package/src/features/LinksProvider/LinkToButton/LinkToButton.tsx +175 -0
- package/src/features/LinksProvider/LinksProvider.tsx +84 -0
- package/src/features/LinksProvider/index.ts +1 -0
- package/src/features/LocalFileSavingProgress/LocalFileSaveProgress.module.css +6 -0
- package/src/features/LocalFileSavingProgress/LocalFileSaveProgress.tsx +30 -0
- package/src/features/LocalFileSavingProgress/index.ts +1 -0
- package/src/features/LoginWith/LoginWith.module.css +18 -0
- package/src/features/LoginWith/LoginWith.tsx +15 -0
- package/src/features/MediaUnavailableModal/MediaUnavailableModal.module.css +52 -0
- package/src/features/MediaUnavailableModal/MediaUnavailableModal.tsx +64 -0
- package/src/features/MediaUnavailableModal/index.ts +4 -0
- package/src/features/Modal/ConfirmModal.module.css +71 -0
- package/src/features/Modal/ConfirmModal.tsx +199 -0
- package/src/features/Modal/CookiesModal.module.css +32 -0
- package/src/features/Modal/CookiesModal.tsx +75 -0
- package/src/features/Modal/InfoModal.module.css +49 -0
- package/src/features/Modal/InfoModal.tsx +90 -0
- package/src/features/Modal/ModalsWrapper.tsx +13 -0
- package/src/features/Modal/SetLinkToModal.module.css +49 -0
- package/src/features/Modal/SetLinkToModal.tsx +112 -0
- package/src/features/Notifications/Notifications.module.css +14 -0
- package/src/features/Notifications/SigninErrorNotification.tsx +34 -0
- package/src/features/Notifications/SignupErrorNotification.tsx +33 -0
- package/src/features/Notifications/index.ts +8 -0
- package/src/features/Pickers/ColorPicker/ColorItem.module.css +44 -0
- package/src/features/Pickers/ColorPicker/ColorItem.tsx +33 -0
- package/src/features/Pickers/ColorPicker/ColorPicker.module.css +12 -0
- package/src/features/Pickers/ColorPicker/ColorPicker.tsx +43 -0
- package/src/features/Pickers/ColorPicker/SquareColorItem.module.css +41 -0
- package/src/features/Pickers/ColorPicker/SquareColorItem.tsx +27 -0
- package/src/features/Pickers/ColorPicker/index.ts +1 -0
- package/src/features/Pickers/ConnectorLineStylePicker.tsx +52 -0
- package/src/features/Pickers/ConnectorPointerPicker/ConnectorPointerPicker.module.css +4 -0
- package/src/features/Pickers/ConnectorPointerPicker/ConnectorPointerPicker.tsx +39 -0
- package/src/features/Pickers/ConnectorPointerPicker/index.ts +1 -0
- package/src/features/Pickers/DrawingToolPicker.tsx +31 -0
- package/src/features/Pickers/FontSizePicker/FontSizePicker.module.css +8 -0
- package/src/features/Pickers/FontSizePicker/FontSizePicker.tsx +61 -0
- package/src/features/Pickers/FontSizePicker/index.ts +1 -0
- package/src/features/Pickers/FontStylePicker.tsx +88 -0
- package/src/features/Pickers/FramePicker/FramePicker.module.css +11 -0
- package/src/features/Pickers/FramePicker/FramePicker.tsx +40 -0
- package/src/features/Pickers/FramePicker/index.ts +1 -0
- package/src/features/Pickers/HorizontalAlignmentPicker.tsx +49 -0
- package/src/features/Pickers/ShapeTypePicker.tsx +80 -0
- package/src/features/Pickers/SliderPicker/SliderPicker.module.css +13 -0
- package/src/features/Pickers/SliderPicker/SliderPicker.tsx +43 -0
- package/src/features/Pickers/SliderPicker/index.ts +1 -0
- package/src/features/Pickers/StrokeStylePicker/StrokeStylePicker.module.css +4 -0
- package/src/features/Pickers/StrokeStylePicker/StrokeStylePicker.tsx +59 -0
- package/src/features/Pickers/StrokeStylePicker/index.ts +1 -0
- package/src/features/Pickers/VerticalAlignmentPicker.tsx +48 -0
- package/src/features/Presence/BringToMe/BringToMe.module.css +134 -0
- package/src/features/Presence/BringToMe/BringToMe.tsx +363 -0
- package/src/features/Presence/PresenceUsers/Dropdown.tsx +70 -0
- package/src/features/Presence/PresenceUsers/EyeIcon.tsx +16 -0
- package/src/features/Presence/PresenceUsers/PresenceUserAvatar.tsx +93 -0
- package/src/features/Presence/PresenceUsers/PresenceUsers.module.css +366 -0
- package/src/features/Presence/PresenceUsers/PresenceUsers.tsx +239 -0
- package/src/features/Presence/PresenceUsers/UserAvatar.tsx +92 -0
- package/src/features/Presence/PresenceUsers/mock.ts +34 -0
- package/src/features/Presence/UserTracking/UserTracking.module.css +72 -0
- package/src/features/Presence/UserTracking/UserTracking.tsx +67 -0
- package/src/features/ProfileSettingsModal/ProfileSettingsModal.module.css +100 -0
- package/src/features/ProfileSettingsModal/ProfileSettingsModal.tsx +333 -0
- package/src/features/ProfileSettingsModal/index.ts +4 -0
- package/src/features/QuickAddButtons/QuickAddButtonsClear.tsx +12 -0
- package/src/features/README.md +36 -0
- package/src/features/Rename/RenameContext.tsx +54 -0
- package/src/features/Rename/RenameInput.module.css +15 -0
- package/src/features/Rename/RenameInput.tsx +78 -0
- package/src/features/Rename/index.ts +2 -0
- package/src/features/ShapesPanel/ShapesCategory/ShapesCategory.module.css +29 -0
- package/src/features/ShapesPanel/ShapesCategory/ShapesCategory.tsx +70 -0
- package/src/features/ShapesPanel/ShapesPanel.module.css +75 -0
- package/src/features/ShapesPanel/ShapesPanel.tsx +69 -0
- package/src/features/ShapesPanel/ShapesPanelContext.tsx +109 -0
- package/src/features/ShapesPanel/index.ts +5 -0
- package/src/features/ShareModal/SaveShareModal.module.css +31 -0
- package/src/features/ShareModal/SaveShareModal.tsx +63 -0
- package/src/features/ShareModal/SearchInput.module.css +188 -0
- package/src/features/ShareModal/SearchInput.tsx +441 -0
- package/src/features/ShareModal/ShareModal.module.css +297 -0
- package/src/features/ShareModal/ShareModal.tsx +627 -0
- package/src/features/ShareModal/SharePanel.module.css +74 -0
- package/src/features/ShareModal/SharePanel.tsx +258 -0
- package/src/features/ShareModal/index.ts +1 -0
- package/src/features/ShareSnapshotModal/ShareSnapshotModal.module.css +286 -0
- package/src/features/ShareSnapshotModal/ShareSnapshotModal.tsx +41 -0
- package/src/features/ShareSnapshotModal/SnapshotNameInput.module.css +92 -0
- package/src/features/ShareSnapshotModal/SnapshotNameInput.tsx +225 -0
- package/src/features/ShareSnapshotModal/index.ts +1 -0
- package/src/features/SidePanel/LocalSidePanelContext.tsx +66 -0
- package/src/features/SidePanel/ResizableEdge.module.css +9 -0
- package/src/features/SidePanel/ResizableEdge.tsx +77 -0
- package/src/features/SidePanel/SidePanel.module.css +140 -0
- package/src/features/SidePanel/SidePanel.tsx +179 -0
- package/src/features/SidePanel/SidePanelContext.tsx +108 -0
- package/src/features/SidePanel/index.ts +3 -0
- package/src/features/SidePanelsContainer/SidePanelsContainer.module.css +15 -0
- package/src/features/SidePanelsContainer/SidePanelsContainer.tsx +61 -0
- package/src/features/SidePanelsContainer/index.ts +1 -0
- package/src/features/Templates/CreateTemplateModal/CreateTemplateModal.module.css +34 -0
- package/src/features/Templates/CreateTemplateModal/CreateTemplateModal.tsx +463 -0
- package/src/features/Templates/SelectTemplateModal/CategoriesMenu/CategoriesMenu.module.css +48 -0
- package/src/features/Templates/SelectTemplateModal/CategoriesMenu/CategoriesMenu.tsx +62 -0
- package/src/features/Templates/SelectTemplateModal/LanguagesDropdown/LanguagesDropdown.module.css +61 -0
- package/src/features/Templates/SelectTemplateModal/LanguagesDropdown/LanguagesDropdown.tsx +72 -0
- package/src/features/Templates/SelectTemplateModal/SelectTemplateModal.module.css +152 -0
- package/src/features/Templates/SelectTemplateModal/SelectTemplateModal.tsx +206 -0
- package/src/features/Templates/SelectTemplateModal/TemplateItemPreview/TemplateItemPreview.module.css +151 -0
- package/src/features/Templates/SelectTemplateModal/TemplateItemPreview/TemplateItemPreview.tsx +77 -0
- package/src/features/Templates/SelectTemplateModal/TemplateItemsGrid/TemplateItem/TemplateItem.tsx +119 -0
- package/src/features/Templates/SelectTemplateModal/TemplateItemsGrid/TemplateItem/templateItem.module.css +88 -0
- package/src/features/Templates/SelectTemplateModal/TemplateItemsGrid/TemplateItemsGrid.module.css +51 -0
- package/src/features/Templates/SelectTemplateModal/TemplateItemsGrid/TemplateItemsGrid.tsx +39 -0
- package/src/features/Templates/TolgeeProvider.tsx +29 -0
- package/src/features/Templates/config.ts +6 -0
- package/src/features/Templates/index.ts +2 -0
- package/src/features/Templates/lib.ts +59 -0
- package/src/features/TextEditor/Element.tsx +204 -0
- package/src/features/TextEditor/Leaf.tsx +72 -0
- package/src/features/TextEditor/README.md +3 -0
- package/src/features/TextEditor/TextEditor.module.css +115 -0
- package/src/features/TextEditor/TextEditor.tsx +610 -0
- package/src/features/TextEditor/index.ts +1 -0
- package/src/features/TextEditor/verticalAlignmentToFlex.tsx +14 -0
- package/src/features/TitlePanel/TitlePanel.module.css +123 -0
- package/src/features/TitlePanel/TitlePanel.tsx +341 -0
- package/src/features/TitlePanel/index.ts +1 -0
- package/src/features/ToastProvider.tsx +33 -0
- package/src/features/ToolsPanel/Buttons/AddConnector.tsx +73 -0
- package/src/features/ToolsPanel/Buttons/AddCounter.tsx +29 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddDrawing.module.css +13 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddDrawing.tsx +115 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddDrawingContext.tsx +15 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddHighlighter/AddHighlighter.module.css +26 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddHighlighter/AddHighlighter.tsx +138 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddPen/AddPen.module.css +26 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/AddPen/AddPen.tsx +126 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/Eraser/Eraser.tsx +47 -0
- package/src/features/ToolsPanel/Buttons/AddDrawing/index.ts +1 -0
- package/src/features/ToolsPanel/Buttons/AddFrame.tsx +57 -0
- package/src/features/ToolsPanel/Buttons/AddGameItem/AddCard.tsx +31 -0
- package/src/features/ToolsPanel/Buttons/AddGameItem/AddDice.tsx +32 -0
- package/src/features/ToolsPanel/Buttons/AddGameItem/AddGameItem.module.css +3 -0
- package/src/features/ToolsPanel/Buttons/AddGameItem/AddGameItem.tsx +39 -0
- package/src/features/ToolsPanel/Buttons/AddMedia/AddMedia.module.css +3 -0
- package/src/features/ToolsPanel/Buttons/AddMedia/AddMedia.tsx +72 -0
- package/src/features/ToolsPanel/Buttons/AddMedia/AddMediaButton.tsx +146 -0
- package/src/features/ToolsPanel/Buttons/AddShape/AddShape.module.css +18 -0
- package/src/features/ToolsPanel/Buttons/AddShape/AddShape.tsx +97 -0
- package/src/features/ToolsPanel/Buttons/AddShape/index.ts +1 -0
- package/src/features/ToolsPanel/Buttons/AddSticker.tsx +73 -0
- package/src/features/ToolsPanel/Buttons/AddTemplate.tsx +28 -0
- package/src/features/ToolsPanel/Buttons/AddText.tsx +31 -0
- package/src/features/ToolsPanel/Buttons/ButtonWithMenu/ButtonWithMenu.module.css +9 -0
- package/src/features/ToolsPanel/Buttons/ButtonWithMenu/ButtonWithMenu.tsx +24 -0
- package/src/features/ToolsPanel/Buttons/ButtonWithMenu/index.ts +1 -0
- package/src/features/ToolsPanel/Buttons/EventList/EventList.module.css +5 -0
- package/src/features/ToolsPanel/Buttons/EventList/EventList.tsx +144 -0
- package/src/features/ToolsPanel/Buttons/EventList/History.tsx +140 -0
- package/src/features/ToolsPanel/Buttons/EventList/HistoryEvent.tsx +28 -0
- package/src/features/ToolsPanel/Buttons/EventList/PrettifiedEvent.tsx +212 -0
- package/src/features/ToolsPanel/Buttons/EventList/SyncJournal.tsx +89 -0
- package/src/features/ToolsPanel/Buttons/EventList/index.ts +1 -0
- package/src/features/ToolsPanel/Buttons/Grab.tsx +29 -0
- package/src/features/ToolsPanel/Buttons/Redo.tsx +40 -0
- package/src/features/ToolsPanel/Buttons/Select.tsx +37 -0
- package/src/features/ToolsPanel/Buttons/Star.tsx +31 -0
- package/src/features/ToolsPanel/Buttons/Undo.tsx +39 -0
- package/src/features/ToolsPanel/PanelContext.ts +13 -0
- package/src/features/ToolsPanel/ToolsPanel.module.css +33 -0
- package/src/features/ToolsPanel/ToolsPanel.tsx +84 -0
- package/src/features/ToolsPanel/ViewToolsPanel.tsx +30 -0
- package/src/features/ToolsPanel/index.ts +1 -0
- package/src/features/UserPanel/ActionButtons/ActionButtons.module.css +9 -0
- package/src/features/UserPanel/ActionButtons/ActionButtons.tsx +22 -0
- package/src/features/UserPanel/Avatar/Avatar.module.css +21 -0
- package/src/features/UserPanel/Avatar/Avatar.tsx +44 -0
- package/src/features/UserPanel/Buttons/AddComment/AddComment.module.css +14 -0
- package/src/features/UserPanel/Buttons/AddComment/AddComment.tsx +61 -0
- package/src/features/UserPanel/Buttons/AddComment/index.ts +1 -0
- package/src/features/UserPanel/Buttons/ButtonWithMenu/ButtonWithMenu.module.css +8 -0
- package/src/features/UserPanel/Buttons/ButtonWithMenu/ButtonWithMenu.tsx +24 -0
- package/src/features/UserPanel/Buttons/ButtonWithMenu/index.ts +1 -0
- package/src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx +49 -0
- package/src/features/UserPanel/Buttons/TogglePresenceRender/TogglePresenceRender.module.css +48 -0
- package/src/features/UserPanel/Buttons/TogglePresenceRender/TogglePresenceRender.tsx +38 -0
- package/src/features/UserPanel/UserAvatar/UserAvatar.tsx +66 -0
- package/src/features/UserPanel/UserDropdown/UserDropdown.tsx +75 -0
- package/src/features/UserPanel/UserPanel.module.css +516 -0
- package/src/features/UserPanel/UserPanel.tsx +153 -0
- package/src/features/UserPanel/UserPic/UserPic.tsx +171 -0
- package/src/features/UserPanel/icons/ChangePassword.tsx +22 -0
- package/src/features/UserPanel/icons/Click.tsx +20 -0
- package/src/features/UserPanel/icons/Logout.tsx +22 -0
- package/src/features/UserPanel/icons/Ring.tsx +18 -0
- package/src/features/UserPanel/icons/Thumb.tsx +18 -0
- package/src/features/UserPanel/icons/Upgrade.tsx +20 -0
- package/src/features/UserPanel/icons/UserShare.tsx +18 -0
- package/src/features/UserPlan/HistoryModal.tsx +30 -0
- package/src/features/UserPlan/HistoryTable.tsx +114 -0
- package/src/features/UserPlan/LimitsModal.tsx +102 -0
- package/src/features/UserPlan/LimitsTable.module.css +131 -0
- package/src/features/UserPlan/LimitsTable.tsx +171 -0
- package/src/features/UserPlan/PlanCard.module.css +184 -0
- package/src/features/UserPlan/PlanCard.tsx +245 -0
- package/src/features/UserPlan/PlanCards.module.css +26 -0
- package/src/features/UserPlan/PlanCards.tsx +476 -0
- package/src/features/UserPlan/SelectPaymentModal.module.css +206 -0
- package/src/features/UserPlan/SelectPaymentModal.tsx +810 -0
- package/src/features/UserPlan/UserPlanModal.module.css +145 -0
- package/src/features/UserPlan/UserPlanModal.tsx +124 -0
- package/src/features/UserPlan/UserPlanUsage.module.css +101 -0
- package/src/features/UserPlan/UserPlanUsage.tsx +186 -0
- package/src/features/UserPlan/index.ts +1 -0
- package/src/features/VideoPlayer/VideoCanvasControls.tsx +59 -0
- package/src/features/VideoPlayer/VideoPlayer.module.css +3 -0
- package/src/features/VideoPlayer/VideoPlayer.tsx +158 -0
- package/src/features/VideoPlayer/index.ts +2 -0
- package/src/features/ViewModeGuard.tsx +62 -0
- package/src/features/WalletLoginButton/WalletLoginButton.module.css +7 -0
- package/src/features/WalletLoginButton/WalletLoginButton.tsx +77 -0
- package/src/features/WalletLoginButton/index.ts +1 -0
- package/src/features/Widgets/Navbar/Navbar.css +148 -0
- package/src/features/Widgets/Navbar/Navbar.tsx +75 -0
- package/src/features/Widgets/Navbar/lead-icon.tsx +25 -0
- package/src/features/Widgets/form-notifications/password-changed.module.css +39 -0
- package/src/features/Widgets/form-notifications/password-changed.tsx +28 -0
- package/src/features/ZoomPanel/ZoomPanel.module.css +32 -0
- package/src/features/ZoomPanel/ZoomPanel.tsx +105 -0
- package/src/features/ZoomPanel/index.ts +1 -0
- package/src/features/hotkeys.json +315 -0
- package/src/features/hyperLink/HyperLink.module.css +20 -0
- package/src/features/hyperLink/HyperLink.tsx +77 -0
- package/src/features/hyperLink/HyperLinkContext.tsx +57 -0
- package/src/features/hyperLink/HyperLinkInput/HyperLinkInput.module.css +47 -0
- package/src/features/hyperLink/HyperLinkInput/HyperLinkInput.tsx +196 -0
- package/src/features/hyperLink/index.ts +6 -0
- package/src/features/index.drawio +115 -0
- package/src/features/index.svg +1 -0
- package/src/features/modules.d.ts +22 -0
- package/src/index.css +65 -0
- package/src/index.html +74 -0
- package/src/index.ts +4 -0
- package/src/initI18N.ts +42 -0
- package/src/pages/AddEmailView/AddEmailPage.module.css +136 -0
- package/src/pages/AddEmailView/AddEmailPage.tsx +125 -0
- package/src/pages/AddEmailView/index.ts +1 -0
- package/src/pages/BindEmailPage/BindEmailPage.module.css +73 -0
- package/src/pages/BindEmailPage/BindEmailPage.tsx +263 -0
- package/src/pages/BindEmailPage/index.ts +1 -0
- package/src/pages/BoardPage.tsx +161 -0
- package/src/pages/ForgotPasswordPage/ForgotPasswordPage.module.css +82 -0
- package/src/pages/ForgotPasswordPage/ForgotPasswordPage.tsx +148 -0
- package/src/pages/ForgotPasswordPage/SuccessIcon.tsx +20 -0
- package/src/pages/ForgotPasswordPage/index.ts +1 -0
- package/src/pages/HTMLSnapshot/HTMLSnapshot.tsx +60 -0
- package/src/pages/HTMLSnapshot/index.ts +1 -0
- package/src/pages/RestorePasswordPage/RestorePasswordPage.module.css +46 -0
- package/src/pages/RestorePasswordPage/RestorePasswordPage.tsx +197 -0
- package/src/pages/RestorePasswordPage/index.ts +1 -0
- package/src/pages/SelectBoardPage/SelectBoardPage.module.css +247 -0
- package/src/pages/SelectBoardPage/SelectBoardPage.tsx +419 -0
- package/src/pages/SelectBoardPage/getEmbedUrl.ts +3 -0
- package/src/pages/SelectBoardPage/index.ts +1 -0
- package/src/pages/SigninPage/SigninPage.module.css +17 -0
- package/src/pages/SigninPage/SigninPage.tsx +201 -0
- package/src/pages/SigninPage/index.ts +1 -0
- package/src/pages/SignupPage/EmailIcon.tsx +24 -0
- package/src/pages/SignupPage/LockIcon.tsx +24 -0
- package/src/pages/SignupPage/PeopleIcon.tsx +23 -0
- package/src/pages/SignupPage/SignupPage.module.css +52 -0
- package/src/pages/SignupPage/SignupPage.tsx +282 -0
- package/src/pages/SignupPage/index.ts +1 -0
- package/src/pages/TestPage.tsx +52 -0
- package/src/pages/VerifyMailPage/VerifyMailPage.module.css +20 -0
- package/src/pages/VerifyMailPage/VerifyMailPage.tsx +287 -0
- package/src/pages/VerifyMailPage/index.ts +1 -0
- package/src/pages/WelcomePage/WelcomePage.tsx +76 -0
- package/src/pages/WelcomePage/index.ts +1 -0
- package/src/pages/WelcomePage/welcomeBoard.json +8727 -0
- package/src/pages/WelcomePage/welcomeBoardEn.json +9683 -0
- package/src/pages/WheelLogger/WheelLogger.module.css +32 -0
- package/src/pages/WheelLogger/WheelLogger.tsx +94 -0
- package/src/pages/layouts/AppLayout.tsx +86 -0
- package/src/pages/layouts/AuthLayout/AuthLayout.module.css +80 -0
- package/src/pages/layouts/AuthLayout/AuthLayout.tsx +74 -0
- package/src/pages/layouts/AuthLayout/Tail.tsx +23 -0
- package/src/pages/layouts/AuthLayout/index.ts +1 -0
- package/src/production.entrypoint.ts +39 -0
- package/src/public/customWebComponents.js +323 -0
- package/src/public/favicon.svg +20 -0
- package/src/public/favicons/apple-touch-icon.png +0 -0
- package/src/public/favicons/favicon-16x16.png +0 -0
- package/src/public/favicons/favicon-32x32.png +0 -0
- package/src/public/favicons/favicon.ico +0 -0
- package/src/public/favicons/favicon.svg +6 -0
- package/src/public/favicons/site.webmanifest +21 -0
- package/src/public/favicons/web-app-manifest-192x192.png +0 -0
- package/src/public/favicons/web-app-manifest-512x512.png +0 -0
- package/src/public/fonts/NotoColorEmoji-Regular.ttf +0 -0
- package/src/public/fonts/OpenSans-Bold.ttf +0 -0
- package/src/public/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/src/public/fonts/OpenSans-Italic.ttf +0 -0
- package/src/public/fonts/OpenSans-Regular.ttf +0 -0
- package/src/public/fonts/RobotoMono-Regular.ttf +0 -0
- package/src/public/loadLinksImages.js +26 -0
- package/src/public/loader.svg +26 -0
- package/src/public/pdf/installiation_ru.pdf +0 -0
- package/src/public/pdf/lifecycle_ru.pdf +0 -0
- package/src/public/pdf/personal_data_policy_ru.pdf +0 -0
- package/src/public/pdf/privacy_policy_en.pdf +0 -0
- package/src/public/pdf/privacy_policy_ru.pdf +0 -0
- package/src/public/pdf/terms_conditions_en.pdf +0 -0
- package/src/public/pdf/terms_conditions_ru.pdf +0 -0
- package/src/public/pdf/user_agreement_ru.pdf +0 -0
- package/src/public/pdf/user_manual_ru.pdf +0 -0
- package/src/shared/Lang/en.json +1227 -0
- package/src/shared/Lang/i18n.d.ts +8 -0
- package/src/shared/Lang/index.ts +32 -0
- package/src/shared/Lang/ru.json +1226 -0
- package/src/shared/Logger.ts +72 -0
- package/src/shared/RawEvents.ts +7 -0
- package/src/shared/Subject.ts +29 -0
- package/src/shared/SubjectOperation.ts +31 -0
- package/src/shared/ViewSettings.tsx +9 -0
- package/src/shared/api/ai/api.ts +6 -0
- package/src/shared/api/ai/index.ts +3 -0
- package/src/shared/api/ai/requestMap.ts +22 -0
- package/src/shared/api/ai/types.ts +6 -0
- package/src/shared/api/auth/api.ts +78 -0
- package/src/shared/api/auth/index.ts +2 -0
- package/src/shared/api/auth/types.ts +51 -0
- package/src/shared/api/base/base.ts +244 -0
- package/src/shared/api/base/httpError.ts +10 -0
- package/src/shared/api/base/httpResponse.ts +7 -0
- package/src/shared/api/base/interceptors.ts +64 -0
- package/src/shared/api/base/types.ts +18 -0
- package/src/shared/api/billing/api.ts +79 -0
- package/src/shared/api/billing/index.ts +2 -0
- package/src/shared/api/billing/types.ts +155 -0
- package/src/shared/api/boards/api.ts +128 -0
- package/src/shared/api/boards/index.ts +2 -0
- package/src/shared/api/boards/types.ts +15 -0
- package/src/shared/api/index.ts +8 -0
- package/src/shared/api/media/index.ts +3 -0
- package/src/shared/api/media/uploadAudio.ts +53 -0
- package/src/shared/api/media/uploadImage.ts +180 -0
- package/src/shared/api/media/uploadVideo.ts +48 -0
- package/src/shared/api/types.ts +3 -0
- package/src/shared/api/users/api.ts +37 -0
- package/src/shared/api/users/index.ts +2 -0
- package/src/shared/api/users/types.ts +17 -0
- package/src/shared/apiV2/base.ts +9 -0
- package/src/shared/apiV2/boards/api.ts +143 -0
- package/src/shared/apiV2/boards/index.ts +2 -0
- package/src/shared/apiV2/boards/types.ts +66 -0
- package/src/shared/apiV2/folders/api.ts +81 -0
- package/src/shared/apiV2/folders/index.ts +2 -0
- package/src/shared/apiV2/folders/types.ts +35 -0
- package/src/shared/apiV2/index.ts +2 -0
- package/src/shared/assets/imgs/default-user-icon.svg +12 -0
- package/src/shared/assets/imgs/no-img-icon.svg +3 -0
- package/src/shared/lib/IframeModule.ts +223 -0
- package/src/shared/lib/convertColors.ts +51 -0
- package/src/shared/lib/debounce.ts +9 -0
- package/src/shared/lib/getCorrectEnding.ts +19 -0
- package/src/shared/lib/getEmailPrefix.ts +13 -0
- package/src/shared/lib/handleClickDetection.ts +25 -0
- package/src/shared/lib/isIframe.ts +3 -0
- package/src/shared/lib/isMicroboardIframe.ts +3 -0
- package/src/shared/lib/queryStringParser.ts +18 -0
- package/src/shared/lib/regex.ts +4 -0
- package/src/shared/lib/strictContext.ts +14 -0
- package/src/shared/lib/throttle.ts +59 -0
- package/src/shared/lib/useClickOutside.ts +50 -0
- package/src/shared/lib/useClientRect.ts +34 -0
- package/src/shared/lib/useDebounce.ts +22 -0
- package/src/shared/lib/useForceUpdate.ts +7 -0
- package/src/shared/lib/useHoverState.ts +14 -0
- package/src/shared/lib/useIsPhoneScreen.ts +21 -0
- package/src/shared/lib/useMediaQuery.tsx +19 -0
- package/src/shared/lib/withRouter.tsx +21 -0
- package/src/shared/sha256.ts +22 -0
- package/src/shared/ui-lib/Button/Button.module.css +179 -0
- package/src/shared/ui-lib/Button/Button.tsx +43 -0
- package/src/shared/ui-lib/Button/Loader.tsx +20 -0
- package/src/shared/ui-lib/Button/index.ts +1 -0
- package/src/shared/ui-lib/Checkbox/Checkbox.module.css +44 -0
- package/src/shared/ui-lib/Checkbox/Checkbox.tsx +42 -0
- package/src/shared/ui-lib/Checkbox/index.ts +1 -0
- package/src/shared/ui-lib/Dropdown/Chevron.tsx +24 -0
- package/src/shared/ui-lib/Dropdown/Dropdown.module.css +48 -0
- package/src/shared/ui-lib/Dropdown/Dropdown.tsx +42 -0
- package/src/shared/ui-lib/Icon/ConnectorIcon.tsx +33 -0
- package/src/shared/ui-lib/Icon/ConnectorPointerIcon.tsx +50 -0
- package/src/shared/ui-lib/Icon/EyeClosed.tsx +34 -0
- package/src/shared/ui-lib/Icon/EyeOpened.tsx +56 -0
- package/src/shared/ui-lib/Icon/FillColorIndicator/FillColorIndicator.module.css +11 -0
- package/src/shared/ui-lib/Icon/FillColorIndicator/FillColorIndicator.tsx +26 -0
- package/src/shared/ui-lib/Icon/FillColorIndicator/bg.png +0 -0
- package/src/shared/ui-lib/Icon/FillColorIndicator/index.ts +1 -0
- package/src/shared/ui-lib/Icon/FrameIcon.tsx +33 -0
- package/src/shared/ui-lib/Icon/Icon.module.css +11 -0
- package/src/shared/ui-lib/Icon/Icon.tsx +212 -0
- package/src/shared/ui-lib/Icon/Logo.tsx +23 -0
- package/src/shared/ui-lib/Icon/ShapeIcon.tsx +33 -0
- package/src/shared/ui-lib/Icon/StrokeColorIndicator.tsx +51 -0
- package/src/shared/ui-lib/Icon/TextColorIndicator/TextColorIndicator.module.css +14 -0
- package/src/shared/ui-lib/Icon/TextColorIndicator/TextColorIndicator.tsx +22 -0
- package/src/shared/ui-lib/Icon/TextColorIndicator/index.ts +1 -0
- package/src/shared/ui-lib/Icon/TextHighlightIndicator/TextHighlightIndicator.module.css +15 -0
- package/src/shared/ui-lib/Icon/TextHighlightIndicator/TextHighlightIndicator.tsx +22 -0
- package/src/shared/ui-lib/Icon/TextHighlightIndicator/index.ts +1 -0
- package/src/shared/ui-lib/Icon/index.ts +11 -0
- package/src/shared/ui-lib/Icon/sprite.svg +1707 -0
- package/src/shared/ui-lib/Input/EyeClose.tsx +22 -0
- package/src/shared/ui-lib/Input/EyeOpen.tsx +23 -0
- package/src/shared/ui-lib/Input/Input.css +130 -0
- package/src/shared/ui-lib/Input/Input.tsx +205 -0
- package/src/shared/ui-lib/Input/index.ts +1 -0
- package/src/shared/ui-lib/Link/Link.module.css +38 -0
- package/src/shared/ui-lib/Link/Link.tsx +19 -0
- package/src/shared/ui-lib/Link/index.ts +1 -0
- package/src/shared/ui-lib/Loader/Loader.module.css +9 -0
- package/src/shared/ui-lib/Loader/Loader.tsx +27 -0
- package/src/shared/ui-lib/Message/Message.module.css +26 -0
- package/src/shared/ui-lib/Message/Message.tsx +37 -0
- package/src/shared/ui-lib/Notification/Notification.module.css +58 -0
- package/src/shared/ui-lib/Notification/Notification.tsx +75 -0
- package/src/shared/ui-lib/Notification/index.ts +1 -0
- package/src/shared/ui-lib/OuterLink/OuterLink.module.css +38 -0
- package/src/shared/ui-lib/OuterLink/OuterLink.tsx +16 -0
- package/src/shared/ui-lib/OuterLink/index.ts +1 -0
- package/src/shared/ui-lib/Progress/Progress.module.css +16 -0
- package/src/shared/ui-lib/Progress/Progress.tsx +35 -0
- package/src/shared/ui-lib/Selector/Selector.module.css +91 -0
- package/src/shared/ui-lib/Selector/Selector.tsx +170 -0
- package/src/shared/ui-lib/Selector/index.ts +1 -0
- package/src/shared/ui-lib/Toast/Toast.module.css +142 -0
- package/src/shared/ui-lib/Toast/index.ts +2 -0
- package/src/shared/ui-lib/Toast/notify.tsx +119 -0
- package/src/shared/ui-lib/ToggleMark/ToggleMark.module.css +22 -0
- package/src/shared/ui-lib/ToggleMark/ToggleMark.tsx +15 -0
- package/src/shared/ui-lib/Tooltip/Tooltip.module.css +195 -0
- package/src/shared/ui-lib/Tooltip/Tooltip.tsx +99 -0
- package/src/shared/ui-lib/Tooltip/index.tsx +1 -0
- package/src/shared/ui-lib/Transitions/FadeTransition.module.css +22 -0
- package/src/shared/ui-lib/Transitions/FadeTransition.tsx +25 -0
- package/src/shared/ui-lib/Transitions/OpacityTransition.module.css +17 -0
- package/src/shared/ui-lib/Transitions/OpacityTransition.tsx +27 -0
- package/src/shared/ui-lib/Transitions/TopFade.module.css +25 -0
- package/src/shared/ui-lib/Transitions/TopFade.tsx +27 -0
- package/src/shared/ui-lib/Transitions/index.ts +2 -0
- package/src/shared/ui-lib/Transitions/types.ts +7 -0
- package/src/shared/ui-lib/UIMainLoader/UIMainLoader.module.css +8 -0
- package/src/shared/ui-lib/UIMainLoader/UIMainLoader.tsx +10 -0
- package/src/shared/ui-lib/UiAccordion/UiAccordion.module.css +4 -0
- package/src/shared/ui-lib/UiAccordion/UiAccordion.tsx +47 -0
- package/src/shared/ui-lib/UiAccordion/index.ts +1 -0
- package/src/shared/ui-lib/UiAdaptiveAccordion/UiAdaptiveAccordion.module.css +22 -0
- package/src/shared/ui-lib/UiAdaptiveAccordion/UiAdaptiveAccordion.tsx +90 -0
- package/src/shared/ui-lib/UiAdaptiveAccordion/index.ts +2 -0
- package/src/shared/ui-lib/UiButton/Loader.tsx +20 -0
- package/src/shared/ui-lib/UiButton/Tooltip.tsx +98 -0
- package/src/shared/ui-lib/UiButton/UiButton.module.css +306 -0
- package/src/shared/ui-lib/UiButton/UiButton.tsx +119 -0
- package/src/shared/ui-lib/UiButton/index.ts +1 -0
- package/src/shared/ui-lib/UiColorInput/UiColorInput.module.css +66 -0
- package/src/shared/ui-lib/UiColorInput/UiColorInput.tsx +66 -0
- package/src/shared/ui-lib/UiColorInput/index.ts +1 -0
- package/src/shared/ui-lib/UiColorInput/palette.png +0 -0
- package/src/shared/ui-lib/UiLink/UiLink.module.css +175 -0
- package/src/shared/ui-lib/UiLink/UiLink.tsx +72 -0
- package/src/shared/ui-lib/UiLink/index.ts +1 -0
- package/src/shared/ui-lib/UiLoader/UiLoader.module.css +19 -0
- package/src/shared/ui-lib/UiLoader/UiLoader.tsx +31 -0
- package/src/shared/ui-lib/UiLoader/index.ts +1 -0
- package/src/shared/ui-lib/UiModal/UiModal.module.css +188 -0
- package/src/shared/ui-lib/UiModal/UiModal.tsx +182 -0
- package/src/shared/ui-lib/UiModal/UiModalBackground.tsx +62 -0
- package/src/shared/ui-lib/UiModal/UiModalContext.tsx +90 -0
- package/src/shared/ui-lib/UiModal/index.ts +2 -0
- package/src/shared/ui-lib/UiPanel/UiPanel.module.css +52 -0
- package/src/shared/ui-lib/UiPanel/UiPanel.tsx +70 -0
- package/src/shared/ui-lib/UiPanel/index.ts +1 -0
- package/src/shared/ui-lib/UiSelector/UiSelector.module.css +143 -0
- package/src/shared/ui-lib/UiSelector/UiSelector.tsx +202 -0
- package/src/shared/ui-lib/UiSelector/index.ts +2 -0
- package/src/shared/ui-lib/UiSeparator/UiSeparator.module.css +18 -0
- package/src/shared/ui-lib/UiSeparator/UiSeparator.tsx +33 -0
- package/src/shared/ui-lib/UiSeparator/index.ts +1 -0
- package/src/shared/ui-lib/UiSkeleton/UiSkeleton.module.css +37 -0
- package/src/shared/ui-lib/UiSkeleton/UiSkeleton.tsx +10 -0
- package/src/shared/ui-lib/UiSkeleton/index.ts +1 -0
- package/src/shared/ui-lib/UiSlider/UiSlider.module.css +75 -0
- package/src/shared/ui-lib/UiSlider/UiSlider.tsx +50 -0
- package/src/shared/ui-lib/UiSlider/index.ts +1 -0
- package/src/shared/ui-lib/UiSwitch/UiSwitch.module.css +48 -0
- package/src/shared/ui-lib/UiSwitch/UiSwitch.tsx +103 -0
- package/src/shared/ui-lib/UiSwitch/index.ts +1 -0
- package/src/staticResources.ts +410 -0
- package/src/version.ts +1 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Board,
|
|
3
|
+
conf,
|
|
4
|
+
prepareImage,
|
|
5
|
+
ImageItem,
|
|
6
|
+
ImageItemData,
|
|
7
|
+
Item,
|
|
8
|
+
PRESENCE_CURSOR_THROTTLE,
|
|
9
|
+
HotkeysMap,
|
|
10
|
+
checkHotkeys,
|
|
11
|
+
isControlCharacter,
|
|
12
|
+
} from "microboard-temp";
|
|
13
|
+
import { throttle } from "shared/lib/throttle";
|
|
14
|
+
import { notify } from "shared/ui-lib/Toast/notify";
|
|
15
|
+
import { Clipboard } from "./Clipboard";
|
|
16
|
+
import { pasteTextToTheBoard, tryToPasteAsItemOrReturnText } from "./Paste";
|
|
17
|
+
import { createWheel } from "./Wheel/Wheel";
|
|
18
|
+
import { isSafari } from "./isSafari";
|
|
19
|
+
import { Account } from "entities/account";
|
|
20
|
+
import { tempStorage } from "App/SessionStorage";
|
|
21
|
+
import { AppSettings } from "App/App";
|
|
22
|
+
import { mediaApi } from "shared/api";
|
|
23
|
+
import { validateMediaFile } from "App/MediaHelpers";
|
|
24
|
+
|
|
25
|
+
export interface Controller {
|
|
26
|
+
onWheel: (event: WheelEvent) => void;
|
|
27
|
+
onPointerDown: (event: PointerEvent) => boolean;
|
|
28
|
+
onPointerMove: (event: PointerEvent) => boolean;
|
|
29
|
+
onPointerUp: (event: PointerEvent) => boolean;
|
|
30
|
+
onPointerLeave: (event: PointerEvent) => void;
|
|
31
|
+
onPointerCancel: (event: PointerEvent) => void;
|
|
32
|
+
onPointerOut: (event: PointerEvent) => void;
|
|
33
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
34
|
+
onKeyUp: (event: KeyboardEvent) => void;
|
|
35
|
+
onClick: (event: MouseEvent) => boolean;
|
|
36
|
+
onResize: () => void;
|
|
37
|
+
onContextMenu: (event: MouseEvent) => void;
|
|
38
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
39
|
+
onPaste: (event: ClipboardEvent) => void;
|
|
40
|
+
onDrop: (event: DragEvent) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getController(
|
|
44
|
+
getBoard: () => Board,
|
|
45
|
+
clipboard: Clipboard,
|
|
46
|
+
account: Account,
|
|
47
|
+
appSettings: AppSettings,
|
|
48
|
+
): Controller {
|
|
49
|
+
let itemUnderPointer: Item | undefined = undefined;
|
|
50
|
+
function onWheel(event: WheelEvent): void {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
const board = getBoard();
|
|
54
|
+
const wheel = createWheel(event);
|
|
55
|
+
if (!board) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
board.camera.unsubscribeFromItem();
|
|
59
|
+
|
|
60
|
+
const { controlMode } = appSettings;
|
|
61
|
+
|
|
62
|
+
const onMouseWheel = () => {
|
|
63
|
+
board.camera.zoomRelativeToPointerBy(
|
|
64
|
+
wheel.getWheelScaleMultiplier(),
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const onPinch = () => {
|
|
69
|
+
board.camera.zoomRelativeToPointerBy(
|
|
70
|
+
wheel.getTouchpadPinchMultiplier(),
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onPan = () => {
|
|
75
|
+
const scale = board.camera.getScale();
|
|
76
|
+
board.camera.translateBy(
|
|
77
|
+
wheel.getTouchpadPanDeltaX() / scale,
|
|
78
|
+
wheel.getTouchpadPanDeltaY() / scale,
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
if (controlMode === "mouse") {
|
|
83
|
+
onMouseWheel();
|
|
84
|
+
return;
|
|
85
|
+
} else if (controlMode === "trackpad") {
|
|
86
|
+
if (wheel.isTouchpadPinch()) {
|
|
87
|
+
onPinch();
|
|
88
|
+
} else {
|
|
89
|
+
onPan();
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (wheel.isProbablyMouseWheel()) {
|
|
95
|
+
onMouseWheel();
|
|
96
|
+
} else if (wheel.isTouchpadPinch()) {
|
|
97
|
+
onPinch();
|
|
98
|
+
} else {
|
|
99
|
+
onPan();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function onKeyDown(event: KeyboardEvent): void {
|
|
104
|
+
const board = getBoard();
|
|
105
|
+
if (!board || !board.events) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
board.camera.unsubscribeFromItem();
|
|
110
|
+
board.presence.disableTracking();
|
|
111
|
+
|
|
112
|
+
const context = board.selection.getContext();
|
|
113
|
+
board.keyboard.keyDown(event);
|
|
114
|
+
|
|
115
|
+
const navigationActions = ["Right", "Left", "Up", "Down"];
|
|
116
|
+
const navigationConfig = Object.fromEntries(
|
|
117
|
+
navigationActions.map(direction => {
|
|
118
|
+
const shouldTranslate = Boolean(
|
|
119
|
+
board.tools.getSelect() || board.tools.getNavigate(),
|
|
120
|
+
);
|
|
121
|
+
return [
|
|
122
|
+
`navigation${direction}`,
|
|
123
|
+
{
|
|
124
|
+
cb: () =>
|
|
125
|
+
board.camera.smoothTranslateTo(
|
|
126
|
+
board.keyboard,
|
|
127
|
+
shouldTranslate,
|
|
128
|
+
),
|
|
129
|
+
selectionContext: [
|
|
130
|
+
"None",
|
|
131
|
+
"EditUnderPointer",
|
|
132
|
+
"SelectByRect",
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const editModeHotkeys: HotkeysMap = {
|
|
140
|
+
select: {
|
|
141
|
+
cb: () => {
|
|
142
|
+
if (board.tools.getNavigate()) {
|
|
143
|
+
board.tools.select(true);
|
|
144
|
+
} else {
|
|
145
|
+
board.tools.navigate();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
149
|
+
},
|
|
150
|
+
text: {
|
|
151
|
+
cb: () => board.tools.addText(true),
|
|
152
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
153
|
+
},
|
|
154
|
+
sticker: {
|
|
155
|
+
cb: () => board.tools.addSticker(true),
|
|
156
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
157
|
+
},
|
|
158
|
+
shape: {
|
|
159
|
+
cb: () => board.tools.addShape(true),
|
|
160
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
161
|
+
},
|
|
162
|
+
connector: {
|
|
163
|
+
cb: () => board.tools.addConnector(true),
|
|
164
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
165
|
+
},
|
|
166
|
+
pen: {
|
|
167
|
+
cb: () => board.tools.addDrawing(true),
|
|
168
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
169
|
+
},
|
|
170
|
+
eraser: {
|
|
171
|
+
cb: () => board.tools.eraser(true),
|
|
172
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
173
|
+
},
|
|
174
|
+
frame: {
|
|
175
|
+
cb: () => board.tools.addFrame(true),
|
|
176
|
+
selectionContext: ["SelectUnderPointer", "None"],
|
|
177
|
+
},
|
|
178
|
+
duplicate: {
|
|
179
|
+
cb: () => board.selection.duplicate(),
|
|
180
|
+
selectionContext: [
|
|
181
|
+
"EditUnderPointer",
|
|
182
|
+
"SelectByRect",
|
|
183
|
+
"EditTextUnderPointer",
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
bringToFront: {
|
|
187
|
+
cb: () => board.selection.bringToFront(),
|
|
188
|
+
selectionContext: [
|
|
189
|
+
"EditUnderPointer",
|
|
190
|
+
"SelectByRect",
|
|
191
|
+
"EditTextUnderPointer",
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
sendToBack: {
|
|
195
|
+
cb: () => board.selection.sendToBack(),
|
|
196
|
+
selectionContext: [
|
|
197
|
+
"EditUnderPointer",
|
|
198
|
+
"SelectByRect",
|
|
199
|
+
"EditTextUnderPointer",
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
delete: {
|
|
203
|
+
cb: () => board.selection.removeFromBoard(),
|
|
204
|
+
selectionContext: ["EditUnderPointer", "SelectByRect"],
|
|
205
|
+
},
|
|
206
|
+
textBold: {
|
|
207
|
+
cb: () => board.selection.setFontStyle("bold"),
|
|
208
|
+
selectionContext: [
|
|
209
|
+
"EditTextUnderPointer",
|
|
210
|
+
"EditUnderPointer",
|
|
211
|
+
"SelectByRect",
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
textItalic: {
|
|
215
|
+
cb: () => board.selection.setFontStyle("italic"),
|
|
216
|
+
selectionContext: [
|
|
217
|
+
"EditTextUnderPointer",
|
|
218
|
+
"EditUnderPointer",
|
|
219
|
+
"SelectByRect",
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
textStrike: {
|
|
223
|
+
/* TODO uncomment when dropflow can text-decoration, prevents default to prevent slate from adding same style */
|
|
224
|
+
cb: () => board.selection.setFontStyle("line-through"),
|
|
225
|
+
selectionContext: [
|
|
226
|
+
"EditTextUnderPointer",
|
|
227
|
+
"EditUnderPointer",
|
|
228
|
+
"SelectByRect",
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
textUnderline: {
|
|
232
|
+
/* TODO uncomment when dropflow can text-decoration, prevents default to prevent slate from adding same style */
|
|
233
|
+
cb: () => board.selection.setFontStyle("underline"),
|
|
234
|
+
selectionContext: [
|
|
235
|
+
"EditTextUnderPointer",
|
|
236
|
+
"EditUnderPointer",
|
|
237
|
+
"SelectByRect",
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
selectAll: {
|
|
241
|
+
cb: () => board.selection.addAll(),
|
|
242
|
+
selectionContext: ["None", "EditUnderPointer", "SelectByRect"],
|
|
243
|
+
},
|
|
244
|
+
undo: () => board.events?.undo(),
|
|
245
|
+
redo: () => board.events?.redo(),
|
|
246
|
+
cancel: { cb: () => board.tools.cancel(), preventDefault: false },
|
|
247
|
+
confirm: () => board.tools.confirm(),
|
|
248
|
+
zoomIn: () => board.camera.zoomInToViewCenter(),
|
|
249
|
+
zoomOut: () => board.camera.zoomOutFromViewCenter(),
|
|
250
|
+
zoomDefault: () => board.camera.zoomToViewCenter(1),
|
|
251
|
+
frameNavigationNext: () => board.tools.frameNavigation("next"),
|
|
252
|
+
frameNavigationPrev: () => board.tools.frameNavigation("prev"),
|
|
253
|
+
navigateMode: {
|
|
254
|
+
cb: () =>
|
|
255
|
+
board.tools.setNavigateMode(board.keyboard.isSpacePressed),
|
|
256
|
+
selectionContext: ["None", "EditUnderPointer", "SelectByRect"],
|
|
257
|
+
},
|
|
258
|
+
...navigationConfig,
|
|
259
|
+
};
|
|
260
|
+
const viewModeHotkeys = {
|
|
261
|
+
zoomIn: () => board.camera.zoomInToViewCenter(),
|
|
262
|
+
zoomOut: () => board.camera.zoomOutFromViewCenter(),
|
|
263
|
+
zoomDefault: () => board.camera.zoomToViewCenter(1),
|
|
264
|
+
...navigationConfig,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const single = board.selection.items.getSingle();
|
|
268
|
+
const shouldRemoveConnector =
|
|
269
|
+
event.key === "Escape" &&
|
|
270
|
+
single &&
|
|
271
|
+
single.itemType === "Connector" &&
|
|
272
|
+
board.selection.showQuickAddPanel;
|
|
273
|
+
if (shouldRemoveConnector) {
|
|
274
|
+
board.remove(single);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const isHotkeyTriggered = checkHotkeys(
|
|
279
|
+
board.getInterfaceType() === "edit"
|
|
280
|
+
? editModeHotkeys
|
|
281
|
+
: viewModeHotkeys,
|
|
282
|
+
event,
|
|
283
|
+
board,
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const isSingleItemInSelection = board.selection.items.isSingle();
|
|
287
|
+
const isTextEditStarted =
|
|
288
|
+
!isHotkeyTriggered &&
|
|
289
|
+
context !== "EditTextUnderPointer" &&
|
|
290
|
+
isSingleItemInSelection &&
|
|
291
|
+
!(event.ctrlKey || event.metaKey || event.altKey) &&
|
|
292
|
+
!isControlCharacter(event.key);
|
|
293
|
+
|
|
294
|
+
if (isTextEditStarted) {
|
|
295
|
+
board.selection.editText(event.key);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (!board.selection.tool.keyDown(board.keyboard.down)) {
|
|
299
|
+
board.tools.keyDown(board.keyboard.down);
|
|
300
|
+
}
|
|
301
|
+
if (!isTextEditStarted) {
|
|
302
|
+
postKeyboardEvent(event);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function onKeyUp(event: KeyboardEvent): void {
|
|
307
|
+
const board = getBoard();
|
|
308
|
+
if (!board) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const editModeHotkeys: HotkeysMap = {
|
|
313
|
+
navigateMode: () => board.tools.exitNavigateMode(),
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
if (board.getInterfaceType() === "edit") {
|
|
317
|
+
checkHotkeys(editModeHotkeys, event, board);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
board.keyboard.keyUp(event);
|
|
321
|
+
if (!board.selection.tool.keyUp(board.keyboard.up)) {
|
|
322
|
+
board.tools.keyUp(board.keyboard.up);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
postKeyboardEvent(event);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function onResize(): void {
|
|
329
|
+
const board = getBoard();
|
|
330
|
+
if (board) {
|
|
331
|
+
board.camera.onWindowResize();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function onContextMenu(event: MouseEvent): void {
|
|
336
|
+
const target = event.target;
|
|
337
|
+
if (target instanceof HTMLElement) {
|
|
338
|
+
if (target.classList.contains("NoContextMenu")) {
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
event.stopPropagation();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
let pointerDownTime = 0;
|
|
346
|
+
const pointerMoveDelay = 100;
|
|
347
|
+
let isPinching = false;
|
|
348
|
+
|
|
349
|
+
function onPointerDown(event: PointerEvent): boolean {
|
|
350
|
+
pointerDownTime = Date.now();
|
|
351
|
+
const board = getBoard();
|
|
352
|
+
if (!board) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
board.camera.unsubscribeFromItem();
|
|
356
|
+
const { tools, camera, selection } = board;
|
|
357
|
+
const transformerTool = selection.tool;
|
|
358
|
+
camera.saveDownEvent(event);
|
|
359
|
+
if (camera.isTwoPointers()) {
|
|
360
|
+
isPinching = true;
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
camera.pointTo(event.pageX, event.pageY);
|
|
364
|
+
const isSelect = tools.getSelect() !== undefined;
|
|
365
|
+
if (isSelect) {
|
|
366
|
+
switch (event.button) {
|
|
367
|
+
case 0:
|
|
368
|
+
return (
|
|
369
|
+
transformerTool.leftButtonDown() ||
|
|
370
|
+
tools.leftButtonDown()
|
|
371
|
+
);
|
|
372
|
+
case 1:
|
|
373
|
+
return (
|
|
374
|
+
transformerTool.middleButtonDown() ||
|
|
375
|
+
tools.middleButtonDown()
|
|
376
|
+
);
|
|
377
|
+
case 2:
|
|
378
|
+
return (
|
|
379
|
+
transformerTool.rightButtonDown() ||
|
|
380
|
+
tools.rightButtonDown()
|
|
381
|
+
);
|
|
382
|
+
default:
|
|
383
|
+
return (
|
|
384
|
+
transformerTool.leftButtonDown() ||
|
|
385
|
+
tools.leftButtonDown()
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
tools.pointerDown();
|
|
390
|
+
switch (event.button) {
|
|
391
|
+
case 0:
|
|
392
|
+
return tools.leftButtonDown();
|
|
393
|
+
case 1:
|
|
394
|
+
return tools.middleButtonDown();
|
|
395
|
+
case 2:
|
|
396
|
+
return tools.rightButtonDown();
|
|
397
|
+
default:
|
|
398
|
+
return tools.leftButtonDown();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const sendPresencePointer = throttle((board: Board, timestamp: number) => {
|
|
404
|
+
const pointer = board.pointer;
|
|
405
|
+
board.presence.emit({
|
|
406
|
+
method: "PointerMove",
|
|
407
|
+
position: { x: pointer.point.x, y: pointer.point.y },
|
|
408
|
+
timestamp,
|
|
409
|
+
});
|
|
410
|
+
}, PRESENCE_CURSOR_THROTTLE);
|
|
411
|
+
|
|
412
|
+
function onPointerMove(event: PointerEvent): boolean {
|
|
413
|
+
const currentTime = Date.now();
|
|
414
|
+
if (currentTime - pointerDownTime < pointerMoveDelay) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
const board = getBoard();
|
|
418
|
+
if (!board) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
sendPresencePointer(board, currentTime);
|
|
423
|
+
const { camera, tools } = board;
|
|
424
|
+
|
|
425
|
+
camera.updateDownEvent(event);
|
|
426
|
+
if (camera.isTwoPointers()) {
|
|
427
|
+
isPinching = true;
|
|
428
|
+
const pinchCenter = camera.getPinchCenter();
|
|
429
|
+
const scale = camera.getPinchScale();
|
|
430
|
+
const delta = camera.getPanDelta();
|
|
431
|
+
camera.translateBy(delta.x, delta.y);
|
|
432
|
+
camera.zoomRelativeToPointBy(
|
|
433
|
+
scale,
|
|
434
|
+
pinchCenter.x,
|
|
435
|
+
pinchCenter.y,
|
|
436
|
+
0,
|
|
437
|
+
);
|
|
438
|
+
camera.updatePositions();
|
|
439
|
+
camera.updateDistance();
|
|
440
|
+
tools.leftButtonUp();
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const selection = board.selection;
|
|
445
|
+
const oldPoint = board.pointer.point.copy();
|
|
446
|
+
camera.pointTo(event.pageX, event.pageY);
|
|
447
|
+
const newPoint = board.pointer.point.copy();
|
|
448
|
+
const dx = newPoint.x - oldPoint.x;
|
|
449
|
+
const dy = newPoint.y - oldPoint.y;
|
|
450
|
+
const isSelect = tools.getSelect() !== undefined;
|
|
451
|
+
const itemsUnderPointer = board.items.getUnderPointer();
|
|
452
|
+
if (itemsUnderPointer.length) {
|
|
453
|
+
if (itemUnderPointer && itemUnderPointer.itemType === "Video") {
|
|
454
|
+
itemUnderPointer.setShouldShowControls(false);
|
|
455
|
+
}
|
|
456
|
+
itemUnderPointer = itemsUnderPointer[itemsUnderPointer.length - 1];
|
|
457
|
+
if (itemUnderPointer.itemType === "Video") {
|
|
458
|
+
itemUnderPointer.setShouldShowControls(true);
|
|
459
|
+
}
|
|
460
|
+
board.pointer.subject.publish(board.pointer);
|
|
461
|
+
} else if (itemUnderPointer) {
|
|
462
|
+
if (itemUnderPointer.itemType === "Video") {
|
|
463
|
+
itemUnderPointer.setShouldShowControls(false);
|
|
464
|
+
}
|
|
465
|
+
itemUnderPointer = undefined;
|
|
466
|
+
board.pointer.subject.publish(board.pointer);
|
|
467
|
+
}
|
|
468
|
+
if (isSelect) {
|
|
469
|
+
return (
|
|
470
|
+
selection.tool.pointerMoveBy(dx, dy) ||
|
|
471
|
+
tools.pointerMoveBy(dx, dy)
|
|
472
|
+
);
|
|
473
|
+
} else {
|
|
474
|
+
return tools.pointerMoveBy(dx, dy);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
let touchtime = 0;
|
|
479
|
+
const delay = 300;
|
|
480
|
+
let pinchingTimeout: NodeJS.Timeout | null = null;
|
|
481
|
+
|
|
482
|
+
function onPointerUp(event: PointerEvent): boolean {
|
|
483
|
+
const board = getBoard();
|
|
484
|
+
if (!board) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
board.presence.emit({
|
|
488
|
+
method: "CancelDrawSelect",
|
|
489
|
+
timestamp: Date.now(),
|
|
490
|
+
});
|
|
491
|
+
const { tools, selection, camera } = board;
|
|
492
|
+
camera.removeDownEvent(event);
|
|
493
|
+
if (isSafari()) {
|
|
494
|
+
if (touchtime === 0) {
|
|
495
|
+
touchtime = new Date().getTime();
|
|
496
|
+
} else {
|
|
497
|
+
if (new Date().getTime() - touchtime < delay && !isPinching) {
|
|
498
|
+
triggerDoubleClick(event);
|
|
499
|
+
touchtime = 0;
|
|
500
|
+
} else {
|
|
501
|
+
touchtime = new Date().getTime();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if (pinchingTimeout) {
|
|
507
|
+
clearTimeout(pinchingTimeout);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
pinchingTimeout = setTimeout(() => {
|
|
511
|
+
isPinching = false;
|
|
512
|
+
pinchingTimeout = null;
|
|
513
|
+
}, delay);
|
|
514
|
+
|
|
515
|
+
const transformerTool = selection.tool;
|
|
516
|
+
const isSelect = tools.getSelect() !== undefined;
|
|
517
|
+
if (isSelect) {
|
|
518
|
+
switch (event.button) {
|
|
519
|
+
case 0:
|
|
520
|
+
return (
|
|
521
|
+
transformerTool.leftButtonUp() || tools.leftButtonUp()
|
|
522
|
+
);
|
|
523
|
+
case 1:
|
|
524
|
+
return (
|
|
525
|
+
transformerTool.middleButtonUp() ||
|
|
526
|
+
tools.middleButtonUp()
|
|
527
|
+
);
|
|
528
|
+
case 2:
|
|
529
|
+
board.setIsBoardMenuOpen(true);
|
|
530
|
+
return (
|
|
531
|
+
transformerTool.rightButtonUp() || tools.rightButtonUp()
|
|
532
|
+
);
|
|
533
|
+
default:
|
|
534
|
+
return (
|
|
535
|
+
transformerTool.leftButtonUp() || tools.leftButtonUp()
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
} else {
|
|
539
|
+
tools.pointerUp();
|
|
540
|
+
board.presence.disableTracking();
|
|
541
|
+
switch (event.button) {
|
|
542
|
+
case 0:
|
|
543
|
+
return tools.leftButtonUp();
|
|
544
|
+
case 1:
|
|
545
|
+
return tools.middleButtonUp();
|
|
546
|
+
case 2:
|
|
547
|
+
board.setIsBoardMenuOpen(true);
|
|
548
|
+
return tools.rightButtonUp();
|
|
549
|
+
default:
|
|
550
|
+
return tools.leftButtonUp();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function onClick(event: MouseEvent): boolean {
|
|
556
|
+
if (event.detail === 2) {
|
|
557
|
+
triggerDoubleClick(event);
|
|
558
|
+
}
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function triggerDoubleClick(event: PointerEvent | MouseEvent): boolean {
|
|
563
|
+
const board = getBoard();
|
|
564
|
+
if (!board) {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
const { tools, selection } = board;
|
|
568
|
+
const transformerTool = selection.tool;
|
|
569
|
+
switch (event.button) {
|
|
570
|
+
case 0:
|
|
571
|
+
return (
|
|
572
|
+
transformerTool.leftButtonDouble() ||
|
|
573
|
+
tools.leftButtonDouble()
|
|
574
|
+
);
|
|
575
|
+
case 1:
|
|
576
|
+
return (
|
|
577
|
+
transformerTool.middleButtonDouble() ||
|
|
578
|
+
tools.middleButtonDouble()
|
|
579
|
+
);
|
|
580
|
+
case 2:
|
|
581
|
+
return (
|
|
582
|
+
transformerTool.rightButtonDouble() ||
|
|
583
|
+
tools.rightButtonDouble()
|
|
584
|
+
);
|
|
585
|
+
default:
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function onPointerLeave(event: PointerEvent): void {
|
|
591
|
+
if (isPointerOutsideWindow(event)) {
|
|
592
|
+
onPointerUp(event);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function onPointerCancel(event: PointerEvent): void {
|
|
597
|
+
if (isPointerOutsideWindow(event)) {
|
|
598
|
+
onPointerUp(event);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function onPointerOut(event: PointerEvent): void {
|
|
603
|
+
if (isPointerOutsideWindow(event)) {
|
|
604
|
+
onPointerUp(event);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function isPointerOutsideWindow(event: PointerEvent): boolean {
|
|
609
|
+
return (
|
|
610
|
+
event.clientX <= 0 ||
|
|
611
|
+
event.clientY <= 0 ||
|
|
612
|
+
event.clientX >= window.innerWidth ||
|
|
613
|
+
event.clientY >= window.innerHeight
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function onCopy(event: ClipboardEvent): void {
|
|
618
|
+
const board = getBoard();
|
|
619
|
+
if (!board) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (board.selection.getContext() === "EditTextUnderPointer") {
|
|
623
|
+
clipboard.set(null);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const aiInputRegex = /^AIInput-module__aiInput/;
|
|
628
|
+
if (
|
|
629
|
+
event?.target instanceof HTMLElement &&
|
|
630
|
+
aiInputRegex.test(event.target.className)
|
|
631
|
+
) {
|
|
632
|
+
clipboard.set(event);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const data = board.selection.copy();
|
|
637
|
+
if ("imageElement" in data) {
|
|
638
|
+
copyImage(event, board, clipboard, data);
|
|
639
|
+
} else {
|
|
640
|
+
const text = JSON.stringify(data);
|
|
641
|
+
event.clipboardData?.setData("text/plain", text);
|
|
642
|
+
clipboard.set(data);
|
|
643
|
+
event.preventDefault();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
async function onPaste(event: ClipboardEvent): Promise<void> {
|
|
648
|
+
const board = getBoard();
|
|
649
|
+
if (!board) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
board.camera.unsubscribeFromItem();
|
|
653
|
+
|
|
654
|
+
const data = await tryToPasteAsItemOrReturnText(
|
|
655
|
+
event,
|
|
656
|
+
event.clipboardData,
|
|
657
|
+
board,
|
|
658
|
+
account.isLoggedIn,
|
|
659
|
+
account.accessToken,
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
if (data) {
|
|
663
|
+
pasteTextToTheBoard(board, data);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
function onDrop(event): void {
|
|
668
|
+
event.preventDefault();
|
|
669
|
+
const board = getBoard();
|
|
670
|
+
if (!board) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
const file = event.dataTransfer.files[0];
|
|
675
|
+
const fileExtension = file.name.split(".").pop()?.toLowerCase();
|
|
676
|
+
if (!validateMediaFile(file, account)) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (fileExtension && conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
681
|
+
mediaApi.uploadVideo(
|
|
682
|
+
file,
|
|
683
|
+
board,
|
|
684
|
+
notify,
|
|
685
|
+
fileExtension,
|
|
686
|
+
account.accessToken,
|
|
687
|
+
);
|
|
688
|
+
return;
|
|
689
|
+
} else if (
|
|
690
|
+
fileExtension &&
|
|
691
|
+
conf.AUDIO_FORMATS.includes(fileExtension)
|
|
692
|
+
) {
|
|
693
|
+
mediaApi.uploadAudio(
|
|
694
|
+
file,
|
|
695
|
+
board,
|
|
696
|
+
notify,
|
|
697
|
+
fileExtension,
|
|
698
|
+
account.accessToken,
|
|
699
|
+
);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const reader = new FileReader();
|
|
704
|
+
|
|
705
|
+
reader.onload = function (event) {
|
|
706
|
+
prepareImage(
|
|
707
|
+
event.target?.result,
|
|
708
|
+
account.accessToken,
|
|
709
|
+
board.getBoardId(),
|
|
710
|
+
)
|
|
711
|
+
.then(imageData => {
|
|
712
|
+
const image = new ImageItem(imageData, board, undefined);
|
|
713
|
+
image.transformation.translateTo(
|
|
714
|
+
board.pointer.point.x,
|
|
715
|
+
board.pointer.point.y,
|
|
716
|
+
);
|
|
717
|
+
const prevDimensions = tempStorage.getImageDimensions();
|
|
718
|
+
if (prevDimensions) {
|
|
719
|
+
const imageMbr = image.getMbr();
|
|
720
|
+
const scaleX =
|
|
721
|
+
prevDimensions.width / imageMbr.getWidth();
|
|
722
|
+
const scaleY =
|
|
723
|
+
prevDimensions.height / imageMbr.getHeight();
|
|
724
|
+
const finalScale = Math.min(scaleX, scaleY);
|
|
725
|
+
image.transformation.applyScaleBy(
|
|
726
|
+
finalScale,
|
|
727
|
+
finalScale,
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
board.add(image);
|
|
731
|
+
})
|
|
732
|
+
.catch(er => {
|
|
733
|
+
console.error("Could not create image:", er);
|
|
734
|
+
conf.notify({
|
|
735
|
+
variant: "error",
|
|
736
|
+
header: conf.i18n.t(
|
|
737
|
+
"toolsPanel.addMedia.unhandled.header",
|
|
738
|
+
),
|
|
739
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
740
|
+
duration: 4000,
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
reader.readAsDataURL(file);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return {
|
|
749
|
+
onWheel,
|
|
750
|
+
onPointerDown,
|
|
751
|
+
onPointerMove,
|
|
752
|
+
onPointerUp,
|
|
753
|
+
onPointerLeave,
|
|
754
|
+
onPointerCancel,
|
|
755
|
+
onPointerOut,
|
|
756
|
+
onKeyDown,
|
|
757
|
+
onKeyUp,
|
|
758
|
+
onClick,
|
|
759
|
+
onResize,
|
|
760
|
+
onContextMenu,
|
|
761
|
+
onCopy,
|
|
762
|
+
onPaste,
|
|
763
|
+
onDrop,
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
async function copyImage(
|
|
768
|
+
event: ClipboardEvent,
|
|
769
|
+
board: Board,
|
|
770
|
+
clipboard: Clipboard,
|
|
771
|
+
data: { imageElement: HTMLImageElement; imageData: ImageItemData },
|
|
772
|
+
) {
|
|
773
|
+
try {
|
|
774
|
+
const { imageElement, imageData } = data;
|
|
775
|
+
const canvas = document.createElement("canvas");
|
|
776
|
+
const ctx = canvas.getContext("2d");
|
|
777
|
+
canvas.width = imageElement.naturalWidth;
|
|
778
|
+
canvas.height = imageElement.naturalHeight;
|
|
779
|
+
ctx?.drawImage(imageElement, 0, 0);
|
|
780
|
+
const blob = await new Promise<Blob | null>((resolve, reject) => {
|
|
781
|
+
canvas.toBlob(blob => {
|
|
782
|
+
if (blob) {
|
|
783
|
+
resolve(blob);
|
|
784
|
+
} else {
|
|
785
|
+
reject(new Error("No blob"));
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
if (!blob) {
|
|
791
|
+
throw new Error("No blob");
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
const item = new ClipboardItem({ [blob.type]: blob });
|
|
795
|
+
await navigator.clipboard.write([item]);
|
|
796
|
+
const metaBlob = new Blob([JSON.stringify(imageData)], {
|
|
797
|
+
type: "text/plain",
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
const clipboardItem = new ClipboardItem({
|
|
801
|
+
"image/png": blob,
|
|
802
|
+
"text/plain": metaBlob,
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
await navigator.clipboard.write([clipboardItem]);
|
|
806
|
+
event.preventDefault();
|
|
807
|
+
} catch (err) {
|
|
808
|
+
console.error("error while copying image", err);
|
|
809
|
+
const text = JSON.stringify(board.selection.copy(true));
|
|
810
|
+
event.clipboardData?.setData("text/plain", text);
|
|
811
|
+
clipboard.set(data);
|
|
812
|
+
event.preventDefault();
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function isTextInput(element): boolean {
|
|
817
|
+
try {
|
|
818
|
+
const tagName = element.tagName.toLowerCase();
|
|
819
|
+
|
|
820
|
+
return (
|
|
821
|
+
tagName === "input" ||
|
|
822
|
+
tagName === "textarea" ||
|
|
823
|
+
element.isContentEditable
|
|
824
|
+
);
|
|
825
|
+
} catch (_) {
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
export function postKeyboardEvent(event: KeyboardEvent): void {
|
|
831
|
+
if (!isTextInput(event.target)) {
|
|
832
|
+
window.parent.postMessage(serializeKeyboardEvent(event), "*");
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
interface SerializedKeyboardEvent {
|
|
837
|
+
type: string;
|
|
838
|
+
eventType: string;
|
|
839
|
+
eventData: {
|
|
840
|
+
key: string;
|
|
841
|
+
code: string;
|
|
842
|
+
ctrlKey: boolean;
|
|
843
|
+
shiftKey: boolean;
|
|
844
|
+
altKey: boolean;
|
|
845
|
+
metaKey: boolean;
|
|
846
|
+
repeat: boolean;
|
|
847
|
+
bubbles: boolean;
|
|
848
|
+
target: string;
|
|
849
|
+
location: number;
|
|
850
|
+
isComposing: boolean;
|
|
851
|
+
charCode: number;
|
|
852
|
+
keyCode: number;
|
|
853
|
+
which: number;
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
function serializeKeyboardEvent(event: KeyboardEvent): SerializedKeyboardEvent {
|
|
858
|
+
return {
|
|
859
|
+
type: "keyboardEvent",
|
|
860
|
+
eventType: event.type,
|
|
861
|
+
eventData: {
|
|
862
|
+
key: event.key,
|
|
863
|
+
code: event.code,
|
|
864
|
+
ctrlKey: event.ctrlKey,
|
|
865
|
+
shiftKey: event.shiftKey,
|
|
866
|
+
altKey: event.altKey,
|
|
867
|
+
metaKey: event.metaKey,
|
|
868
|
+
repeat: event.repeat,
|
|
869
|
+
bubbles: event.bubbles,
|
|
870
|
+
target: "whiteboard",
|
|
871
|
+
location: event.location,
|
|
872
|
+
isComposing: event.isComposing,
|
|
873
|
+
charCode: event.charCode,
|
|
874
|
+
keyCode: event.keyCode,
|
|
875
|
+
which: event.which,
|
|
876
|
+
},
|
|
877
|
+
};
|
|
878
|
+
}
|