@vonaffenfels/slate-editor 1.1.71 → 1.2.10

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 (96) hide show
  1. package/.babelrc +43 -43
  2. package/README.md +5 -5
  3. package/componentLoader.js +93 -93
  4. package/dist/BlockEditor.css +4 -1871
  5. package/dist/BlockEditor.js +336 -3960
  6. package/dist/BlockEditor.js.LICENSE.txt +61 -0
  7. package/dist/Renderer.js +2 -2081
  8. package/dist/Renderer.js.LICENSE.txt +15 -0
  9. package/dist/fromHTML.js +1 -78
  10. package/dist/index.css +4 -1871
  11. package/dist/index.js +336 -4037
  12. package/dist/index.js.LICENSE.txt +69 -0
  13. package/dist/toHTML.js +2 -1689
  14. package/dist/toHTML.js.LICENSE.txt +23 -0
  15. package/dist/toText.js +2 -1689
  16. package/dist/toText.js.LICENSE.txt +23 -0
  17. package/package.json +2 -2
  18. package/postcss.config.js +6 -6
  19. package/scss/demo.scss +148 -148
  20. package/scss/editor.scss +17 -5
  21. package/scss/sidebarEditor.scss +185 -181
  22. package/scss/toolbar.scss +161 -161
  23. package/src/BlockEditor.js +6 -3
  24. package/src/Blocks/EmptyBlock.js +11 -11
  25. package/src/Blocks/EmptyWrapper.js +4 -4
  26. package/src/Blocks/ErrorBoundary.js +40 -40
  27. package/src/Blocks/LayoutBlock.js +274 -274
  28. package/src/Blocks/LayoutSlot.js +90 -90
  29. package/src/CollapsableMenu/CollapsableMenu.js +48 -48
  30. package/src/Context/StorybookContext.js +6 -6
  31. package/src/ElementAutocomplete.js +133 -133
  32. package/src/Loader.js +137 -137
  33. package/src/Nodes/Default.js +158 -158
  34. package/src/Nodes/Leaf.js +54 -54
  35. package/src/Nodes/Text.js +97 -97
  36. package/src/ObjectId.js +3 -3
  37. package/src/Renderer.js +73 -73
  38. package/src/Serializer/Html.js +42 -42
  39. package/src/Serializer/Serializer.js +371 -371
  40. package/src/Serializer/Text.js +17 -17
  41. package/src/Serializer/ads.js +174 -174
  42. package/src/Serializer/index.js +3 -3
  43. package/src/SidebarEditor/AssetList.js +181 -181
  44. package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
  45. package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
  46. package/src/SidebarEditor/Fields/ContentfulContentSelect.js +62 -62
  47. package/src/SidebarEditor/Fields/DateTime.js +55 -55
  48. package/src/SidebarEditor/Fields/MVP.js +66 -66
  49. package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
  50. package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
  51. package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
  52. package/src/SidebarEditor/Fields/Select.js +47 -47
  53. package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
  54. package/src/SidebarEditor/Fields/Switch.js +34 -34
  55. package/src/SidebarEditor/Fields/Textarea.js +21 -21
  56. package/src/SidebarEditor/Resizable.js +85 -85
  57. package/src/Storybook.js +151 -151
  58. package/src/Toolbar/Align.js +64 -64
  59. package/src/Toolbar/Anchor.js +94 -94
  60. package/src/Toolbar/Block.js +135 -135
  61. package/src/Toolbar/Element.js +44 -44
  62. package/src/Toolbar/Formats.js +71 -71
  63. package/src/Toolbar/Insert.js +28 -28
  64. package/src/Toolbar/Layout.js +399 -399
  65. package/src/Toolbar/Link.js +164 -164
  66. package/src/Toolbar/Toolbar.js +235 -235
  67. package/src/Tools/Margin.js +51 -51
  68. package/src/Translation/TranslationToolbarButton.js +119 -115
  69. package/src/dev/draftToSlate.json +3147 -3147
  70. package/src/dev/index.css +2 -2
  71. package/src/dev/index.html +10 -10
  72. package/src/dev/index.js +4 -4
  73. package/src/dev/sampleValue1.json +4294 -4294
  74. package/src/dev/sampleValueValid.json +410 -410
  75. package/src/dev/testComponents/TestStory.js +74 -74
  76. package/src/dev/testComponents/TestStory.stories.js +216 -216
  77. package/src/dev/testComponents/TestStory2.js +74 -74
  78. package/src/dev/testComponents/TestStory2.stories.js +197 -197
  79. package/src/dev/testComponents/TestStory3.js +74 -74
  80. package/src/dev/testComponents/TestStory3.stories.js +197 -197
  81. package/src/dev/testSampleValue.json +746 -746
  82. package/src/fromHTML.js +4 -4
  83. package/src/helper/array.js +8 -8
  84. package/src/index.js +10 -10
  85. package/src/plugins/ListItem.js +48 -48
  86. package/src/plugins/SoftBreak.js +23 -23
  87. package/src/toHTML.js +6 -6
  88. package/src/toText.js +6 -6
  89. package/src/util/reduceContentfulResponse.js +64 -64
  90. package/src/util.js +19 -19
  91. package/storyLoader.js +47 -47
  92. package/tailwind.config.js +4 -4
  93. package/webpack.config.build.js +55 -55
  94. package/webpack.config.dev.js +60 -60
  95. package/webpack.config.js +130 -130
  96. package/webpack.config.watch.js +4 -4
package/.babelrc CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- "presets": [
3
- "next/babel",
4
- [
5
- "@babel/preset-env",
6
- {
7
- "modules": false,
8
- "targets": {
9
- "browsers": [
10
- "last 2 Chrome versions",
11
- "last 2 Firefox versions",
12
- "last 2 Safari versions",
13
- "last 2 iOS versions",
14
- "last 1 Android version",
15
- "last 1 ChromeAndroid version",
16
- "ie 11"
17
- ]
18
- }
19
- }
20
- ],
21
- "@babel/preset-react"
22
- ],
23
- "plugins": [
24
- [
25
- "@babel/plugin-proposal-private-methods",
26
- {
27
- "loose": true
28
- }
29
- ],
30
- [
31
- "@babel/plugin-proposal-private-property-in-object",
32
- {
33
- "loose": true
34
- }
35
- ],
36
- [
37
- "@babel/plugin-proposal-class-properties",
38
- {
39
- "loose": true
40
- }
41
- ],
42
- "@babel/plugin-syntax-dynamic-import"
43
- ]
1
+ {
2
+ "presets": [
3
+ "next/babel",
4
+ [
5
+ "@babel/preset-env",
6
+ {
7
+ "modules": false,
8
+ "targets": {
9
+ "browsers": [
10
+ "last 2 Chrome versions",
11
+ "last 2 Firefox versions",
12
+ "last 2 Safari versions",
13
+ "last 2 iOS versions",
14
+ "last 1 Android version",
15
+ "last 1 ChromeAndroid version",
16
+ "ie 11"
17
+ ]
18
+ }
19
+ }
20
+ ],
21
+ "@babel/preset-react"
22
+ ],
23
+ "plugins": [
24
+ [
25
+ "@babel/plugin-proposal-private-methods",
26
+ {
27
+ "loose": true
28
+ }
29
+ ],
30
+ [
31
+ "@babel/plugin-proposal-private-property-in-object",
32
+ {
33
+ "loose": true
34
+ }
35
+ ],
36
+ [
37
+ "@babel/plugin-proposal-class-properties",
38
+ {
39
+ "loose": true
40
+ }
41
+ ],
42
+ "@babel/plugin-syntax-dynamic-import"
43
+ ]
44
44
  }
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # dev
2
-
3
- run config EDITOR :: DEV or in repo root yarn devEditor
4
-
5
- http://localhost:9000/dist/
1
+ # dev
2
+
3
+ run config EDITOR :: DEV or in repo root yarn devEditor
4
+
5
+ http://localhost:9000/dist/
@@ -1,94 +1,94 @@
1
- const walkSync = require("walk-sync");
2
-
3
- module.exports = async function componentLoader() {
4
- const options = this.getOptions();
5
- const files = walkSync(options.componentRoot, {
6
- directories: false,
7
- globs: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
8
- ignore: [
9
- "**/*.stories.js",
10
- "**/*.stories.jsx",
11
- "**/*.stories.ts",
12
- "**/*.loader.js",
13
- "**/*.loader.jsx",
14
- "**/*.loader.ts",
15
- "**/streams/*.js",
16
- "**/streams/*.jsx",
17
- "**/streams/*.ts",
18
- "**/atomic/**/*",
19
- ],
20
- });
21
-
22
- // this.addContextDependency(options.componentRoot);
23
-
24
- console.log(`Found ${files.length} components in ${options.componentRoot}`);
25
- const components = files.map(file => {
26
- let componentNameParts = file.split(".");
27
- componentNameParts.pop();
28
-
29
- const exportName = componentNameParts.join("").split("/").pop();
30
-
31
- return {
32
- name: componentNameParts.join("").split("/").join(""),
33
- exportName,
34
- namePath: componentNameParts.join(""),
35
- file: `${options.componentImportRoot}/${file}`,
36
- };
37
- });
38
-
39
- const nonDynamicComponentImports = [];
40
- const componentImports = components.map(component => {
41
- let allowSSR = !(options.nonSSRComponents || []).map(v => String(v).toLowerCase()).includes(String(component.name).toLowerCase());
42
-
43
- if (!allowSSR) {
44
- // console.log(`Disabled SSR for ${component.file}`);
45
- }
46
-
47
- let isDynamic = !(options.nonDynamicComponents || []).map(v => String(v).toLowerCase()).includes(String(component.name).toLowerCase());
48
-
49
- if (isDynamic) {
50
- return `COMPONENT_REGISTRY["${component.namePath.toLowerCase()}"] = dynamic(() => import(/* webpackChunkName: "${component.name}" */"${component.file}").then(v => makeExport(v, ["${component.exportName}", "${component.name}"]))${!allowSSR ? ",{ssr: false}" : ""});`;
51
- } else {
52
- nonDynamicComponentImports.push(`import {default as ${component.name}} from "${component.file}";`);
53
- return `COMPONENT_REGISTRY["${component.namePath.toLowerCase()}"] = ${component.name};`;
54
- }
55
- });
56
-
57
- const fileContent = `
58
- ${nonDynamicComponentImports.join("\n")}
59
- import dynamic from 'next/dynamic';
60
-
61
- const COMPONENT_REGISTRY = {};
62
- const MissingComponent = () => null;
63
- const makeExport = (component, names) => {
64
- const ElementComponent = [...names, "default"].reduce((acc, name) => acc || component[name], null);
65
-
66
- if(!ElementComponent) {
67
- console.debug(\`Missing export for \${names.join(" / ")}\`);
68
- return MissingComponent;
69
- }
70
-
71
- return ElementComponent;
72
- }
73
-
74
- ${componentImports.join("\n")}
75
-
76
- export default function componentLoader(block) {
77
- const localBlock = String(block).toLowerCase();
78
-
79
- if(!COMPONENT_REGISTRY[localBlock]) {
80
- console.warn(\`No Component found for \${block}\`);
81
- return MissingComponent;
82
- }
83
-
84
- return COMPONENT_REGISTRY[localBlock];
85
- }
86
- `;
87
-
88
- /*
89
- const writeFileSync = require("fs").writeFileSync;
90
- writeFileSync("./componentLoader.static.DEBUG.js", fileContent);
91
- */
92
-
93
- return fileContent;
1
+ const walkSync = require("walk-sync");
2
+
3
+ module.exports = async function componentLoader() {
4
+ const options = this.getOptions();
5
+ const files = walkSync(options.componentRoot, {
6
+ directories: false,
7
+ globs: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
8
+ ignore: [
9
+ "**/*.stories.js",
10
+ "**/*.stories.jsx",
11
+ "**/*.stories.ts",
12
+ "**/*.loader.js",
13
+ "**/*.loader.jsx",
14
+ "**/*.loader.ts",
15
+ "**/streams/*.js",
16
+ "**/streams/*.jsx",
17
+ "**/streams/*.ts",
18
+ "**/atomic/**/*",
19
+ ],
20
+ });
21
+
22
+ // this.addContextDependency(options.componentRoot);
23
+
24
+ console.log(`Found ${files.length} components in ${options.componentRoot}`);
25
+ const components = files.map(file => {
26
+ let componentNameParts = file.split(".");
27
+ componentNameParts.pop();
28
+
29
+ const exportName = componentNameParts.join("").split("/").pop();
30
+
31
+ return {
32
+ name: componentNameParts.join("").split("/").join(""),
33
+ exportName,
34
+ namePath: componentNameParts.join(""),
35
+ file: `${options.componentImportRoot}/${file}`,
36
+ };
37
+ });
38
+
39
+ const nonDynamicComponentImports = [];
40
+ const componentImports = components.map(component => {
41
+ let allowSSR = !(options.nonSSRComponents || []).map(v => String(v).toLowerCase()).includes(String(component.name).toLowerCase());
42
+
43
+ if (!allowSSR) {
44
+ // console.log(`Disabled SSR for ${component.file}`);
45
+ }
46
+
47
+ let isDynamic = !(options.nonDynamicComponents || []).map(v => String(v).toLowerCase()).includes(String(component.name).toLowerCase());
48
+
49
+ if (isDynamic) {
50
+ return `COMPONENT_REGISTRY["${component.namePath.toLowerCase()}"] = dynamic(() => import(/* webpackChunkName: "${component.name}" */"${component.file}").then(v => makeExport(v, ["${component.exportName}", "${component.name}"]))${!allowSSR ? ",{ssr: false}" : ""});`;
51
+ } else {
52
+ nonDynamicComponentImports.push(`import {default as ${component.name}} from "${component.file}";`);
53
+ return `COMPONENT_REGISTRY["${component.namePath.toLowerCase()}"] = ${component.name};`;
54
+ }
55
+ });
56
+
57
+ const fileContent = `
58
+ ${nonDynamicComponentImports.join("\n")}
59
+ import dynamic from 'next/dynamic';
60
+
61
+ const COMPONENT_REGISTRY = {};
62
+ const MissingComponent = () => null;
63
+ const makeExport = (component, names) => {
64
+ const ElementComponent = [...names, "default"].reduce((acc, name) => acc || component[name], null);
65
+
66
+ if(!ElementComponent) {
67
+ console.debug(\`Missing export for \${names.join(" / ")}\`);
68
+ return MissingComponent;
69
+ }
70
+
71
+ return ElementComponent;
72
+ }
73
+
74
+ ${componentImports.join("\n")}
75
+
76
+ export default function componentLoader(block) {
77
+ const localBlock = String(block).toLowerCase();
78
+
79
+ if(!COMPONENT_REGISTRY[localBlock]) {
80
+ console.warn(\`No Component found for \${block}\`);
81
+ return MissingComponent;
82
+ }
83
+
84
+ return COMPONENT_REGISTRY[localBlock];
85
+ }
86
+ `;
87
+
88
+ /*
89
+ const writeFileSync = require("fs").writeFileSync;
90
+ writeFileSync("./componentLoader.static.DEBUG.js", fileContent);
91
+ */
92
+
93
+ return fileContent;
94
94
  };