@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,171 +0,0 @@
1
- import React from 'react';
2
- import redraft from 'redraft';
3
- import TextBlockView from './TextBlockView';
4
- import TextBlockEdit from './TextBlockEdit';
5
- import TextBlockSchema from './TextBlockSchema';
6
-
7
- import {
8
- goDown,
9
- goUp,
10
- backspaceInList,
11
- indentListItems,
12
- joinWithNextBlock,
13
- joinWithPreviousBlock,
14
- softBreak,
15
- moveListItemDown,
16
- moveListItemUp,
17
- traverseBlocks,
18
- unwrapEmptyString,
19
- slashMenu,
20
- cancelEsc,
21
- } from './keyboard';
22
- import { withDeleteSelectionOnEnter } from '@plone/volto-slate/editor/extensions';
23
- import {
24
- breakList,
25
- withDeserializers,
26
- withLists,
27
- withSplitBlocksOnBreak,
28
- withIsSelected,
29
- normalizeExternalData,
30
- } from './extensions';
31
- import { extractImages } from '@plone/volto-slate/editor/plugins/Image/deconstruct';
32
- import { extractTables } from '@plone/volto-slate/blocks/Table/deconstruct';
33
-
34
- import textSVG from '@plone/volto/icons/subtext.svg';
35
-
36
- export { TextBlockView, TextBlockEdit, TextBlockSchema };
37
-
38
- export default function applyConfig(config) {
39
- config.settings.slate = {
40
- // TODO: should we inverse order? First here gets executed last
41
- textblockExtensions: [
42
- withLists,
43
- withSplitBlocksOnBreak, // TODO: do we still need this one?
44
- withDeleteSelectionOnEnter,
45
- withDeserializers,
46
- withIsSelected,
47
- breakList,
48
- normalizeExternalData,
49
- ],
50
-
51
- // Pluggable handlers for the onKeyDown event of <Editable />
52
- // Order matters here. A handler can return `true` to stop executing any
53
- // following handler
54
- textblockKeyboardHandlers: {
55
- Backspace: [
56
- unwrapEmptyString,
57
- backspaceInList, // Backspace in list item lifts node and breaks Volto blocks
58
- joinWithPreviousBlock, // Backspace at beginning of block joins with previous block
59
- ],
60
- Delete: [
61
- unwrapEmptyString,
62
- joinWithNextBlock, // Delete at end of block joins with next block
63
- ],
64
- Enter: [
65
- slashMenu,
66
- unwrapEmptyString,
67
- softBreak, // Handles shift+Enter as a newline (<br/>)
68
- ],
69
- ArrowUp: [
70
- slashMenu,
71
- moveListItemUp, // Move up a list with with Ctrl+up
72
- goUp, // Select previous block
73
- ],
74
- ArrowDown: [
75
- slashMenu,
76
- moveListItemDown, // Move down a list item with Ctrl+down
77
- goDown, // Select next block
78
- ],
79
- Tab: [
80
- indentListItems, // <tab> and <c-tab> behaviour for list items
81
- traverseBlocks,
82
- ],
83
- Escape: [cancelEsc],
84
- },
85
- textblockDetachedKeyboardHandlers: {
86
- Enter: [
87
- softBreak, // Handles shift+Enter as a newline (<br/>)
88
- ],
89
- },
90
- // Used by deconstructToVoltoBlocks to transform tags such as <img> to a Volto image block
91
- // These emiters receive (editor, pathRef), emit [blockid, blockoptions] and
92
- // are allowed to change the editor contents (for the given path)
93
- voltoBlockEmiters: [
94
- ...(config.settings.slate.voltoBlockEmiters || []),
95
- extractImages,
96
- extractTables,
97
- ],
98
-
99
- // These elements will get an id, to make them targets in TOC
100
- topLevelTargetElements: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
101
-
102
- ...config.settings.slate, // TODO: is this correct for volto-slate addons?
103
- };
104
-
105
- const slateBlockConfig = {
106
- id: 'slate',
107
- title: 'Text',
108
- icon: textSVG,
109
- group: 'text',
110
- view: TextBlockView,
111
- edit: TextBlockEdit,
112
- schema: TextBlockSchema,
113
- restricted: false,
114
- mostUsed: false,
115
- blockHasOwnFocusManagement: true,
116
- sidebarTab: 0,
117
- security: {
118
- addPermission: [],
119
- view: [],
120
- },
121
- blockHasValue: (data) => {
122
- // TODO: this should be handled better
123
- return data && !!data.plaintext?.trim();
124
- },
125
- tocEntry: (block = {}) => {
126
- const { value, override_toc, entry_text, level, plaintext } = block;
127
- const type = value?.[0]?.type;
128
- return override_toc && level
129
- ? [parseInt(level.slice(1)), entry_text]
130
- : config.settings.slate.topLevelTargetElements.includes(type)
131
- ? [parseInt(type.slice(1)), plaintext]
132
- : null;
133
- },
134
- };
135
-
136
- // Make draft js compatible with ToC
137
- config.blocks.blocksConfig.text = {
138
- ...config.blocks.blocksConfig.text,
139
- restricted: true,
140
- tocEntry: (block = {}) => {
141
- const draft = redraft(
142
- block.text,
143
- config.settings.richtextViewSettings.ToHTMLRenderers,
144
- config.settings.richtextViewSettings.ToHTMLOptions,
145
- );
146
- const type = draft?.[0]?.[0]?.type;
147
-
148
- return config.settings.slate.topLevelTargetElements.includes(type)
149
- ? [parseInt(type.slice(1)), block.text.blocks[0].text]
150
- : null;
151
- },
152
- };
153
-
154
- config.blocks.blocksConfig.slate = slateBlockConfig;
155
- config.blocks.blocksConfig.detachedSlate = {
156
- ...config.blocks.blocksConfig.slate,
157
- id: 'detachedSlate',
158
- title: 'Detached Slate',
159
- edit: (props) => <TextBlockEdit {...props} detached />,
160
- restricted: true,
161
- };
162
-
163
- if (config.blocks.blocksConfig.gridBlock) {
164
- // This is required in order to initialize the inner blocksConfig
165
- // for the grid block, since the slate block lives in an add-on
166
- // it should be responsible to fill itself into the grid configuration
167
- config.blocks.blocksConfig.gridBlock.blocksConfig.slate = slateBlockConfig;
168
- }
169
-
170
- return config;
171
- }
@@ -1,58 +0,0 @@
1
- import { Transforms } from 'slate';
2
- import config from '@plone/volto/registry';
3
- import {
4
- isCursorInList,
5
- isCursorAtListBlockStart,
6
- deconstructToVoltoBlocks,
7
- } from '@plone/volto-slate/utils';
8
-
9
- /**
10
- * Handle the new Volto blocks created by `deconstructToVoltoBlocks`.
11
- * @param {Editor} editor The Slate editor object
12
- * @param {string[]} newIds The IDs of the newly created Volto blocks.
13
- */
14
- const handleNewVoltoBlocks = (editor, newIds) => {
15
- const props = editor.getBlockProps();
16
- props.onSelectBlock(newIds[0]);
17
- };
18
-
19
- /**
20
- * Handles the Backspace key press event in the given `editor`.
21
- *
22
- * @param {Editor} editor
23
- * @param {Event} event
24
- */
25
- export function backspaceInList({ editor, event }) {
26
- // If the cursor is not in a list, nothing special.
27
- if (!isCursorInList(editor)) return false;
28
-
29
- if (isCursorAtListBlockStart(editor)) {
30
- const { slate } = config.settings;
31
- const blockProps = editor.getBlockProps();
32
- const { data } = blockProps;
33
-
34
- // Can't split if block is required
35
- if (data?.required) return;
36
-
37
- // Raise all LI-s as direct children of the editor.
38
- // TODO: add check for path depth
39
- // Error: Cannot lift node at a path [0] because it has a depth of less
40
- // than `2`.
41
- Transforms.liftNodes(editor, {
42
- match: (n, path) => {
43
- // console.log('lift', n, path);
44
- return path.length > 1 && n.type === slate.listItemType;
45
- },
46
- });
47
-
48
- // Convert all the selection to be of type `slate.defaultBlockType` (by
49
- // default 'p' or paragraph).
50
- Transforms.setNodes(editor, { type: slate.defaultBlockType });
51
-
52
- deconstructToVoltoBlocks(editor).then((newIds) => {
53
- handleNewVoltoBlocks(editor, newIds);
54
- });
55
-
56
- return true;
57
- }
58
- }
@@ -1,3 +0,0 @@
1
- export function breakBlocks({ editor, event }) {
2
- return true;
3
- }
@@ -1,7 +0,0 @@
1
- export const cancelEsc = ({ editor, event }) => {
2
- // TODO: this doesn't work, escape canceling doesn't work.
3
- event.stopPropagation();
4
- event.nativeEvent.stopImmediatePropagation();
5
- event.preventDefault();
6
- return true;
7
- };
@@ -1,240 +0,0 @@
1
- import { Editor, Path, Transforms } from 'slate';
2
- import {
3
- isCursorInList,
4
- deconstructToVoltoBlocks,
5
- getCurrentListItem,
6
- mergeWithNextList,
7
- mergeWithPreviousList,
8
- } from '@plone/volto-slate/utils';
9
- import config from '@plone/volto/registry';
10
-
11
- /**
12
- * @function indentListItems
13
- * @param {Editor} editor
14
- * @param {Event} event
15
- *
16
- * This bit is quite involved. You need a good understanding of Slate API and
17
- * Slate's DOM-like behaviour.
18
- *
19
- * The markup we're trying to produce is like:
20
- *
21
- * ```
22
- * <ul>
23
- * <li>something</li>
24
- * <ul>
25
- * <li>else</li>
26
- * </ul>
27
- * </ul>
28
- * ```
29
- *
30
- * Although not the cleanest, there are numerous advantages to having lists like
31
- * this:
32
- * - Code is a lot cleaner, easy to understand and maintain
33
- * - Google Docs produces the same type of lists
34
- * - HTML produced by LibreWriter (as witnesed in clipboard transfer) is same
35
- *
36
- * See https://github.com/eea/volto-slate/releases/tag/ul_inside_li for an
37
- * implementation that "inlines" the <ul> tags inside <li>. It's not pretty.
38
- */
39
- export function indentListItems({ editor, event }) {
40
- // TODO: test if the cursor is at the beginning of the list item
41
-
42
- // If the text cursor is not in a list, then do nothing.
43
- if (!isCursorInList(editor)) {
44
- return;
45
- } else {
46
- // Else prevent the default event handling and bubbling.
47
- event.preventDefault();
48
- event.stopPropagation();
49
-
50
- // If Shift & Ctrl, decrease multiple items depth. If Shift & !Ctrl,
51
- // decrease item depth. If !Shift & Ctrl, increase multiple item depth. If
52
- // !Shift & !Ctrl, increase item depth.
53
- return event.shiftKey
54
- ? event.ctrlKey
55
- ? decreaseMultipleItemsDepth(editor, event)
56
- : decreaseItemDepth(editor, event)
57
- : event.ctrlKey
58
- ? increaseMultipleItemDepth(editor, event)
59
- : increaseItemDepth(editor, event);
60
- }
61
- }
62
-
63
- /**
64
- * Handle the new Volto blocks created by `deconstructToVoltoBlocks`.
65
- * @param {Editor} editor The Slate editor object as customized by the
66
- * volto-slate addon.
67
- * @param {string[]} newIds The IDs of the newly created Volto blocks.
68
- */
69
- const handleNewVoltoBlocks = (editor, blockIds) => {
70
- const props = editor.getBlockProps();
71
- props.onSelectBlock(blockIds[blockIds.length - 1]);
72
- };
73
-
74
- /**
75
- * @function decreaseItemDepth
76
- *
77
- * Decreases indent level of a single list item.
78
- *
79
- * @param {Editor} editor
80
- * @param {Event} event
81
- */
82
- export function decreaseItemDepth(editor, event) {
83
- const { slate } = config.settings;
84
-
85
- // Current list item being unindented
86
- const [listItemNode, listItemPath] = getCurrentListItem(editor);
87
-
88
- // The ul/ol that holds the current list item
89
- const [, parentListPath] = Editor.parent(editor, listItemPath);
90
-
91
- // TODO: when unindenting a sublist item, it should take its next siblings
92
- // with it as a sublist
93
- const listItemRef = Editor.pathRef(editor, listItemPath);
94
-
95
- // TODO: please clarify, we unwrap at list item path but we only unwrap nodes
96
- // that match list types, but list item type is different from all list types:
97
- Transforms.unwrapNodes(editor, {
98
- at: listItemPath,
99
- split: true,
100
- mode: 'lowest',
101
- match: (node) => slate.listTypes.includes(node.type),
102
- });
103
-
104
- /**
105
- * This condition is the same as "listItemRef.current is not the root editor
106
- * node or one if its children".
107
- */
108
- function getCondition1() {
109
- return listItemRef.current.length > 1;
110
- }
111
-
112
- /**
113
- * @returns The current parent Node of the PathRef linked to the initial list
114
- * item that we want deindented.
115
- */
116
- function getParent() {
117
- return Path.parent(listItemRef.current);
118
- }
119
-
120
- // Merge with any previous <ul/ol> list
121
- if (getCondition1()) mergeWithPreviousList(editor, getParent());
122
-
123
- // Merge with any next <ul/ol> list
124
- if (getCondition1()) mergeWithNextList(editor, getParent());
125
-
126
- if (parentListPath.length === 1) {
127
- // Our parent is at root, just under the Editor, where just block nodes can
128
- // be, and the user wants to break out so we unwrap the list item. Usually
129
- // this means making the list item a `p` just below the Editor in the
130
- // document tree, keeping its contents.
131
- Transforms.setNodes(
132
- editor,
133
- { type: slate.defaultBlockType },
134
- {
135
- at: listItemRef.current,
136
- match: (node) => node === listItemNode,
137
- },
138
- );
139
- }
140
-
141
- listItemRef.unref();
142
-
143
- // If we have more then one child in the editor root, break to volto blocks
144
- if (editor.children.length > 1) {
145
- deconstructToVoltoBlocks(editor).then((newIds) => {
146
- handleNewVoltoBlocks(editor, newIds);
147
- });
148
- }
149
-
150
- return true;
151
- }
152
-
153
- /**
154
- * Increases the depth (indent level) of a single list item.
155
- *
156
- * @param {Editor} editor
157
- * @param {Event} event
158
- */
159
- export function increaseItemDepth(editor, event) {
160
- // test if there's a sibling ul element above (in this case we insert at end)
161
- // or below (then we insert at top)
162
-
163
- // Get the current list item's path.
164
- const [, listItemPath] = getCurrentListItem(editor);
165
-
166
- // Get the current list item's parent Node.
167
- const [parentList] = Editor.parent(editor, listItemPath);
168
-
169
- const { slate } = config.settings;
170
- const { type } = parentList;
171
-
172
- // If the parent is not a list
173
- if (!slate.listTypes.includes(type)) {
174
- // Do not increase any indent level. And also, this situation shows that
175
- // there is a LI inside something that is not a list, and this means that
176
- // something broke the data in the Slate document. TODO: Maybe throw an
177
- // exception?
178
- return false; // false means that the event was not practically handled
179
- }
180
-
181
- /**
182
- * Create a list of the same type as the parent list and put the specified
183
- * list item in it, then put the new list inside the parent list.
184
- */
185
- function wrapListItem() {
186
- Transforms.wrapNodes(
187
- editor,
188
- // `children` property is added automatically as an empty array then
189
- // normalized
190
- { type: type },
191
- {
192
- at: listItemPath,
193
- },
194
- );
195
- }
196
-
197
- // If the parent list is just below the Editor node
198
- if (parentList.children.length === 1) {
199
- // There should be just one block node inside the Editor node in volto-slate
200
- // (what about table cells? currently they allow multiple paragraphs in
201
- // them), so there should be no previous or next sibling.
202
- wrapListItem();
203
- return true;
204
- }
205
-
206
- wrapListItem();
207
-
208
- // listItemPath was wrapped in a node, so it now points to a list
209
- const currentListRef = Editor.pathRef(editor, listItemPath);
210
-
211
- // Merge with any previous <ul/ol> list
212
- mergeWithPreviousList(editor, currentListRef.current);
213
-
214
- // Merge with any next <ul/ol> list
215
- mergeWithNextList(editor, currentListRef.current);
216
-
217
- currentListRef.unref();
218
-
219
- return true;
220
- }
221
-
222
- /**
223
- * [Not implemented] Indents current list item + plus siblings that come after
224
- * it.
225
- * @param {Editor} editor
226
- * @param {Event} event
227
- */
228
- export function increaseMultipleItemDepth(editor, event) {
229
- // TODO: implement
230
- }
231
-
232
- /**
233
- * [Not implemented] Un-indents current list item + plus siblings that come
234
- * after it.
235
- * @param {Editor} editor
236
- * @param {Event} event
237
- */
238
- export function decreaseMultipleItemsDepth(editor, event) {
239
- // TODO: implement
240
- }
@@ -1,52 +0,0 @@
1
- import config from '@plone/volto/registry';
2
-
3
- export * from './backspaceInList';
4
- export * from './breakBlocks';
5
- export * from './indentListItems';
6
- export * from './joinBlocks';
7
- export * from './moveListItems';
8
- export * from './softBreak';
9
- export * from './traverseBlocks';
10
- export * from './unwrapEmptyString';
11
- export * from './slashMenu';
12
- export * from './cancelEsc';
13
-
14
- /**
15
- * Takes all the handlers from `slate.textblockKeyboardHandlers` that are
16
- * associated with the key that was pressed to generate the `event` and runs
17
- * them all until one of them returns `true`, moment when the rest of the
18
- * handlers are skipped.
19
- * @param {Editor} editor
20
- * @param {KeyboardEvent} event
21
- */
22
- export function handleKey({ editor, event }) {
23
- const { slate } = config.settings;
24
-
25
- const handlers = slate.textblockKeyboardHandlers[event.key];
26
-
27
- if (handlers) {
28
- // a handler can return `true` to signify it has handled the event in this
29
- // case, the execution flow is stopped
30
- return handlers.find((handler) => handler({ editor, event }));
31
- }
32
- }
33
-
34
- /**
35
- * Takes all the handlers from `slate.textblockDetachedKeyboardHandlers` that are
36
- * associated with the key that was pressed to generate the `event` and runs
37
- * them all until one of them returns `true`, moment when the rest of the
38
- * handlers are skipped.
39
- * @param {Editor} editor
40
- * @param {KeyboardEvent} event
41
- */
42
- export function handleKeyDetached({ editor, event }) {
43
- const { slate } = config.settings;
44
-
45
- const handlers = slate.textblockDetachedKeyboardHandlers[event.key];
46
-
47
- if (handlers) {
48
- // a handler can return `true` to signify it has handled the event in this
49
- // case, the execution flow is stopped
50
- return handlers.find((handler) => handler({ editor, event }));
51
- }
52
- }