@plone/volto 18.0.0-alpha.3 → 18.0.0-alpha.4

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 (324) hide show
  1. package/.eslintrc +3 -3
  2. package/.prettierignore +8 -0
  3. package/.prettierrc +12 -0
  4. package/{packages/registry/.release-it.json → .release-it.json} +11 -6
  5. package/CHANGELOG.md +29 -4
  6. package/package.json +57 -127
  7. package/razzle.config.js +4 -7
  8. package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +2 -2
  9. package/src/components/manage/Form/Form.jsx +5 -2
  10. package/src/config/index.js +0 -4
  11. package/src/icons/divide-horizontal.svg +0 -0
  12. package/src/icons/divide-vertical.svg +0 -0
  13. package/src/icons/hero.svg +0 -0
  14. package/src/icons/slider.svg +0 -0
  15. package/src/icons/summary.svg +0 -0
  16. package/src/middleware/api.js +1 -1
  17. package/theme/themes/default/elements/icon.overrides +0 -0
  18. package/theme/themes/default/globals/reset.overrides +0 -0
  19. package/theme/themes/default/globals/site.variables +0 -0
  20. package/theme/themes/default/modules/dropdown.overrides +0 -0
  21. package/theme/themes/default/modules/dropdown.variables +0 -0
  22. package/theme/themes/default/modules/modal.variables +0 -0
  23. package/theme/themes/default/modules/video.overrides +0 -0
  24. package/theme/themes/default/modules/video.variables +0 -0
  25. package/theme/themes/pastanaga/assets/fonts/icons.eot +0 -0
  26. package/theme/themes/pastanaga/assets/fonts/icons.svg +0 -0
  27. package/theme/themes/pastanaga/assets/fonts/icons.ttf +0 -0
  28. package/theme/themes/pastanaga/assets/fonts/icons.woff +0 -0
  29. package/theme/themes/pastanaga/globals/reset.overrides +0 -0
  30. package/theme/themes/pastanaga/globals/site.variables +0 -0
  31. package/theme/themes/pastanaga/modules/dropdown.variables +0 -0
  32. package/theme/themes/pastanaga/modules/modal.variables +0 -0
  33. package/theme/themes/pastanaga/modules/video.overrides +0 -0
  34. package/theme/themes/pastanaga/modules/video.variables +0 -0
  35. package/tsconfig.json +1 -4
  36. package/types/config/RichTextEditor/index.d.ts +5 -8
  37. package/types/helpers/AsyncConnect/index.d.ts +2 -2
  38. package/types/helpers/Url/Url.d.ts +3 -3
  39. package/types/icons/load-icons.d.ts +1 -1
  40. package/webpack-plugins/webpack-less-plugin.js +1 -0
  41. package/CODE_OF_CONDUCT.md +0 -13
  42. package/CONTRIBUTING.md +0 -7
  43. package/README.md +0 -154
  44. package/RELEASING.md +0 -73
  45. package/ROADMAP.md +0 -30
  46. package/SECURITY.md +0 -14
  47. package/apps/plone/node_modules/.bin/acorn +0 -17
  48. package/apps/plone/node_modules/.bin/addon +0 -17
  49. package/apps/plone/node_modules/.bin/autoprefixer +0 -17
  50. package/apps/plone/node_modules/.bin/browserslist +0 -17
  51. package/apps/plone/node_modules/.bin/build-storybook +0 -17
  52. package/apps/plone/node_modules/.bin/changelogupdater +0 -17
  53. package/apps/plone/node_modules/.bin/eslint +0 -17
  54. package/apps/plone/node_modules/.bin/eslint-config-prettier +0 -17
  55. package/apps/plone/node_modules/.bin/i18n +0 -17
  56. package/apps/plone/node_modules/.bin/jest +0 -17
  57. package/apps/plone/node_modules/.bin/lessc +0 -17
  58. package/apps/plone/node_modules/.bin/missdev +0 -17
  59. package/apps/plone/node_modules/.bin/prettier +0 -17
  60. package/apps/plone/node_modules/.bin/razzle +0 -17
  61. package/apps/plone/node_modules/.bin/server-test +0 -17
  62. package/apps/plone/node_modules/.bin/start-server-and-test +0 -17
  63. package/apps/plone/node_modules/.bin/start-storybook +0 -17
  64. package/apps/plone/node_modules/.bin/start-test +0 -17
  65. package/apps/plone/node_modules/.bin/storybook-server +0 -17
  66. package/apps/plone/node_modules/.bin/stylelint +0 -17
  67. package/apps/plone/node_modules/.bin/tlds +0 -17
  68. package/apps/plone/node_modules/.bin/ts-jest +0 -17
  69. package/apps/plone/node_modules/.bin/tsc +0 -17
  70. package/apps/plone/node_modules/.bin/tsserver +0 -17
  71. package/apps/plone/node_modules/.bin/uuid +0 -17
  72. package/apps/plone/node_modules/.bin/webpack +0 -17
  73. package/apps/plone/node_modules/.bin/webpack-dev-server +0 -17
  74. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/acorn +0 -17
  75. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/addon +0 -17
  76. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/browserslist +0 -17
  77. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/changelogupdater +0 -17
  78. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint +0 -17
  79. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint-config-prettier +0 -17
  80. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/i18n +0 -17
  81. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/prettier +0 -17
  82. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/release-it +0 -17
  83. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/stylelint +0 -17
  84. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/tsc +0 -17
  85. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/tsserver +0 -17
  86. package/logos/Logo.png +0 -0
  87. package/logos/VoltoLogoEra2-dark-mode.png +0 -0
  88. package/logos/VoltoLogoEra2.png +0 -0
  89. package/logos/volto-colorful.png +0 -0
  90. package/logos/volto-colorful.svg +0 -35
  91. package/logos/volto-guide.png +0 -0
  92. package/logos/volto-h-transparent.svg +0 -6
  93. package/logos/volto-transparent.png +0 -0
  94. package/logos/volto-transparent.svg +0 -19
  95. package/logos/volto-transparent2.svg +0 -5
  96. package/logos/volto-yellow.svg +0 -29
  97. package/logos/volto.sketch +0 -0
  98. package/packages/README.md +0 -7
  99. package/packages/registry/.towncrier/towncrier_template.jinja +0 -10
  100. package/packages/registry/CHANGELOG.md +0 -16
  101. package/packages/registry/README.md +0 -207
  102. package/packages/registry/addon-registry.js +0 -603
  103. package/packages/registry/create-addons-loader.js +0 -116
  104. package/packages/registry/create-theme-addons-loader.js +0 -78
  105. package/packages/registry/news/.gitkeep +0 -0
  106. package/packages/registry/node_modules/.bin/browserslist +0 -17
  107. package/packages/registry/node_modules/.bin/parcel +0 -17
  108. package/packages/registry/node_modules/.bin/release-it +0 -17
  109. package/packages/registry/node_modules/.bin/tsc +0 -17
  110. package/packages/registry/node_modules/.bin/tsserver +0 -17
  111. package/packages/registry/node_modules/.bin/vitest +0 -17
  112. package/packages/registry/package.json +0 -76
  113. package/packages/registry/src/index.ts +0 -174
  114. package/packages/registry/src/registry.test.js +0 -111
  115. package/packages/registry/tsconfig.json +0 -32
  116. package/packages/scripts/CHANGELOG.md +0 -173
  117. package/packages/scripts/README.md +0 -128
  118. package/packages/scripts/addon/consolidate.js +0 -28
  119. package/packages/scripts/addon/generators.js +0 -213
  120. package/packages/scripts/addon/getAddonInfo.js +0 -65
  121. package/packages/scripts/addon/index.js +0 -88
  122. package/packages/scripts/addon/utils.js +0 -44
  123. package/packages/scripts/backportpr.js +0 -75
  124. package/packages/scripts/changelogupdater.cjs +0 -94
  125. package/packages/scripts/corepackagebump.js +0 -20
  126. package/packages/scripts/i18n.cjs +0 -310
  127. package/packages/scripts/package.json +0 -76
  128. package/packages/scripts/templates/towncrier_template.jinja +0 -10
  129. package/packages/types/Blocks/View.ts +0 -11
  130. package/packages/types/actions.ts +0 -15
  131. package/packages/types/breadcrumbs.ts +0 -10
  132. package/packages/types/config/Blocks.ts +0 -153
  133. package/packages/types/config/Content.ts +0 -62
  134. package/packages/types/config/Settings.ts +0 -86
  135. package/packages/types/config/Views.ts +0 -15
  136. package/packages/types/config/Widgets.ts +0 -7
  137. package/packages/types/config/index.ts +0 -21
  138. package/packages/types/content/common.ts +0 -60
  139. package/packages/types/content/get.ts +0 -66
  140. package/packages/types/index.ts +0 -0
  141. package/packages/types/navigation.ts +0 -12
  142. package/packages/types/node_modules/.bin/browserslist +0 -17
  143. package/packages/types/node_modules/.bin/parcel +0 -17
  144. package/packages/types/node_modules/.bin/release-it +0 -17
  145. package/packages/types/node_modules/.bin/tsc +0 -17
  146. package/packages/types/node_modules/.bin/tsserver +0 -17
  147. package/packages/types/package.json +0 -64
  148. package/packages/types/types.ts +0 -61
  149. package/packages/volto-slate/.i18n.babel.config.js +0 -1
  150. package/packages/volto-slate/README.md +0 -4
  151. package/packages/volto-slate/build/messages/src/blocks/Table/TableBlockEdit.json +0 -90
  152. package/packages/volto-slate/build/messages/src/blocks/Text/DefaultTextBlockEditor.json +0 -6
  153. package/packages/volto-slate/build/messages/src/blocks/Text/DetachedTextBlockEditor.json +0 -6
  154. package/packages/volto-slate/build/messages/src/blocks/Text/SlashMenu.json +0 -6
  155. package/packages/volto-slate/build/messages/src/editor/plugins/AdvancedLink/index.json +0 -10
  156. package/packages/volto-slate/build/messages/src/editor/plugins/Link/index.json +0 -10
  157. package/packages/volto-slate/build/messages/src/editor/plugins/Table/index.json +0 -30
  158. package/packages/volto-slate/build/messages/src/elementEditor/messages.json +0 -10
  159. package/packages/volto-slate/build/messages/src/widgets/HtmlSlateWidget.json +0 -6
  160. package/packages/volto-slate/build/messages/src/widgets/RichTextWidgetView.json +0 -6
  161. package/packages/volto-slate/locales/de/LC_MESSAGES/volto.po +0 -148
  162. package/packages/volto-slate/locales/en/LC_MESSAGES/volto.po +0 -148
  163. package/packages/volto-slate/locales/volto.pot +0 -182
  164. package/packages/volto-slate/package.json +0 -43
  165. package/packages/volto-slate/src/actions/content.js +0 -30
  166. package/packages/volto-slate/src/actions/index.js +0 -3
  167. package/packages/volto-slate/src/actions/plugins.js +0 -9
  168. package/packages/volto-slate/src/actions/selection.js +0 -22
  169. package/packages/volto-slate/src/blocks/Table/Cell.jsx +0 -87
  170. package/packages/volto-slate/src/blocks/Table/Cell.test.js +0 -54
  171. package/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx +0 -694
  172. package/packages/volto-slate/src/blocks/Table/TableBlockEdit.test.js +0 -40
  173. package/packages/volto-slate/src/blocks/Table/TableBlockView.jsx +0 -150
  174. package/packages/volto-slate/src/blocks/Table/TableBlockView.test.js +0 -49
  175. package/packages/volto-slate/src/blocks/Table/deconstruct.js +0 -113
  176. package/packages/volto-slate/src/blocks/Table/extensions/normalizeTable.js +0 -5
  177. package/packages/volto-slate/src/blocks/Table/index.js +0 -60
  178. package/packages/volto-slate/src/blocks/Table/schema.js +0 -122
  179. package/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +0 -304
  180. package/packages/volto-slate/src/blocks/Text/DetachedTextBlockEditor.jsx +0 -77
  181. package/packages/volto-slate/src/blocks/Text/MarkdownIntroduction.jsx +0 -59
  182. package/packages/volto-slate/src/blocks/Text/PluginSidebar.jsx +0 -18
  183. package/packages/volto-slate/src/blocks/Text/ShortcutListing.jsx +0 -28
  184. package/packages/volto-slate/src/blocks/Text/SlashMenu.jsx +0 -203
  185. package/packages/volto-slate/src/blocks/Text/TextBlockEdit.jsx +0 -38
  186. package/packages/volto-slate/src/blocks/Text/TextBlockEdit.test.js +0 -107
  187. package/packages/volto-slate/src/blocks/Text/TextBlockSchema.js +0 -54
  188. package/packages/volto-slate/src/blocks/Text/TextBlockView.jsx +0 -31
  189. package/packages/volto-slate/src/blocks/Text/css/editor.css +0 -18
  190. package/packages/volto-slate/src/blocks/Text/extensions/Readme.md +0 -49
  191. package/packages/volto-slate/src/blocks/Text/extensions/breakList.js +0 -100
  192. package/packages/volto-slate/src/blocks/Text/extensions/index.js +0 -6
  193. package/packages/volto-slate/src/blocks/Text/extensions/insertBreak.js +0 -57
  194. package/packages/volto-slate/src/blocks/Text/extensions/isSelected.js +0 -7
  195. package/packages/volto-slate/src/blocks/Text/extensions/normalizeExternalData.js +0 -7
  196. package/packages/volto-slate/src/blocks/Text/extensions/withDeserializers.js +0 -87
  197. package/packages/volto-slate/src/blocks/Text/extensions/withLists.js +0 -5
  198. package/packages/volto-slate/src/blocks/Text/index.js +0 -171
  199. package/packages/volto-slate/src/blocks/Text/keyboard/backspaceInList.js +0 -58
  200. package/packages/volto-slate/src/blocks/Text/keyboard/breakBlocks.js +0 -3
  201. package/packages/volto-slate/src/blocks/Text/keyboard/cancelEsc.js +0 -7
  202. package/packages/volto-slate/src/blocks/Text/keyboard/indentListItems.js +0 -240
  203. package/packages/volto-slate/src/blocks/Text/keyboard/index.js +0 -52
  204. package/packages/volto-slate/src/blocks/Text/keyboard/joinBlocks.js +0 -180
  205. package/packages/volto-slate/src/blocks/Text/keyboard/moveListItems.js +0 -124
  206. package/packages/volto-slate/src/blocks/Text/keyboard/slashMenu.js +0 -19
  207. package/packages/volto-slate/src/blocks/Text/keyboard/softBreak.js +0 -7
  208. package/packages/volto-slate/src/blocks/Text/keyboard/traverseBlocks.js +0 -81
  209. package/packages/volto-slate/src/blocks/Text/keyboard/unwrapEmptyString.js +0 -26
  210. package/packages/volto-slate/src/blocks/Text/schema.js +0 -39
  211. package/packages/volto-slate/src/constants.js +0 -123
  212. package/packages/volto-slate/src/editor/EditorContext.jsx +0 -5
  213. package/packages/volto-slate/src/editor/EditorReference.jsx +0 -22
  214. package/packages/volto-slate/src/editor/SlateEditor.jsx +0 -375
  215. package/packages/volto-slate/src/editor/config.jsx +0 -344
  216. package/packages/volto-slate/src/editor/decorate.js +0 -68
  217. package/packages/volto-slate/src/editor/deserialize.js +0 -185
  218. package/packages/volto-slate/src/editor/extensions/index.js +0 -6
  219. package/packages/volto-slate/src/editor/extensions/insertBreak.js +0 -15
  220. package/packages/volto-slate/src/editor/extensions/insertData.js +0 -159
  221. package/packages/volto-slate/src/editor/extensions/isInline.js +0 -14
  222. package/packages/volto-slate/src/editor/extensions/normalizeExternalData.js +0 -8
  223. package/packages/volto-slate/src/editor/extensions/normalizeNode.js +0 -48
  224. package/packages/volto-slate/src/editor/extensions/withDeserializers.js +0 -15
  225. package/packages/volto-slate/src/editor/extensions/withTestingFeatures.jsx +0 -84
  226. package/packages/volto-slate/src/editor/index.js +0 -14
  227. package/packages/volto-slate/src/editor/less/editor.less +0 -173
  228. package/packages/volto-slate/src/editor/less/globals.less +0 -18
  229. package/packages/volto-slate/src/editor/less/slate.less +0 -28
  230. package/packages/volto-slate/src/editor/plugins/AdvancedLink/deserialize.js +0 -90
  231. package/packages/volto-slate/src/editor/plugins/AdvancedLink/extensions.js +0 -32
  232. package/packages/volto-slate/src/editor/plugins/AdvancedLink/index.js +0 -50
  233. package/packages/volto-slate/src/editor/plugins/AdvancedLink/render.jsx +0 -37
  234. package/packages/volto-slate/src/editor/plugins/AdvancedLink/schema.js +0 -114
  235. package/packages/volto-slate/src/editor/plugins/AdvancedLink/styles.less +0 -8
  236. package/packages/volto-slate/src/editor/plugins/Blockquote/index.js +0 -30
  237. package/packages/volto-slate/src/editor/plugins/Callout/index.js +0 -34
  238. package/packages/volto-slate/src/editor/plugins/Image/deconstruct.js +0 -30
  239. package/packages/volto-slate/src/editor/plugins/Image/extensions.js +0 -51
  240. package/packages/volto-slate/src/editor/plugins/Image/index.js +0 -11
  241. package/packages/volto-slate/src/editor/plugins/Image/render.jsx +0 -22
  242. package/packages/volto-slate/src/editor/plugins/Link/extensions.js +0 -58
  243. package/packages/volto-slate/src/editor/plugins/Link/index.js +0 -164
  244. package/packages/volto-slate/src/editor/plugins/Link/render.jsx +0 -54
  245. package/packages/volto-slate/src/editor/plugins/Markdown/constants.js +0 -81
  246. package/packages/volto-slate/src/editor/plugins/Markdown/extensions.js +0 -334
  247. package/packages/volto-slate/src/editor/plugins/Markdown/index.js +0 -28
  248. package/packages/volto-slate/src/editor/plugins/Markdown/utils.js +0 -198
  249. package/packages/volto-slate/src/editor/plugins/StyleMenu/StyleMenu.jsx +0 -153
  250. package/packages/volto-slate/src/editor/plugins/StyleMenu/index.js +0 -19
  251. package/packages/volto-slate/src/editor/plugins/StyleMenu/style.less +0 -29
  252. package/packages/volto-slate/src/editor/plugins/StyleMenu/utils.js +0 -168
  253. package/packages/volto-slate/src/editor/plugins/Table/TableButton.jsx +0 -142
  254. package/packages/volto-slate/src/editor/plugins/Table/TableCell.jsx +0 -44
  255. package/packages/volto-slate/src/editor/plugins/Table/TableContainer.jsx +0 -37
  256. package/packages/volto-slate/src/editor/plugins/Table/TableSizePicker.jsx +0 -83
  257. package/packages/volto-slate/src/editor/plugins/Table/extensions.js +0 -87
  258. package/packages/volto-slate/src/editor/plugins/Table/index.js +0 -390
  259. package/packages/volto-slate/src/editor/plugins/Table/less/public.less +0 -29
  260. package/packages/volto-slate/src/editor/plugins/Table/less/table.less +0 -28
  261. package/packages/volto-slate/src/editor/plugins/Table/render.jsx +0 -30
  262. package/packages/volto-slate/src/editor/plugins/index.js +0 -19
  263. package/packages/volto-slate/src/editor/render.jsx +0 -224
  264. package/packages/volto-slate/src/editor/ui/BasicToolbar.jsx +0 -11
  265. package/packages/volto-slate/src/editor/ui/BlockButton.jsx +0 -31
  266. package/packages/volto-slate/src/editor/ui/ClearFormattingButton.jsx +0 -21
  267. package/packages/volto-slate/src/editor/ui/ExpandedToolbar.jsx +0 -18
  268. package/packages/volto-slate/src/editor/ui/Expando.jsx +0 -5
  269. package/packages/volto-slate/src/editor/ui/InlineToolbar.jsx +0 -73
  270. package/packages/volto-slate/src/editor/ui/MarkButton.jsx +0 -23
  271. package/packages/volto-slate/src/editor/ui/MarkElementButton.jsx +0 -30
  272. package/packages/volto-slate/src/editor/ui/Menu.jsx +0 -13
  273. package/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx +0 -32
  274. package/packages/volto-slate/src/editor/ui/Separator.jsx +0 -7
  275. package/packages/volto-slate/src/editor/ui/SlateContextToolbar.jsx +0 -13
  276. package/packages/volto-slate/src/editor/ui/SlateToolbar.jsx +0 -96
  277. package/packages/volto-slate/src/editor/ui/Toolbar.jsx +0 -103
  278. package/packages/volto-slate/src/editor/ui/ToolbarButton.jsx +0 -33
  279. package/packages/volto-slate/src/editor/ui/ToolbarButton.test.js +0 -25
  280. package/packages/volto-slate/src/editor/ui/index.js +0 -15
  281. package/packages/volto-slate/src/editor/utils.js +0 -248
  282. package/packages/volto-slate/src/elementEditor/ContextButtons.jsx +0 -56
  283. package/packages/volto-slate/src/elementEditor/PluginEditor.jsx +0 -124
  284. package/packages/volto-slate/src/elementEditor/Readme.md +0 -6
  285. package/packages/volto-slate/src/elementEditor/SchemaProvider.jsx +0 -3
  286. package/packages/volto-slate/src/elementEditor/SidebarEditor.jsx +0 -46
  287. package/packages/volto-slate/src/elementEditor/ToolbarButton.jsx +0 -44
  288. package/packages/volto-slate/src/elementEditor/index.js +0 -5
  289. package/packages/volto-slate/src/elementEditor/makeInlineElementPlugin.js +0 -100
  290. package/packages/volto-slate/src/elementEditor/messages.js +0 -14
  291. package/packages/volto-slate/src/elementEditor/utils.js +0 -226
  292. package/packages/volto-slate/src/hooks/index.js +0 -3
  293. package/packages/volto-slate/src/hooks/useEditorContext.js +0 -6
  294. package/packages/volto-slate/src/hooks/useIsomorphicLayoutEffect.js +0 -7
  295. package/packages/volto-slate/src/hooks/useSelectionPosition.js +0 -25
  296. package/packages/volto-slate/src/i18n.js +0 -180
  297. package/packages/volto-slate/src/icons/hashlink.svg +0 -57
  298. package/packages/volto-slate/src/index.js +0 -61
  299. package/packages/volto-slate/src/reducers/content.js +0 -74
  300. package/packages/volto-slate/src/reducers/index.js +0 -3
  301. package/packages/volto-slate/src/reducers/plugins.js +0 -17
  302. package/packages/volto-slate/src/reducers/selection.js +0 -16
  303. package/packages/volto-slate/src/utils/blocks.js +0 -375
  304. package/packages/volto-slate/src/utils/blocks.test.js +0 -138
  305. package/packages/volto-slate/src/utils/editor.js +0 -31
  306. package/packages/volto-slate/src/utils/image.js +0 -25
  307. package/packages/volto-slate/src/utils/index.js +0 -11
  308. package/packages/volto-slate/src/utils/internals.js +0 -46
  309. package/packages/volto-slate/src/utils/lists.js +0 -92
  310. package/packages/volto-slate/src/utils/marks.js +0 -104
  311. package/packages/volto-slate/src/utils/mime-types.js +0 -24
  312. package/packages/volto-slate/src/utils/nodes.js +0 -4
  313. package/packages/volto-slate/src/utils/ops.js +0 -20
  314. package/packages/volto-slate/src/utils/random.js +0 -17
  315. package/packages/volto-slate/src/utils/selection.js +0 -236
  316. package/packages/volto-slate/src/utils/slate-string-utils.js +0 -408
  317. package/packages/volto-slate/src/utils/volto-blocks.js +0 -314
  318. package/packages/volto-slate/src/widgets/ErrorBoundary.jsx +0 -27
  319. package/packages/volto-slate/src/widgets/HtmlSlateWidget.jsx +0 -139
  320. package/packages/volto-slate/src/widgets/ObjectByTypeWidget.jsx +0 -49
  321. package/packages/volto-slate/src/widgets/RichTextWidget.jsx +0 -72
  322. package/packages/volto-slate/src/widgets/RichTextWidgetView.jsx +0 -37
  323. package/packages/volto-slate/src/widgets/style.css +0 -21
  324. package/types/components/manage/Blocks/Video/Body.test.d.ts +0 -1
@@ -1,61 +0,0 @@
1
- import * as slateReducers from './reducers';
2
-
3
- import installSlate from './editor';
4
- import installTextBlock from './blocks/Text';
5
- import installTableBlock from './blocks/Table';
6
- import RichTextWidget from './widgets/RichTextWidget';
7
- import RichTextWidgetView from './widgets/RichTextWidgetView';
8
- import HtmlSlateWidget from './widgets/HtmlSlateWidget';
9
- import ObjectByTypeWidget from './widgets/ObjectByTypeWidget';
10
-
11
- export default function applyConfig(config) {
12
- config = [installSlate, installTextBlock, installTableBlock].reduce(
13
- (acc, apply) => apply(acc),
14
- config,
15
- );
16
-
17
- config.settings.defaultBlockType = 'slate';
18
-
19
- config.settings.slate.toolbarButtons = [
20
- 'bold',
21
- 'italic',
22
- 'strikethrough',
23
- 'link',
24
- 'separator',
25
- 'heading-two',
26
- 'heading-three',
27
- 'separator',
28
- 'sub',
29
- 'sup',
30
- 'separator',
31
- 'numbered-list',
32
- 'bulleted-list',
33
- 'blockquote',
34
- 'styleMenu',
35
- ];
36
-
37
- config.settings.slate.scrollIntoView = false;
38
-
39
- config.addonReducers = {
40
- ...config.addonReducers,
41
- ...slateReducers,
42
- };
43
-
44
- config.views = {
45
- ...config.views,
46
- };
47
-
48
- config.widgets.widget.slate = RichTextWidget;
49
- config.widgets.widget.slate_richtext = RichTextWidget;
50
- config.widgets.widget.slate_html = HtmlSlateWidget;
51
- config.widgets.widget.richtext = HtmlSlateWidget;
52
- config.widgets.widget.object_by_type = ObjectByTypeWidget;
53
-
54
- // volto-widgets-view
55
- if (config.widgets.views?.widget) {
56
- config.widgets.views.widget.slate = RichTextWidgetView;
57
- config.widgets.views.widget.slate_richtext = RichTextWidgetView;
58
- }
59
-
60
- return config;
61
- }
@@ -1,74 +0,0 @@
1
- /**
2
- * Upload reducer.
3
- * @module reducers/content
4
- *
5
- * Customized copy of Volto's content reducer
6
- */
7
-
8
- import config from '@plone/volto/registry';
9
-
10
- import { UPLOAD_CONTENT } from '@plone/volto-slate/constants';
11
-
12
- const initialState = {};
13
-
14
- /**
15
- * Content reducer.
16
- * @function content
17
- * @param {Object} state Current state.
18
- * @param {Object} action Action to be handled.
19
- * @returns {Object} New state.
20
- */
21
- export default function upload_content(state = initialState, action = {}) {
22
- let { result, origin } = action;
23
- switch (action.type) {
24
- case `${UPLOAD_CONTENT}_PENDING`:
25
- return {
26
- ...state,
27
- [origin]: {
28
- ...state[origin],
29
- upload: {
30
- loading: true,
31
- loaded: false,
32
- error: null,
33
- },
34
- },
35
- };
36
- case `${UPLOAD_CONTENT}_SUCCESS`:
37
- return {
38
- ...state,
39
- [origin]: {
40
- ...state[origin],
41
- data: {
42
- ...result,
43
- items:
44
- action.result &&
45
- action.result.items &&
46
- action.result.items.map((item) => ({
47
- ...item,
48
- url: item['@id'].replace(config.settings.apiPath, ''),
49
- })),
50
- },
51
- upload: {
52
- loading: false,
53
- loaded: true,
54
- error: null,
55
- },
56
- },
57
- };
58
- case `${UPLOAD_CONTENT}_FAIL`:
59
- return {
60
- ...state,
61
- [origin]: {
62
- ...state[origin],
63
- data: null,
64
- upload: {
65
- loading: false,
66
- loaded: false,
67
- error: action.error,
68
- },
69
- },
70
- };
71
- default:
72
- return state;
73
- }
74
- }
@@ -1,3 +0,0 @@
1
- export { default as slate_block_selections } from './selection';
2
- export { default as upload_content } from './content';
3
- export { default as slate_plugins } from './plugins';
@@ -1,17 +0,0 @@
1
- const initialState = {};
2
-
3
- export default function slate_plugins(state = initialState, action = {}) {
4
- const { type, pluginId, ...rest } = action;
5
- switch (type) {
6
- case 'SLATE_PLUGINS':
7
- return {
8
- ...state,
9
- [pluginId]: {
10
- ...state[pluginId],
11
- ...rest,
12
- },
13
- };
14
- default:
15
- return state;
16
- }
17
- }
@@ -1,16 +0,0 @@
1
- const initialState = {};
2
-
3
- export default function slate_block_selections(
4
- state = initialState,
5
- action = {},
6
- ) {
7
- switch (action.type) {
8
- case 'SAVE_SLATE_BLOCK_SELECTION':
9
- return {
10
- ...state,
11
- [action.blockid]: action.selection,
12
- };
13
- default:
14
- return state;
15
- }
16
- }
@@ -1,375 +0,0 @@
1
- /* eslint no-console: ["error", { allow: ["error", "warn"] }] */
2
- import { Editor, Transforms, Text } from 'slate'; // Range, RangeRef
3
- import config from '@plone/volto/registry';
4
- import {
5
- getBlocksFieldname,
6
- getBlocksLayoutFieldname,
7
- } from '@plone/volto/helpers';
8
- import _ from 'lodash';
9
- import { makeEditor } from './editor';
10
-
11
- // case sensitive; first in an inner array is the default and preffered format
12
- // in that array of formats
13
- const formatAliases = [
14
- ['strong', 'b'],
15
- ['em', 'i'],
16
- ['del', 's'],
17
- ];
18
-
19
- /**
20
- * Excerpt from Slate documentation, kept here for posterity:
21
- * See https://docs.slatejs.org/concepts/11-normalizing#built-in-constraints
22
-
23
- ## Built-in Constraints
24
-
25
- Slate editors come with a few built-in constraints out of the box. These
26
- constraints are there to make working with content much more predictable than
27
- standard contenteditable. All of the built-in logic in Slate depends on these
28
- constraints, so unfortunately you cannot omit them. They are...
29
-
30
- - All Element nodes must contain at least one Text descendant. If an element node
31
- does not contain any children, an empty text node will be added as its only
32
- child. This constraint exists to ensure that the selection's anchor and focus
33
- points (which rely on referencing text nodes) can always be placed inside any
34
- node. With this, empty elements (or void elements) wouldn't be selectable.
35
-
36
- - Two adjacent texts with the same custom properties will be merged. If two
37
- adjacent text nodes have the same formatting, they're merged into a single text
38
- node with a combined text string of the two. This exists to prevent the text
39
- nodes from only ever expanding in count in the document, since both adding and
40
- removing formatting results in splitting text nodes.
41
-
42
- - Block nodes can only contain other blocks, or inline and text nodes. For
43
- example, a paragraph block cannot have another paragraph block element and
44
- a link inline element as children at the same time. The type of children
45
- allowed is determined by the first child, and any other non-conforming children
46
- are removed. This ensures that common richtext behaviors like "splitting
47
- a block in two" function consistently.
48
-
49
- - Inline nodes cannot be the first or last child of a parent block, nor can it
50
- be next to another inline node in the children array. If this is the case, an
51
- empty text node will be added to correct this to be in compliance with the
52
- constraint.
53
-
54
- - The top-level editor node can only contain block nodes. If any of the
55
- top-level children are inline or text nodes they will be removed. This ensures
56
- that there are always block nodes in the editor so that behaviors like
57
- "splitting a block in two" work as expected.
58
-
59
- - These default constraints are all mandated because they make working with
60
- Slate documents much more predictable.
61
-
62
- Although these constraints are the best we've come up with now, we're always
63
- looking for ways to have Slate's built-in constraints be less constraining if
64
- possible—as long as it keeps standard behaviors easy to reason about. If you
65
- come up with a way to reduce or remove a built-in constraint with a different
66
- approach, we're all ears!
67
- *
68
- */
69
-
70
- export const normalizeExternalData = (editor, nodes) => {
71
- let fakeEditor = makeEditor({ extensions: editor._installedPlugins });
72
- fakeEditor.children = nodes;
73
- // put all the non-blocks (e.g. images which are inline Elements) inside p-s
74
- Editor.withoutNormalizing(fakeEditor, () => {
75
- //for htmlSlateWidget compatibility
76
- if (nodes && !Editor.isBlock(fakeEditor, nodes[0]))
77
- Transforms.wrapNodes(
78
- fakeEditor,
79
- { type: 'p' },
80
- {
81
- at: [],
82
- match: (node, path) =>
83
- (!Editor.isEditor(node) && !Editor.isBlock(fakeEditor, node)) ||
84
- fakeEditor.isInline(node),
85
- mode: 'highest',
86
- },
87
- );
88
- });
89
-
90
- Editor.normalize(fakeEditor, { force: true });
91
-
92
- return fakeEditor.children;
93
- };
94
-
95
- /**
96
- * Is it text? Is it whitespace (space, newlines, tabs) ?
97
- *
98
- */
99
- export const isWhitespace = (c) => {
100
- return (
101
- typeof c === 'string' &&
102
- c.replace(/\s/g, '').replace(/\t/g, '').replace(/\n/g, '').length === 0
103
- );
104
- };
105
-
106
- export function createDefaultBlock(children) {
107
- return {
108
- type: config.settings.slate.defaultBlockType,
109
- children: children || [{ text: '' }],
110
- };
111
- }
112
-
113
- export function createBlock(type, children) {
114
- return {
115
- type,
116
- children: children || [{ text: '' }],
117
- };
118
- }
119
-
120
- export function createEmptyParagraph() {
121
- // TODO: rename to createEmptyBlock
122
- return {
123
- type: config.settings.slate.defaultBlockType,
124
- children: [{ text: '' }],
125
- };
126
- }
127
-
128
- export function createParagraph(text) {
129
- return {
130
- type: config.settings.slate.defaultBlockType,
131
- children: [{ text }],
132
- };
133
- }
134
-
135
- export const isSingleBlockTypeActive = (editor, format) => {
136
- const [match] = Editor.nodes(editor, {
137
- match: (n) => n.type === format,
138
- });
139
-
140
- return !!match;
141
- };
142
-
143
- export const isBlockActive = (editor, format) => {
144
- const aliasList = _.find(formatAliases, (x) => _.includes(x, format));
145
-
146
- if (aliasList) {
147
- const aliasFound = _.some(aliasList, (y) => {
148
- return isSingleBlockTypeActive(editor, y);
149
- });
150
-
151
- if (aliasFound) {
152
- return true;
153
- }
154
- }
155
-
156
- return isSingleBlockTypeActive(editor, format);
157
- };
158
-
159
- export const getBlockTypeContextData = (editor, format) => {
160
- let isActive, defaultFormat, matcher;
161
-
162
- const aliasList = _.find(formatAliases, (x) => _.includes(x, format));
163
-
164
- if (aliasList) {
165
- const aliasFound = _.some(aliasList, (y) => {
166
- return isSingleBlockTypeActive(editor, y);
167
- });
168
-
169
- if (aliasFound) {
170
- isActive = true;
171
- defaultFormat = _.first(aliasList);
172
- matcher = (n) => _.includes(aliasList, n.type);
173
-
174
- return { isActive, defaultFormat, matcher };
175
- }
176
- }
177
-
178
- isActive = isBlockActive(editor, format);
179
- defaultFormat = format;
180
- matcher = (n) => n.type === format;
181
-
182
- return { isActive, defaultFormat, matcher };
183
- };
184
-
185
- export const toggleInlineFormat = (editor, format) => {
186
- const { isActive, defaultFormat, matcher } = getBlockTypeContextData(
187
- editor,
188
- format,
189
- );
190
-
191
- if (isActive) {
192
- const rangeRef = Editor.rangeRef(editor, editor.selection);
193
-
194
- Transforms.unwrapNodes(editor, {
195
- match: matcher,
196
- split: false,
197
- });
198
-
199
- const newSel = JSON.parse(JSON.stringify(rangeRef.current));
200
-
201
- Transforms.select(editor, newSel);
202
- editor.setSavedSelection(newSel);
203
- // editor.savedSelection = newSel;
204
- return;
205
- }
206
-
207
- const exclusiveElements = config.settings.slate.exclusiveElements;
208
- const matchedElements = exclusiveTags(exclusiveElements, format);
209
- let alreadyOneIsActive =
210
- !!matchedElements &&
211
- (matchedElements.indexOf(format) === 0
212
- ? isBlockActive(editor, matchedElements[1])
213
- : isBlockActive(editor, matchedElements[0]));
214
-
215
- if (alreadyOneIsActive) {
216
- Transforms.unwrapNodes(editor, {
217
- match: (n) => matchedElements.includes(n.type),
218
- split: false,
219
- });
220
-
221
- const block = { type: format, children: [] };
222
- Transforms.wrapNodes(editor, block, { split: true });
223
- return;
224
- }
225
-
226
- // `children` property is added automatically as an empty array then
227
- // normalized
228
- const block = { type: defaultFormat };
229
- Transforms.wrapNodes(editor, block, { split: true });
230
- };
231
-
232
- const exclusiveTags = (exclusiveElements, format) => {
233
- let elements = null;
234
- for (const item of exclusiveElements) {
235
- if (item.includes(format)) {
236
- elements = item;
237
- break;
238
- }
239
- }
240
-
241
- return elements;
242
- };
243
-
244
- export const toggleBlock = (editor, format, allowedChildren) => {
245
- // We have 6 boolean variables which need to be accounted for.
246
- // See https://docs.google.com/spreadsheets/d/1mVeMuqSTMABV2BhoHPrPAFjn7zUksbNgZ9AQK_dcd3U/edit?usp=sharing
247
- const { slate } = config.settings;
248
- const { listTypes } = slate;
249
-
250
- const isListItem = isBlockActive(editor, slate.listItemType);
251
- const isActive = isBlockActive(editor, format);
252
- const wantsList = listTypes.includes(format);
253
-
254
- if (isListItem && !wantsList) {
255
- toggleFormatAsListItem(editor, format);
256
- } else if (isListItem && wantsList && !isActive) {
257
- switchListType(editor, format);
258
- } else if (!isListItem && wantsList) {
259
- changeBlockToList(editor, format);
260
- } else if (!isListItem && !wantsList) {
261
- toggleFormat(editor, format, allowedChildren);
262
- } else if (isListItem && wantsList && isActive) {
263
- clearFormatting(editor);
264
- } else {
265
- console.warn('toggleBlock case not covered, please examine:', {
266
- wantsList,
267
- isActive,
268
- isListItem,
269
- });
270
- }
271
- };
272
-
273
- /*
274
- * Applies a block format to a list item. Will split the list
275
- */
276
- export const toggleFormatAsListItem = (editor, format) => {
277
- Transforms.setNodes(editor, {
278
- type: format,
279
- });
280
-
281
- Editor.normalize(editor);
282
- };
283
-
284
- /*
285
- * Toggles between list types by exploding the block
286
- */
287
- export const switchListType = (editor, format) => {
288
- const { slate } = config.settings;
289
- Transforms.unwrapNodes(editor, {
290
- match: (n) => slate.listTypes.includes(n.type),
291
- split: true,
292
- });
293
- const block = { type: format, children: [] };
294
- Transforms.wrapNodes(editor, block);
295
- };
296
-
297
- export const changeBlockToList = (editor, format) => {
298
- const { slate } = config.settings;
299
- const [match] = Editor.nodes(editor, {
300
- match: (n) => n.type === slate.listItemType,
301
- });
302
-
303
- if (!match) {
304
- Transforms.setNodes(editor, {
305
- type: slate.listItemType,
306
- // id: nanoid(8),
307
- });
308
- }
309
-
310
- // `children` property is added automatically as an empty array then
311
- // normalized
312
- const block = { type: format };
313
- Transforms.wrapNodes(editor, block);
314
- };
315
-
316
- export const toggleFormat = (editor, format, allowedChildren) => {
317
- const { slate } = config.settings;
318
- const isActive = isBlockActive(editor, format);
319
- const type = isActive ? slate.defaultBlockType : format;
320
- Transforms.setNodes(editor, {
321
- type,
322
- });
323
- allowedChildren?.length &&
324
- Transforms.unwrapNodes(editor, {
325
- mode: 'all',
326
- at: [0],
327
- match: (n, path) => {
328
- const isMatch =
329
- path.length > 1 && // we don't deal with the parent nodes
330
- !(Text.isText(n) || allowedChildren.includes(n?.type));
331
- return isMatch;
332
- },
333
- });
334
- };
335
-
336
- /**
337
- * @param {object} properties A prop received by the View component
338
- * which is read by the `getBlocksFieldname` and
339
- * `getBlocksLayoutFieldname` Volto helpers to produce the return value.
340
- * @returns {Array} All the blocks data taken from the Volto form.
341
- */
342
- export const getAllBlocks = (properties, blocks) => {
343
- const blocksFieldName = getBlocksFieldname(properties);
344
- const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
345
-
346
- for (const n of properties?.[blocksLayoutFieldname]?.items || []) {
347
- const block = properties[blocksFieldName][n];
348
- // TODO Make this configurable via block config getBlocks
349
- if (
350
- block?.data?.[blocksLayoutFieldname] &&
351
- block?.data?.[blocksFieldName]
352
- ) {
353
- getAllBlocks(block.data, blocks);
354
- } else if (block?.[blocksLayoutFieldname] && block?.[blocksFieldName]) {
355
- getAllBlocks(block, blocks);
356
- }
357
- blocks.push({
358
- id: n,
359
- ...block,
360
- });
361
- }
362
- return blocks;
363
- };
364
-
365
- export const clearFormatting = (editor) => {
366
- const { slate } = config.settings;
367
- Transforms.setNodes(editor, {
368
- type: slate.defaultBlockType,
369
- });
370
- Transforms.unwrapNodes(editor, {
371
- match: (n) => n.type && n.type !== slate.defaultBlockType,
372
- mode: 'all',
373
- split: false,
374
- });
375
- };
@@ -1,138 +0,0 @@
1
- import { getAllBlocks } from './blocks';
2
-
3
- describe('Blocks utils', () => {
4
- describe('Get all blocks', () => {
5
- it('Basic empty test', () => {
6
- const metadata = {};
7
- const blocks = getAllBlocks(metadata, []);
8
- expect(blocks).toEqual([]);
9
- });
10
-
11
- it('Empty blocks', () => {
12
- const metadata = {
13
- blocks: {},
14
- blocks_layout: {},
15
- };
16
- const blocks = getAllBlocks(metadata, []);
17
- expect(blocks).toEqual([]);
18
- });
19
-
20
- it('Empty blocks with items', () => {
21
- const metadata = {
22
- blocks: {},
23
- blocks_layout: { items: [] },
24
- };
25
- const blocks = getAllBlocks(metadata, []);
26
- expect(blocks).toEqual([]);
27
- });
28
-
29
- it('One level of blocks', () => {
30
- const metadata = {
31
- blocks: { a: {} },
32
- blocks_layout: { items: ['a'] },
33
- };
34
- const blocks = getAllBlocks(metadata, []);
35
- expect(blocks).toEqual([{ id: 'a' }]);
36
- });
37
-
38
- it('Two level of blocks w/o data', () => {
39
- const metadata = {
40
- blocks: {
41
- a: {
42
- blocks: {
43
- b: { type: 'text' },
44
- },
45
- blocks_layout: {
46
- items: ['b'],
47
- },
48
- },
49
- },
50
- blocks_layout: {
51
- items: ['a'],
52
- },
53
- };
54
- const blocks = getAllBlocks(metadata, []);
55
- expect(blocks).toEqual([
56
- { id: 'b', ...metadata.blocks.a.blocks.b },
57
- { id: 'a', ...metadata.blocks.a },
58
- ]);
59
- });
60
-
61
- it('Two level of blocks w/ data', () => {
62
- const metadata = {
63
- blocks: {
64
- a: {
65
- data: {
66
- blocks: {
67
- b: { type: 'text' },
68
- },
69
- blocks_layout: {
70
- items: ['b'],
71
- },
72
- },
73
- },
74
- },
75
- blocks_layout: {
76
- items: ['a'],
77
- },
78
- };
79
- const blocks = getAllBlocks(metadata, []);
80
- expect(blocks).toEqual([
81
- { id: 'b', ...metadata.blocks.a.data.blocks.b },
82
- { id: 'a', ...metadata.blocks.a },
83
- ]);
84
- });
85
-
86
- it('Three level of blocks', () => {
87
- const metadata = {
88
- blocks: {
89
- a: {
90
- data: {
91
- blocks: {
92
- a1: { type: 'text' },
93
- a2: {
94
- type: 'text',
95
- blocks: {
96
- a21: { type: 'image' },
97
- a22: { type: 'image' },
98
- },
99
- blocks_layout: {
100
- items: ['a21', 'a22'],
101
- },
102
- },
103
- },
104
- blocks_layout: {
105
- items: ['a1', 'a2'],
106
- },
107
- },
108
- },
109
- b: {
110
- data: {
111
- blocks: {
112
- b1: { type: 'text' },
113
- b2: { type: 'text' },
114
- },
115
- blocks_layout: {
116
- items: ['b1', 'b2'],
117
- },
118
- },
119
- },
120
- },
121
- blocks_layout: {
122
- items: ['a', 'b'],
123
- },
124
- };
125
- const blocks = getAllBlocks(metadata, []);
126
- expect(blocks).toEqual([
127
- { id: 'a1', ...metadata.blocks.a.data.blocks.a1 },
128
- { id: 'a21', ...metadata.blocks.a.data.blocks.a2.blocks.a21 },
129
- { id: 'a22', ...metadata.blocks.a.data.blocks.a2.blocks.a22 },
130
- { id: 'a2', ...metadata.blocks.a.data.blocks.a2 },
131
- { id: 'a', ...metadata.blocks.a },
132
- { id: 'b1', ...metadata.blocks.b.data.blocks.b1 },
133
- { id: 'b2', ...metadata.blocks.b.data.blocks.b2 },
134
- { id: 'b', ...metadata.blocks.b },
135
- ]);
136
- });
137
- });
138
- });