@vonaffenfels/slate-editor 1.2.39 → 1.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +43 -43
- package/README.md +5 -5
- package/componentLoader.js +93 -93
- package/package.json +2 -2
- package/postcss.config.js +6 -6
- package/scss/demo.scss +148 -148
- package/scss/sidebarEditor.scss +185 -185
- package/scss/toolbar.scss +162 -162
- package/src/Blocks/EmptyBlock.js +11 -11
- package/src/Blocks/EmptyWrapper.js +4 -4
- package/src/Blocks/ErrorBoundary.js +40 -40
- package/src/Blocks/LayoutBlock.js +274 -274
- package/src/Blocks/LayoutSlot.js +90 -90
- package/src/CollapsableMenu/CollapsableMenu.js +48 -48
- package/src/Context/StorybookContext.js +6 -6
- package/src/ElementAutocomplete.js +134 -134
- package/src/Loader.js +137 -137
- package/src/Nodes/Default.js +162 -162
- package/src/Nodes/Leaf.js +54 -54
- package/src/Nodes/Text.js +97 -97
- package/src/ObjectId.js +3 -3
- package/src/Renderer.js +73 -73
- package/src/Serializer/Html.js +42 -42
- package/src/Serializer/Serializer.js +374 -374
- package/src/Serializer/Text.js +17 -17
- package/src/Serializer/ads.js +187 -187
- package/src/Serializer/index.js +3 -3
- package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
- package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
- package/src/SidebarEditor/Fields/DateTime.js +55 -55
- package/src/SidebarEditor/Fields/MVP.js +66 -66
- package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
- package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
- package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
- package/src/SidebarEditor/Fields/Select.js +47 -47
- package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
- package/src/SidebarEditor/Fields/Switch.js +34 -34
- package/src/SidebarEditor/Fields/Textarea.js +21 -21
- package/src/SidebarEditor/Resizable.js +85 -85
- package/src/Storybook.js +151 -151
- package/src/Toolbar/Align.js +64 -64
- package/src/Toolbar/Anchor.js +94 -94
- package/src/Toolbar/Block.js +135 -135
- package/src/Toolbar/Element.js +44 -44
- package/src/Toolbar/Formats.js +71 -71
- package/src/Toolbar/Insert.js +28 -28
- package/src/Toolbar/Layout.js +399 -399
- package/src/Toolbar/Link.js +164 -164
- package/src/Toolbar/Toolbar.js +235 -235
- package/src/Tools/Margin.js +51 -51
- package/src/Translation/TranslationToolbarButton.js +119 -119
- package/src/dev/draftToSlate.json +3147 -3147
- package/src/dev/index.css +2 -2
- package/src/dev/index.html +10 -10
- package/src/dev/index.js +4 -4
- package/src/dev/sampleValue1.json +4294 -4294
- package/src/dev/sampleValueValid.json +410 -410
- package/src/dev/testComponents/TestStory.js +74 -74
- package/src/dev/testComponents/TestStory.stories.js +216 -216
- package/src/dev/testComponents/TestStory2.js +74 -74
- package/src/dev/testComponents/TestStory2.stories.js +197 -197
- package/src/dev/testComponents/TestStory3.js +74 -74
- package/src/dev/testComponents/TestStory3.stories.js +197 -197
- package/src/dev/testSampleValue.json +746 -746
- package/src/fromHTML.js +4 -4
- package/src/helper/array.js +8 -8
- package/src/index.js +10 -10
- package/src/plugins/ListItem.js +48 -48
- package/src/plugins/SoftBreak.js +23 -23
- package/src/toHTML.js +6 -6
- package/src/toText.js +6 -6
- package/src/util/reduceContentfulResponse.js +64 -64
- package/src/util.js +19 -19
- package/storyLoader.js +47 -47
- package/tailwind.config.js +4 -4
- package/webpack.config.build.js +55 -55
- package/webpack.config.dev.js +60 -60
- package/webpack.config.js +130 -130
- package/webpack.config.watch.js +4 -4
package/webpack.config.dev.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
-
const config = require("./webpack.config");
|
|
4
|
-
const Dotenv = require("dotenv-webpack");
|
|
5
|
-
|
|
6
|
-
config.mode = "development";
|
|
7
|
-
config.watchOptions = {ignored: ['dist/**', 'node_modules/**']};
|
|
8
|
-
config.cache = {type: "memory"};
|
|
9
|
-
|
|
10
|
-
config.resolve.alias.react = path.resolve(__dirname, '../../node_modules/react');
|
|
11
|
-
config.resolve.alias["react-dom"] = path.resolve(__dirname, '../../node_modules/react-dom');
|
|
12
|
-
config.resolve.alias.storybookStories = path.resolve(__dirname, 'storyLoader.js');
|
|
13
|
-
|
|
14
|
-
config.entry.dev = './src/dev/index.js';
|
|
15
|
-
config.module.rules.unshift({
|
|
16
|
-
test: /storyLoader.js/i,
|
|
17
|
-
use: [
|
|
18
|
-
{
|
|
19
|
-
loader: path.resolve(__dirname + "/storyLoader.js"),
|
|
20
|
-
options: {
|
|
21
|
-
storiesRoot: path.resolve(__dirname + "/src/dev/testComponents"),
|
|
22
|
-
storiesImportRoot: "@vonaffenfels/slate-editor/src/dev/testComponents",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
config.module.rules.unshift({
|
|
28
|
-
test: /componentLoader.js/i,
|
|
29
|
-
use: [
|
|
30
|
-
{
|
|
31
|
-
loader: "@vonaffenfels/slate-editor/componentLoader.js",
|
|
32
|
-
options: {
|
|
33
|
-
componentRoot: path.resolve(__dirname + "/src/dev/testComponents"),
|
|
34
|
-
componentImportRoot: "@vonaffenfels/slate-editor/src/dev/testComponents",
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
config.devtool = 'inline-source-map';
|
|
41
|
-
|
|
42
|
-
config.plugins.push(new Dotenv());
|
|
43
|
-
config.plugins.push(new HtmlWebpackPlugin({
|
|
44
|
-
title: 'Development',
|
|
45
|
-
filename: 'index.html',
|
|
46
|
-
template: path.join(
|
|
47
|
-
__dirname, 'src', 'dev', 'index.html',
|
|
48
|
-
),
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
config.devServer = {
|
|
52
|
-
static: {
|
|
53
|
-
serveIndex: true,
|
|
54
|
-
publicPath: path.join(__dirname, 'dist'),
|
|
55
|
-
},
|
|
56
|
-
compress: true,
|
|
57
|
-
liveReload: true,
|
|
58
|
-
port: 9000,
|
|
59
|
-
};
|
|
60
|
-
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
+
const config = require("./webpack.config");
|
|
4
|
+
const Dotenv = require("dotenv-webpack");
|
|
5
|
+
|
|
6
|
+
config.mode = "development";
|
|
7
|
+
config.watchOptions = {ignored: ['dist/**', 'node_modules/**']};
|
|
8
|
+
config.cache = {type: "memory"};
|
|
9
|
+
|
|
10
|
+
config.resolve.alias.react = path.resolve(__dirname, '../../node_modules/react');
|
|
11
|
+
config.resolve.alias["react-dom"] = path.resolve(__dirname, '../../node_modules/react-dom');
|
|
12
|
+
config.resolve.alias.storybookStories = path.resolve(__dirname, 'storyLoader.js');
|
|
13
|
+
|
|
14
|
+
config.entry.dev = './src/dev/index.js';
|
|
15
|
+
config.module.rules.unshift({
|
|
16
|
+
test: /storyLoader.js/i,
|
|
17
|
+
use: [
|
|
18
|
+
{
|
|
19
|
+
loader: path.resolve(__dirname + "/storyLoader.js"),
|
|
20
|
+
options: {
|
|
21
|
+
storiesRoot: path.resolve(__dirname + "/src/dev/testComponents"),
|
|
22
|
+
storiesImportRoot: "@vonaffenfels/slate-editor/src/dev/testComponents",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
config.module.rules.unshift({
|
|
28
|
+
test: /componentLoader.js/i,
|
|
29
|
+
use: [
|
|
30
|
+
{
|
|
31
|
+
loader: "@vonaffenfels/slate-editor/componentLoader.js",
|
|
32
|
+
options: {
|
|
33
|
+
componentRoot: path.resolve(__dirname + "/src/dev/testComponents"),
|
|
34
|
+
componentImportRoot: "@vonaffenfels/slate-editor/src/dev/testComponents",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
config.devtool = 'inline-source-map';
|
|
41
|
+
|
|
42
|
+
config.plugins.push(new Dotenv());
|
|
43
|
+
config.plugins.push(new HtmlWebpackPlugin({
|
|
44
|
+
title: 'Development',
|
|
45
|
+
filename: 'index.html',
|
|
46
|
+
template: path.join(
|
|
47
|
+
__dirname, 'src', 'dev', 'index.html',
|
|
48
|
+
),
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
config.devServer = {
|
|
52
|
+
static: {
|
|
53
|
+
serveIndex: true,
|
|
54
|
+
publicPath: path.join(__dirname, 'dist'),
|
|
55
|
+
},
|
|
56
|
+
compress: true,
|
|
57
|
+
liveReload: true,
|
|
58
|
+
port: 9000,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
61
|
module.exports = config;
|
package/webpack.config.js
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
3
|
-
const Dotenv = require("dotenv-webpack");
|
|
4
|
-
const {readFileSync} = require("fs");
|
|
5
|
-
const babelConfig = JSON.parse(readFileSync(__dirname + "/.babelrc").toString());
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
mode: 'production',
|
|
9
|
-
entry: {
|
|
10
|
-
BlockEditor: './src/BlockEditor.js',
|
|
11
|
-
Renderer: './src/Renderer.js',
|
|
12
|
-
toHTML: './src/toHTML.js',
|
|
13
|
-
fromHTML: './src/fromHTML.js',
|
|
14
|
-
toText: './src/toText.js',
|
|
15
|
-
index: './src/index.js',
|
|
16
|
-
},
|
|
17
|
-
module: {
|
|
18
|
-
rules: [
|
|
19
|
-
{
|
|
20
|
-
test: /\.js$/,
|
|
21
|
-
include: [
|
|
22
|
-
path.resolve(__dirname, 'src'),
|
|
23
|
-
],
|
|
24
|
-
use: [
|
|
25
|
-
{
|
|
26
|
-
loader: 'babel-loader',
|
|
27
|
-
options: babelConfig,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
test: /\.s[ac]ss$/i,
|
|
33
|
-
include: path.resolve(__dirname, 'scss'),
|
|
34
|
-
use: [
|
|
35
|
-
"style-loader",
|
|
36
|
-
"css-loader",
|
|
37
|
-
"sass-loader",
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
test: /\.css$/i,
|
|
42
|
-
use: [
|
|
43
|
-
'style-loader',
|
|
44
|
-
{
|
|
45
|
-
loader: 'css-loader',
|
|
46
|
-
options: {importLoaders: 1},
|
|
47
|
-
},
|
|
48
|
-
{loader: 'postcss-loader'},
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
test: /\.svg$/,
|
|
53
|
-
exclude: /node_modules/,
|
|
54
|
-
resourceQuery: {not: [/url/]}, // exclude react component if *.svg?url
|
|
55
|
-
use: [
|
|
56
|
-
{
|
|
57
|
-
loader: '@svgr/webpack',
|
|
58
|
-
options: {
|
|
59
|
-
dimensions: false,
|
|
60
|
-
svgo: false,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
test: /\.svg$/,
|
|
67
|
-
resourceQuery: /url/, // include if *.svg?url
|
|
68
|
-
use: [
|
|
69
|
-
{
|
|
70
|
-
loader: 'file-loader',
|
|
71
|
-
options: {
|
|
72
|
-
name: '[name].[ext]',
|
|
73
|
-
outputPath: 'svgs/',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
|
80
|
-
use: [
|
|
81
|
-
{
|
|
82
|
-
loader: 'file-loader',
|
|
83
|
-
options: {
|
|
84
|
-
name: '[name].[ext]',
|
|
85
|
-
outputPath: 'fonts/',
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
test: /\.(png)(\?v=\d+\.\d+\.\d+)?$/,
|
|
92
|
-
use: [
|
|
93
|
-
{
|
|
94
|
-
loader: 'file-loader',
|
|
95
|
-
options: {
|
|
96
|
-
name: '[name].[ext]',
|
|
97
|
-
outputPath: 'img/',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
resolve: {
|
|
105
|
-
extensions: ['.js', '.json', '.jsx'],
|
|
106
|
-
fallback: {
|
|
107
|
-
fs: false,
|
|
108
|
-
zlib: false,
|
|
109
|
-
stream: false,
|
|
110
|
-
path: false,
|
|
111
|
-
timers: false,
|
|
112
|
-
buffer: false,
|
|
113
|
-
util: false,
|
|
114
|
-
},
|
|
115
|
-
alias: {
|
|
116
|
-
scss: path.resolve(__dirname, 'scss'),
|
|
117
|
-
"@vonaffenfels/slate-editor/dist": path.resolve(__dirname, 'src'),
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
plugins: [
|
|
121
|
-
new Dotenv({systemvars: true}),
|
|
122
|
-
new MiniCssExtractPlugin({}),
|
|
123
|
-
],
|
|
124
|
-
output: {
|
|
125
|
-
filename: '[name].js',
|
|
126
|
-
libraryTarget: "umd",
|
|
127
|
-
publicPath: "/dist/",
|
|
128
|
-
globalObject: "this",
|
|
129
|
-
path: path.resolve(__dirname, 'dist'),
|
|
130
|
-
},
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
3
|
+
const Dotenv = require("dotenv-webpack");
|
|
4
|
+
const {readFileSync} = require("fs");
|
|
5
|
+
const babelConfig = JSON.parse(readFileSync(__dirname + "/.babelrc").toString());
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
mode: 'production',
|
|
9
|
+
entry: {
|
|
10
|
+
BlockEditor: './src/BlockEditor.js',
|
|
11
|
+
Renderer: './src/Renderer.js',
|
|
12
|
+
toHTML: './src/toHTML.js',
|
|
13
|
+
fromHTML: './src/fromHTML.js',
|
|
14
|
+
toText: './src/toText.js',
|
|
15
|
+
index: './src/index.js',
|
|
16
|
+
},
|
|
17
|
+
module: {
|
|
18
|
+
rules: [
|
|
19
|
+
{
|
|
20
|
+
test: /\.js$/,
|
|
21
|
+
include: [
|
|
22
|
+
path.resolve(__dirname, 'src'),
|
|
23
|
+
],
|
|
24
|
+
use: [
|
|
25
|
+
{
|
|
26
|
+
loader: 'babel-loader',
|
|
27
|
+
options: babelConfig,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
test: /\.s[ac]ss$/i,
|
|
33
|
+
include: path.resolve(__dirname, 'scss'),
|
|
34
|
+
use: [
|
|
35
|
+
"style-loader",
|
|
36
|
+
"css-loader",
|
|
37
|
+
"sass-loader",
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
test: /\.css$/i,
|
|
42
|
+
use: [
|
|
43
|
+
'style-loader',
|
|
44
|
+
{
|
|
45
|
+
loader: 'css-loader',
|
|
46
|
+
options: {importLoaders: 1},
|
|
47
|
+
},
|
|
48
|
+
{loader: 'postcss-loader'},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
test: /\.svg$/,
|
|
53
|
+
exclude: /node_modules/,
|
|
54
|
+
resourceQuery: {not: [/url/]}, // exclude react component if *.svg?url
|
|
55
|
+
use: [
|
|
56
|
+
{
|
|
57
|
+
loader: '@svgr/webpack',
|
|
58
|
+
options: {
|
|
59
|
+
dimensions: false,
|
|
60
|
+
svgo: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
test: /\.svg$/,
|
|
67
|
+
resourceQuery: /url/, // include if *.svg?url
|
|
68
|
+
use: [
|
|
69
|
+
{
|
|
70
|
+
loader: 'file-loader',
|
|
71
|
+
options: {
|
|
72
|
+
name: '[name].[ext]',
|
|
73
|
+
outputPath: 'svgs/',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
|
80
|
+
use: [
|
|
81
|
+
{
|
|
82
|
+
loader: 'file-loader',
|
|
83
|
+
options: {
|
|
84
|
+
name: '[name].[ext]',
|
|
85
|
+
outputPath: 'fonts/',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
test: /\.(png)(\?v=\d+\.\d+\.\d+)?$/,
|
|
92
|
+
use: [
|
|
93
|
+
{
|
|
94
|
+
loader: 'file-loader',
|
|
95
|
+
options: {
|
|
96
|
+
name: '[name].[ext]',
|
|
97
|
+
outputPath: 'img/',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
resolve: {
|
|
105
|
+
extensions: ['.js', '.json', '.jsx'],
|
|
106
|
+
fallback: {
|
|
107
|
+
fs: false,
|
|
108
|
+
zlib: false,
|
|
109
|
+
stream: false,
|
|
110
|
+
path: false,
|
|
111
|
+
timers: false,
|
|
112
|
+
buffer: false,
|
|
113
|
+
util: false,
|
|
114
|
+
},
|
|
115
|
+
alias: {
|
|
116
|
+
scss: path.resolve(__dirname, 'scss'),
|
|
117
|
+
"@vonaffenfels/slate-editor/dist": path.resolve(__dirname, 'src'),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
plugins: [
|
|
121
|
+
new Dotenv({systemvars: true}),
|
|
122
|
+
new MiniCssExtractPlugin({}),
|
|
123
|
+
],
|
|
124
|
+
output: {
|
|
125
|
+
filename: '[name].js',
|
|
126
|
+
libraryTarget: "umd",
|
|
127
|
+
publicPath: "/dist/",
|
|
128
|
+
globalObject: "this",
|
|
129
|
+
path: path.resolve(__dirname, 'dist'),
|
|
130
|
+
},
|
|
131
131
|
};
|
package/webpack.config.watch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const config = require("./webpack.config.build");
|
|
2
|
-
|
|
3
|
-
config.mode = "development";
|
|
4
|
-
|
|
1
|
+
const config = require("./webpack.config.build");
|
|
2
|
+
|
|
3
|
+
config.mode = "development";
|
|
4
|
+
|
|
5
5
|
module.exports = config;
|