@webiny/app-admin 0.0.0-mt-1

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.
Files changed (357) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -0
  3. package/assets/icons/add-18px.svg +3 -0
  4. package/assets/icons/arrow_drop_down-24px.svg +4 -0
  5. package/assets/icons/attach_file_black_24dp.svg +1 -0
  6. package/assets/icons/baseline-menu-24px.svg +4 -0
  7. package/assets/icons/baseline-notification_important-24px.svg +4 -0
  8. package/assets/icons/baseline-security-24px.svg +4 -0
  9. package/assets/icons/filter-24px.svg +8 -0
  10. package/assets/icons/github-brands.svg +1 -0
  11. package/assets/icons/highlight-24px.svg +1 -0
  12. package/assets/icons/icon-community.svg +16 -0
  13. package/assets/icons/icon-documentation.svg +16 -0
  14. package/assets/icons/info.svg +1 -0
  15. package/assets/icons/insert_drive_file-24px.svg +1 -0
  16. package/assets/icons/insert_photo-24px.svg +1 -0
  17. package/assets/icons/label-24px.svg +1 -0
  18. package/assets/icons/round-account_circle-24px.svg +1 -0
  19. package/assets/icons/round-add-24px.svg +16 -0
  20. package/assets/icons/round-arrow_drop_down-24px.svg +1 -0
  21. package/assets/icons/round-chevron_right-24px.svg +12 -0
  22. package/assets/icons/round-feedback-24px.svg +54 -0
  23. package/assets/icons/round-help-24px.svg +1 -0
  24. package/assets/icons/round-invert_colors-24px.svg +52 -0
  25. package/assets/icons/round-keyboard_arrow_down-24px.svg +16 -0
  26. package/assets/icons/round-keyboard_arrow_up-24px.svg +16 -0
  27. package/assets/icons/round-lock_open-24px.svg +60 -0
  28. package/assets/icons/round-more_vert-24px.svg +12 -0
  29. package/assets/icons/round-open_in_new-24px.svg +44 -0
  30. package/assets/icons/round-settings-24px.svg +4 -0
  31. package/assets/icons/search-24px.svg +20 -0
  32. package/assets/icons/slack-logo.svg +1 -0
  33. package/assets/icons/today-24px.svg +1 -0
  34. package/assets/icons/touch_app.svg +1 -0
  35. package/assets/images/arr.png +0 -0
  36. package/assets/images/arr_2.png +0 -0
  37. package/assets/images/header_bg.jpg +0 -0
  38. package/assets/images/icons.png +0 -0
  39. package/assets/images/icons_retina.png +0 -0
  40. package/assets/images/logo.png +0 -0
  41. package/assets/images/logo_orange.png +0 -0
  42. package/assets/images/public/bg-login.png +0 -0
  43. package/assets/images/public/favicon.ico +0 -0
  44. package/assets/images/public/logo_orange.png +0 -0
  45. package/assets/images/public/preloader_2.png +0 -0
  46. package/assets/images/swich.png +0 -0
  47. package/assets/images/table_img.jpg +0 -0
  48. package/assets/images/webiny-logo.svg +20 -0
  49. package/assets/images/webiny-orange-logo.svg +20 -0
  50. package/components/AdminLayout.d.ts +7 -0
  51. package/components/AdminLayout.js +35 -0
  52. package/components/AppInstaller/Sidebar.d.ts +7 -0
  53. package/components/AppInstaller/Sidebar.js +158 -0
  54. package/components/AppInstaller/assets/sign-in-divider.svg +19 -0
  55. package/components/AppInstaller/index.d.ts +5 -0
  56. package/components/AppInstaller/index.js +134 -0
  57. package/components/AppInstaller/styled.d.ts +7 -0
  58. package/components/AppInstaller/styled.js +73 -0
  59. package/components/AppInstaller/useInstaller.d.ts +11 -0
  60. package/components/AppInstaller/useInstaller.js +279 -0
  61. package/components/EmptyView.d.ts +8 -0
  62. package/components/EmptyView.js +56 -0
  63. package/components/FileManager/BottomInfoBar/SupportedFileTypes.d.ts +5 -0
  64. package/components/FileManager/BottomInfoBar/SupportedFileTypes.js +35 -0
  65. package/components/FileManager/BottomInfoBar/UploadStatus.d.ts +5 -0
  66. package/components/FileManager/BottomInfoBar/UploadStatus.js +47 -0
  67. package/components/FileManager/BottomInfoBar.d.ts +3 -0
  68. package/components/FileManager/BottomInfoBar.js +42 -0
  69. package/components/FileManager/DropFilesHere.d.ts +8 -0
  70. package/components/FileManager/DropFilesHere.js +58 -0
  71. package/components/FileManager/File.d.ts +18 -0
  72. package/components/FileManager/File.js +129 -0
  73. package/components/FileManager/FileDetails/Name.d.ts +6 -0
  74. package/components/FileManager/FileDetails/Name.js +113 -0
  75. package/components/FileManager/FileDetails/Tags.d.ts +6 -0
  76. package/components/FileManager/FileDetails/Tags.js +241 -0
  77. package/components/FileManager/FileDetails.d.ts +23 -0
  78. package/components/FileManager/FileDetails.js +392 -0
  79. package/components/FileManager/FileManagerContext.d.ts +23 -0
  80. package/components/FileManager/FileManagerContext.js +174 -0
  81. package/components/FileManager/FileManagerView.d.ts +23 -0
  82. package/components/FileManager/FileManagerView.js +632 -0
  83. package/components/FileManager/LeftSidebar.d.ts +8 -0
  84. package/components/FileManager/LeftSidebar.js +95 -0
  85. package/components/FileManager/NoPermissionView.d.ts +3 -0
  86. package/components/FileManager/NoPermissionView.js +70 -0
  87. package/components/FileManager/NoResults.d.ts +2 -0
  88. package/components/FileManager/NoResults.js +13 -0
  89. package/components/FileManager/getFileTypePlugin.d.ts +1 -0
  90. package/components/FileManager/getFileTypePlugin.js +27 -0
  91. package/components/FileManager/getFileUploader.d.ts +2 -0
  92. package/components/FileManager/getFileUploader.js +10 -0
  93. package/components/FileManager/graphql.d.ts +6 -0
  94. package/components/FileManager/graphql.js +17 -0
  95. package/components/FileManager/icons/content_copy-black-24px.svg +1 -0
  96. package/components/FileManager/icons/delete.svg +12 -0
  97. package/components/FileManager/icons/privacy_tip-24px.svg +10 -0
  98. package/components/FileManager/icons/round-check_box-24px.svg +4 -0
  99. package/components/FileManager/icons/round-check_box_outline_blank-24px.svg +4 -0
  100. package/components/FileManager/icons/round-cloud_download-24px.svg +4 -0
  101. package/components/FileManager/icons/round-cloud_upload-24px.svg +4 -0
  102. package/components/FileManager/icons/round-description-24px.svg +4 -0
  103. package/components/FileManager/icons/round-edit-24px.svg +4 -0
  104. package/components/FileManager/icons/round-info-24px.svg +4 -0
  105. package/components/FileManager/icons/round-label-24px.svg +4 -0
  106. package/components/FileManager/icons/round-more_vert-24px.svg +4 -0
  107. package/components/FileManager/icons/round-search-24px.svg +20 -0
  108. package/components/FileManager/outputFileSelectionError.d.ts +2 -0
  109. package/components/FileManager/outputFileSelectionError.js +39 -0
  110. package/components/FileManager.d.ts +18 -0
  111. package/components/FileManager.js +133 -0
  112. package/components/FloatingActionButton.d.ts +3 -0
  113. package/components/FloatingActionButton.js +17 -0
  114. package/components/MultiImageUpload.d.ts +4 -0
  115. package/components/MultiImageUpload.js +20 -0
  116. package/components/OverlayLayout/OverlayLayout.d.ts +25 -0
  117. package/components/OverlayLayout/OverlayLayout.js +159 -0
  118. package/components/OverlayLayout/icons/close.svg +13 -0
  119. package/components/OverlayLayout/icons/navigate_before.svg +16 -0
  120. package/components/OverlayLayout/index.d.ts +1 -0
  121. package/components/OverlayLayout/index.js +1 -0
  122. package/components/Permissions/Permissions.d.ts +7 -0
  123. package/components/Permissions/Permissions.js +37 -0
  124. package/components/Permissions/StyledComponents.d.ts +6 -0
  125. package/components/Permissions/StyledComponents.js +19 -0
  126. package/components/Permissions/index.d.ts +2 -0
  127. package/components/Permissions/index.js +2 -0
  128. package/components/RichTextEditor/RichTextEditor.d.ts +3 -0
  129. package/components/RichTextEditor/RichTextEditor.js +15 -0
  130. package/components/RichTextEditor/index.d.ts +2 -0
  131. package/components/RichTextEditor/index.js +2 -0
  132. package/components/RichTextEditor/styles.scss +64 -0
  133. package/components/RichTextEditor/tools/header/index.d.ts +228 -0
  134. package/components/RichTextEditor/tools/header/index.js +731 -0
  135. package/components/RichTextEditor/tools/header/styles.scss +48 -0
  136. package/components/RichTextEditor/tools/image/index.d.ts +97 -0
  137. package/components/RichTextEditor/tools/image/index.js +257 -0
  138. package/components/RichTextEditor/tools/image/styles.scss +90 -0
  139. package/components/RichTextEditor/tools/image/svgs.d.ts +6 -0
  140. package/components/RichTextEditor/tools/image/svgs.js +5 -0
  141. package/components/RichTextEditor/tools/image/tunes.d.ts +58 -0
  142. package/components/RichTextEditor/tools/image/tunes.js +134 -0
  143. package/components/RichTextEditor/tools/image/ui.d.ts +111 -0
  144. package/components/RichTextEditor/tools/image/ui.js +281 -0
  145. package/components/RichTextEditor/tools/paragraph/index.d.ts +211 -0
  146. package/components/RichTextEditor/tools/paragraph/index.js +520 -0
  147. package/components/RichTextEditor/tools/paragraph/styles.scss +29 -0
  148. package/components/RichTextEditor/tools/textColor/index.d.ts +58 -0
  149. package/components/RichTextEditor/tools/textColor/index.js +232 -0
  150. package/components/RichTextEditor/tools/textColor/styles.scss +21 -0
  151. package/components/RichTextEditor/tools/utils.d.ts +19 -0
  152. package/components/RichTextEditor/tools/utils.js +24 -0
  153. package/components/SearchUI.d.ts +8 -0
  154. package/components/SearchUI.js +59 -0
  155. package/components/SimpleForm/SimpleForm.d.ts +21 -0
  156. package/components/SimpleForm/SimpleForm.js +75 -0
  157. package/components/SimpleForm/index.d.ts +1 -0
  158. package/components/SimpleForm/index.js +1 -0
  159. package/components/SimpleUI/InputField.d.ts +9 -0
  160. package/components/SimpleUI/InputField.js +97 -0
  161. package/components/SingleImageUpload.d.ts +25 -0
  162. package/components/SingleImageUpload.js +102 -0
  163. package/components/SplitView/SplitView.d.ts +10 -0
  164. package/components/SplitView/SplitView.js +76 -0
  165. package/components/SplitView/index.d.ts +1 -0
  166. package/components/SplitView/index.js +1 -0
  167. package/components/index.d.ts +1 -0
  168. package/components/index.js +1 -0
  169. package/hooks/useConfirmationDialog.d.ts +10 -0
  170. package/hooks/useConfirmationDialog.js +47 -0
  171. package/hooks/useDialog.d.ts +5 -0
  172. package/hooks/useDialog.js +27 -0
  173. package/hooks/useSnackbar.d.ts +4 -0
  174. package/hooks/useSnackbar.js +25 -0
  175. package/package.json +101 -0
  176. package/plugins/FileManagerFileTypePlugin.d.ts +33 -0
  177. package/plugins/FileManagerFileTypePlugin.js +46 -0
  178. package/plugins/MenuPlugin.d.ts +20 -0
  179. package/plugins/MenuPlugin.js +41 -0
  180. package/plugins/PermissionRendererPlugin.d.ts +22 -0
  181. package/plugins/PermissionRendererPlugin.js +41 -0
  182. package/plugins/fileManager/fileDefault.d.ts +3 -0
  183. package/plugins/fileManager/fileDefault.js +20 -0
  184. package/plugins/fileManager/fileImage/DeleteAction.d.ts +3 -0
  185. package/plugins/fileManager/fileImage/DeleteAction.js +62 -0
  186. package/plugins/fileManager/fileImage/EditAction.d.ts +9 -0
  187. package/plugins/fileManager/fileImage/EditAction.js +143 -0
  188. package/plugins/fileManager/fileImage/index.d.ts +3 -0
  189. package/plugins/fileManager/fileImage/index.js +29 -0
  190. package/plugins/fileManager/icons/edit.svg +17 -0
  191. package/plugins/fileManager/icons/round-description-24px.svg +1 -0
  192. package/plugins/fileManager/index.d.ts +2 -0
  193. package/plugins/fileManager/index.js +3 -0
  194. package/plugins/globalSearch/SearchBar.d.ts +3 -0
  195. package/plugins/globalSearch/SearchBar.js +241 -0
  196. package/plugins/globalSearch/SearchBarDropdown.d.ts +5 -0
  197. package/plugins/globalSearch/SearchBarDropdown.js +82 -0
  198. package/plugins/globalSearch/icons/round-search-24px.svg +20 -0
  199. package/plugins/globalSearch/index.d.ts +8 -0
  200. package/plugins/globalSearch/index.js +30 -0
  201. package/plugins/globalSearch/styled.d.ts +9 -0
  202. package/plugins/globalSearch/styled.js +115 -0
  203. package/plugins/index.d.ts +6 -0
  204. package/plugins/index.js +8 -0
  205. package/plugins/logo/Logo.d.ts +22 -0
  206. package/plugins/logo/Logo.js +108 -0
  207. package/plugins/logo/index.d.ts +5 -0
  208. package/plugins/logo/index.js +32 -0
  209. package/plugins/menu/documentation.d.ts +4 -0
  210. package/plugins/menu/documentation.js +16 -0
  211. package/plugins/menu/fileManager.d.ts +4 -0
  212. package/plugins/menu/fileManager.js +64 -0
  213. package/plugins/menu/index.d.ts +6 -0
  214. package/plugins/menu/index.js +24 -0
  215. package/plugins/menu/renderers/MenuGroupRenderer.d.ts +7 -0
  216. package/plugins/menu/renderers/MenuGroupRenderer.js +126 -0
  217. package/plugins/menu/renderers/MenuLinkRenderer.d.ts +7 -0
  218. package/plugins/menu/renderers/MenuLinkRenderer.js +52 -0
  219. package/plugins/menu/renderers/MenuSectionItemRenderer.d.ts +7 -0
  220. package/plugins/menu/renderers/MenuSectionItemRenderer.js +77 -0
  221. package/plugins/menu/renderers/MenuSectionRenderer.d.ts +7 -0
  222. package/plugins/menu/renderers/MenuSectionRenderer.js +51 -0
  223. package/plugins/menu/slack.d.ts +4 -0
  224. package/plugins/menu/slack.js +16 -0
  225. package/plugins/menu/source.d.ts +4 -0
  226. package/plugins/menu/source.js +16 -0
  227. package/plugins/uiLayoutRenderer/index.d.ts +3 -0
  228. package/plugins/uiLayoutRenderer/index.js +63 -0
  229. package/plugins/userMenu/UserMenuElement.d.ts +7 -0
  230. package/plugins/userMenu/UserMenuElement.js +43 -0
  231. package/plugins/userMenu/UserMenuRenderer.d.ts +6 -0
  232. package/plugins/userMenu/UserMenuRenderer.js +47 -0
  233. package/plugins/userMenu/index.d.ts +4 -0
  234. package/plugins/userMenu/index.js +16 -0
  235. package/styles/material-theme-assignments.scss +333 -0
  236. package/styles/material.scss +74 -0
  237. package/styles/theme.scss +43 -0
  238. package/styles.scss +2 -0
  239. package/types.d.ts +100 -0
  240. package/types.js +1 -0
  241. package/ui/UIElement.d.ts +2 -0
  242. package/ui/UIElement.js +1 -0
  243. package/ui/UILayout.d.ts +1 -0
  244. package/ui/UILayout.js +1 -0
  245. package/ui/UIRenderer.d.ts +2 -0
  246. package/ui/UIRenderer.js +1 -0
  247. package/ui/UIView.d.ts +2 -0
  248. package/ui/UIView.js +1 -0
  249. package/ui/elements/AccordionElement.d.ts +27 -0
  250. package/ui/elements/AccordionElement.js +86 -0
  251. package/ui/elements/ButtonElement.d.ts +24 -0
  252. package/ui/elements/ButtonElement.js +78 -0
  253. package/ui/elements/ButtonGroupElement.d.ts +6 -0
  254. package/ui/elements/ButtonGroupElement.js +48 -0
  255. package/ui/elements/GenericElement.d.ts +1 -0
  256. package/ui/elements/GenericElement.js +1 -0
  257. package/ui/elements/LabelElement.d.ts +16 -0
  258. package/ui/elements/LabelElement.js +47 -0
  259. package/ui/elements/NavigationMenuElement.d.ts +32 -0
  260. package/ui/elements/NavigationMenuElement.js +158 -0
  261. package/ui/elements/PanelElement.d.ts +3 -0
  262. package/ui/elements/PanelElement.js +17 -0
  263. package/ui/elements/PlaceholderElement.d.ts +5 -0
  264. package/ui/elements/PlaceholderElement.js +30 -0
  265. package/ui/elements/SmallButtonElement.d.ts +6 -0
  266. package/ui/elements/SmallButtonElement.js +47 -0
  267. package/ui/elements/TypographyElement.d.ts +13 -0
  268. package/ui/elements/TypographyElement.js +49 -0
  269. package/ui/elements/ViewElement.d.ts +1 -0
  270. package/ui/elements/ViewElement.js +1 -0
  271. package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.d.ts +6 -0
  272. package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js +44 -0
  273. package/ui/elements/form/DynamicFieldsetElement.d.ts +42 -0
  274. package/ui/elements/form/DynamicFieldsetElement.js +127 -0
  275. package/ui/elements/form/FileManagerElement/EmptyStateElement.d.ts +4 -0
  276. package/ui/elements/form/FileManagerElement/EmptyStateElement.js +24 -0
  277. package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.d.ts +7 -0
  278. package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js +72 -0
  279. package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.d.ts +13 -0
  280. package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js +95 -0
  281. package/ui/elements/form/FileManagerElement/styled.d.ts +14 -0
  282. package/ui/elements/form/FileManagerElement/styled.js +106 -0
  283. package/ui/elements/form/FileManagerElement.d.ts +24 -0
  284. package/ui/elements/form/FileManagerElement.js +91 -0
  285. package/ui/elements/form/FormElement.d.ts +21 -0
  286. package/ui/elements/form/FormElement.js +45 -0
  287. package/ui/elements/form/FormFieldElement.d.ts +55 -0
  288. package/ui/elements/form/FormFieldElement.js +183 -0
  289. package/ui/elements/form/HiddenElement.d.ts +6 -0
  290. package/ui/elements/form/HiddenElement.js +49 -0
  291. package/ui/elements/form/InputElement.d.ts +6 -0
  292. package/ui/elements/form/InputElement.js +55 -0
  293. package/ui/elements/form/PasswordElement.d.ts +6 -0
  294. package/ui/elements/form/PasswordElement.js +50 -0
  295. package/ui/elements/form/README.md +2 -0
  296. package/ui/elements/form/SelectElement.d.ts +15 -0
  297. package/ui/elements/form/SelectElement.js +71 -0
  298. package/ui/elements/form/TextareaElement.d.ts +15 -0
  299. package/ui/elements/form/TextareaElement.js +56 -0
  300. package/ui/views/AdminView/ContentElement.d.ts +4 -0
  301. package/ui/views/AdminView/ContentElement.js +62 -0
  302. package/ui/views/AdminView/HeaderElement.d.ts +13 -0
  303. package/ui/views/AdminView/HeaderElement.js +111 -0
  304. package/ui/views/AdminView/HeaderSectionCenterElement.d.ts +6 -0
  305. package/ui/views/AdminView/HeaderSectionCenterElement.js +42 -0
  306. package/ui/views/AdminView/HeaderSectionLeftElement.d.ts +6 -0
  307. package/ui/views/AdminView/HeaderSectionLeftElement.js +42 -0
  308. package/ui/views/AdminView/HeaderSectionRightElement.d.ts +6 -0
  309. package/ui/views/AdminView/HeaderSectionRightElement.js +42 -0
  310. package/ui/views/AdminView/components/Dialog.d.ts +2 -0
  311. package/ui/views/AdminView/components/Dialog.js +40 -0
  312. package/ui/views/AdminView/components/Hamburger.d.ts +3 -0
  313. package/ui/views/AdminView/components/Hamburger.js +25 -0
  314. package/ui/views/AdminView/components/Snackbar.d.ts +3 -0
  315. package/ui/views/AdminView/components/Snackbar.js +28 -0
  316. package/ui/views/AdminView.d.ts +12 -0
  317. package/ui/views/AdminView.js +90 -0
  318. package/ui/views/FormView/FormContainerElement.d.ts +12 -0
  319. package/ui/views/FormView/FormContainerElement.js +51 -0
  320. package/ui/views/FormView/FormContentElement.d.ts +3 -0
  321. package/ui/views/FormView/FormContentElement.js +17 -0
  322. package/ui/views/FormView/FormFooterElement.d.ts +6 -0
  323. package/ui/views/FormView/FormFooterElement.js +49 -0
  324. package/ui/views/FormView/FormHeaderElement.d.ts +14 -0
  325. package/ui/views/FormView/FormHeaderElement.js +81 -0
  326. package/ui/views/FormView.d.ts +40 -0
  327. package/ui/views/FormView.js +160 -0
  328. package/ui/views/NavigationView/ContentElement.d.ts +10 -0
  329. package/ui/views/NavigationView/ContentElement.js +86 -0
  330. package/ui/views/NavigationView/FooterElement.d.ts +13 -0
  331. package/ui/views/NavigationView/FooterElement.js +57 -0
  332. package/ui/views/NavigationView/HeaderElement.d.ts +16 -0
  333. package/ui/views/NavigationView/HeaderElement.js +66 -0
  334. package/ui/views/NavigationView/NavigationViewRenderer.d.ts +6 -0
  335. package/ui/views/NavigationView/NavigationViewRenderer.js +38 -0
  336. package/ui/views/NavigationView/Styled.d.ts +7 -0
  337. package/ui/views/NavigationView/Styled.js +47 -0
  338. package/ui/views/NavigationView/legacyMenu.d.ts +22 -0
  339. package/ui/views/NavigationView/legacyMenu.js +1 -0
  340. package/ui/views/NavigationView/useNavigation.d.ts +6 -0
  341. package/ui/views/NavigationView/useNavigation.js +22 -0
  342. package/ui/views/NavigationView.d.ts +26 -0
  343. package/ui/views/NavigationView.js +204 -0
  344. package/ui/views/OverlayView/ContentElement.d.ts +6 -0
  345. package/ui/views/OverlayView/ContentElement.js +42 -0
  346. package/ui/views/OverlayView/HeaderElement.d.ts +24 -0
  347. package/ui/views/OverlayView/HeaderElement.js +115 -0
  348. package/ui/views/OverlayView/HeaderTitleElement.d.ts +13 -0
  349. package/ui/views/OverlayView/HeaderTitleElement.js +54 -0
  350. package/ui/views/OverlayView/useOverlayView.d.ts +6 -0
  351. package/ui/views/OverlayView/useOverlayView.js +38 -0
  352. package/ui/views/OverlayView.d.ts +31 -0
  353. package/ui/views/OverlayView.js +176 -0
  354. package/ui/views/SplitView/SplitViewPanelElement.d.ts +11 -0
  355. package/ui/views/SplitView/SplitViewPanelElement.js +72 -0
  356. package/ui/views/SplitView.d.ts +21 -0
  357. package/ui/views/SplitView.js +142 -0
@@ -0,0 +1,731 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { ALIGNMENTS, ALIGNMENT_ICONS, TextAlign } from "../utils";
5
+
6
+ var Header = /*#__PURE__*/function () {
7
+ /**
8
+ * Render plugin`s main Element and fill it with saved data
9
+ *
10
+ * @param {{data: HeaderData, config: HeaderConfig, api: object}}
11
+ * data — previously saved data
12
+ * config - user config for Tool
13
+ * api - Editor.js API
14
+ * readOnly - read only mode flag
15
+ */
16
+ function Header(_ref) {
17
+ var data = _ref.data,
18
+ config = _ref.config,
19
+ api = _ref.api,
20
+ readOnly = _ref.readOnly;
21
+
22
+ _classCallCheck(this, Header);
23
+
24
+ _defineProperty(this, "api", void 0);
25
+
26
+ _defineProperty(this, "readOnly", void 0);
27
+
28
+ _defineProperty(this, "settingsButtons", void 0);
29
+
30
+ _defineProperty(this, "_CSS", void 0);
31
+
32
+ _defineProperty(this, "_settings", void 0);
33
+
34
+ _defineProperty(this, "_data", void 0);
35
+
36
+ _defineProperty(this, "_element", void 0);
37
+
38
+ _defineProperty(this, "alignments", void 0);
39
+
40
+ _defineProperty(this, "typography", void 0);
41
+
42
+ this.api = api;
43
+ this.readOnly = readOnly;
44
+ this.alignments = ALIGNMENTS;
45
+ /**
46
+ * Import typography from theme
47
+ */
48
+
49
+ this.typography = config.typography || null;
50
+ /**
51
+ * Styles
52
+ *
53
+ * @type {object}
54
+ */
55
+
56
+ this._CSS = {
57
+ block: this.api.styles.block,
58
+ settingsButton: this.api.styles.settingsButton,
59
+ settingsButtonActive: this.api.styles.settingsButtonActive,
60
+ wrapper: "ce-header"
61
+ };
62
+ /**
63
+ * Tool's settings passed from Editor
64
+ *
65
+ * @type {HeaderConfig}
66
+ * @private
67
+ */
68
+
69
+ this._settings = config;
70
+ /**
71
+ * Block's data
72
+ *
73
+ * @type {HeaderData}
74
+ * @private
75
+ */
76
+
77
+ this._data = this.normalizeData(data);
78
+ /**
79
+ * List of settings buttons
80
+ *
81
+ * @type {HTMLElement[]}
82
+ */
83
+
84
+ this.settingsButtons = [];
85
+ /**
86
+ * Main Block wrapper
87
+ *
88
+ * @type {HTMLElement}
89
+ * @private
90
+ */
91
+
92
+ this._element = this.getTag();
93
+ }
94
+ /**
95
+ * Normalize input data
96
+ *
97
+ * @param {HeaderData} data - saved data to process
98
+ *
99
+ * @returns {HeaderData}
100
+ * @private
101
+ */
102
+
103
+
104
+ _createClass(Header, [{
105
+ key: "normalizeData",
106
+ value: function normalizeData(data) {
107
+ var newData = {};
108
+
109
+ if (typeof data !== "object") {
110
+ data = {};
111
+ }
112
+
113
+ newData.text = data.text || "";
114
+ newData.level = parseInt(data.level) || this.defaultLevel.number;
115
+ newData.textAlign = data.textAlign || TextAlign.START;
116
+ return newData;
117
+ }
118
+ /**
119
+ * Return Tool's view
120
+ *
121
+ * @returns {HTMLHeadingElement}
122
+ * @public
123
+ */
124
+
125
+ }, {
126
+ key: "render",
127
+ value: function render() {
128
+ return this._element;
129
+ }
130
+ /**
131
+ * Create Block's settings block
132
+ *
133
+ * @returns {HTMLElement}
134
+ */
135
+
136
+ }, {
137
+ key: "renderSettings",
138
+ value: function renderSettings() {
139
+ var _this = this;
140
+
141
+ var holder = document.createElement("DIV"); // do not add settings button, when only one level is configured
142
+
143
+ if (this.levels.length <= 1) {
144
+ return holder;
145
+ }
146
+ /** Add type selectors */
147
+
148
+
149
+ this.levels.forEach(function (level) {
150
+ var selectTypeButton = document.createElement("SPAN");
151
+ selectTypeButton.classList.add(_this._CSS.settingsButton);
152
+ /**
153
+ * Highlight current level button
154
+ */
155
+
156
+ if (_this.currentLevel.number === level.number) {
157
+ selectTypeButton.classList.add(_this._CSS.settingsButtonActive);
158
+ }
159
+ /**
160
+ * Add SVG icon
161
+ */
162
+
163
+
164
+ selectTypeButton.innerHTML = level.svg;
165
+ /**
166
+ * Save level to its button
167
+ */
168
+
169
+ selectTypeButton.dataset.level = level.number + "";
170
+ /**
171
+ * Set up click handler
172
+ */
173
+
174
+ selectTypeButton.addEventListener("click", function () {
175
+ _this.setLevel(level.number);
176
+ });
177
+ /**
178
+ * Append settings button to holder
179
+ */
180
+
181
+ holder.appendChild(selectTypeButton);
182
+ /**
183
+ * Save settings buttons
184
+ */
185
+
186
+ _this.settingsButtons.push(selectTypeButton);
187
+ });
188
+ /**
189
+ * Add alignment selectors
190
+ * */
191
+
192
+ this.alignments.forEach(function (alignment) {
193
+ var selectTypeButton = document.createElement("SPAN");
194
+ selectTypeButton.classList.add(_this._CSS.settingsButton);
195
+ /**
196
+ * Highlight current level button
197
+ */
198
+
199
+ if (_this.currentAlignment.name === alignment.name) {
200
+ selectTypeButton.classList.add(_this._CSS.settingsButtonActive);
201
+ }
202
+ /**
203
+ * Add SVG icon
204
+ */
205
+
206
+
207
+ selectTypeButton.innerHTML = alignment.svg;
208
+ /**
209
+ * Save alignment to its button
210
+ */
211
+
212
+ selectTypeButton.dataset.textAlign = alignment.name;
213
+ /**
214
+ * Set up click handler
215
+ */
216
+
217
+ selectTypeButton.addEventListener("click", function () {
218
+ _this.setAlignment(alignment);
219
+ });
220
+ /**
221
+ * Append settings button to holder
222
+ */
223
+
224
+ holder.appendChild(selectTypeButton);
225
+ /**
226
+ * Save settings buttons
227
+ */
228
+
229
+ _this.settingsButtons.push(selectTypeButton);
230
+ });
231
+ return holder;
232
+ }
233
+ /**
234
+ * Callback for Block's settings buttons
235
+ *
236
+ * @param {number} level - level to set
237
+ */
238
+
239
+ }, {
240
+ key: "setLevel",
241
+ value: function setLevel(level) {
242
+ var _this2 = this;
243
+
244
+ this.data = {
245
+ level: level,
246
+ text: this.data.text
247
+ };
248
+ /**
249
+ * Highlight button by selected level
250
+ */
251
+
252
+ this.settingsButtons.forEach(function (button) {
253
+ button.classList.toggle(_this2._CSS.settingsButtonActive, parseInt(button.dataset.level) === level);
254
+ });
255
+ }
256
+ /**
257
+ * Callback for Block's settings buttons
258
+ *
259
+ * @param {number} alignment - level to set
260
+ */
261
+
262
+ }, {
263
+ key: "setAlignment",
264
+ value: function setAlignment(alignment) {
265
+ var _this3 = this;
266
+
267
+ this.data = {
268
+ textAlign: alignment.name,
269
+ text: this.data.text,
270
+ level: this.data.level
271
+ };
272
+ /**
273
+ * Highlight button by selected level
274
+ */
275
+
276
+ this.settingsButtons.forEach(function (button) {
277
+ button.classList.toggle(_this3._CSS.settingsButtonActive, button.dataset.textAlign === alignment.name);
278
+ });
279
+ }
280
+ /**
281
+ * Method that specified how to merge two Text blocks.
282
+ * Called by Editor.js by backspace at the beginning of the Block
283
+ *
284
+ * @param {HeaderData} data - saved data to merger with current block
285
+ * @public
286
+ */
287
+
288
+ }, {
289
+ key: "merge",
290
+ value: function merge(data) {
291
+ var newData = {
292
+ text: this.data.text + data.text,
293
+ level: this.data.level,
294
+ alignment: this.data.alignment
295
+ };
296
+ this.data = newData;
297
+ }
298
+ /**
299
+ * Validate Text block data:
300
+ * - check for emptiness
301
+ *
302
+ * @param {HeaderData} blockData — data received after saving
303
+ * @returns {boolean} false if saved data is not correct, otherwise true
304
+ * @public
305
+ */
306
+
307
+ }, {
308
+ key: "validate",
309
+ value: function validate(blockData) {
310
+ return blockData.text.trim() !== "";
311
+ }
312
+ /**
313
+ * Extract Tool's data from the view
314
+ *
315
+ * @param {HTMLHeadingElement} toolsContent - Text tools rendered view
316
+ * @returns {HeaderData} - saved data
317
+ * @public
318
+ */
319
+
320
+ }, {
321
+ key: "save",
322
+ value: function save(toolsContent) {
323
+ return {
324
+ text: toolsContent.innerHTML,
325
+ level: this.currentLevel.number,
326
+ textAlign: this.getTextAlign(toolsContent.className),
327
+ className: toolsContent.className
328
+ };
329
+ }
330
+ /**
331
+ * Extract textAlign from className
332
+ *
333
+ * @param {string} className - heading element className
334
+ * @returns {TextAlign} textAlign
335
+ */
336
+
337
+ }, {
338
+ key: "getTextAlign",
339
+ value: function getTextAlign(className) {
340
+ var textAlign = TextAlign.START; // Match className with alignment
341
+
342
+ this.alignments.forEach(function (alignment) {
343
+ if (className.includes("ce-header-text--".concat(alignment.name))) {
344
+ textAlign = alignment.name;
345
+ }
346
+ });
347
+ return textAlign;
348
+ }
349
+ /**
350
+ * Allow Header to be converted to/from other blocks
351
+ */
352
+
353
+ }, {
354
+ key: "data",
355
+ get:
356
+ /**
357
+ * Get current Tools`s data
358
+ *
359
+ * @returns {HeaderData} Current data
360
+ * @private
361
+ */
362
+ function get() {
363
+ this._data.text = this._element.innerHTML;
364
+ this._data.level = this.currentLevel.number;
365
+ this._data.textAlign = this.currentAlignment.name;
366
+ return this._data;
367
+ }
368
+ /**
369
+ * Store data in plugin:
370
+ * - at the this._data property
371
+ * - at the HTML
372
+ *
373
+ * @param {HeaderData} data — data to set
374
+ * @private
375
+ */
376
+ ,
377
+ set: function set(data) {
378
+ this._data = this.normalizeData(data);
379
+ /**
380
+ * If level is set and block in DOM
381
+ * then replace it to a new block
382
+ */
383
+
384
+ if (data.level !== undefined && this._element.parentNode) {
385
+ /**
386
+ * Create a new tag
387
+ *
388
+ * @type {HTMLHeadingElement}
389
+ */
390
+ var newHeader = this.getTag();
391
+ /**
392
+ * Save Block's content
393
+ */
394
+
395
+ newHeader.innerHTML = this._element.innerHTML;
396
+ /**
397
+ * Replace blocks
398
+ */
399
+
400
+ this._element.parentNode.replaceChild(newHeader, this._element);
401
+ /**
402
+ * Save new block to private variable
403
+ *
404
+ * @type {HTMLHeadingElement}
405
+ * @private
406
+ */
407
+
408
+
409
+ this._element = newHeader;
410
+ }
411
+ /**
412
+ * If data.text was passed then update block's content
413
+ */
414
+
415
+
416
+ if (data.text !== undefined) {
417
+ this._element.innerHTML = this._data.text || "";
418
+ }
419
+ }
420
+ /**
421
+ * Get tag for target level
422
+ * By default returns second-leveled header
423
+ *
424
+ * @returns {HTMLElement}
425
+ */
426
+
427
+ }, {
428
+ key: "getTag",
429
+ value: function getTag() {
430
+ var _this4 = this;
431
+
432
+ /**
433
+ * Create element for current Block's level
434
+ */
435
+ var tag = document.createElement(this.currentLevel.tag);
436
+ /**
437
+ * Add text to block
438
+ */
439
+
440
+ tag.innerHTML = this._data.text || "";
441
+ /**
442
+ * Add styles class from typography
443
+ */
444
+
445
+ if (this.typography) {
446
+ var component = this.currentLevel.tag.toLowerCase();
447
+ var typographyConfig = this.typography[component];
448
+ tag.classList.add(typographyConfig.className);
449
+ } else {
450
+ /**
451
+ * Add styles class
452
+ */
453
+ tag.classList.add(this._CSS.wrapper);
454
+ }
455
+ /**
456
+ * Add Alignment class
457
+ */
458
+
459
+
460
+ this.alignments.forEach(function (alignment) {
461
+ var textAlignClass = "ce-header-text--".concat(alignment.name);
462
+
463
+ if (alignment.name === _this4._data.textAlign) {
464
+ tag.classList.add(textAlignClass);
465
+ } else {
466
+ tag.classList.remove(textAlignClass);
467
+ }
468
+ });
469
+ /**
470
+ * Make tag editable
471
+ */
472
+
473
+ tag.contentEditable = this.readOnly ? "false" : "true";
474
+ /**
475
+ * Add Placeholder
476
+ */
477
+
478
+ tag.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || "");
479
+ return tag;
480
+ }
481
+ /**
482
+ * Get current level
483
+ *
484
+ * @returns {level}
485
+ */
486
+
487
+ }, {
488
+ key: "currentLevel",
489
+ get: function get() {
490
+ var _this5 = this;
491
+
492
+ var level = this.levels.find(function (levelItem) {
493
+ return levelItem.number === _this5._data.level;
494
+ });
495
+
496
+ if (!level) {
497
+ level = this.defaultLevel;
498
+ }
499
+
500
+ return level;
501
+ }
502
+ /**
503
+ * Get current alignment
504
+ *
505
+ * @returns {alignment}
506
+ */
507
+
508
+ }, {
509
+ key: "currentAlignment",
510
+ get: function get() {
511
+ var _this6 = this;
512
+
513
+ var alignment = this.alignments.find(function (alignment) {
514
+ return alignment.name === _this6._data.textAlign;
515
+ });
516
+
517
+ if (!alignment) {
518
+ alignment = {
519
+ name: TextAlign.START,
520
+ svg: ALIGNMENT_ICONS.start
521
+ };
522
+ }
523
+
524
+ return alignment;
525
+ }
526
+ /**
527
+ * Return default level
528
+ *
529
+ * @returns {level}
530
+ */
531
+
532
+ }, {
533
+ key: "defaultLevel",
534
+ get: function get() {
535
+ var _this7 = this;
536
+
537
+ /**
538
+ * User can specify own default level value
539
+ */
540
+ if (this._settings.defaultLevel) {
541
+ var userSpecified = this.levels.find(function (levelItem) {
542
+ return levelItem.number === _this7._settings.defaultLevel;
543
+ });
544
+
545
+ if (userSpecified) {
546
+ return userSpecified;
547
+ } else {
548
+ console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels");
549
+ }
550
+ }
551
+ /**
552
+ * With no additional options, there will be H2 by default
553
+ *
554
+ * @type {level}
555
+ */
556
+
557
+
558
+ return this.levels[1];
559
+ }
560
+ /**
561
+ * @typedef {object} level
562
+ * @property {number} number - level number
563
+ * @property {string} tag - tag corresponds with level number
564
+ * @property {string} svg - icon
565
+ */
566
+
567
+ /**
568
+ * Available header levels
569
+ *
570
+ * @returns {level[]}
571
+ */
572
+
573
+ }, {
574
+ key: "levels",
575
+ get: function get() {
576
+ var _this8 = this;
577
+
578
+ var availableLevels = [{
579
+ number: 1,
580
+ tag: "H1",
581
+ 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>'
582
+ }, {
583
+ number: 2,
584
+ tag: "H2",
585
+ 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>'
586
+ }, {
587
+ number: 3,
588
+ tag: "H3",
589
+ 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>'
590
+ }, {
591
+ number: 4,
592
+ tag: "H4",
593
+ 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>'
594
+ }, {
595
+ number: 5,
596
+ tag: "H5",
597
+ 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>'
598
+ }, {
599
+ number: 6,
600
+ tag: "H6",
601
+ 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>'
602
+ }];
603
+ return this._settings.levels ? availableLevels.filter(function (l) {
604
+ return _this8._settings.levels.includes(l.number);
605
+ }) : availableLevels;
606
+ }
607
+ /**
608
+ * Handle H1-H6 tags on paste to substitute it with header Tool
609
+ *
610
+ * @param {PasteEvent} event - event with pasted content
611
+ */
612
+
613
+ }, {
614
+ key: "onPaste",
615
+ value: function onPaste(event) {
616
+ var content = event.detail.data;
617
+ /**
618
+ * Define default level value
619
+ *
620
+ * @type {number}
621
+ */
622
+
623
+ var level = this.defaultLevel.number;
624
+
625
+ switch (content.tagName) {
626
+ case "H1":
627
+ level = 1;
628
+ break;
629
+
630
+ case "H2":
631
+ level = 2;
632
+ break;
633
+
634
+ case "H3":
635
+ level = 3;
636
+ break;
637
+
638
+ case "H4":
639
+ level = 4;
640
+ break;
641
+
642
+ case "H5":
643
+ level = 5;
644
+ break;
645
+
646
+ case "H6":
647
+ level = 6;
648
+ break;
649
+ }
650
+
651
+ if (this._settings.levels) {
652
+ // Fallback to nearest level when specified not available
653
+ level = this._settings.levels.reduce(function (prevLevel, currLevel) {
654
+ return Math.abs(currLevel - level) < Math.abs(prevLevel - level) ? currLevel : prevLevel;
655
+ });
656
+ }
657
+
658
+ this.data = {
659
+ level: level,
660
+ text: content.innerHTML
661
+ };
662
+ }
663
+ /**
664
+ * Used by Editor.js paste handling API.
665
+ * Provides configuration to handle H1-H6 tags.
666
+ *
667
+ * @returns {{handler: (function(HTMLElement): {text: string}), tags: string[]}}
668
+ */
669
+
670
+ }], [{
671
+ key: "conversionConfig",
672
+ get: function get() {
673
+ return {
674
+ export: "text",
675
+ // use 'text' property for other blocks
676
+ import: "text" // fill 'text' property from other block's export string
677
+
678
+ };
679
+ }
680
+ /**
681
+ * Sanitizer Rules
682
+ */
683
+
684
+ }, {
685
+ key: "sanitize",
686
+ get: function get() {
687
+ return {
688
+ level: false,
689
+ text: {}
690
+ };
691
+ }
692
+ /**
693
+ * Returns true to notify core that read-only is supported
694
+ *
695
+ * @returns {boolean}
696
+ */
697
+
698
+ }, {
699
+ key: "isReadOnlySupported",
700
+ get: function get() {
701
+ return true;
702
+ }
703
+ }, {
704
+ key: "pasteConfig",
705
+ get: function get() {
706
+ return {
707
+ tags: ["H1", "H2", "H3", "H4", "H5", "H6"]
708
+ };
709
+ }
710
+ /**
711
+ * Get Tool toolbox settings
712
+ * icon - Tool icon's SVG
713
+ * title - title to show in toolbox
714
+ *
715
+ * @returns {{icon: string, title: string}}
716
+ */
717
+
718
+ }, {
719
+ key: "toolbox",
720
+ get: function get() {
721
+ return {
722
+ 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>",
723
+ title: "Heading"
724
+ };
725
+ }
726
+ }]);
727
+
728
+ return Header;
729
+ }();
730
+
731
+ export default Header;