@webiny/app-admin 5.43.2 → 6.0.0-alpha.0
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/base/Admin.js +25 -35
- package/base/Admin.js.map +1 -1
- package/base/Base/Menus/SupportMenuItems.d.ts +2 -0
- package/base/Base/Menus/SupportMenuItems.js +20 -0
- package/base/Base/Menus/SupportMenuItems.js.map +1 -0
- package/base/Base/Menus/WebinyVersion.d.ts +2 -0
- package/base/Base/Menus/WebinyVersion.js +24 -0
- package/base/Base/Menus/WebinyVersion.js.map +1 -0
- package/base/Base/Menus.d.ts +2 -0
- package/base/Base/Menus.js +129 -0
- package/base/Base/Menus.js.map +1 -0
- package/base/Base/Routes.d.ts +2 -0
- package/base/Base/Routes.js +24 -0
- package/base/Base/Routes.js.map +1 -0
- package/base/Base/Tenant/wby-logo.svg +3 -0
- package/base/Base/Tenant.d.ts +2 -0
- package/base/Base/Tenant.js +19 -0
- package/base/Base/Tenant.js.map +1 -0
- package/base/Base.js +11 -79
- package/base/Base.js.map +1 -1
- package/base/WebinyVersion.d.ts +2 -0
- package/base/WebinyVersion.js +24 -0
- package/base/WebinyVersion.js.map +1 -0
- package/base/plugins/AddGraphQLQuerySelection.js +11 -21
- package/base/plugins/AddGraphQLQuerySelection.js.map +1 -1
- package/base/providers/AdminUiStateProvider.d.ts +1 -0
- package/base/providers/AdminUiStateProvider.js +14 -0
- package/base/providers/AdminUiStateProvider.js.map +1 -0
- package/base/providers/ApolloProvider.js +9 -15
- package/base/providers/ApolloProvider.js.map +1 -1
- package/base/providers/TelemetryProvider.js +12 -18
- package/base/providers/TelemetryProvider.js.map +1 -1
- package/base/providers/UiProviders.d.ts +1 -0
- package/base/providers/UiProviders.js +14 -0
- package/base/providers/UiProviders.js.map +1 -0
- package/base/providers/UiStateProvider.js +9 -15
- package/base/providers/UiStateProvider.js.map +1 -1
- package/base/providers/ViewCompositionProvider.js +33 -44
- package/base/providers/ViewCompositionProvider.js.map +1 -1
- package/base/ui/Brand.js +5 -12
- package/base/ui/Brand.js.map +1 -1
- package/base/ui/CenteredView.js +12 -43
- package/base/ui/CenteredView.js.map +1 -1
- package/base/ui/Dashboard.js +5 -12
- package/base/ui/Dashboard.js.map +1 -1
- package/base/ui/FileManager.js +42 -56
- package/base/ui/FileManager.js.map +1 -1
- package/base/ui/Layout.js +8 -16
- package/base/ui/Layout.js.map +1 -1
- package/base/ui/LocaleSelector.js +5 -12
- package/base/ui/LocaleSelector.js.map +1 -1
- package/base/ui/LoginScreen.js +9 -15
- package/base/ui/LoginScreen.js.map +1 -1
- package/base/ui/Logo.d.ts +0 -5
- package/base/ui/Logo.js +5 -26
- package/base/ui/Logo.js.map +1 -1
- package/base/ui/Navigation.d.ts +0 -57
- package/base/ui/Navigation.js +5 -146
- package/base/ui/Navigation.js.map +1 -1
- package/base/ui/NotFound.js +5 -12
- package/base/ui/NotFound.js.map +1 -1
- package/base/ui/Tags.js +14 -19
- package/base/ui/Tags.js.map +1 -1
- package/base/ui/{Search.d.ts → TenantSelector.d.ts} +2 -18
- package/base/ui/TenantSelector.js +8 -0
- package/base/ui/TenantSelector.js.map +1 -0
- package/base/ui/UserMenu/UserMenu.d.ts +39 -0
- package/base/ui/UserMenu/UserMenu.js +8 -0
- package/base/ui/UserMenu/UserMenu.js.map +1 -0
- package/base/ui/UserMenu/UserMenuHandle.d.ts +39 -0
- package/base/ui/UserMenu/UserMenuHandle.js +8 -0
- package/base/ui/UserMenu/UserMenuHandle.js.map +1 -0
- package/base/ui/UserMenu/UserMenuItem.d.ts +81 -0
- package/base/ui/UserMenu/UserMenuItem.js +19 -0
- package/base/ui/UserMenu/UserMenuItem.js.map +1 -0
- package/base/ui/UserMenu/UserMenuLink.d.ts +81 -0
- package/base/ui/UserMenu/UserMenuLink.js +19 -0
- package/base/ui/UserMenu/UserMenuLink.js.map +1 -0
- package/base/ui/UserMenu/UserMenuSeparator.d.ts +42 -0
- package/base/ui/UserMenu/UserMenuSeparator.js +9 -0
- package/base/ui/UserMenu/UserMenuSeparator.js.map +1 -0
- package/base/ui/UserMenu.d.ts +3 -79
- package/base/ui/UserMenu.js +14 -101
- package/base/ui/UserMenu.js.map +1 -1
- package/components/AdminLayout.js +7 -13
- package/components/AdminLayout.js.map +1 -1
- package/components/AppInstaller/AppInstaller.js +57 -67
- package/components/AppInstaller/AppInstaller.js.map +1 -1
- package/components/AppInstaller/Sidebar.js +49 -69
- package/components/AppInstaller/Sidebar.js.map +1 -1
- package/components/AppInstaller/index.js +10 -16
- package/components/AppInstaller/index.js.map +1 -1
- package/components/AppInstaller/styled.js +8 -15
- package/components/AppInstaller/styled.js.map +1 -1
- package/components/AppInstaller/useInstaller.js +81 -91
- package/components/AppInstaller/useInstaller.js.map +1 -1
- package/components/BulkActions/Worker.js +95 -141
- package/components/BulkActions/Worker.js.map +1 -1
- package/components/BulkActions/index.js +2 -27
- package/components/BulkActions/index.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/DialogMessage.js +20 -33
- package/components/BulkActions/useDialogWithReport/DialogMessage.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/index.js +1 -16
- package/components/BulkActions/useDialogWithReport/index.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.js +45 -52
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.js.map +1 -1
- package/components/Buttons/Buttons.d.ts +7 -6
- package/components/Buttons/Buttons.js +58 -56
- package/components/Buttons/Buttons.js.map +1 -1
- package/components/Buttons/Buttons.styles.js +2 -9
- package/components/Buttons/Buttons.styles.js.map +1 -1
- package/components/Buttons/index.js +2 -25
- package/components/Buttons/index.js.map +1 -1
- package/components/Buttons/useButtons.js +13 -19
- package/components/Buttons/useButtons.js.map +1 -1
- package/components/Dialogs/CustomDialog.js +30 -37
- package/components/Dialogs/CustomDialog.js.map +1 -1
- package/components/Dialogs/Dialog.d.ts +8 -4
- package/components/Dialogs/Dialog.js +56 -41
- package/components/Dialogs/Dialog.js.map +1 -1
- package/components/Dialogs/DialogsContext.d.ts +9 -3
- package/components/Dialogs/DialogsContext.js +96 -107
- package/components/Dialogs/DialogsContext.js.map +1 -1
- package/components/Dialogs/useDialogs.js +5 -17
- package/components/Dialogs/useDialogs.js.map +1 -1
- package/components/EmptyView.d.ts +1 -1
- package/components/EmptyView.js +31 -41
- package/components/EmptyView.js.map +1 -1
- package/components/Filters/Filters.js +12 -20
- package/components/Filters/Filters.js.map +1 -1
- package/components/Filters/FiltersToggle.d.ts +7 -0
- package/components/Filters/FiltersToggle.js +26 -0
- package/components/Filters/FiltersToggle.js.map +1 -0
- package/components/Filters/index.d.ts +1 -0
- package/components/Filters/index.js +2 -16
- package/components/Filters/index.js.map +1 -1
- package/components/FloatingActionButton.js +7 -13
- package/components/FloatingActionButton.js.map +1 -1
- package/components/FloatingPanel.js +44 -68
- package/components/FloatingPanel.js.map +1 -1
- package/components/IconPicker/IconPicker.d.ts +1 -1
- package/components/IconPicker/IconPicker.js +25 -32
- package/components/IconPicker/IconPicker.js.map +1 -1
- package/components/IconPicker/IconPickerComponent.d.ts +5 -5
- package/components/IconPicker/IconPickerComponent.js +67 -87
- package/components/IconPicker/IconPickerComponent.js.map +1 -1
- package/components/IconPicker/IconPickerPresenter.d.ts +5 -4
- package/components/IconPicker/IconPickerPresenter.js +68 -109
- package/components/IconPicker/IconPickerPresenter.js.map +1 -1
- package/components/IconPicker/IconPickerPresenter.test.js +21 -23
- package/components/IconPicker/IconPickerPresenter.test.js.map +1 -1
- package/components/IconPicker/IconPickerPresenterProvider.js +10 -17
- package/components/IconPicker/IconPickerPresenterProvider.js.map +1 -1
- package/components/IconPicker/IconPickerTab.d.ts +2 -1
- package/components/IconPicker/IconPickerTab.js +103 -113
- package/components/IconPicker/IconPickerTab.js.map +1 -1
- package/components/IconPicker/IconRenderer.js +16 -24
- package/components/IconPicker/IconRenderer.js.map +1 -1
- package/components/IconPicker/IconRepository.js +41 -73
- package/components/IconPicker/IconRepository.js.map +1 -1
- package/components/IconPicker/IconRepository.test.js +11 -13
- package/components/IconPicker/IconRepository.test.js.map +1 -1
- package/components/IconPicker/IconRepositoryFactory.js +14 -37
- package/components/IconPicker/IconRepositoryFactory.js.map +1 -1
- package/components/IconPicker/Loading.js +42 -68
- package/components/IconPicker/Loading.js.map +1 -1
- package/components/IconPicker/components/IconPickerCell.d.ts +12 -0
- package/components/IconPicker/components/IconPickerCell.js +27 -0
- package/components/IconPicker/components/IconPickerCell.js.map +1 -0
- package/components/IconPicker/components/IconPickerContent.d.ts +11 -0
- package/components/IconPicker/components/IconPickerContent.js +41 -0
- package/components/IconPicker/components/IconPickerContent.js.map +1 -0
- package/components/IconPicker/components/IconPickerRow.d.ts +4 -0
- package/components/IconPicker/components/IconPickerRow.js +14 -0
- package/components/IconPicker/components/IconPickerRow.js.map +1 -0
- package/components/IconPicker/components/IconPickerTrigger.d.ts +13 -0
- package/components/IconPicker/components/IconPickerTrigger.js +52 -0
- package/components/IconPicker/components/IconPickerTrigger.js.map +1 -0
- package/components/IconPicker/components/index.d.ts +4 -0
- package/components/IconPicker/components/index.js +6 -0
- package/components/IconPicker/components/index.js.map +1 -0
- package/components/IconPicker/config/Emojis.js +9 -16
- package/components/IconPicker/config/Emojis.js.map +1 -1
- package/components/IconPicker/config/FontAwesomeIcons.js +30 -43
- package/components/IconPicker/config/FontAwesomeIcons.js.map +1 -1
- package/components/IconPicker/config/IconPackProvider.js +10 -16
- package/components/IconPicker/config/IconPackProvider.js.map +1 -1
- package/components/IconPicker/config/IconType.js +52 -55
- package/components/IconPicker/config/IconType.js.map +1 -1
- package/components/IconPicker/config/index.js +35 -53
- package/components/IconPicker/config/index.js.map +1 -1
- package/components/IconPicker/defaultIcon.js +1 -7
- package/components/IconPicker/defaultIcon.js.map +1 -1
- package/components/IconPicker/index.js +6 -47
- package/components/IconPicker/index.js.map +1 -1
- package/components/IconPicker/plugins/customPlugin.js +71 -96
- package/components/IconPicker/plugins/customPlugin.js.map +1 -1
- package/components/IconPicker/plugins/emojisPlugin.js +80 -117
- package/components/IconPicker/plugins/emojisPlugin.js.map +1 -1
- package/components/IconPicker/plugins/graphql.js +19 -10
- package/components/IconPicker/plugins/graphql.js.map +1 -1
- package/components/IconPicker/plugins/iconsPlugin.js +62 -93
- package/components/IconPicker/plugins/iconsPlugin.js.map +1 -1
- package/components/IconPicker/types.d.ts +1 -1
- package/components/IconPicker/types.js +3 -8
- package/components/IconPicker/types.js.map +1 -1
- package/components/LexicalEditor/LexicalEditor.js +24 -31
- package/components/LexicalEditor/LexicalEditor.js.map +1 -1
- package/components/LexicalEditor/index.js +1 -12
- package/components/LexicalEditor/index.js.map +1 -1
- package/components/MultiImageUpload.d.ts +1 -1
- package/components/MultiImageUpload.js +8 -31
- package/components/MultiImageUpload.js.map +1 -1
- package/components/OptionsMenu/OptionsMenu.d.ts +1 -0
- package/components/OptionsMenu/OptionsMenu.js +17 -23
- package/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/components/OptionsMenu/OptionsMenuItem.d.ts +1 -0
- package/components/OptionsMenu/OptionsMenuItem.js +12 -17
- package/components/OptionsMenu/OptionsMenuItem.js.map +1 -1
- package/components/OptionsMenu/OptionsMenuLink.d.ts +1 -0
- package/components/OptionsMenu/OptionsMenuLink.js +13 -36
- package/components/OptionsMenu/OptionsMenuLink.js.map +1 -1
- package/components/OptionsMenu/index.js +4 -51
- package/components/OptionsMenu/index.js.map +1 -1
- package/components/OptionsMenu/useOptionsMenuItem.js +12 -18
- package/components/OptionsMenu/useOptionsMenuItem.js.map +1 -1
- package/components/OverlayLayout/OverlayLayout.d.ts +6 -16
- package/components/OverlayLayout/OverlayLayout.js +42 -147
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/OverlayLayout/components/OverlayBackdrop.d.ts +7 -0
- package/components/OverlayLayout/components/OverlayBackdrop.js +15 -0
- package/components/OverlayLayout/components/OverlayBackdrop.js.map +1 -0
- package/components/OverlayLayout/components/OverlayContent.d.ts +6 -0
- package/components/OverlayLayout/components/OverlayContent.js +21 -0
- package/components/OverlayLayout/components/OverlayContent.js.map +1 -0
- package/components/OverlayLayout/components/OverlayHeader.d.ts +13 -0
- package/components/OverlayLayout/components/OverlayHeader.js +44 -0
- package/components/OverlayLayout/components/OverlayHeader.js.map +1 -0
- package/components/OverlayLayout/components/OverlayRoot.d.ts +9 -0
- package/components/OverlayLayout/components/OverlayRoot.js +19 -0
- package/components/OverlayLayout/components/OverlayRoot.js.map +1 -0
- package/components/OverlayLayout/components/index.d.ts +4 -0
- package/components/OverlayLayout/components/index.js +6 -0
- package/components/OverlayLayout/components/index.js.map +1 -0
- package/components/OverlayLayout/index.js +1 -16
- package/components/OverlayLayout/index.js.map +1 -1
- package/components/Permissions/CannotUseAaclAlert.js +5 -12
- package/components/Permissions/CannotUseAaclAlert.js.map +1 -1
- package/components/Permissions/Permissions.js +37 -48
- package/components/Permissions/Permissions.js.map +1 -1
- package/components/Permissions/PermissionsGroup.d.ts +6 -0
- package/components/Permissions/PermissionsGroup.js +18 -0
- package/components/Permissions/PermissionsGroup.js.map +1 -0
- package/components/Permissions/StyledComponents.d.ts +1 -2
- package/components/Permissions/StyledComponents.js +12 -25
- package/components/Permissions/StyledComponents.js.map +1 -1
- package/components/Permissions/index.d.ts +1 -0
- package/components/Permissions/index.js +4 -35
- package/components/Permissions/index.js.map +1 -1
- package/components/ResizablePanels/index.js +1 -42
- package/components/ResizablePanels/index.js.map +1 -1
- package/components/RichTextEditor/RichTextEditor.js +13 -21
- package/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/components/RichTextEditor/index.js +2 -19
- package/components/RichTextEditor/index.js.map +1 -1
- package/components/RichTextEditor/tools/header/index.js +455 -521
- package/components/RichTextEditor/tools/header/index.js.map +1 -1
- package/components/RichTextEditor/tools/image/index.js +147 -182
- package/components/RichTextEditor/tools/image/index.js.map +1 -1
- package/components/RichTextEditor/tools/image/svgs.js +4 -10
- package/components/RichTextEditor/tools/image/svgs.js.map +1 -1
- package/components/RichTextEditor/tools/image/tunes.js +75 -96
- package/components/RichTextEditor/tools/image/tunes.js.map +1 -1
- package/components/RichTextEditor/tools/image/types.js +1 -5
- package/components/RichTextEditor/tools/image/ui.js +143 -174
- package/components/RichTextEditor/tools/image/ui.js.map +1 -1
- package/components/RichTextEditor/tools/paragraph/index.js +337 -389
- package/components/RichTextEditor/tools/paragraph/index.js.map +1 -1
- package/components/RichTextEditor/tools/textColor/index.js +164 -202
- package/components/RichTextEditor/tools/textColor/index.js.map +1 -1
- package/components/RichTextEditor/tools/utils.js +3 -9
- package/components/RichTextEditor/tools/utils.js.map +1 -1
- package/components/Routes.js +14 -23
- package/components/Routes.js.map +1 -1
- package/components/SearchUI.d.ts +2 -1
- package/components/SearchUI.js +22 -48
- package/components/SearchUI.js.map +1 -1
- package/components/SimpleForm/SimpleForm.d.ts +14 -7
- package/components/SimpleForm/SimpleForm.js +72 -77
- package/components/SimpleForm/SimpleForm.js.map +1 -1
- package/components/SimpleForm/index.js +1 -30
- package/components/SimpleForm/index.js.map +1 -1
- package/components/SimpleUI/InputField.js +39 -47
- package/components/SimpleUI/InputField.js.map +1 -1
- package/components/SingleImageUpload.d.ts +19 -1
- package/components/SingleImageUpload.js +39 -75
- package/components/SingleImageUpload.js.map +1 -1
- package/components/SplitView/SplitView.d.ts +4 -4
- package/components/SplitView/SplitView.js +41 -88
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/SplitView/index.js +1 -24
- package/components/SplitView/index.js.map +1 -1
- package/components/StateInspector.js +28 -28
- package/components/StateInspector.js.map +1 -1
- package/components/Wcp.js +21 -25
- package/components/Wcp.js.map +1 -1
- package/components/index.js +3 -26
- package/components/index.js.map +1 -1
- package/config/AdminConfig/Menu/MenuGroup.d.ts +62 -0
- package/config/AdminConfig/Menu/MenuGroup.js +14 -0
- package/config/AdminConfig/Menu/MenuGroup.js.map +1 -0
- package/config/AdminConfig/Menu/MenuItem.d.ts +43 -0
- package/config/AdminConfig/Menu/MenuItem.js +14 -0
- package/config/AdminConfig/Menu/MenuItem.js.map +1 -0
- package/config/AdminConfig/Menu/MenuLink.d.ts +43 -0
- package/config/AdminConfig/Menu/MenuLink.js +18 -0
- package/config/AdminConfig/Menu/MenuLink.js.map +1 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.d.ts +43 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js +13 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js.map +1 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.d.ts +24 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js +13 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js.map +1 -0
- package/config/AdminConfig/Menu/SupportMenu.d.ts +72 -0
- package/config/AdminConfig/Menu/SupportMenu.js +49 -0
- package/config/AdminConfig/Menu/SupportMenu.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.d.ts +41 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js +7 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.d.ts +41 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js +7 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.d.ts +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js +3 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/types.d.ts +7 -0
- package/config/AdminConfig/Menu/UserMenu/types.js +3 -0
- package/config/AdminConfig/Menu/UserMenu/types.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu.d.ts +129 -0
- package/config/AdminConfig/Menu/UserMenu.js +61 -0
- package/config/AdminConfig/Menu/UserMenu.js.map +1 -0
- package/config/AdminConfig/Menu/types.d.ts +7 -0
- package/config/AdminConfig/Menu/types.js +3 -0
- package/config/AdminConfig/Menu/types.js.map +1 -0
- package/config/AdminConfig/Menu.d.ts +350 -0
- package/config/AdminConfig/Menu.js +75 -0
- package/config/AdminConfig/Menu.js.map +1 -0
- package/config/AdminConfig/Route.d.ts +3 -0
- package/config/AdminConfig/Route.js +8 -0
- package/config/AdminConfig/Route.js.map +1 -0
- package/config/AdminConfig/Tenant/TenantLogo.d.ts +23 -0
- package/config/AdminConfig/Tenant/TenantLogo.js +16 -0
- package/config/AdminConfig/Tenant/TenantLogo.js.map +1 -0
- package/config/AdminConfig/Tenant/TenantName.d.ts +23 -0
- package/config/AdminConfig/Tenant/TenantName.js +16 -0
- package/config/AdminConfig/Tenant/TenantName.js.map +1 -0
- package/config/AdminConfig/Tenant.d.ts +66 -0
- package/config/AdminConfig/Tenant.js +23 -0
- package/config/AdminConfig/Tenant.js.map +1 -0
- package/config/AdminConfig/Theme/assignColor.d.ts +2 -0
- package/config/AdminConfig/Theme/assignColor.js +22 -0
- package/config/AdminConfig/Theme/assignColor.js.map +1 -0
- package/config/AdminConfig/Theme/consts.d.ts +2 -0
- package/config/AdminConfig/Theme/consts.js +4 -0
- package/config/AdminConfig/Theme/consts.js.map +1 -0
- package/config/AdminConfig/Theme/types.d.ts +3 -0
- package/config/AdminConfig/Theme/types.js +3 -0
- package/config/AdminConfig/Theme/types.js.map +1 -0
- package/config/AdminConfig/Theme.d.ts +16 -0
- package/config/AdminConfig/Theme.js +22 -0
- package/config/AdminConfig/Theme.js.map +1 -0
- package/config/AdminConfig.d.ts +434 -0
- package/config/AdminConfig.js +47 -0
- package/config/AdminConfig.js.map +1 -0
- package/config/createAdminConfig.d.ts +57 -0
- package/config/createAdminConfig.js +94 -0
- package/config/createAdminConfig.js.map +1 -0
- package/hooks/index.js +10 -115
- package/hooks/index.js.map +1 -1
- package/hooks/useConfirmationDialog.js +26 -39
- package/hooks/useConfirmationDialog.js.map +1 -1
- package/hooks/useDialog.js +16 -21
- package/hooks/useDialog.js.map +1 -1
- package/hooks/useIsMounted.js +6 -14
- package/hooks/useIsMounted.js.map +1 -1
- package/hooks/useKeyHandler.js +28 -46
- package/hooks/useKeyHandler.js.map +1 -1
- package/hooks/useModKey.js +9 -20
- package/hooks/useModKey.js.map +1 -1
- package/hooks/useShiftKey.js +13 -26
- package/hooks/useShiftKey.js.map +1 -1
- package/hooks/useSnackbar.js +22 -43
- package/hooks/useSnackbar.js.map +1 -1
- package/hooks/useStateIfMounted.js +8 -18
- package/hooks/useStateIfMounted.js.map +1 -1
- package/hooks/useStateWithCallback.js +7 -20
- package/hooks/useStateWithCallback.js.map +1 -1
- package/index.d.ts +2 -5
- package/index.js +52 -491
- package/index.js.map +1 -1
- package/package.json +25 -23
- package/plugins/MenuPlugin.js +15 -36
- package/plugins/MenuPlugin.js.map +1 -1
- package/plugins/PermissionRendererPlugin.js +15 -36
- package/plugins/PermissionRendererPlugin.js.map +1 -1
- package/plugins/uiLayoutRenderer/index.js +39 -48
- package/plugins/uiLayoutRenderer/index.js.map +1 -1
- package/styles.scss +7 -3
- package/types.d.ts +1 -36
- package/types.js +4 -11
- package/types.js.map +1 -1
- package/ui/UIElement.js +1 -18
- package/ui/UIElement.js.map +1 -1
- package/ui/UILayout.js +1 -18
- package/ui/UILayout.js.map +1 -1
- package/ui/UIRenderer.js +1 -12
- package/ui/UIRenderer.js.map +1 -1
- package/ui/UIView.js +1 -24
- package/ui/UIView.js.map +1 -1
- package/ui/elements/AccordionElement.js +43 -74
- package/ui/elements/AccordionElement.js.map +1 -1
- package/ui/elements/ButtonElement.js +46 -79
- package/ui/elements/ButtonElement.js.map +1 -1
- package/ui/elements/ButtonGroupElement.js +12 -31
- package/ui/elements/ButtonGroupElement.js.map +1 -1
- package/ui/elements/GenericElement.js +1 -16
- package/ui/elements/GenericElement.js.map +1 -1
- package/ui/elements/LabelElement.js +15 -37
- package/ui/elements/LabelElement.js.map +1 -1
- package/ui/elements/NavigationMenuElement.js +67 -119
- package/ui/elements/NavigationMenuElement.js.map +1 -1
- package/ui/elements/PanelElement.js +2 -20
- package/ui/elements/PanelElement.js.map +1 -1
- package/ui/elements/PlaceholderElement.js +8 -29
- package/ui/elements/PlaceholderElement.js.map +1 -1
- package/ui/elements/SmallButtonElement.js +20 -40
- package/ui/elements/SmallButtonElement.js.map +1 -1
- package/ui/elements/TypographyElement.js +20 -43
- package/ui/elements/TypographyElement.js.map +1 -1
- package/ui/elements/ViewElement.js +1 -16
- package/ui/elements/ViewElement.js.map +1 -1
- package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js +17 -33
- package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js.map +1 -1
- package/ui/elements/form/DynamicFieldsetElement.js +90 -127
- package/ui/elements/form/DynamicFieldsetElement.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElement.js +7 -23
- package/ui/elements/form/FileManagerElement/EmptyStateElement.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js +40 -65
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js +56 -82
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/styled.js +37 -35
- package/ui/elements/form/FileManagerElement/styled.js.map +1 -1
- package/ui/elements/form/FileManagerElement.js +43 -81
- package/ui/elements/form/FileManagerElement.js.map +1 -1
- package/ui/elements/form/FormElement.js +17 -40
- package/ui/elements/form/FormElement.js.map +1 -1
- package/ui/elements/form/FormFieldElement.js +100 -158
- package/ui/elements/form/FormFieldElement.js.map +1 -1
- package/ui/elements/form/HiddenElement.js +21 -42
- package/ui/elements/form/HiddenElement.js.map +1 -1
- package/ui/elements/form/InputElement.js +28 -49
- package/ui/elements/form/InputElement.js.map +1 -1
- package/ui/elements/form/PasswordElement.js +26 -48
- package/ui/elements/form/PasswordElement.js.map +1 -1
- package/ui/elements/form/SelectElement.js +38 -64
- package/ui/elements/form/SelectElement.js.map +1 -1
- package/ui/elements/form/TextareaElement.js +30 -50
- package/ui/elements/form/TextareaElement.js.map +1 -1
- package/ui/views/AdminView/ContentElement.js +19 -42
- package/ui/views/AdminView/ContentElement.js.map +1 -1
- package/ui/views/AdminView/HeaderElement.js +57 -90
- package/ui/views/AdminView/HeaderElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionCenterElement.js +16 -35
- package/ui/views/AdminView/HeaderSectionCenterElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionLeftElement.js +16 -35
- package/ui/views/AdminView/HeaderSectionLeftElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionRightElement.js +16 -35
- package/ui/views/AdminView/HeaderSectionRightElement.js.map +1 -1
- package/ui/views/AdminView/components/Dialog.js +30 -36
- package/ui/views/AdminView/components/Dialog.js.map +1 -1
- package/ui/views/AdminView/components/Hamburger.js +12 -21
- package/ui/views/AdminView/components/Hamburger.js.map +1 -1
- package/ui/views/FormView/FormContainerElement.js +16 -53
- package/ui/views/FormView/FormContainerElement.js.map +1 -1
- package/ui/views/FormView/FormContentElement.d.ts +3 -1
- package/ui/views/FormView/FormContentElement.js +7 -19
- package/ui/views/FormView/FormContentElement.js.map +1 -1
- package/ui/views/FormView/FormFooterElement.js +11 -45
- package/ui/views/FormView/FormFooterElement.js.map +1 -1
- package/ui/views/FormView/FormHeaderElement.js +26 -75
- package/ui/views/FormView/FormHeaderElement.js.map +1 -1
- package/ui/views/FormView.js +104 -148
- package/ui/views/FormView.js.map +1 -1
- package/ui/views/OverlayView/ContentElement.js +12 -31
- package/ui/views/OverlayView/ContentElement.js.map +1 -1
- package/ui/views/OverlayView/HeaderElement.js +62 -99
- package/ui/views/OverlayView/HeaderElement.js.map +1 -1
- package/ui/views/OverlayView/HeaderTitleElement.js +21 -44
- package/ui/views/OverlayView/HeaderTitleElement.js.map +1 -1
- package/ui/views/OverlayView/useOverlayView.js +16 -27
- package/ui/views/OverlayView/useOverlayView.js.map +1 -1
- package/ui/views/OverlayView.js +72 -123
- package/ui/views/OverlayView.js.map +1 -1
- package/ui/views/SplitView/SplitViewPanelElement.js +28 -64
- package/ui/views/SplitView/SplitViewPanelElement.js.map +1 -1
- package/ui/views/SplitView.js +51 -82
- package/ui/views/SplitView.js.map +1 -1
- package/base/Version.d.ts +0 -3
- package/base/Version.js +0 -56
- package/base/Version.js.map +0 -1
- package/base/ui/Menu.d.ts +0 -51
- package/base/ui/Menu.js +0 -133
- package/base/ui/Menu.js.map +0 -1
- package/base/ui/Search.js +0 -61
- package/base/ui/Search.js.map +0 -1
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.d.ts +0 -20
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.js +0 -48
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.js.map +0 -1
- package/components/Dialogs/styled.d.ts +0 -10
- package/components/Dialogs/styled.js +0 -40
- package/components/Dialogs/styled.js.map +0 -1
- package/components/Filters/Filters.styled.d.ts +0 -13
- package/components/Filters/Filters.styled.js +0 -53
- package/components/Filters/Filters.styled.js.map +0 -1
- package/components/IconPicker/IconPicker.styles.d.ts +0 -63
- package/components/IconPicker/IconPicker.styles.js +0 -187
- package/components/IconPicker/IconPicker.styles.js.map +0 -1
- package/components/OptionsMenu/OptionsMenu.styled.d.ts +0 -3
- package/components/OptionsMenu/OptionsMenu.styled.js +0 -26
- package/components/OptionsMenu/OptionsMenu.styled.js.map +0 -1
- package/components/OverlayLayout/icons/close.svg +0 -13
- package/components/OverlayLayout/icons/navigate_before.svg +0 -16
- package/plugins/globalSearch/SearchBar.d.ts +0 -34
- package/plugins/globalSearch/SearchBar.js +0 -225
- package/plugins/globalSearch/SearchBar.js.map +0 -1
- package/plugins/globalSearch/SearchBarDropdown.d.ts +0 -23
- package/plugins/globalSearch/SearchBarDropdown.js +0 -82
- package/plugins/globalSearch/SearchBarDropdown.js.map +0 -1
- package/plugins/globalSearch/icons/round-search-24px.svg +0 -20
- package/plugins/globalSearch/index.d.ts +0 -6
- package/plugins/globalSearch/index.js +0 -17
- package/plugins/globalSearch/index.js.map +0 -1
- package/plugins/globalSearch/styled.d.ts +0 -18
- package/plugins/globalSearch/styled.js +0 -133
- package/plugins/globalSearch/styled.js.map +0 -1
- package/styles/material-theme-assignments.scss +0 -375
- package/styles/material.scss +0 -42
- package/styles/reset.scss +0 -1
- package/styles/theme.scss +0 -76
- package/ui/views/AdminView/components/Snackbar.d.ts +0 -3
- package/ui/views/AdminView/components/Snackbar.js +0 -33
- package/ui/views/AdminView/components/Snackbar.js.map +0 -1
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var Header = /*#__PURE__*/function () {
|
|
1
|
+
import { ALIGNMENTS, ALIGNMENT_ICONS, TextAlign } from "../utils";
|
|
2
|
+
class Header {
|
|
12
3
|
/**
|
|
13
4
|
* Render plugin`s main Element and fill it with saved data
|
|
14
5
|
*
|
|
@@ -18,15 +9,15 @@ var Header = /*#__PURE__*/function () {
|
|
|
18
9
|
* api - Editor.js API
|
|
19
10
|
* readOnly - read only mode flag
|
|
20
11
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
constructor({
|
|
13
|
+
data,
|
|
14
|
+
config,
|
|
15
|
+
api,
|
|
16
|
+
readOnly
|
|
17
|
+
}) {
|
|
27
18
|
this.api = api;
|
|
28
19
|
this.readOnly = readOnly;
|
|
29
|
-
this.alignments =
|
|
20
|
+
this.alignments = ALIGNMENTS;
|
|
30
21
|
/**
|
|
31
22
|
* Import typography from theme
|
|
32
23
|
*/
|
|
@@ -84,598 +75,541 @@ var Header = /*#__PURE__*/function () {
|
|
|
84
75
|
* @returns {HeaderData}
|
|
85
76
|
* @private
|
|
86
77
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (typeof data !== "object") {
|
|
92
|
-
data = {};
|
|
93
|
-
}
|
|
94
|
-
newData.text = data.text || "";
|
|
95
|
-
newData.level = parseInt(data.level) || this.defaultLevel.number;
|
|
96
|
-
newData.textAlign = data.textAlign || _utils.TextAlign.START;
|
|
97
|
-
return newData;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Return Tool's view
|
|
102
|
-
*
|
|
103
|
-
* @returns {HTMLHeadingElement}
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
}, {
|
|
107
|
-
key: "render",
|
|
108
|
-
value: function render() {
|
|
109
|
-
return this._element;
|
|
78
|
+
normalizeData(data) {
|
|
79
|
+
const newData = {};
|
|
80
|
+
if (typeof data !== "object") {
|
|
81
|
+
data = {};
|
|
110
82
|
}
|
|
83
|
+
newData.text = data.text || "";
|
|
84
|
+
newData.level = parseInt(data.level) || this.defaultLevel.number;
|
|
85
|
+
newData.textAlign = data.textAlign || TextAlign.START;
|
|
86
|
+
return newData;
|
|
87
|
+
}
|
|
111
88
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var holder = document.createElement("DIV");
|
|
122
|
-
|
|
123
|
-
// do not add settings button, when only one level is configured
|
|
124
|
-
if (this.levels.length <= 1) {
|
|
125
|
-
return holder;
|
|
126
|
-
}
|
|
89
|
+
/**
|
|
90
|
+
* Return Tool's view
|
|
91
|
+
*
|
|
92
|
+
* @returns {HTMLHeadingElement}
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
render() {
|
|
96
|
+
return this._element;
|
|
97
|
+
}
|
|
127
98
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*/
|
|
136
|
-
if (_this.currentLevel.number === level.number) {
|
|
137
|
-
selectTypeButton.classList.add(_this._CSS.settingsButtonActive);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Add SVG icon
|
|
142
|
-
*/
|
|
143
|
-
selectTypeButton.innerHTML = level.svg;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Save level to its button
|
|
147
|
-
*/
|
|
148
|
-
selectTypeButton.dataset["level"] = level.number + "";
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Set up click handler
|
|
152
|
-
*/
|
|
153
|
-
selectTypeButton.addEventListener("click", function () {
|
|
154
|
-
_this.setLevel(level.number);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Append settings button to holder
|
|
159
|
-
*/
|
|
160
|
-
holder.appendChild(selectTypeButton);
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Save settings buttons
|
|
164
|
-
*/
|
|
165
|
-
_this.settingsButtons.push(selectTypeButton);
|
|
166
|
-
});
|
|
99
|
+
/**
|
|
100
|
+
* Create Block's settings block
|
|
101
|
+
*
|
|
102
|
+
* @returns {HTMLElement}
|
|
103
|
+
*/
|
|
104
|
+
renderSettings() {
|
|
105
|
+
const holder = document.createElement("DIV");
|
|
167
106
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* */
|
|
171
|
-
this.alignments.forEach(function (alignment) {
|
|
172
|
-
var selectTypeButton = document.createElement("SPAN");
|
|
173
|
-
selectTypeButton.classList.add(_this._CSS.settingsButton);
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Highlight current level button
|
|
177
|
-
*/
|
|
178
|
-
if (_this.currentAlignment.name === alignment.name) {
|
|
179
|
-
selectTypeButton.classList.add(_this._CSS.settingsButtonActive);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Add SVG icon
|
|
184
|
-
*/
|
|
185
|
-
selectTypeButton.innerHTML = alignment.svg;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Save alignment to its button
|
|
189
|
-
*/
|
|
190
|
-
selectTypeButton.dataset["textAlign"] = alignment.name;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Set up click handler
|
|
194
|
-
*/
|
|
195
|
-
selectTypeButton.addEventListener("click", function () {
|
|
196
|
-
_this.setAlignment(alignment);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Append settings button to holder
|
|
201
|
-
*/
|
|
202
|
-
holder.appendChild(selectTypeButton);
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Save settings buttons
|
|
206
|
-
*/
|
|
207
|
-
_this.settingsButtons.push(selectTypeButton);
|
|
208
|
-
});
|
|
107
|
+
// do not add settings button, when only one level is configured
|
|
108
|
+
if (this.levels.length <= 1) {
|
|
209
109
|
return holder;
|
|
210
110
|
}
|
|
211
111
|
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*/
|
|
217
|
-
}, {
|
|
218
|
-
key: "setLevel",
|
|
219
|
-
value: function setLevel(level) {
|
|
220
|
-
var _this2 = this;
|
|
221
|
-
this.data = {
|
|
222
|
-
level: level,
|
|
223
|
-
text: this.data.text
|
|
224
|
-
};
|
|
112
|
+
/** Add type selectors */
|
|
113
|
+
this.levels.forEach(level => {
|
|
114
|
+
const selectTypeButton = document.createElement("SPAN");
|
|
115
|
+
selectTypeButton.classList.add(this._CSS.settingsButton);
|
|
225
116
|
|
|
226
117
|
/**
|
|
227
|
-
* Highlight
|
|
118
|
+
* Highlight current level button
|
|
228
119
|
*/
|
|
229
|
-
this.
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Callback for Block's settings buttons
|
|
236
|
-
*
|
|
237
|
-
* @param {number} alignment - level to set
|
|
238
|
-
*/
|
|
239
|
-
}, {
|
|
240
|
-
key: "setAlignment",
|
|
241
|
-
value: function setAlignment(alignment) {
|
|
242
|
-
var _this3 = this;
|
|
243
|
-
this.data = {
|
|
244
|
-
textAlign: alignment.name,
|
|
245
|
-
text: this.data.text,
|
|
246
|
-
level: this.data.level
|
|
247
|
-
};
|
|
120
|
+
if (this.currentLevel.number === level.number) {
|
|
121
|
+
selectTypeButton.classList.add(this._CSS.settingsButtonActive);
|
|
122
|
+
}
|
|
248
123
|
|
|
249
124
|
/**
|
|
250
|
-
*
|
|
125
|
+
* Add SVG icon
|
|
251
126
|
*/
|
|
252
|
-
|
|
253
|
-
button.classList.toggle(_this3._CSS.settingsButtonActive, button.dataset.textAlign === alignment.name);
|
|
254
|
-
});
|
|
255
|
-
}
|
|
127
|
+
selectTypeButton.innerHTML = level.svg;
|
|
256
128
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
* @param {HeaderData} data - saved data to merger with current block
|
|
262
|
-
* @public
|
|
263
|
-
*/
|
|
264
|
-
}, {
|
|
265
|
-
key: "merge",
|
|
266
|
-
value: function merge(data) {
|
|
267
|
-
this.data = {
|
|
268
|
-
text: this.data.text + data.text,
|
|
269
|
-
level: this.data.level,
|
|
270
|
-
alignment: this.data.alignment
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Validate Text block data:
|
|
276
|
-
* - check for emptiness
|
|
277
|
-
*
|
|
278
|
-
* @param {HeaderData} blockData — data received after saving
|
|
279
|
-
* @returns {boolean} false if saved data is not correct, otherwise true
|
|
280
|
-
* @public
|
|
281
|
-
*/
|
|
282
|
-
}, {
|
|
283
|
-
key: "validate",
|
|
284
|
-
value: function validate(blockData) {
|
|
285
|
-
return blockData.text.trim() !== "";
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Extract Tool's data from the view
|
|
290
|
-
*
|
|
291
|
-
* @param {HTMLHeadingElement} toolsContent - Text tools rendered view
|
|
292
|
-
* @returns {HeaderData} - saved data
|
|
293
|
-
* @public
|
|
294
|
-
*/
|
|
295
|
-
}, {
|
|
296
|
-
key: "save",
|
|
297
|
-
value: function save(toolsContent) {
|
|
298
|
-
return {
|
|
299
|
-
text: toolsContent.innerHTML,
|
|
300
|
-
level: this.currentLevel.number,
|
|
301
|
-
textAlign: this.getTextAlign(toolsContent.className),
|
|
302
|
-
className: toolsContent.className
|
|
303
|
-
};
|
|
304
|
-
}
|
|
129
|
+
/**
|
|
130
|
+
* Save level to its button
|
|
131
|
+
*/
|
|
132
|
+
selectTypeButton.dataset["level"] = level.number + "";
|
|
305
133
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
*/
|
|
312
|
-
}, {
|
|
313
|
-
key: "getTextAlign",
|
|
314
|
-
value: function getTextAlign(className) {
|
|
315
|
-
var textAlign = _utils.TextAlign.START;
|
|
316
|
-
// Match className with alignment
|
|
317
|
-
this.alignments.forEach(function (alignment) {
|
|
318
|
-
if (className.includes("ce-header-text--".concat(alignment.name))) {
|
|
319
|
-
textAlign = alignment.name;
|
|
320
|
-
}
|
|
134
|
+
/**
|
|
135
|
+
* Set up click handler
|
|
136
|
+
*/
|
|
137
|
+
selectTypeButton.addEventListener("click", () => {
|
|
138
|
+
this.setLevel(level.number);
|
|
321
139
|
});
|
|
322
|
-
return textAlign;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Allow Header to be converted to/from other blocks
|
|
327
|
-
*/
|
|
328
|
-
}, {
|
|
329
|
-
key: "data",
|
|
330
|
-
get:
|
|
331
|
-
/**
|
|
332
|
-
* Get current Tools`s data
|
|
333
|
-
*
|
|
334
|
-
* @returns {HeaderData} Current data
|
|
335
|
-
* @private
|
|
336
|
-
*/
|
|
337
|
-
function get() {
|
|
338
|
-
this._data.text = this._element.innerHTML;
|
|
339
|
-
this._data.level = this.currentLevel.number;
|
|
340
|
-
this._data.textAlign = this.currentAlignment.name;
|
|
341
|
-
return this._data;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Store data in plugin:
|
|
346
|
-
* - at the this._data property
|
|
347
|
-
* - at the HTML
|
|
348
|
-
*
|
|
349
|
-
* @param {HeaderData} data — data to set
|
|
350
|
-
* @private
|
|
351
|
-
*/,
|
|
352
|
-
set: function set(data) {
|
|
353
|
-
this._data = this.normalizeData(data);
|
|
354
140
|
|
|
355
141
|
/**
|
|
356
|
-
*
|
|
357
|
-
* then replace it to a new block
|
|
142
|
+
* Append settings button to holder
|
|
358
143
|
*/
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Create a new tag
|
|
362
|
-
*
|
|
363
|
-
* @type {HTMLHeadingElement}
|
|
364
|
-
*/
|
|
365
|
-
var newHeader = this.getTag();
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Save Block's content
|
|
369
|
-
*/
|
|
370
|
-
newHeader.innerHTML = this._element.innerHTML;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Replace blocks
|
|
374
|
-
*/
|
|
375
|
-
this._element.parentNode.replaceChild(newHeader, this._element);
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Save new block to private variable
|
|
379
|
-
*
|
|
380
|
-
* @type {HTMLHeadingElement}
|
|
381
|
-
* @private
|
|
382
|
-
*/
|
|
383
|
-
this._element = newHeader;
|
|
384
|
-
}
|
|
144
|
+
holder.appendChild(selectTypeButton);
|
|
385
145
|
|
|
386
146
|
/**
|
|
387
|
-
*
|
|
147
|
+
* Save settings buttons
|
|
388
148
|
*/
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
}
|
|
149
|
+
this.settingsButtons.push(selectTypeButton);
|
|
150
|
+
});
|
|
393
151
|
|
|
394
152
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
key: "getTag",
|
|
402
|
-
value: function getTag() {
|
|
403
|
-
var _this4 = this;
|
|
153
|
+
* Add alignment selectors
|
|
154
|
+
* */
|
|
155
|
+
this.alignments.forEach(alignment => {
|
|
156
|
+
const selectTypeButton = document.createElement("SPAN");
|
|
157
|
+
selectTypeButton.classList.add(this._CSS.settingsButton);
|
|
158
|
+
|
|
404
159
|
/**
|
|
405
|
-
*
|
|
160
|
+
* Highlight current level button
|
|
406
161
|
*/
|
|
407
|
-
|
|
162
|
+
if (this.currentAlignment.name === alignment.name) {
|
|
163
|
+
selectTypeButton.classList.add(this._CSS.settingsButtonActive);
|
|
164
|
+
}
|
|
408
165
|
|
|
409
166
|
/**
|
|
410
|
-
* Add
|
|
167
|
+
* Add SVG icon
|
|
411
168
|
*/
|
|
412
|
-
|
|
169
|
+
selectTypeButton.innerHTML = alignment.svg;
|
|
413
170
|
|
|
414
171
|
/**
|
|
415
|
-
*
|
|
172
|
+
* Save alignment to its button
|
|
416
173
|
*/
|
|
417
|
-
|
|
418
|
-
var component = this.currentLevel.tag.toLowerCase();
|
|
419
|
-
var typographyConfig = this.typography[component];
|
|
420
|
-
tag.classList.add(typographyConfig.className);
|
|
421
|
-
} else {
|
|
422
|
-
/**
|
|
423
|
-
* Add styles class
|
|
424
|
-
*/
|
|
425
|
-
tag.classList.add(this._CSS.wrapper);
|
|
426
|
-
}
|
|
174
|
+
selectTypeButton.dataset["textAlign"] = alignment.name;
|
|
427
175
|
|
|
428
176
|
/**
|
|
429
|
-
*
|
|
177
|
+
* Set up click handler
|
|
430
178
|
*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (alignment.name === _this4._data.textAlign) {
|
|
434
|
-
tag.classList.add(textAlignClass);
|
|
435
|
-
} else {
|
|
436
|
-
tag.classList.remove(textAlignClass);
|
|
437
|
-
}
|
|
179
|
+
selectTypeButton.addEventListener("click", () => {
|
|
180
|
+
this.setAlignment(alignment);
|
|
438
181
|
});
|
|
439
182
|
|
|
440
183
|
/**
|
|
441
|
-
*
|
|
184
|
+
* Append settings button to holder
|
|
442
185
|
*/
|
|
443
|
-
|
|
186
|
+
holder.appendChild(selectTypeButton);
|
|
444
187
|
|
|
445
188
|
/**
|
|
446
|
-
*
|
|
189
|
+
* Save settings buttons
|
|
447
190
|
*/
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
191
|
+
this.settingsButtons.push(selectTypeButton);
|
|
192
|
+
});
|
|
193
|
+
return holder;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Callback for Block's settings buttons
|
|
198
|
+
*
|
|
199
|
+
* @param {number} level - level to set
|
|
200
|
+
*/
|
|
201
|
+
setLevel(level) {
|
|
202
|
+
this.data = {
|
|
203
|
+
level: level,
|
|
204
|
+
text: this.data.text
|
|
205
|
+
};
|
|
451
206
|
|
|
452
207
|
/**
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
* @returns {level}
|
|
208
|
+
* Highlight button by selected level
|
|
456
209
|
*/
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
210
|
+
this.settingsButtons.forEach(button => {
|
|
211
|
+
button.classList.toggle(this._CSS.settingsButtonActive, parseInt(button.dataset.level) === level);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Callback for Block's settings buttons
|
|
217
|
+
*
|
|
218
|
+
* @param {number} alignment - level to set
|
|
219
|
+
*/
|
|
220
|
+
setAlignment(alignment) {
|
|
221
|
+
this.data = {
|
|
222
|
+
textAlign: alignment.name,
|
|
223
|
+
text: this.data.text,
|
|
224
|
+
level: this.data.level
|
|
225
|
+
};
|
|
469
226
|
|
|
470
227
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* @returns {alignment}
|
|
228
|
+
* Highlight button by selected level
|
|
474
229
|
*/
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
230
|
+
this.settingsButtons.forEach(button => {
|
|
231
|
+
button.classList.toggle(this._CSS.settingsButtonActive, button.dataset.textAlign === alignment.name);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Method that specified how to merge two Text blocks.
|
|
237
|
+
* Called by Editor.js by backspace at the beginning of the Block
|
|
238
|
+
*
|
|
239
|
+
* @param {HeaderData} data - saved data to merger with current block
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
merge(data) {
|
|
243
|
+
this.data = {
|
|
244
|
+
text: this.data.text + data.text,
|
|
245
|
+
level: this.data.level,
|
|
246
|
+
alignment: this.data.alignment
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Validate Text block data:
|
|
252
|
+
* - check for emptiness
|
|
253
|
+
*
|
|
254
|
+
* @param {HeaderData} blockData — data received after saving
|
|
255
|
+
* @returns {boolean} false if saved data is not correct, otherwise true
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
258
|
+
validate(blockData) {
|
|
259
|
+
return blockData.text.trim() !== "";
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Extract Tool's data from the view
|
|
264
|
+
*
|
|
265
|
+
* @param {HTMLHeadingElement} toolsContent - Text tools rendered view
|
|
266
|
+
* @returns {HeaderData} - saved data
|
|
267
|
+
* @public
|
|
268
|
+
*/
|
|
269
|
+
save(toolsContent) {
|
|
270
|
+
return {
|
|
271
|
+
text: toolsContent.innerHTML,
|
|
272
|
+
level: this.currentLevel.number,
|
|
273
|
+
textAlign: this.getTextAlign(toolsContent.className),
|
|
274
|
+
className: toolsContent.className
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Extract textAlign from className
|
|
280
|
+
*
|
|
281
|
+
* @param {string} className - heading element className
|
|
282
|
+
* @returns {TextAlign} textAlign
|
|
283
|
+
*/
|
|
284
|
+
getTextAlign(className) {
|
|
285
|
+
let textAlign = TextAlign.START;
|
|
286
|
+
// Match className with alignment
|
|
287
|
+
this.alignments.forEach(alignment => {
|
|
288
|
+
if (className.includes(`ce-header-text--${alignment.name}`)) {
|
|
289
|
+
textAlign = alignment.name;
|
|
487
290
|
}
|
|
488
|
-
|
|
489
|
-
|
|
291
|
+
});
|
|
292
|
+
return textAlign;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Allow Header to be converted to/from other blocks
|
|
297
|
+
*/
|
|
298
|
+
static get conversionConfig() {
|
|
299
|
+
return {
|
|
300
|
+
export: "text",
|
|
301
|
+
// use 'text' property for other blocks
|
|
302
|
+
import: "text" // fill 'text' property from other block's export string
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Sanitizer Rules
|
|
308
|
+
*/
|
|
309
|
+
static get sanitize() {
|
|
310
|
+
return {
|
|
311
|
+
level: false,
|
|
312
|
+
text: {}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Returns true to notify core that read-only is supported
|
|
318
|
+
*
|
|
319
|
+
* @returns {boolean}
|
|
320
|
+
*/
|
|
321
|
+
static get isReadOnlySupported() {
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Get current Tools`s data
|
|
327
|
+
*
|
|
328
|
+
* @returns {HeaderData} Current data
|
|
329
|
+
* @private
|
|
330
|
+
*/
|
|
331
|
+
get data() {
|
|
332
|
+
this._data.text = this._element.innerHTML;
|
|
333
|
+
this._data.level = this.currentLevel.number;
|
|
334
|
+
this._data.textAlign = this.currentAlignment.name;
|
|
335
|
+
return this._data;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Store data in plugin:
|
|
340
|
+
* - at the this._data property
|
|
341
|
+
* - at the HTML
|
|
342
|
+
*
|
|
343
|
+
* @param {HeaderData} data — data to set
|
|
344
|
+
* @private
|
|
345
|
+
*/
|
|
346
|
+
set data(data) {
|
|
347
|
+
this._data = this.normalizeData(data);
|
|
490
348
|
|
|
491
349
|
/**
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
* @returns {level}
|
|
350
|
+
* If level is set and block in DOM
|
|
351
|
+
* then replace it to a new block
|
|
495
352
|
*/
|
|
496
|
-
|
|
497
|
-
key: "defaultLevel",
|
|
498
|
-
get: function get() {
|
|
499
|
-
var _this7 = this;
|
|
353
|
+
if (data.level !== undefined && this._element.parentNode) {
|
|
500
354
|
/**
|
|
501
|
-
*
|
|
355
|
+
* Create a new tag
|
|
356
|
+
*
|
|
357
|
+
* @type {HTMLHeadingElement}
|
|
502
358
|
*/
|
|
503
|
-
|
|
504
|
-
var userSpecified = this.levels.find(function (levelItem) {
|
|
505
|
-
return levelItem.number === _this7._settings.defaultLevel;
|
|
506
|
-
});
|
|
507
|
-
if (userSpecified) {
|
|
508
|
-
return userSpecified;
|
|
509
|
-
} else {
|
|
510
|
-
console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels");
|
|
511
|
-
}
|
|
512
|
-
}
|
|
359
|
+
const newHeader = this.getTag();
|
|
513
360
|
|
|
514
361
|
/**
|
|
515
|
-
*
|
|
362
|
+
* Save Block's content
|
|
363
|
+
*/
|
|
364
|
+
newHeader.innerHTML = this._element.innerHTML;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Replace blocks
|
|
368
|
+
*/
|
|
369
|
+
this._element.parentNode.replaceChild(newHeader, this._element);
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Save new block to private variable
|
|
516
373
|
*
|
|
517
|
-
* @type {
|
|
374
|
+
* @type {HTMLHeadingElement}
|
|
375
|
+
* @private
|
|
518
376
|
*/
|
|
519
|
-
|
|
377
|
+
this._element = newHeader;
|
|
520
378
|
}
|
|
521
379
|
|
|
522
380
|
/**
|
|
523
|
-
*
|
|
524
|
-
* @property {number} number - level number
|
|
525
|
-
* @property {string} tag - tag corresponds with level number
|
|
526
|
-
* @property {string} svg - icon
|
|
381
|
+
* If data.text was passed then update block's content
|
|
527
382
|
*/
|
|
383
|
+
if (data.text !== undefined) {
|
|
384
|
+
this._element.innerHTML = this._data.text || "";
|
|
385
|
+
}
|
|
386
|
+
}
|
|
528
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Get tag for target level
|
|
390
|
+
* By default returns second-leveled header
|
|
391
|
+
*
|
|
392
|
+
* @returns {HTMLElement}
|
|
393
|
+
*/
|
|
394
|
+
getTag() {
|
|
529
395
|
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* @returns {level[]}
|
|
396
|
+
* Create element for current Block's level
|
|
533
397
|
*/
|
|
534
|
-
|
|
535
|
-
key: "levels",
|
|
536
|
-
get: function get() {
|
|
537
|
-
var _this8 = this;
|
|
538
|
-
var availableLevels = [{
|
|
539
|
-
number: 1,
|
|
540
|
-
tag: "H1",
|
|
541
|
-
svg: '<svg width="16" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.14 1.494V4.98h4.62V1.494c0-.498.098-.871.293-1.12A.927.927 0 0 1 7.82 0c.322 0 .583.123.782.37.2.246.3.62.3 1.124v9.588c0 .503-.101.88-.303 1.128a.957.957 0 0 1-.779.374.921.921 0 0 1-.77-.378c-.193-.251-.29-.626-.29-1.124V6.989H2.14v4.093c0 .503-.1.88-.302 1.128a.957.957 0 0 1-.778.374.921.921 0 0 1-.772-.378C.096 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.285.374A.922.922 0 0 1 1.06 0c.321 0 .582.123.782.37.199.246.299.62.299 1.124zm11.653 9.985V5.27c-1.279.887-2.14 1.33-2.583 1.33a.802.802 0 0 1-.563-.228.703.703 0 0 1-.245-.529c0-.232.08-.402.241-.511.161-.11.446-.25.854-.424.61-.259 1.096-.532 1.462-.818a5.84 5.84 0 0 0 .97-.962c.282-.355.466-.573.552-.655.085-.082.246-.123.483-.123.267 0 .481.093.642.28.161.186.242.443.242.77v7.813c0 .914-.345 1.371-1.035 1.371-.307 0-.554-.093-.74-.28-.187-.186-.28-.461-.28-.825z"/></svg>'
|
|
542
|
-
}, {
|
|
543
|
-
number: 2,
|
|
544
|
-
tag: "H2",
|
|
545
|
-
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm10.99 9.288h3.527c.351 0 .62.072.804.216.185.144.277.34.277.588 0 .22-.073.408-.22.56-.146.154-.368.23-.665.23h-4.972c-.338 0-.601-.093-.79-.28a.896.896 0 0 1-.284-.659c0-.162.06-.377.182-.645s.255-.478.399-.631a38.617 38.617 0 0 1 1.621-1.598c.482-.444.827-.735 1.034-.875.369-.261.676-.523.922-.787.245-.263.432-.534.56-.81.129-.278.193-.549.193-.815 0-.288-.069-.546-.206-.773a1.428 1.428 0 0 0-.56-.53 1.618 1.618 0 0 0-.774-.19c-.59 0-1.054.26-1.392.777-.045.068-.12.252-.226.554-.106.302-.225.534-.358.696-.133.162-.328.243-.585.243a.76.76 0 0 1-.56-.223c-.149-.148-.223-.351-.223-.608 0-.31.07-.635.21-.972.139-.338.347-.645.624-.92a3.093 3.093 0 0 1 1.054-.665c.426-.169.924-.253 1.496-.253.69 0 1.277.108 1.764.324.315.144.592.343.83.595.24.252.425.544.558.875.133.33.2.674.2 1.03 0 .558-.14 1.066-.416 1.523-.277.457-.56.815-.848 1.074-.288.26-.771.666-1.45 1.22-.677.554-1.142.984-1.394 1.29a3.836 3.836 0 0 0-.331.44z"/></svg>'
|
|
546
|
-
}, {
|
|
547
|
-
number: 3,
|
|
548
|
-
tag: "H3",
|
|
549
|
-
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm11.61 4.919c.418 0 .778-.123 1.08-.368.301-.245.452-.597.452-1.055 0-.35-.12-.65-.36-.902-.241-.252-.566-.378-.974-.378-.277 0-.505.038-.684.116a1.1 1.1 0 0 0-.426.306 2.31 2.31 0 0 0-.296.49c-.093.2-.178.388-.255.565a.479.479 0 0 1-.245.225.965.965 0 0 1-.409.081.706.706 0 0 1-.5-.22c-.152-.148-.228-.345-.228-.59 0-.236.071-.484.214-.745a2.72 2.72 0 0 1 .627-.746 3.149 3.149 0 0 1 1.024-.568 4.122 4.122 0 0 1 1.368-.214c.44 0 .842.06 1.205.18.364.12.679.294.947.52.267.228.47.49.606.79.136.3.204.622.204.967 0 .454-.099.843-.296 1.168-.198.324-.48.64-.848.95.354.19.653.408.895.653.243.245.426.516.548.813.123.298.184.619.184.964 0 .413-.083.812-.248 1.198-.166.386-.41.73-.732 1.031a3.49 3.49 0 0 1-1.147.708c-.443.17-.932.256-1.467.256a3.512 3.512 0 0 1-1.464-.293 3.332 3.332 0 0 1-1.699-1.64c-.142-.314-.214-.573-.214-.777 0-.263.085-.475.255-.636a.89.89 0 0 1 .637-.242c.127 0 .25.037.367.112a.53.53 0 0 1 .232.27c.236.63.489 1.099.759 1.405.27.306.65.46 1.14.46a1.714 1.714 0 0 0 1.46-.824c.17-.273.256-.588.256-.947 0-.53-.145-.947-.436-1.249-.29-.302-.694-.453-1.212-.453-.09 0-.231.01-.422.028-.19.018-.313.027-.367.027-.25 0-.443-.062-.579-.187-.136-.125-.204-.299-.204-.521 0-.218.081-.394.245-.528.163-.134.406-.2.728-.2h.28z"/></svg>'
|
|
550
|
-
}, {
|
|
551
|
-
number: 4,
|
|
552
|
-
tag: "H4",
|
|
553
|
-
svg: '<svg width="20" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm13.003 10.09v-1.252h-3.38c-.427 0-.746-.097-.96-.29-.213-.193-.32-.456-.32-.788 0-.085.016-.171.048-.259.031-.088.078-.18.141-.276.063-.097.128-.19.195-.28.068-.09.15-.2.25-.33l3.568-4.774a5.44 5.44 0 0 1 .576-.683.763.763 0 0 1 .542-.212c.682 0 1.023.39 1.023 1.171v5.212h.29c.346 0 .623.047.832.142.208.094.313.3.313.62 0 .26-.086.45-.256.568-.17.12-.427.179-.768.179h-.41v1.252c0 .346-.077.603-.23.771-.152.168-.356.253-.612.253a.78.78 0 0 1-.61-.26c-.154-.173-.232-.427-.232-.764zm-2.895-2.76h2.895V4.91L12.26 8.823z"/></svg>'
|
|
554
|
-
}, {
|
|
555
|
-
number: 5,
|
|
556
|
-
tag: "H5",
|
|
557
|
-
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm14.16 2.645h-3.234l-.388 2.205c.644-.344 1.239-.517 1.783-.517.436 0 .843.082 1.222.245.38.164.712.39.998.677.286.289.51.63.674 1.025.163.395.245.82.245 1.273 0 .658-.148 1.257-.443 1.797-.295.54-.72.97-1.276 1.287-.556.318-1.197.477-1.923.477-.813 0-1.472-.15-1.978-.45-.506-.3-.865-.643-1.076-1.031-.21-.388-.316-.727-.316-1.018 0-.177.073-.345.22-.504a.725.725 0 0 1 .556-.238c.381 0 .665.22.85.66.182.404.427.719.736.943.309.225.654.337 1.035.337.35 0 .656-.09.919-.272.263-.182.466-.431.61-.749.142-.318.214-.678.214-1.082 0-.436-.078-.808-.232-1.117a1.607 1.607 0 0 0-.62-.69 1.674 1.674 0 0 0-.864-.229c-.39 0-.67.048-.837.143-.168.095-.41.262-.725.5-.316.239-.576.358-.78.358a.843.843 0 0 1-.592-.242c-.173-.16-.259-.344-.259-.548 0-.022.025-.177.075-.463l.572-3.26c.063-.39.181-.675.354-.852.172-.177.454-.265.844-.265h3.595c.708 0 1.062.27 1.062.81a.711.711 0 0 1-.26.572c-.172.145-.426.218-.762.218z"/></svg>'
|
|
558
|
-
}, {
|
|
559
|
-
number: 6,
|
|
560
|
-
tag: "H6",
|
|
561
|
-
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zM12.53 7.058a3.093 3.093 0 0 1 1.004-.814 2.734 2.734 0 0 1 1.214-.264c.43 0 .827.08 1.19.24.365.161.684.39.957.686.274.296.485.645.635 1.048a3.6 3.6 0 0 1 .223 1.262c0 .637-.145 1.216-.437 1.736-.292.52-.699.926-1.221 1.218-.522.292-1.114.438-1.774.438-.76 0-1.416-.186-1.967-.557-.552-.37-.974-.919-1.265-1.645-.292-.726-.438-1.613-.438-2.662 0-.855.088-1.62.265-2.293.176-.674.43-1.233.76-1.676.33-.443.73-.778 1.2-1.004.47-.226 1.006-.339 1.608-.339.579 0 1.089.113 1.53.34.44.225.773.506.997.84.224.335.335.656.335.964 0 .185-.07.354-.21.505a.698.698 0 0 1-.536.227.874.874 0 0 1-.529-.18 1.039 1.039 0 0 1-.36-.498 1.42 1.42 0 0 0-.495-.655 1.3 1.3 0 0 0-.786-.247c-.24 0-.479.069-.716.207a1.863 1.863 0 0 0-.6.56c-.33.479-.525 1.333-.584 2.563zm1.832 4.213c.456 0 .834-.186 1.133-.56.298-.373.447-.862.447-1.468 0-.412-.07-.766-.21-1.062a1.584 1.584 0 0 0-.577-.678 1.47 1.47 0 0 0-.807-.234c-.28 0-.548.074-.804.224-.255.149-.461.365-.617.647a2.024 2.024 0 0 0-.234.994c0 .61.158 1.12.475 1.527.316.407.714.61 1.194.61z"/></svg>'
|
|
562
|
-
}];
|
|
563
|
-
return this._settings.levels ? availableLevels.filter(function (l) {
|
|
564
|
-
return _this8._settings.levels.includes(l.number);
|
|
565
|
-
}) : availableLevels;
|
|
566
|
-
}
|
|
398
|
+
const tag = document.createElement(this.currentLevel.tag);
|
|
567
399
|
|
|
568
400
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
* @param {HTMLPasteEvent} event - event with pasted content
|
|
401
|
+
* Add text to block
|
|
572
402
|
*/
|
|
573
|
-
|
|
574
|
-
key: "onPaste",
|
|
575
|
-
value: function onPaste(event) {
|
|
576
|
-
var content = event.detail.data;
|
|
403
|
+
tag.innerHTML = this._data.text || "";
|
|
577
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Add styles class from typography
|
|
407
|
+
*/
|
|
408
|
+
if (this.typography) {
|
|
409
|
+
const component = this.currentLevel.tag.toLowerCase();
|
|
410
|
+
const typographyConfig = this.typography[component];
|
|
411
|
+
tag.classList.add(typographyConfig.className);
|
|
412
|
+
} else {
|
|
578
413
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
* @type {number}
|
|
414
|
+
* Add styles class
|
|
582
415
|
*/
|
|
583
|
-
|
|
584
|
-
switch (content.tagName) {
|
|
585
|
-
case "H1":
|
|
586
|
-
level = 1;
|
|
587
|
-
break;
|
|
588
|
-
case "H2":
|
|
589
|
-
level = 2;
|
|
590
|
-
break;
|
|
591
|
-
case "H3":
|
|
592
|
-
level = 3;
|
|
593
|
-
break;
|
|
594
|
-
case "H4":
|
|
595
|
-
level = 4;
|
|
596
|
-
break;
|
|
597
|
-
case "H5":
|
|
598
|
-
level = 5;
|
|
599
|
-
break;
|
|
600
|
-
case "H6":
|
|
601
|
-
level = 6;
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
if (this._settings.levels) {
|
|
605
|
-
// Fallback to nearest level when specified not available
|
|
606
|
-
level = this._settings.levels.reduce(function (prevLevel, currLevel) {
|
|
607
|
-
return Math.abs(currLevel - level) < Math.abs(prevLevel - level) ? currLevel : prevLevel;
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
this.data = {
|
|
611
|
-
level: level,
|
|
612
|
-
text: content.innerHTML
|
|
613
|
-
};
|
|
416
|
+
tag.classList.add(this._CSS.wrapper);
|
|
614
417
|
}
|
|
615
418
|
|
|
616
419
|
/**
|
|
617
|
-
*
|
|
618
|
-
* Provides configuration to handle H1-H6 tags.
|
|
619
|
-
*
|
|
620
|
-
* @returns {{handler: (function(HTMLElement): {text: string}), tags: string[]}}
|
|
420
|
+
* Add Alignment class
|
|
621
421
|
*/
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
422
|
+
this.alignments.forEach(alignment => {
|
|
423
|
+
const textAlignClass = `ce-header-text--${alignment.name}`;
|
|
424
|
+
if (alignment.name === this._data.textAlign) {
|
|
425
|
+
tag.classList.add(textAlignClass);
|
|
426
|
+
} else {
|
|
427
|
+
tag.classList.remove(textAlignClass);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Make tag editable
|
|
433
|
+
*/
|
|
434
|
+
tag.contentEditable = this.readOnly ? "false" : "true";
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Add Placeholder
|
|
438
|
+
*/
|
|
439
|
+
tag.dataset["placeholder"] = this.api.i18n.t(this._settings.placeholder || "");
|
|
440
|
+
return tag;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Get current level
|
|
445
|
+
*
|
|
446
|
+
* @returns {level}
|
|
447
|
+
*/
|
|
448
|
+
get currentLevel() {
|
|
449
|
+
let level = this.levels.find(levelItem => levelItem.number === this._data.level);
|
|
450
|
+
if (!level) {
|
|
451
|
+
level = this.defaultLevel;
|
|
452
|
+
}
|
|
453
|
+
return level;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Get current alignment
|
|
458
|
+
*
|
|
459
|
+
* @returns {alignment}
|
|
460
|
+
*/
|
|
461
|
+
get currentAlignment() {
|
|
462
|
+
let alignment = this.alignments.find(alignment => alignment.name === this._data.textAlign);
|
|
463
|
+
if (!alignment) {
|
|
464
|
+
alignment = {
|
|
465
|
+
name: TextAlign.START,
|
|
466
|
+
svg: ALIGNMENT_ICONS.start
|
|
629
467
|
};
|
|
630
468
|
}
|
|
469
|
+
return alignment;
|
|
470
|
+
}
|
|
631
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Return default level
|
|
474
|
+
*
|
|
475
|
+
* @returns {level}
|
|
476
|
+
*/
|
|
477
|
+
get defaultLevel() {
|
|
632
478
|
/**
|
|
633
|
-
*
|
|
479
|
+
* User can specify own default level value
|
|
634
480
|
*/
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
481
|
+
if (this._settings.defaultLevel) {
|
|
482
|
+
const userSpecified = this.levels.find(levelItem => {
|
|
483
|
+
return levelItem.number === this._settings.defaultLevel;
|
|
484
|
+
});
|
|
485
|
+
if (userSpecified) {
|
|
486
|
+
return userSpecified;
|
|
487
|
+
} else {
|
|
488
|
+
console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels");
|
|
489
|
+
}
|
|
642
490
|
}
|
|
643
491
|
|
|
644
492
|
/**
|
|
645
|
-
*
|
|
493
|
+
* With no additional options, there will be H2 by default
|
|
646
494
|
*
|
|
647
|
-
* @
|
|
495
|
+
* @type {level}
|
|
648
496
|
*/
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
497
|
+
return this.levels[1];
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* @typedef {object} level
|
|
502
|
+
* @property {number} number - level number
|
|
503
|
+
* @property {string} tag - tag corresponds with level number
|
|
504
|
+
* @property {string} svg - icon
|
|
505
|
+
*/
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Available header levels
|
|
509
|
+
*
|
|
510
|
+
* @returns {level[]}
|
|
511
|
+
*/
|
|
512
|
+
get levels() {
|
|
513
|
+
const availableLevels = [{
|
|
514
|
+
number: 1,
|
|
515
|
+
tag: "H1",
|
|
516
|
+
svg: '<svg width="16" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.14 1.494V4.98h4.62V1.494c0-.498.098-.871.293-1.12A.927.927 0 0 1 7.82 0c.322 0 .583.123.782.37.2.246.3.62.3 1.124v9.588c0 .503-.101.88-.303 1.128a.957.957 0 0 1-.779.374.921.921 0 0 1-.77-.378c-.193-.251-.29-.626-.29-1.124V6.989H2.14v4.093c0 .503-.1.88-.302 1.128a.957.957 0 0 1-.778.374.921.921 0 0 1-.772-.378C.096 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.285.374A.922.922 0 0 1 1.06 0c.321 0 .582.123.782.37.199.246.299.62.299 1.124zm11.653 9.985V5.27c-1.279.887-2.14 1.33-2.583 1.33a.802.802 0 0 1-.563-.228.703.703 0 0 1-.245-.529c0-.232.08-.402.241-.511.161-.11.446-.25.854-.424.61-.259 1.096-.532 1.462-.818a5.84 5.84 0 0 0 .97-.962c.282-.355.466-.573.552-.655.085-.082.246-.123.483-.123.267 0 .481.093.642.28.161.186.242.443.242.77v7.813c0 .914-.345 1.371-1.035 1.371-.307 0-.554-.093-.74-.28-.187-.186-.28-.461-.28-.825z"/></svg>'
|
|
517
|
+
}, {
|
|
518
|
+
number: 2,
|
|
519
|
+
tag: "H2",
|
|
520
|
+
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm10.99 9.288h3.527c.351 0 .62.072.804.216.185.144.277.34.277.588 0 .22-.073.408-.22.56-.146.154-.368.23-.665.23h-4.972c-.338 0-.601-.093-.79-.28a.896.896 0 0 1-.284-.659c0-.162.06-.377.182-.645s.255-.478.399-.631a38.617 38.617 0 0 1 1.621-1.598c.482-.444.827-.735 1.034-.875.369-.261.676-.523.922-.787.245-.263.432-.534.56-.81.129-.278.193-.549.193-.815 0-.288-.069-.546-.206-.773a1.428 1.428 0 0 0-.56-.53 1.618 1.618 0 0 0-.774-.19c-.59 0-1.054.26-1.392.777-.045.068-.12.252-.226.554-.106.302-.225.534-.358.696-.133.162-.328.243-.585.243a.76.76 0 0 1-.56-.223c-.149-.148-.223-.351-.223-.608 0-.31.07-.635.21-.972.139-.338.347-.645.624-.92a3.093 3.093 0 0 1 1.054-.665c.426-.169.924-.253 1.496-.253.69 0 1.277.108 1.764.324.315.144.592.343.83.595.24.252.425.544.558.875.133.33.2.674.2 1.03 0 .558-.14 1.066-.416 1.523-.277.457-.56.815-.848 1.074-.288.26-.771.666-1.45 1.22-.677.554-1.142.984-1.394 1.29a3.836 3.836 0 0 0-.331.44z"/></svg>'
|
|
521
|
+
}, {
|
|
522
|
+
number: 3,
|
|
523
|
+
tag: "H3",
|
|
524
|
+
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm11.61 4.919c.418 0 .778-.123 1.08-.368.301-.245.452-.597.452-1.055 0-.35-.12-.65-.36-.902-.241-.252-.566-.378-.974-.378-.277 0-.505.038-.684.116a1.1 1.1 0 0 0-.426.306 2.31 2.31 0 0 0-.296.49c-.093.2-.178.388-.255.565a.479.479 0 0 1-.245.225.965.965 0 0 1-.409.081.706.706 0 0 1-.5-.22c-.152-.148-.228-.345-.228-.59 0-.236.071-.484.214-.745a2.72 2.72 0 0 1 .627-.746 3.149 3.149 0 0 1 1.024-.568 4.122 4.122 0 0 1 1.368-.214c.44 0 .842.06 1.205.18.364.12.679.294.947.52.267.228.47.49.606.79.136.3.204.622.204.967 0 .454-.099.843-.296 1.168-.198.324-.48.64-.848.95.354.19.653.408.895.653.243.245.426.516.548.813.123.298.184.619.184.964 0 .413-.083.812-.248 1.198-.166.386-.41.73-.732 1.031a3.49 3.49 0 0 1-1.147.708c-.443.17-.932.256-1.467.256a3.512 3.512 0 0 1-1.464-.293 3.332 3.332 0 0 1-1.699-1.64c-.142-.314-.214-.573-.214-.777 0-.263.085-.475.255-.636a.89.89 0 0 1 .637-.242c.127 0 .25.037.367.112a.53.53 0 0 1 .232.27c.236.63.489 1.099.759 1.405.27.306.65.46 1.14.46a1.714 1.714 0 0 0 1.46-.824c.17-.273.256-.588.256-.947 0-.53-.145-.947-.436-1.249-.29-.302-.694-.453-1.212-.453-.09 0-.231.01-.422.028-.19.018-.313.027-.367.027-.25 0-.443-.062-.579-.187-.136-.125-.204-.299-.204-.521 0-.218.081-.394.245-.528.163-.134.406-.2.728-.2h.28z"/></svg>'
|
|
525
|
+
}, {
|
|
526
|
+
number: 4,
|
|
527
|
+
tag: "H4",
|
|
528
|
+
svg: '<svg width="20" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm13.003 10.09v-1.252h-3.38c-.427 0-.746-.097-.96-.29-.213-.193-.32-.456-.32-.788 0-.085.016-.171.048-.259.031-.088.078-.18.141-.276.063-.097.128-.19.195-.28.068-.09.15-.2.25-.33l3.568-4.774a5.44 5.44 0 0 1 .576-.683.763.763 0 0 1 .542-.212c.682 0 1.023.39 1.023 1.171v5.212h.29c.346 0 .623.047.832.142.208.094.313.3.313.62 0 .26-.086.45-.256.568-.17.12-.427.179-.768.179h-.41v1.252c0 .346-.077.603-.23.771-.152.168-.356.253-.612.253a.78.78 0 0 1-.61-.26c-.154-.173-.232-.427-.232-.764zm-2.895-2.76h2.895V4.91L12.26 8.823z"/></svg>'
|
|
529
|
+
}, {
|
|
530
|
+
number: 5,
|
|
531
|
+
tag: "H5",
|
|
532
|
+
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zm14.16 2.645h-3.234l-.388 2.205c.644-.344 1.239-.517 1.783-.517.436 0 .843.082 1.222.245.38.164.712.39.998.677.286.289.51.63.674 1.025.163.395.245.82.245 1.273 0 .658-.148 1.257-.443 1.797-.295.54-.72.97-1.276 1.287-.556.318-1.197.477-1.923.477-.813 0-1.472-.15-1.978-.45-.506-.3-.865-.643-1.076-1.031-.21-.388-.316-.727-.316-1.018 0-.177.073-.345.22-.504a.725.725 0 0 1 .556-.238c.381 0 .665.22.85.66.182.404.427.719.736.943.309.225.654.337 1.035.337.35 0 .656-.09.919-.272.263-.182.466-.431.61-.749.142-.318.214-.678.214-1.082 0-.436-.078-.808-.232-1.117a1.607 1.607 0 0 0-.62-.69 1.674 1.674 0 0 0-.864-.229c-.39 0-.67.048-.837.143-.168.095-.41.262-.725.5-.316.239-.576.358-.78.358a.843.843 0 0 1-.592-.242c-.173-.16-.259-.344-.259-.548 0-.022.025-.177.075-.463l.572-3.26c.063-.39.181-.675.354-.852.172-.177.454-.265.844-.265h3.595c.708 0 1.062.27 1.062.81a.711.711 0 0 1-.26.572c-.172.145-.426.218-.762.218z"/></svg>'
|
|
533
|
+
}, {
|
|
534
|
+
number: 6,
|
|
535
|
+
tag: "H6",
|
|
536
|
+
svg: '<svg width="18" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M2.152 1.494V4.98h4.646V1.494c0-.498.097-.871.293-1.12A.934.934 0 0 1 7.863 0c.324 0 .586.123.786.37.2.246.301.62.301 1.124v9.588c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378c-.194-.251-.29-.626-.29-1.124V6.989H2.152v4.093c0 .503-.101.88-.304 1.128a.964.964 0 0 1-.783.374.928.928 0 0 1-.775-.378C.097 11.955 0 11.58 0 11.082V1.494C0 .996.095.623.286.374A.929.929 0 0 1 1.066 0c.323 0 .585.123.786.37.2.246.3.62.3 1.124zM12.53 7.058a3.093 3.093 0 0 1 1.004-.814 2.734 2.734 0 0 1 1.214-.264c.43 0 .827.08 1.19.24.365.161.684.39.957.686.274.296.485.645.635 1.048a3.6 3.6 0 0 1 .223 1.262c0 .637-.145 1.216-.437 1.736-.292.52-.699.926-1.221 1.218-.522.292-1.114.438-1.774.438-.76 0-1.416-.186-1.967-.557-.552-.37-.974-.919-1.265-1.645-.292-.726-.438-1.613-.438-2.662 0-.855.088-1.62.265-2.293.176-.674.43-1.233.76-1.676.33-.443.73-.778 1.2-1.004.47-.226 1.006-.339 1.608-.339.579 0 1.089.113 1.53.34.44.225.773.506.997.84.224.335.335.656.335.964 0 .185-.07.354-.21.505a.698.698 0 0 1-.536.227.874.874 0 0 1-.529-.18 1.039 1.039 0 0 1-.36-.498 1.42 1.42 0 0 0-.495-.655 1.3 1.3 0 0 0-.786-.247c-.24 0-.479.069-.716.207a1.863 1.863 0 0 0-.6.56c-.33.479-.525 1.333-.584 2.563zm1.832 4.213c.456 0 .834-.186 1.133-.56.298-.373.447-.862.447-1.468 0-.412-.07-.766-.21-1.062a1.584 1.584 0 0 0-.577-.678 1.47 1.47 0 0 0-.807-.234c-.28 0-.548.074-.804.224-.255.149-.461.365-.617.647a2.024 2.024 0 0 0-.234.994c0 .61.158 1.12.475 1.527.316.407.714.61 1.194.61z"/></svg>'
|
|
537
|
+
}];
|
|
538
|
+
return this._settings.levels ? availableLevels.filter(l => this._settings.levels.includes(l.number)) : availableLevels;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Handle H1-H6 tags on paste to substitute it with header Tool
|
|
543
|
+
*
|
|
544
|
+
* @param {HTMLPasteEvent} event - event with pasted content
|
|
545
|
+
*/
|
|
546
|
+
onPaste(event) {
|
|
547
|
+
const content = event.detail.data;
|
|
661
548
|
|
|
662
549
|
/**
|
|
663
|
-
*
|
|
664
|
-
* icon - Tool icon's SVG
|
|
665
|
-
* title - title to show in toolbox
|
|
550
|
+
* Define default level value
|
|
666
551
|
*
|
|
667
|
-
* @
|
|
552
|
+
* @type {number}
|
|
668
553
|
*/
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
554
|
+
let level = this.defaultLevel.number;
|
|
555
|
+
switch (content.tagName) {
|
|
556
|
+
case "H1":
|
|
557
|
+
level = 1;
|
|
558
|
+
break;
|
|
559
|
+
case "H2":
|
|
560
|
+
level = 2;
|
|
561
|
+
break;
|
|
562
|
+
case "H3":
|
|
563
|
+
level = 3;
|
|
564
|
+
break;
|
|
565
|
+
case "H4":
|
|
566
|
+
level = 4;
|
|
567
|
+
break;
|
|
568
|
+
case "H5":
|
|
569
|
+
level = 5;
|
|
570
|
+
break;
|
|
571
|
+
case "H6":
|
|
572
|
+
level = 6;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
if (this._settings.levels) {
|
|
576
|
+
// Fallback to nearest level when specified not available
|
|
577
|
+
level = this._settings.levels.reduce((prevLevel, currLevel) => {
|
|
578
|
+
return Math.abs(currLevel - level) < Math.abs(prevLevel - level) ? currLevel : prevLevel;
|
|
579
|
+
});
|
|
676
580
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
581
|
+
this.data = {
|
|
582
|
+
level,
|
|
583
|
+
text: content.innerHTML
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Used by Editor.js paste handling API.
|
|
589
|
+
* Provides configuration to handle H1-H6 tags.
|
|
590
|
+
*
|
|
591
|
+
* @returns {{handler: (function(HTMLElement): {text: string}), tags: string[]}}
|
|
592
|
+
*/
|
|
593
|
+
static get pasteConfig() {
|
|
594
|
+
return {
|
|
595
|
+
tags: ["H1", "H2", "H3", "H4", "H5", "H6"]
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Get Tool toolbox settings
|
|
601
|
+
* icon - Tool icon's SVG
|
|
602
|
+
* title - title to show in toolbox
|
|
603
|
+
*
|
|
604
|
+
* @returns {{icon: string, title: string}}
|
|
605
|
+
*/
|
|
606
|
+
static get toolbox() {
|
|
607
|
+
return {
|
|
608
|
+
icon: '<svg width="10" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 14">\n' + ' <path d="M7.6 8.15H2.25v4.525a1.125 1.125 0 0 1-2.25 0V1.125a1.125 1.125 0 1 1 2.25 0V5.9H7.6V1.125a1.125 1.125 0 0 1 2.25 0v11.55a1.125 1.125 0 0 1-2.25 0V8.15z"/>\n' + "</svg>",
|
|
609
|
+
title: "Heading"
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
export default Header;
|
|
680
614
|
|
|
681
615
|
//# sourceMappingURL=index.js.map
|