@plone/volto-slate 19.0.0-alpha.8 → 19.0.0
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/.release-it.json +2 -2
- package/AGENTS.md +28 -0
- package/CHANGELOG.md +83 -0
- package/locales/af/LC_MESSAGES/volto.po +183 -0
- package/locales/ar/LC_MESSAGES/volto.po +184 -0
- package/locales/bg/LC_MESSAGES/volto.po +183 -0
- package/locales/bn/LC_MESSAGES/volto.po +183 -0
- package/locales/ca/LC_MESSAGES/volto.po +183 -0
- package/locales/cs/LC_MESSAGES/volto.po +183 -0
- package/locales/cy/LC_MESSAGES/volto.po +184 -0
- package/locales/da/LC_MESSAGES/volto.po +183 -0
- package/locales/de/LC_MESSAGES/volto.po +9 -4
- package/locales/el/LC_MESSAGES/volto.po +183 -0
- package/locales/en/LC_MESSAGES/volto.po +9 -4
- package/locales/en_AU/LC_MESSAGES/volto.po +183 -0
- package/locales/en_GB/LC_MESSAGES/volto.po +183 -0
- package/locales/eo/LC_MESSAGES/volto.po +183 -0
- package/locales/es/LC_MESSAGES/volto.po +190 -0
- package/locales/et/LC_MESSAGES/volto.po +183 -0
- package/locales/eu/LC_MESSAGES/volto.po +149 -0
- package/locales/fa/LC_MESSAGES/volto.po +183 -0
- package/locales/fi/LC_MESSAGES/volto.po +191 -0
- package/locales/fr/LC_MESSAGES/volto.po +183 -0
- package/locales/fu/LC_MESSAGES/volto.po +183 -0
- package/locales/gl/LC_MESSAGES/volto.po +185 -0
- package/locales/he/LC_MESSAGES/volto.po +184 -0
- package/locales/hi/LC_MESSAGES/volto.po +183 -0
- package/locales/hr/LC_MESSAGES/volto.po +184 -0
- package/locales/hu/LC_MESSAGES/volto.po +183 -0
- package/locales/hy/LC_MESSAGES/volto.po +183 -0
- package/locales/id/LC_MESSAGES/volto.po +183 -0
- package/locales/it/LC_MESSAGES/volto.po +7 -2
- package/locales/ja/LC_MESSAGES/volto.po +183 -0
- package/locales/ka/LC_MESSAGES/volto.po +183 -0
- package/locales/kn/LC_MESSAGES/volto.po +183 -0
- package/locales/ko/LC_MESSAGES/volto.po +183 -0
- package/locales/lt/LC_MESSAGES/volto.po +185 -0
- package/locales/lv/LC_MESSAGES/volto.po +184 -0
- package/locales/mi/LC_MESSAGES/volto.po +183 -0
- package/locales/mk/LC_MESSAGES/volto.po +183 -0
- package/locales/my/LC_MESSAGES/volto.po +183 -0
- package/locales/nb_NO/LC_MESSAGES/volto.po +183 -0
- package/locales/nl/LC_MESSAGES/volto.po +10 -5
- package/locales/nn/LC_MESSAGES/volto.po +183 -0
- package/locales/pl/LC_MESSAGES/volto.po +184 -0
- package/locales/pt/LC_MESSAGES/volto.po +183 -0
- package/locales/pt_BR/LC_MESSAGES/volto.po +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +183 -0
- package/locales/ro/LC_MESSAGES/volto.po +205 -0
- package/locales/ru/LC_MESSAGES/volto.po +184 -0
- package/locales/sk/LC_MESSAGES/volto.po +183 -0
- package/locales/sl/LC_MESSAGES/volto.po +184 -0
- package/locales/sm/LC_MESSAGES/volto.po +183 -0
- package/locales/sq/LC_MESSAGES/volto.po +183 -0
- package/locales/sr/LC_MESSAGES/volto.po +184 -0
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +184 -0
- package/locales/sr@latn/LC_MESSAGES/volto.po +184 -0
- package/locales/sv/LC_MESSAGES/volto.po +183 -0
- package/locales/ta/LC_MESSAGES/volto.po +183 -0
- package/locales/te/LC_MESSAGES/volto.po +183 -0
- package/locales/th/LC_MESSAGES/volto.po +183 -0
- package/locales/to/LC_MESSAGES/volto.po +183 -0
- package/locales/tr/LC_MESSAGES/volto.po +183 -0
- package/locales/uk/LC_MESSAGES/volto.po +184 -0
- package/locales/vi/LC_MESSAGES/volto.po +183 -0
- package/locales/zh_Hans/LC_MESSAGES/volto.po +183 -0
- package/locales/zh_Hant/LC_MESSAGES/volto.po +183 -0
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +183 -0
- package/package.json +5 -6
- package/src/blocks/Table/TableBlockEdit.jsx +319 -465
- package/src/blocks/Table/TableBlockEdit.test.jsx +0 -6
- package/src/blocks/Table/TableBlockView.jsx +65 -62
- package/src/blocks/Table/__snapshots__/Cell.test.jsx.snap +3 -0
- package/src/blocks/Table/__snapshots__/{TableBlockEdit.test.js.snap → TableBlockEdit.test.jsx.snap} +2 -2
- package/src/blocks/Table/__snapshots__/TableBlockView.test.jsx.snap +38 -0
- package/src/blocks/Table/deconstruct.js +1 -1
- package/src/blocks/Table/deconstruct.test.js +24 -0
- package/src/blocks/Text/SlashMenu.jsx +4 -2
- package/src/blocks/Text/TextBlockEdit.test.jsx +51 -34
- package/src/blocks/Text/__snapshots__/{TextBlockEdit.test.js.snap → TextBlockEdit.test.jsx.snap} +19 -6
- package/src/editor/config.jsx +1 -1
- package/src/editor/plugins/Link/index.jsx +0 -1
- package/src/editor/plugins/Table/less/public.less +4 -0
- package/src/editor/ui/__snapshots__/{ToolbarButton.test.js.snap → ToolbarButton.test.jsx.snap} +2 -2
- package/src/widgets/HtmlSlateWidget.jsx +9 -3
- package/src/blocks/Table/__snapshots__/Cell.test.js.snap +0 -3
- package/src/blocks/Table/__snapshots__/TableBlockView.test.js.snap +0 -27
|
@@ -25,12 +25,6 @@ test('renders an edit table block component', () => {
|
|
|
25
25
|
onAddBlock={() => {}}
|
|
26
26
|
onChangeBlock={() => {}}
|
|
27
27
|
onSelectBlock={() => {}}
|
|
28
|
-
onDeleteBlock={() => {}}
|
|
29
|
-
onInsertBlock={() => {}}
|
|
30
|
-
onFocusPreviousBlock={() => {}}
|
|
31
|
-
onFocusNextBlock={() => {}}
|
|
32
|
-
handleKeyDown={() => {}}
|
|
33
|
-
onMutateBlock={() => {}}
|
|
34
28
|
index={1}
|
|
35
29
|
/>
|
|
36
30
|
</Provider>,
|
|
@@ -85,70 +85,73 @@ const View = ({ data }) => {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
return (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
onKeyDown={(e) => {
|
|
114
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
115
|
-
e.preventDefault();
|
|
88
|
+
<div className="block slate-table">
|
|
89
|
+
<div className="block-inner-container">
|
|
90
|
+
{data && data.table && (
|
|
91
|
+
<Table
|
|
92
|
+
fixed={data.table.fixed}
|
|
93
|
+
compact={data.table.compact}
|
|
94
|
+
basic={data.table.basic ? 'very' : false}
|
|
95
|
+
celled={data.table.celled}
|
|
96
|
+
inverted={data.table.inverted}
|
|
97
|
+
striped={data.table.striped}
|
|
98
|
+
sortable={data.table.sortable}
|
|
99
|
+
className="slate-table-block"
|
|
100
|
+
unstackable
|
|
101
|
+
>
|
|
102
|
+
{!data.table.hideHeaders ? (
|
|
103
|
+
<Table.Header>
|
|
104
|
+
<Table.Row>
|
|
105
|
+
{headers.map((cell, index) => (
|
|
106
|
+
<Table.HeaderCell
|
|
107
|
+
key={cell.key}
|
|
108
|
+
textAlign="left"
|
|
109
|
+
verticalAlign="middle"
|
|
110
|
+
tabIndex={data.table.sortable ? '0' : '-1'}
|
|
111
|
+
sorted={state.column === index ? state.direction : null}
|
|
112
|
+
onClick={() => {
|
|
116
113
|
handleSort(index);
|
|
114
|
+
}}
|
|
115
|
+
onKeyDown={(e) => {
|
|
116
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
handleSort(index);
|
|
119
|
+
}
|
|
120
|
+
}}
|
|
121
|
+
aria-sort={
|
|
122
|
+
state.column === index ? state.direction : 'none'
|
|
117
123
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
</Table>
|
|
150
|
-
)}
|
|
151
|
-
</>
|
|
124
|
+
>
|
|
125
|
+
{cell.value &&
|
|
126
|
+
Node.string({ children: cell.value }).length > 0
|
|
127
|
+
? serializeNodes(cell.value)
|
|
128
|
+
: '\u00A0'}
|
|
129
|
+
</Table.HeaderCell>
|
|
130
|
+
))}
|
|
131
|
+
</Table.Row>
|
|
132
|
+
</Table.Header>
|
|
133
|
+
) : (
|
|
134
|
+
''
|
|
135
|
+
)}
|
|
136
|
+
<Table.Body>
|
|
137
|
+
{map(sortedRows, (row) => (
|
|
138
|
+
<Table.Row key={row}>
|
|
139
|
+
{map(rows[row], (cell) => (
|
|
140
|
+
<Table.Cell
|
|
141
|
+
key={cell.key}
|
|
142
|
+
textAlign="left"
|
|
143
|
+
verticalAlign="middle"
|
|
144
|
+
>
|
|
145
|
+
{cell.value}
|
|
146
|
+
</Table.Cell>
|
|
147
|
+
))}
|
|
148
|
+
</Table.Row>
|
|
149
|
+
))}
|
|
150
|
+
</Table.Body>
|
|
151
|
+
</Table>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
152
155
|
);
|
|
153
156
|
};
|
|
154
157
|
|
package/src/blocks/Table/__snapshots__/{TableBlockEdit.test.js.snap → TableBlockEdit.test.jsx.snap}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`renders an edit table block component 1`] = `
|
|
4
4
|
<div
|
|
5
5
|
className="block table"
|
|
6
6
|
>
|
|
7
7
|
<table
|
|
8
|
-
className="ui table slate-table-block"
|
|
8
|
+
className="ui unstackable table slate-table-block"
|
|
9
9
|
>
|
|
10
10
|
<thead
|
|
11
11
|
className=""
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`renders a view table component 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="block slate-table"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="block-inner-container"
|
|
9
|
+
>
|
|
10
|
+
<table
|
|
11
|
+
className="ui unstackable table slate-table-block"
|
|
12
|
+
>
|
|
13
|
+
<thead
|
|
14
|
+
className=""
|
|
15
|
+
>
|
|
16
|
+
<tr
|
|
17
|
+
className=""
|
|
18
|
+
>
|
|
19
|
+
<th
|
|
20
|
+
aria-sort="none"
|
|
21
|
+
className="left aligned middle aligned"
|
|
22
|
+
onClick={[Function]}
|
|
23
|
+
onKeyDown={[Function]}
|
|
24
|
+
tabIndex="-1"
|
|
25
|
+
>
|
|
26
|
+
<h2>
|
|
27
|
+
My header
|
|
28
|
+
</h2>
|
|
29
|
+
</th>
|
|
30
|
+
</tr>
|
|
31
|
+
</thead>
|
|
32
|
+
<tbody
|
|
33
|
+
className=""
|
|
34
|
+
/>
|
|
35
|
+
</table>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { syncCreateTableBlock } from './deconstruct';
|
|
2
|
+
|
|
3
|
+
describe('syncCreateTableBlock', () => {
|
|
4
|
+
it('creates a slateTable block with the given rows', () => {
|
|
5
|
+
const rows = [
|
|
6
|
+
{
|
|
7
|
+
key: 'row1',
|
|
8
|
+
cells: [
|
|
9
|
+
{
|
|
10
|
+
key: 'cell1',
|
|
11
|
+
type: 'data',
|
|
12
|
+
value: [{ children: [{ text: '1' }] }],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const [id, block] = syncCreateTableBlock(rows);
|
|
19
|
+
|
|
20
|
+
expect(id).toBeDefined();
|
|
21
|
+
expect(block['@type']).toBe('slateTable');
|
|
22
|
+
expect(block.table.rows).toEqual(rows);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -120,7 +120,7 @@ const PersistentSlashMenu = ({ editor }) => {
|
|
|
120
120
|
const slashCommand = data.plaintext
|
|
121
121
|
?.toLowerCase()
|
|
122
122
|
.trim()
|
|
123
|
-
.match(/^\/([
|
|
123
|
+
.match(/^\/([\p{L}]*)$/u);
|
|
124
124
|
|
|
125
125
|
const availableBlocks = React.useMemo(
|
|
126
126
|
() =>
|
|
@@ -141,10 +141,12 @@ const PersistentSlashMenu = ({ editor }) => {
|
|
|
141
141
|
.filter((block) => {
|
|
142
142
|
// typed text is a substring of the title or id
|
|
143
143
|
const title = translateBlockTitle(block, intl).toLowerCase();
|
|
144
|
+
const originalTitle = block.title.toLowerCase();
|
|
144
145
|
return (
|
|
145
146
|
block.id !== 'slate' &&
|
|
146
147
|
slashCommand &&
|
|
147
|
-
title.
|
|
148
|
+
(title.includes(slashCommand[1]) ||
|
|
149
|
+
originalTitle.includes(slashCommand[1]))
|
|
148
150
|
);
|
|
149
151
|
})
|
|
150
152
|
.sort((a, b) => {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { Provider } from 'react-
|
|
2
|
+
import { createStore } from 'redux';
|
|
3
|
+
import { Provider } from 'react-redux';
|
|
4
|
+
import { IntlProvider } from 'react-intl';
|
|
4
5
|
import { render } from '@testing-library/react';
|
|
5
6
|
import config from '@plone/volto/registry';
|
|
6
7
|
import TextBlockEdit from './TextBlockEdit';
|
|
7
8
|
import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
// Create a proper Redux store with initial state
|
|
11
|
+
const createMockStore = (initialState) => {
|
|
12
|
+
const rootReducer = (state = initialState) => state;
|
|
13
|
+
return createStore(rootReducer, initialState);
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
window.getSelection = () => null;
|
|
12
17
|
|
|
13
|
-
global.__SERVER__ = true;
|
|
14
|
-
global.__CLIENT__ = false;
|
|
18
|
+
global.__SERVER__ = true;
|
|
19
|
+
global.__CLIENT__ = false;
|
|
15
20
|
|
|
16
21
|
beforeAll(() => {
|
|
17
22
|
config.widgets = {
|
|
@@ -60,7 +65,18 @@ beforeAll(() => {
|
|
|
60
65
|
|
|
61
66
|
describe('TextBlockEdit', () => {
|
|
62
67
|
it('renders w/o errors', async () => {
|
|
63
|
-
const store =
|
|
68
|
+
const store = createMockStore({
|
|
69
|
+
userSession: {
|
|
70
|
+
token: null,
|
|
71
|
+
},
|
|
72
|
+
users: {
|
|
73
|
+
user: {},
|
|
74
|
+
get: {
|
|
75
|
+
loading: false,
|
|
76
|
+
loaded: false,
|
|
77
|
+
error: null,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
64
80
|
intl: {
|
|
65
81
|
locale: 'en',
|
|
66
82
|
messages: {},
|
|
@@ -69,36 +85,37 @@ describe('TextBlockEdit', () => {
|
|
|
69
85
|
|
|
70
86
|
mockAllIsIntersecting(true);
|
|
71
87
|
|
|
72
|
-
// TODO: also test for the initial contents: My first paragraph.
|
|
73
88
|
const { asFragment } = render(
|
|
74
89
|
<Provider store={store}>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
<IntlProvider locale="en" messages={{}}>
|
|
91
|
+
<TextBlockEdit
|
|
92
|
+
block="478923"
|
|
93
|
+
blockNode={{ current: {} }}
|
|
94
|
+
detached={false}
|
|
95
|
+
index={2}
|
|
96
|
+
onAddBlock={() => {}}
|
|
97
|
+
onChangeBlock={() => {}}
|
|
98
|
+
onDeleteBlock={() => {}}
|
|
99
|
+
onFocusNextBlock={() => {}}
|
|
100
|
+
onFocusPreviousBlock={() => {}}
|
|
101
|
+
onInsertBlock={() => {}}
|
|
102
|
+
onMutateBlock={() => {}}
|
|
103
|
+
onSelectBlock={() => {}}
|
|
104
|
+
properties={{}}
|
|
105
|
+
setSlateBlockSelection={() => {}}
|
|
106
|
+
data={{
|
|
107
|
+
'@type': 'slate',
|
|
108
|
+
plaintext: '',
|
|
109
|
+
value: [
|
|
110
|
+
{
|
|
111
|
+
type: 'p',
|
|
112
|
+
children: [{ text: '' }],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
}}
|
|
116
|
+
selected={true}
|
|
117
|
+
/>
|
|
118
|
+
</IntlProvider>
|
|
102
119
|
</Provider>,
|
|
103
120
|
);
|
|
104
121
|
|
package/src/blocks/Text/__snapshots__/{TextBlockEdit.test.js.snap → TextBlockEdit.test.jsx.snap}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`TextBlockEdit renders w/o errors 1`] = `
|
|
3
|
+
exports[`TextBlockEdit > renders w/o errors 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="text-slate-editor-inner"
|
|
@@ -13,6 +13,7 @@ exports[`TextBlockEdit renders w/o errors 1`] = `
|
|
|
13
13
|
class="toolbar-wrapper"
|
|
14
14
|
/>
|
|
15
15
|
<div
|
|
16
|
+
aria-labelledby="field-undefined"
|
|
16
17
|
aria-multiline="false"
|
|
17
18
|
autocapitalize="false"
|
|
18
19
|
autocorrect="false"
|
|
@@ -49,13 +50,25 @@ exports[`TextBlockEdit renders w/o errors 1`] = `
|
|
|
49
50
|
<button
|
|
50
51
|
class="ui basic icon button block-add-button"
|
|
51
52
|
title="Add block"
|
|
53
|
+
type="button"
|
|
52
54
|
>
|
|
53
55
|
<svg
|
|
54
56
|
class="icon block-add-button"
|
|
55
|
-
style="height: 24px; width: auto; fill:
|
|
56
|
-
viewBox=""
|
|
57
|
-
xmlns=""
|
|
58
|
-
|
|
57
|
+
style="height: 24px; width: auto; fill: currentcolor;"
|
|
58
|
+
viewBox="0 0 36 36"
|
|
59
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
60
|
+
>
|
|
61
|
+
<g
|
|
62
|
+
fill-rule="evenodd"
|
|
63
|
+
>
|
|
64
|
+
<path
|
|
65
|
+
d="M19 9 17 9 17 17 9 17 9 19 17 19 17 27 19 27 19 19 27 19 27 17 19 17z"
|
|
66
|
+
/>
|
|
67
|
+
<path
|
|
68
|
+
d="M18,31 C10.832,31 5,25.168 5,18 C5,10.832 10.832,5 18,5 C25.168,5 31,10.832 31,18 C31,25.168 25.168,31 18,31 M18,3 C9.729,3 3,9.729 3,18 C3,26.271 9.729,33 18,33 C26.271,33 33,26.271 33,18 C33,9.729 26.271,3 18,3"
|
|
69
|
+
/>
|
|
70
|
+
</g>
|
|
71
|
+
</svg>
|
|
59
72
|
</button>
|
|
60
73
|
</div>
|
|
61
74
|
</DocumentFragment>
|
package/src/editor/config.jsx
CHANGED
|
@@ -207,7 +207,7 @@ export const hotkeys = {
|
|
|
207
207
|
'mod+b': { format: 'strong', type: 'inline' },
|
|
208
208
|
'mod+i': { format: 'em', type: 'inline' },
|
|
209
209
|
'mod+u': { format: 'u', type: 'inline' },
|
|
210
|
-
'mod+
|
|
210
|
+
'mod+shift+x': { format: 'del', type: 'inline' },
|
|
211
211
|
// 'mod+`': { format: 'code', type: 'inline' },
|
|
212
212
|
// TODO: more hotkeys, including from plugins!
|
|
213
213
|
};
|
package/src/editor/ui/__snapshots__/{ToolbarButton.test.js.snap → ToolbarButton.test.jsx.snap}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`ToolbarButton renders a toolbar button 1`] = `
|
|
3
|
+
exports[`ToolbarButton > renders a toolbar button 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="button-wrapper"
|
|
@@ -7,7 +7,7 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
7
7
|
import configureStore from 'redux-mock-store';
|
|
8
8
|
import { MemoryRouter } from 'react-router-dom';
|
|
9
9
|
import { Provider, useSelector } from 'react-redux';
|
|
10
|
-
import { defineMessages, injectIntl } from 'react-intl';
|
|
10
|
+
import { defineMessages, injectIntl, IntlProvider } from 'react-intl';
|
|
11
11
|
|
|
12
12
|
import { FormFieldWrapper } from '@plone/volto/components/manage/Widgets';
|
|
13
13
|
import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
|
|
@@ -61,7 +61,13 @@ const HtmlSlateWidget = (props) => {
|
|
|
61
61
|
const mockStore = configureStore();
|
|
62
62
|
const html = ReactDOMServer.renderToStaticMarkup(
|
|
63
63
|
<Provider store={mockStore({ userSession: { token } })}>
|
|
64
|
-
<
|
|
64
|
+
<IntlProvider
|
|
65
|
+
locale={intl.locale}
|
|
66
|
+
messages={intl.messages}
|
|
67
|
+
defaultLocale={intl.defaultLocale ?? 'en'}
|
|
68
|
+
>
|
|
69
|
+
<MemoryRouter>{serializeNodes(value || [])}</MemoryRouter>
|
|
70
|
+
</IntlProvider>
|
|
65
71
|
</Provider>,
|
|
66
72
|
);
|
|
67
73
|
// console.log('toHtml value', JSON.stringify(value));
|
|
@@ -73,7 +79,7 @@ const HtmlSlateWidget = (props) => {
|
|
|
73
79
|
data: html,
|
|
74
80
|
};
|
|
75
81
|
},
|
|
76
|
-
[token],
|
|
82
|
+
[token, intl],
|
|
77
83
|
);
|
|
78
84
|
|
|
79
85
|
const fromHtml = React.useCallback(
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`renders a view table component 1`] = `
|
|
4
|
-
<table
|
|
5
|
-
className="ui table slate-table-block"
|
|
6
|
-
>
|
|
7
|
-
<thead
|
|
8
|
-
className=""
|
|
9
|
-
>
|
|
10
|
-
<tr
|
|
11
|
-
className=""
|
|
12
|
-
>
|
|
13
|
-
<th
|
|
14
|
-
className="left aligned middle aligned"
|
|
15
|
-
onClick={[Function]}
|
|
16
|
-
>
|
|
17
|
-
<h2>
|
|
18
|
-
My header
|
|
19
|
-
</h2>
|
|
20
|
-
</th>
|
|
21
|
-
</tr>
|
|
22
|
-
</thead>
|
|
23
|
-
<tbody
|
|
24
|
-
className=""
|
|
25
|
-
/>
|
|
26
|
-
</table>
|
|
27
|
-
`;
|