@plone/volto 16.26.0 → 16.26.1
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/.changelog.draft +4 -12
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +11 -0
- package/package.json +4 -4
- package/packages/volto-slate/package.json +5 -5
- package/packages/volto-slate/src/blocks/Text/keyboard/joinBlocks.js +6 -3
- package/packages/volto-slate/src/editor/SlateEditor.jsx +3 -1
- package/packages/volto-slate/src/editor/plugins/Link/extensions.js +25 -20
- package/packages/volto-slate/src/slate-react.js +26 -0
- package/packages/volto-slate/src/utils/selection.js +7 -4
- package/razzle.config.js +3 -0
- package/src/components/manage/Blocks/Description/Edit.jsx +1 -1
- package/src/components/manage/Blocks/Title/Edit.jsx +1 -1
- package/src/components/manage/TextLineEdit/TextLineEdit.jsx +1 -1
- package/theme/themes/pastanaga/extras/blocks.less +9 -0
- package/pyvenv.cfg +0 -3
package/.changelog.draft
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
## 16.26.
|
|
2
|
-
|
|
3
|
-
### Feature
|
|
4
|
-
|
|
5
|
-
- Updated aria-label for landmarks @ichim-david
|
|
6
|
-
Added landmark on sidebar @ichim-david
|
|
7
|
-
Added Pluggable section for skiplinks @ichim-david [#5290](https://github.com/plone/volto/issues/5290)
|
|
1
|
+
## 16.26.1 (2023-11-10)
|
|
8
2
|
|
|
9
3
|
### Bugfix
|
|
10
4
|
|
|
11
|
-
-
|
|
12
|
-
- Fix compare translations view @sneridagh [#5327](https://github.com/plone/volto/issues/5327)
|
|
13
|
-
- Fix DatetimeWidget on FF, the button default if no type is set is sending the form. @sneridagh
|
|
14
|
-
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#formmethod [#5343](https://github.com/plone/volto/issues/5343)
|
|
5
|
+
- Fix empty link element left hanging when hit enter at end of link. @iFlameing @tiberiuichim [#5291](https://github.com/plone/volto/issues/5291)
|
|
15
6
|
|
|
16
7
|
### Internal
|
|
17
8
|
|
|
18
|
-
-
|
|
9
|
+
- Added shim to keep working with value instead of initialValue in upgraded Slate @davisagli [#5291](https://github.com/plone/volto/issues/5291)
|
|
10
|
+
- Update internal Plone version to 6.0.8 @sneridagh [#5384](https://github.com/plone/volto/issues/5384)
|
|
19
11
|
|
|
20
12
|
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
<!-- towncrier release notes start -->
|
|
10
10
|
|
|
11
|
+
## 16.26.1 (2023-11-10)
|
|
12
|
+
|
|
13
|
+
### Bugfix
|
|
14
|
+
|
|
15
|
+
- Fix empty link element left hanging when hit enter at end of link. @iFlameing @tiberiuichim [#5291](https://github.com/plone/volto/issues/5291)
|
|
16
|
+
|
|
17
|
+
### Internal
|
|
18
|
+
|
|
19
|
+
- Added shim to keep working with value instead of initialValue in upgraded Slate @davisagli [#5291](https://github.com/plone/volto/issues/5291)
|
|
20
|
+
- Update internal Plone version to 6.0.8 @sneridagh [#5384](https://github.com/plone/volto/issues/5384)
|
|
21
|
+
|
|
11
22
|
## 16.26.0 (2023-10-27)
|
|
12
23
|
|
|
13
24
|
### Feature
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "16.26.
|
|
12
|
+
"version": "16.26.1",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git@github.com:plone/volto.git"
|
|
@@ -384,9 +384,9 @@
|
|
|
384
384
|
"semantic-ui-react": "2.0.3",
|
|
385
385
|
"semver": "5.6.0",
|
|
386
386
|
"serialize-javascript": "3.1.0",
|
|
387
|
-
"slate": "0.
|
|
388
|
-
"slate-hyperscript": "0.
|
|
389
|
-
"slate-react": "0.
|
|
387
|
+
"slate": "0.100.0",
|
|
388
|
+
"slate-hyperscript": "0.100.0",
|
|
389
|
+
"slate-react": "0.98.4",
|
|
390
390
|
"start-server-and-test": "1.14.0",
|
|
391
391
|
"style-loader": "2",
|
|
392
392
|
"stylelint": "14.0.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plone/volto-slate",
|
|
3
|
-
"version": "16.26.
|
|
3
|
+
"version": "16.26.1",
|
|
4
4
|
"description": "Slate.js integration with Volto",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"is-url": "1.2.4",
|
|
19
19
|
"jsdom": "^16.6.0",
|
|
20
20
|
"react-intersection-observer": "^8.32.0",
|
|
21
|
-
"slate": "
|
|
22
|
-
"slate-history": "
|
|
23
|
-
"slate-hyperscript": "
|
|
24
|
-
"slate-react": "
|
|
21
|
+
"slate": "0.100.0",
|
|
22
|
+
"slate-history": "0.100.0",
|
|
23
|
+
"slate-hyperscript": "0.100.0",
|
|
24
|
+
"slate-react": "0.98.4",
|
|
25
25
|
"weak-key": "^1.0.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
|
+
import { cloneDeep } from 'lodash';
|
|
2
3
|
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
3
4
|
import { Editor } from 'slate';
|
|
4
5
|
import {
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
isCursorAtBlockEnd,
|
|
9
10
|
mergeSlateWithBlockBackward,
|
|
10
11
|
mergeSlateWithBlockForward,
|
|
12
|
+
makeEditor,
|
|
11
13
|
} from '@plone/volto-slate/utils';
|
|
12
14
|
import {
|
|
13
15
|
changeBlock,
|
|
@@ -15,7 +17,6 @@ import {
|
|
|
15
17
|
getBlocksFieldname,
|
|
16
18
|
getBlocksLayoutFieldname,
|
|
17
19
|
} from '@plone/volto/helpers';
|
|
18
|
-
|
|
19
20
|
/**
|
|
20
21
|
* Joins the current block (which has an active Slate Editor)
|
|
21
22
|
* with the previous block, to make a single block.
|
|
@@ -164,9 +165,11 @@ function getBlockEndAsRange(block) {
|
|
|
164
165
|
const { value } = block;
|
|
165
166
|
const location = [value.length - 1]; // adress of root node
|
|
166
167
|
const editor = { children: value };
|
|
167
|
-
const
|
|
168
|
+
const newEditor = makeEditor();
|
|
169
|
+
newEditor.children = cloneDeep(editor.children);
|
|
170
|
+
const path = Editor.last(newEditor, location)[1]; // last Node in the block
|
|
168
171
|
// The last Text node (leaf node) entry inside the path computed just above.
|
|
169
|
-
const [leaf, leafpath] = Editor.leaf(
|
|
172
|
+
const [leaf, leafpath] = Editor.leaf(newEditor, path);
|
|
170
173
|
// The offset of the Points in the collapsed Range computed below:
|
|
171
174
|
const offset = (leaf.text || '').length;
|
|
172
175
|
|
|
@@ -135,6 +135,8 @@ class SlateEditor extends Component {
|
|
|
135
135
|
} catch {}
|
|
136
136
|
}, 100); // flush
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
this.state.editor.normalize({ force: true });
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
|
|
@@ -257,7 +259,7 @@ class SlateEditor extends Component {
|
|
|
257
259
|
<EditorContext.Provider value={editor}>
|
|
258
260
|
<Slate
|
|
259
261
|
editor={editor}
|
|
260
|
-
|
|
262
|
+
initialValue={this.props.value || slateSettings.defaultValue()}
|
|
261
263
|
onChange={this.handleChange}
|
|
262
264
|
>
|
|
263
265
|
{selected ? (
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
+
import { Text, Transforms, Element } from 'slate'; // Editor,
|
|
1
2
|
import { SIMPLELINK } from '@plone/volto-slate/constants';
|
|
2
3
|
import { jsx } from 'slate-hyperscript';
|
|
3
4
|
import { deserialize } from '@plone/volto-slate/editor/deserialize';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const nodeToText = (node) => {
|
|
7
|
+
if (Text.isText(node)) {
|
|
8
|
+
return node.text.trim();
|
|
9
|
+
} else {
|
|
10
|
+
return node.children.map(nodeToText).join('');
|
|
11
|
+
}
|
|
12
|
+
};
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
export const withSimpleLink = (editor) => {
|
|
15
|
+
const { isInline, normalizeNode } = editor;
|
|
9
16
|
|
|
10
17
|
editor.isInline = (element) => {
|
|
11
18
|
return element && element.type === SIMPLELINK ? true : isInline(element);
|
|
12
19
|
};
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// }
|
|
30
|
-
// };
|
|
21
|
+
editor.normalizeNode = (entry) => {
|
|
22
|
+
const [node, path] = entry;
|
|
23
|
+
const isTextNode = Text.isText(node);
|
|
24
|
+
const isElementNode = Element.isElement(node);
|
|
25
|
+
const isLinkTypeNode = node.type === SIMPLELINK;
|
|
26
|
+
|
|
27
|
+
// delete childless link nodes
|
|
28
|
+
if (!isTextNode && isElementNode && isLinkTypeNode && !nodeToText(node)) {
|
|
29
|
+
Transforms.removeNodes(editor, { at: path });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return normalizeNode(entry);
|
|
34
|
+
};
|
|
35
|
+
|
|
31
36
|
return editor;
|
|
32
37
|
};
|
|
33
38
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Slate as OrigSlate } from '@slate-react';
|
|
2
|
+
|
|
3
|
+
// Components
|
|
4
|
+
export { Editable, DefaultPlaceholder } from '@slate-react';
|
|
5
|
+
|
|
6
|
+
export { DefaultElement } from '@slate-react';
|
|
7
|
+
export { DefaultLeaf } from '@slate-react';
|
|
8
|
+
|
|
9
|
+
// Hooks
|
|
10
|
+
export { useEditor } from '@slate-react';
|
|
11
|
+
export { useSlateStatic } from '@slate-react';
|
|
12
|
+
export { useFocused } from '@slate-react';
|
|
13
|
+
export { useReadOnly } from '@slate-react';
|
|
14
|
+
export { useSelected } from '@slate-react';
|
|
15
|
+
export { useSlate, useSlateWithV } from '@slate-react';
|
|
16
|
+
export { useSlateSelector } from '@slate-react';
|
|
17
|
+
export { useSlateSelection } from '@slate-react';
|
|
18
|
+
|
|
19
|
+
// Plugin
|
|
20
|
+
export { ReactEditor } from '@slate-react';
|
|
21
|
+
export { withReact } from '@slate-react';
|
|
22
|
+
|
|
23
|
+
export const Slate = (props) => {
|
|
24
|
+
const initialValue = props.initialValue || props.value;
|
|
25
|
+
return OrigSlate({ ...props, initialValue });
|
|
26
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { castArray } from 'lodash';
|
|
1
|
+
import { castArray, cloneDeep } from 'lodash';
|
|
2
2
|
import { Editor, Transforms, Range, Node } from 'slate';
|
|
3
3
|
import { ReactEditor } from 'slate-react';
|
|
4
|
-
import { isCursorInList } from '@plone/volto-slate/utils';
|
|
4
|
+
import { isCursorInList, makeEditor } from '@plone/volto-slate/utils';
|
|
5
5
|
import { LI } from '@plone/volto-slate/constants';
|
|
6
6
|
import config from '@plone/volto/registry';
|
|
7
7
|
|
|
@@ -155,7 +155,8 @@ export function getFragmentFromStartOfSelectionToEndOfEditor(
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
// immer doesn't like editor.savedSelection
|
|
158
|
-
const newEditor =
|
|
158
|
+
const newEditor = makeEditor();
|
|
159
|
+
newEditor.children = cloneDeep(editor.children);
|
|
159
160
|
return Editor.fragment(newEditor, range);
|
|
160
161
|
}
|
|
161
162
|
|
|
@@ -174,7 +175,9 @@ export function getFragmentFromBeginningOfEditorToStartOfSelection(
|
|
|
174
175
|
|
|
175
176
|
// immer doesn't like editor.savedSelection
|
|
176
177
|
// TODO: there's a bug here related to splitting lists
|
|
177
|
-
const newEditor =
|
|
178
|
+
const newEditor = makeEditor();
|
|
179
|
+
newEditor.children = cloneDeep(editor.children);
|
|
180
|
+
|
|
178
181
|
return Editor.fragment(
|
|
179
182
|
newEditor,
|
|
180
183
|
Editor.range(
|
package/razzle.config.js
CHANGED
|
@@ -251,6 +251,9 @@ const defaultModify = ({
|
|
|
251
251
|
// avoids including lodash multiple times.
|
|
252
252
|
// semantic-ui-react uses lodash-es, everything else uses lodash
|
|
253
253
|
'lodash-es': path.dirname(require.resolve('lodash')),
|
|
254
|
+
// workaround for backwards-incompatible change in slate-react
|
|
255
|
+
'@slate-react': path.dirname(require.resolve('slate-react')),
|
|
256
|
+
'slate-react$': `${registry.voltoPath}/packages/volto-slate/src/slate-react`,
|
|
254
257
|
};
|
|
255
258
|
|
|
256
259
|
const [
|
|
@@ -155,7 +155,7 @@ export const TitleBlockEdit = (props) => {
|
|
|
155
155
|
return <div />;
|
|
156
156
|
}
|
|
157
157
|
return (
|
|
158
|
-
<Slate editor={editor} onChange={handleChange}
|
|
158
|
+
<Slate editor={editor} onChange={handleChange} initialValue={initialValue}>
|
|
159
159
|
<Editable
|
|
160
160
|
readOnly={!editable}
|
|
161
161
|
onKeyDown={handleKeyDown}
|
|
@@ -174,7 +174,7 @@ export const TextLineEdit = (props) => {
|
|
|
174
174
|
return <div />;
|
|
175
175
|
}
|
|
176
176
|
return (
|
|
177
|
-
<Slate editor={editor} onChange={handleChange}
|
|
177
|
+
<Slate editor={editor} onChange={handleChange} initialValue={initialValue}>
|
|
178
178
|
<Editable
|
|
179
179
|
readOnly={!editable}
|
|
180
180
|
onKeyDown={handleKeyDown}
|
|
@@ -42,6 +42,15 @@
|
|
|
42
42
|
border-color: rgba(120, 192, 215, 0.75);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
.block-editor-title,
|
|
46
|
+
.block-editor-slate,
|
|
47
|
+
.block-editor-slateTable,
|
|
48
|
+
.slate-editor.selected {
|
|
49
|
+
:focus-visible {
|
|
50
|
+
outline: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
.block .block:hover::before {
|
|
46
55
|
border-color: rgba(120, 192, 215, 0.375);
|
|
47
56
|
}
|
package/pyvenv.cfg
DELETED