@plone/volto-slate 18.0.1 → 18.0.3
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/.eslintrc.js +7 -0
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/actions/content.js +1 -1
- package/src/blocks/Table/TableBlockEdit.jsx +5 -2
- package/src/blocks/Table/TableBlockView.jsx +1 -1
- package/src/blocks/Text/DefaultTextBlockEditor.jsx +6 -8
- package/src/blocks/Text/SlashMenu.jsx +4 -3
- package/src/blocks/Text/TextBlockEdit.jsx +2 -4
- package/src/blocks/Text/TextBlockView.jsx +2 -2
- package/src/blocks/Text/extensions/breakList.js +6 -8
- package/src/blocks/Text/extensions/insertBreak.js +4 -7
- package/src/blocks/Text/extensions/withDeserializers.js +2 -1
- package/src/blocks/Text/index.jsx +1 -1
- package/src/blocks/Text/keyboard/backspaceInList.js +2 -2
- package/src/blocks/Text/keyboard/indentListItems.js +2 -2
- package/src/blocks/Text/keyboard/joinBlocks.js +8 -6
- package/src/blocks/Text/keyboard/moveListItems.js +4 -1
- package/src/blocks/Text/keyboard/traverseBlocks.js +4 -2
- package/src/editor/SlateEditor.jsx +5 -7
- package/src/editor/config.jsx +1 -1
- package/src/editor/extensions/insertData.js +2 -2
- package/src/editor/extensions/normalizeExternalData.js +1 -1
- package/src/editor/extensions/withTestingFeatures.jsx +1 -1
- package/src/editor/plugins/AdvancedLink/deserialize.js +1 -1
- package/src/editor/plugins/AdvancedLink/render.jsx +1 -1
- package/src/editor/plugins/Blockquote/index.jsx +1 -1
- package/src/editor/plugins/Callout/index.jsx +1 -1
- package/src/editor/plugins/Link/index.jsx +4 -6
- package/src/editor/plugins/Link/render.jsx +2 -2
- package/src/editor/plugins/Markdown/constants.js +1 -1
- package/src/editor/plugins/Markdown/extensions.js +2 -1
- package/src/editor/plugins/Markdown/utils.js +1 -1
- package/src/editor/plugins/StyleMenu/StyleMenu.jsx +2 -2
- package/src/editor/plugins/StyleMenu/utils.js +1 -1
- package/src/editor/plugins/Table/TableButton.jsx +1 -1
- package/src/editor/plugins/Table/index.jsx +1 -1
- package/src/editor/render.jsx +6 -3
- package/src/editor/ui/BlockButton.jsx +1 -1
- package/src/editor/ui/ClearFormattingButton.jsx +1 -1
- package/src/editor/ui/InlineToolbar.jsx +1 -1
- package/src/editor/ui/MarkButton.jsx +1 -1
- package/src/editor/ui/MarkElementButton.jsx +4 -1
- package/src/editor/ui/ToolbarButton.jsx +1 -1
- package/src/elementEditor/ContextButtons.jsx +2 -2
- package/src/elementEditor/PluginEditor.jsx +3 -3
- package/src/elementEditor/SidebarEditor.jsx +2 -2
- package/src/elementEditor/ToolbarButton.jsx +4 -4
- package/src/elementEditor/{makeInlineElementPlugin.js → makeInlineElementPlugin.jsx} +1 -1
- package/src/utils/blocks.js +11 -8
- package/src/utils/selection.js +4 -2
- package/src/utils/volto-blocks.js +2 -2
- package/src/widgets/HtmlSlateWidget.jsx +1 -1
- package/src/widgets/ObjectByTypeWidget.jsx +1 -1
- /package/src/blocks/Table/{Cell.test.js → Cell.test.jsx} +0 -0
- /package/src/blocks/Table/{TableBlockEdit.test.js → TableBlockEdit.test.jsx} +0 -0
- /package/src/blocks/Table/{TableBlockView.test.js → TableBlockView.test.jsx} +0 -0
- /package/src/blocks/Text/{TextBlockEdit.test.js → TextBlockEdit.test.jsx} +0 -0
- /package/src/editor/ui/{ToolbarButton.test.js → ToolbarButton.test.jsx} +0 -0
package/.eslintrc.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
<!-- towncrier release notes start -->
|
|
10
10
|
|
|
11
|
+
## 18.0.3 (2024-12-09)
|
|
12
|
+
|
|
13
|
+
### Internal
|
|
14
|
+
|
|
15
|
+
- Fix extension in files containing JSX. @sneridagh [#6520](https://github.com/plone/volto/issues/6520)
|
|
16
|
+
|
|
17
|
+
## 18.0.2 (2024-12-08)
|
|
18
|
+
|
|
19
|
+
### Internal
|
|
20
|
+
|
|
21
|
+
- Removed all imports from barrel files for components, actions, helpers, hooks and lodash. @pnicolli [#6509](https://github.com/plone/volto/issues/6509)
|
|
22
|
+
|
|
11
23
|
## 18.0.1 (2024-11-11)
|
|
12
24
|
|
|
13
25
|
### Feature
|
package/package.json
CHANGED
package/src/actions/content.js
CHANGED
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import
|
|
8
|
+
import isEmpty from 'lodash/isEmpty';
|
|
9
|
+
import map from 'lodash/map';
|
|
10
|
+
import remove from 'lodash/remove';
|
|
9
11
|
import { Button, Table } from 'semantic-ui-react';
|
|
10
12
|
import cx from 'classnames';
|
|
11
13
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
12
14
|
|
|
13
15
|
import Cell from './Cell';
|
|
14
|
-
import
|
|
16
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
17
|
+
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
|
|
15
18
|
import { BlockDataForm } from '@plone/volto/components/manage/Form';
|
|
16
19
|
import TableSchema from './schema';
|
|
17
20
|
|
|
@@ -6,22 +6,20 @@ import { defineMessages, useIntl } from 'react-intl';
|
|
|
6
6
|
import { useInView } from 'react-intersection-observer';
|
|
7
7
|
import { Dimmer, Loader, Message, Segment } from 'semantic-ui-react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
getBaseUrl,
|
|
12
|
-
validateFileUploadSize,
|
|
13
|
-
} from '@plone/volto/helpers';
|
|
9
|
+
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
10
|
+
import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
|
|
14
11
|
import config from '@plone/volto/registry';
|
|
15
|
-
import
|
|
12
|
+
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
|
|
13
|
+
import BlockChooserButton from '@plone/volto/components/manage/BlockChooser/BlockChooserButton';
|
|
16
14
|
import { BlockDataForm } from '@plone/volto/components/manage/Form';
|
|
17
15
|
|
|
18
16
|
import { SlateEditor } from '@plone/volto-slate/editor';
|
|
19
17
|
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
20
18
|
import {
|
|
21
19
|
createImageBlock,
|
|
22
|
-
parseDefaultSelection,
|
|
23
20
|
deconstructToVoltoBlocks,
|
|
24
|
-
} from '@plone/volto-slate/utils';
|
|
21
|
+
} from '@plone/volto-slate/utils/volto-blocks';
|
|
22
|
+
import { parseDefaultSelection } from '@plone/volto-slate/utils/selection';
|
|
25
23
|
import { Transforms } from 'slate';
|
|
26
24
|
|
|
27
25
|
import PersistentSlashMenu from './SlashMenu';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import filter from 'lodash/filter';
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
5
|
import { Menu } from 'semantic-ui-react';
|
|
5
6
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
7
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
8
|
+
import useUser from '@plone/volto/hooks/user/useUser';
|
|
8
9
|
|
|
9
10
|
const emptySlateBlock = () => ({
|
|
10
11
|
value: [
|
|
@@ -2,10 +2,8 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
saveSlateBlockSelection,
|
|
8
|
-
} from '@plone/volto-slate/actions';
|
|
5
|
+
import { uploadContent } from '@plone/volto-slate/actions/content';
|
|
6
|
+
import saveSlateBlockSelection from '@plone/volto-slate/actions/selection';
|
|
9
7
|
|
|
10
8
|
import DefaultTextBlockEditor from './DefaultTextBlockEditor';
|
|
11
9
|
import DetachedTextBlockEditor from './DetachedTextBlockEditor';
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
serializeNodesToText,
|
|
4
4
|
} from '@plone/volto-slate/editor/render';
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
|
-
import
|
|
6
|
+
import isEqual from 'lodash/isEqual';
|
|
7
7
|
import Slugger from 'github-slugger';
|
|
8
|
-
import { normalizeString } from '@plone/volto/helpers';
|
|
8
|
+
import { normalizeString } from '@plone/volto/helpers/Utils/Utils';
|
|
9
9
|
|
|
10
10
|
const TextBlockView = (props) => {
|
|
11
11
|
const { id, data, styling = {} } = props;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Editor, Range, Transforms } from 'slate';
|
|
2
2
|
import config from '@plone/volto/registry';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
createEmptyParagraph,
|
|
10
|
-
} from '@plone/volto-slate/utils';
|
|
3
|
+
import { isCursorAtBlockEnd } from '@plone/volto-slate/utils/selection';
|
|
4
|
+
import { splitEditorInTwoFragments } from '@plone/volto-slate/utils/ops';
|
|
5
|
+
import { setEditorContent } from '@plone/volto-slate/utils/editor';
|
|
6
|
+
import { createAndSelectNewBlockAfter } from '@plone/volto-slate/utils/volto-blocks';
|
|
7
|
+
import { getCurrentListItem } from '@plone/volto-slate/utils/lists';
|
|
8
|
+
import { createEmptyParagraph } from '@plone/volto-slate/utils/blocks';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Handles `Enter` key on empty and non-empty list items.
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
2
|
import { Editor } from 'slate';
|
|
3
3
|
// import { ReactEditor } from 'slate-react';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
rangeIsInSplittableNode,
|
|
9
|
-
// deconstructToVoltoBlocks,
|
|
10
|
-
} from '@plone/volto-slate/utils';
|
|
4
|
+
import { splitEditorInTwoFragments } from '@plone/volto-slate/utils/ops';
|
|
5
|
+
import { setEditorContent } from '@plone/volto-slate/utils/editor';
|
|
6
|
+
import { createAndSelectNewBlockAfter } from '@plone/volto-slate/utils/volto-blocks';
|
|
7
|
+
import { rangeIsInSplittableNode } from '@plone/volto-slate/utils/internals';
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
* @param {Editor} editor The Slate editor object to extend.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import isUrl from 'is-url';
|
|
2
2
|
import imageExtensions from 'image-extensions';
|
|
3
3
|
import { blockTagDeserializer } from '@plone/volto-slate/editor/deserialize';
|
|
4
|
-
import { getBaseUrl
|
|
4
|
+
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
5
|
+
import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
|
|
5
6
|
import { v4 as uuid } from 'uuid';
|
|
6
7
|
import { Transforms } from 'slate';
|
|
7
8
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import TextBlockView from './TextBlockView';
|
|
3
3
|
import TextBlockEdit from './TextBlockEdit';
|
|
4
4
|
import TextBlockSchema from './TextBlockSchema';
|
|
5
|
-
import
|
|
5
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
goDown,
|
|
@@ -3,8 +3,8 @@ import config from '@plone/volto/registry';
|
|
|
3
3
|
import {
|
|
4
4
|
isCursorInList,
|
|
5
5
|
isCursorAtListBlockStart,
|
|
6
|
-
|
|
7
|
-
} from '@plone/volto-slate/utils';
|
|
6
|
+
} from '@plone/volto-slate/utils/lists';
|
|
7
|
+
import { deconstructToVoltoBlocks } from '@plone/volto-slate/utils/volto-blocks';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Handle the new Volto blocks created by `deconstructToVoltoBlocks`.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Editor, Path, Transforms } from 'slate';
|
|
2
2
|
import {
|
|
3
3
|
isCursorInList,
|
|
4
|
-
deconstructToVoltoBlocks,
|
|
5
4
|
getCurrentListItem,
|
|
6
5
|
mergeWithNextList,
|
|
7
6
|
mergeWithPreviousList,
|
|
8
|
-
} from '@plone/volto-slate/utils';
|
|
7
|
+
} from '@plone/volto-slate/utils/lists';
|
|
8
|
+
import { deconstructToVoltoBlocks } from '@plone/volto-slate/utils/volto-blocks';
|
|
9
9
|
import config from '@plone/volto/registry';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
|
-
import
|
|
2
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
3
3
|
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
4
4
|
import { Editor } from 'slate';
|
|
5
5
|
import {
|
|
6
6
|
getPreviousVoltoBlock,
|
|
7
7
|
getNextVoltoBlock,
|
|
8
|
-
isCursorAtBlockStart,
|
|
9
|
-
isCursorAtBlockEnd,
|
|
10
8
|
mergeSlateWithBlockBackward,
|
|
11
9
|
mergeSlateWithBlockForward,
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
} from '@plone/volto-slate/utils/volto-blocks';
|
|
11
|
+
import {
|
|
12
|
+
isCursorAtBlockStart,
|
|
13
|
+
isCursorAtBlockEnd,
|
|
14
|
+
} from '@plone/volto-slate/utils/selection';
|
|
15
|
+
import { makeEditor } from '@plone/volto-slate/utils/editor';
|
|
14
16
|
import {
|
|
15
17
|
changeBlock,
|
|
16
18
|
deleteBlock,
|
|
17
19
|
getBlocksFieldname,
|
|
18
20
|
getBlocksLayoutFieldname,
|
|
19
|
-
} from '@plone/volto/helpers';
|
|
21
|
+
} from '@plone/volto/helpers/Blocks/Blocks';
|
|
20
22
|
/**
|
|
21
23
|
* Joins the current block (which has an active Slate Editor)
|
|
22
24
|
* with the previous block, to make a single block.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Editor, Path, Transforms, Node } from 'slate';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isCursorInList,
|
|
4
|
+
getCurrentListItem,
|
|
5
|
+
} from '@plone/volto-slate/utils/lists';
|
|
3
6
|
import config from '@plone/volto/registry';
|
|
4
7
|
|
|
5
8
|
/**
|
|
@@ -2,10 +2,12 @@ import { Node } from 'slate';
|
|
|
2
2
|
import {
|
|
3
3
|
isCursorAtBlockStart,
|
|
4
4
|
isCursorAtBlockEnd,
|
|
5
|
+
} from '@plone/volto-slate/utils/selection';
|
|
6
|
+
import {
|
|
5
7
|
getNextVoltoBlock,
|
|
6
8
|
getPreviousVoltoBlock,
|
|
7
|
-
|
|
8
|
-
} from '@plone/volto-slate/utils';
|
|
9
|
+
} from '@plone/volto-slate/utils/volto-blocks';
|
|
10
|
+
import { createDefaultBlock } from '@plone/volto-slate/utils/blocks';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* goUp.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import isEqual from 'lodash/isEqual';
|
|
4
4
|
import { Transforms, Editor } from 'slate'; // , Transforms
|
|
5
5
|
import { Slate, Editable, ReactEditor } from 'slate-react';
|
|
6
6
|
import React, { Component } from 'react'; // , useState
|
|
@@ -11,12 +11,10 @@ import config from '@plone/volto/registry';
|
|
|
11
11
|
import { Element, Leaf } from './render';
|
|
12
12
|
|
|
13
13
|
import withTestingFeatures from './extensions/withTestingFeatures';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
parseDefaultSelection,
|
|
19
|
-
} from '@plone/volto-slate/utils';
|
|
14
|
+
import { makeEditor } from '@plone/volto-slate/utils/editor';
|
|
15
|
+
import { toggleInlineFormat } from '@plone/volto-slate/utils/blocks';
|
|
16
|
+
import { toggleMark } from '@plone/volto-slate/utils/marks';
|
|
17
|
+
import { parseDefaultSelection } from '@plone/volto-slate/utils/selection';
|
|
20
18
|
import { InlineToolbar } from './ui';
|
|
21
19
|
import EditorContext from './EditorContext';
|
|
22
20
|
|
package/src/editor/config.jsx
CHANGED
|
@@ -15,7 +15,7 @@ import strikethroughIcon from '@plone/volto/icons/strikethrough.svg';
|
|
|
15
15
|
import subindexIcon from '@plone/volto/icons/subindex.svg';
|
|
16
16
|
import superindexIcon from '@plone/volto/icons/superindex.svg';
|
|
17
17
|
|
|
18
|
-
import { createEmptyParagraph } from '@plone/volto-slate/utils';
|
|
18
|
+
import { createEmptyParagraph } from '@plone/volto-slate/utils/blocks';
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
21
|
MarkElementButton,
|
|
@@ -3,9 +3,9 @@ import { deserialize } from '@plone/volto-slate/editor/deserialize';
|
|
|
3
3
|
import {
|
|
4
4
|
createBlock,
|
|
5
5
|
createDefaultBlock,
|
|
6
|
-
MIMETypeName,
|
|
7
6
|
normalizeExternalData,
|
|
8
|
-
} from '@plone/volto-slate/utils';
|
|
7
|
+
} from '@plone/volto-slate/utils/blocks';
|
|
8
|
+
import { MIMETypeName } from '@plone/volto-slate/utils/mime-types';
|
|
9
9
|
import { isBlockActive } from '../../utils/blocks';
|
|
10
10
|
|
|
11
11
|
export const insertData = (editor) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'slate-hyperscript';
|
|
2
2
|
import { LINK } from '@plone/volto-slate/constants';
|
|
3
3
|
import { deserialize } from '@plone/volto-slate/editor/deserialize';
|
|
4
|
-
import
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
5
5
|
// import { Editor } from 'slate';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
3
3
|
import './styles.less';
|
|
4
4
|
|
|
5
5
|
export const LinkElement = ({ attributes, children, element, mode }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import BlockButton from '@plone/volto-slate/editor/ui/BlockButton';
|
|
3
3
|
import calloutSVG from '@plone/volto/icons/megaphone.svg';
|
|
4
4
|
|
|
5
5
|
// TODO: this needs to use constants for el type
|
|
@@ -12,12 +12,10 @@ import {
|
|
|
12
12
|
import { SIMPLELINK, LINK } from '@plone/volto-slate/constants';
|
|
13
13
|
import { LinkElement } from './render';
|
|
14
14
|
import { simpleLinkDeserializer, withSimpleLink } from './extensions';
|
|
15
|
-
import { setPluginOptions } from '@plone/volto-slate/actions';
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from '@plone/volto-slate/editor/ui';
|
|
20
|
-
import { useSelectionPosition } from '@plone/volto-slate/hooks';
|
|
15
|
+
import { setPluginOptions } from '@plone/volto-slate/actions/plugins';
|
|
16
|
+
import UIToolbarButton from '@plone/volto-slate/editor/ui/ToolbarButton';
|
|
17
|
+
import PositionedToolbar from '@plone/volto-slate/editor/ui/PositionedToolbar';
|
|
18
|
+
import { useSelectionPosition } from '@plone/volto-slate/hooks/useSelectionPosition';
|
|
21
19
|
|
|
22
20
|
import linkSVG from '@plone/volto/icons/link.svg';
|
|
23
21
|
import unlinkSVG from '@plone/volto/icons/unlink.svg';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
|
-
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
|
|
5
|
+
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
6
6
|
|
|
7
7
|
const ViewLink = ({ url, target, download, children }) => {
|
|
8
8
|
const { openExternalLinkInNewTab } = config.settings;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getMaxRange,
|
|
4
4
|
selectAll,
|
|
5
5
|
getSelectionNodesArrayByType,
|
|
6
|
-
} from '@plone/volto-slate/utils';
|
|
6
|
+
} from '@plone/volto-slate/utils/selection';
|
|
7
7
|
import { P, LI, UL, OL } from '@plone/volto-slate/constants';
|
|
8
8
|
|
|
9
9
|
export function unwrapNodesByType(editor, types, options = {}) {
|
|
@@ -3,10 +3,10 @@ import { useSlate } from 'slate-react';
|
|
|
3
3
|
import { Dropdown } from 'semantic-ui-react';
|
|
4
4
|
import { useIntl, defineMessages } from 'react-intl';
|
|
5
5
|
import cx from 'classnames';
|
|
6
|
-
import
|
|
6
|
+
import omit from 'lodash/omit';
|
|
7
7
|
import { isBlockStyleActive, isInlineStyleActive, toggleStyle } from './utils';
|
|
8
8
|
import config from '@plone/volto/registry';
|
|
9
|
-
import
|
|
9
|
+
import ToolbarButton from '@plone/volto-slate/editor/ui/ToolbarButton';
|
|
10
10
|
import paintSVG from '@plone/volto/icons/paint.svg';
|
|
11
11
|
|
|
12
12
|
const messages = defineMessages({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
|
2
2
|
import { Editor, Transforms } from 'slate';
|
|
3
|
-
import { isBlockActive } from '@plone/volto-slate/utils';
|
|
3
|
+
import { isBlockActive } from '@plone/volto-slate/utils/blocks';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSlate } from 'slate-react';
|
|
3
3
|
import { Dropdown } from 'semantic-ui-react';
|
|
4
|
-
import
|
|
4
|
+
import ToolbarButton from '@plone/volto-slate/editor/ui/ToolbarButton';
|
|
5
5
|
|
|
6
6
|
import tableSVG from '@plone/volto/icons/table.svg';
|
|
7
7
|
import TableContainer from './TableContainer';
|
|
@@ -12,7 +12,7 @@ import colAfterSVG from '@plone/volto/icons/column-after.svg';
|
|
|
12
12
|
import rowDeleteSVG from '@plone/volto/icons/row-delete.svg';
|
|
13
13
|
import colDeleteSVG from '@plone/volto/icons/column-delete.svg';
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ToolbarButton from '@plone/volto-slate/editor/ui/ToolbarButton';
|
|
16
16
|
import { Range, Transforms, Editor, Path } from 'slate';
|
|
17
17
|
import { defineMessages, useIntl } from 'react-intl';
|
|
18
18
|
import { TABLE, TR, P, TD, TH } from '@plone/volto-slate/constants';
|
package/src/editor/render.jsx
CHANGED
|
@@ -6,9 +6,12 @@ import { useIntl } from 'react-intl';
|
|
|
6
6
|
import { useSelector } from 'react-redux';
|
|
7
7
|
import { Node, Text } from 'slate';
|
|
8
8
|
import cx from 'classnames';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import isEmpty from 'lodash/isEmpty';
|
|
10
|
+
import omit from 'lodash/omit';
|
|
11
|
+
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
12
|
+
import Toast from '@plone/volto/components/manage/Toast/Toast';
|
|
13
|
+
import { messages } from '@plone/volto/helpers/MessageLabels/MessageLabels';
|
|
14
|
+
import { addAppURL } from '@plone/volto/helpers/Url/Url';
|
|
12
15
|
import useClipboard from '@plone/volto/hooks/clipboard/useClipboard';
|
|
13
16
|
import config from '@plone/volto/registry';
|
|
14
17
|
import linkSVG from '@plone/volto/icons/link.svg';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSlate } from 'slate-react';
|
|
3
|
-
import { isBlockActive, toggleBlock } from '@plone/volto-slate/utils';
|
|
3
|
+
import { isBlockActive, toggleBlock } from '@plone/volto-slate/utils/blocks';
|
|
4
4
|
|
|
5
5
|
import ToolbarButton from './ToolbarButton';
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@ import React from 'react'; // , useState
|
|
|
2
2
|
import SlateToolbar from './SlateToolbar';
|
|
3
3
|
import SlateContextToolbar from './SlateContextToolbar';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
|
-
import { hasRangeSelection } from '@plone/volto-slate/utils';
|
|
5
|
+
import { hasRangeSelection } from '@plone/volto-slate/utils/selection';
|
|
6
6
|
import { ReactEditor } from 'slate-react';
|
|
7
7
|
import cx from 'classnames';
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSlate } from 'slate-react';
|
|
3
3
|
|
|
4
|
-
import { isMarkActive, toggleMark } from '@plone/volto-slate/utils';
|
|
4
|
+
import { isMarkActive, toggleMark } from '@plone/volto-slate/utils/marks';
|
|
5
5
|
import ToolbarButton from './ToolbarButton';
|
|
6
6
|
|
|
7
7
|
const MarkButton = ({ format, icon, ...props }) => {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSlate } from 'slate-react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isBlockActive,
|
|
5
|
+
toggleInlineFormat,
|
|
6
|
+
} from '@plone/volto-slate/utils/blocks';
|
|
4
7
|
|
|
5
8
|
import ToolbarButton from './ToolbarButton';
|
|
6
9
|
|
|
@@ -4,8 +4,8 @@ import { useIntl } from 'react-intl'; // , defineMessages
|
|
|
4
4
|
|
|
5
5
|
import clearSVG from '@plone/volto/icons/delete.svg';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import { setPluginOptions } from '@plone/volto-slate/actions';
|
|
7
|
+
import ToolbarButton from '@plone/volto-slate/editor/ui/ToolbarButton';
|
|
8
|
+
import { setPluginOptions } from '@plone/volto-slate/actions/plugins';
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* Note: this is a weirder component, it should be called as a native function
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint no-console: ["error", { allow: ["error"] }] */
|
|
2
|
-
import
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useDispatch } from 'react-redux';
|
|
5
5
|
import { ReactEditor } from 'slate-react';
|
|
6
|
-
import
|
|
6
|
+
import VoltoIcon from '@plone/volto/components/theme/Icon/Icon';
|
|
7
7
|
import { BlockDataForm } from '@plone/volto/components/manage/Form';
|
|
8
|
-
import { setPluginOptions } from '@plone/volto-slate/actions';
|
|
8
|
+
import { setPluginOptions } from '@plone/volto-slate/actions/plugins';
|
|
9
9
|
import BaseSchemaProvider from './SchemaProvider';
|
|
10
10
|
|
|
11
11
|
import briefcaseSVG from '@plone/volto/icons/briefcase.svg';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { useSelector, useDispatch } from 'react-redux';
|
|
8
|
-
import
|
|
9
|
-
import { setPluginOptions } from '@plone/volto-slate/actions';
|
|
8
|
+
import SidebarPopup from '@plone/volto/components/manage/Sidebar/SidebarPopup';
|
|
9
|
+
import { setPluginOptions } from '@plone/volto-slate/actions/plugins';
|
|
10
10
|
|
|
11
11
|
const SidebarEditor = (props) => {
|
|
12
12
|
const { editor, pluginId, getActiveElement, pluginEditor } = props;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useSlate } from 'slate-react';
|
|
6
6
|
import { useDispatch } from 'react-redux';
|
|
7
|
-
import
|
|
7
|
+
import omit from 'lodash/omit';
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import { hasRangeSelection } from '@plone/volto-slate/utils';
|
|
11
|
-
import { setPluginOptions } from '@plone/volto-slate/actions';
|
|
9
|
+
import ToolbarButton from '@plone/volto-slate/editor/ui/ToolbarButton';
|
|
10
|
+
import { hasRangeSelection } from '@plone/volto-slate/utils/selection';
|
|
11
|
+
import { setPluginOptions } from '@plone/volto-slate/actions/plugins';
|
|
12
12
|
|
|
13
13
|
const ElementToolbarButton = (props) => {
|
|
14
14
|
const { isActiveElement, insertElement, pluginId, toolbarButtonIcon } = props;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
import ToolbarButton from './ToolbarButton';
|
|
13
13
|
import SchemaProvider from './SchemaProvider';
|
|
14
|
-
import
|
|
14
|
+
import omit from 'lodash/omit';
|
|
15
15
|
|
|
16
16
|
import tagSVG from '@plone/volto/icons/tag.svg';
|
|
17
17
|
|
package/src/utils/blocks.js
CHANGED
|
@@ -4,8 +4,11 @@ import config from '@plone/volto/registry';
|
|
|
4
4
|
import {
|
|
5
5
|
getBlocksFieldname,
|
|
6
6
|
getBlocksLayoutFieldname,
|
|
7
|
-
} from '@plone/volto/helpers';
|
|
8
|
-
import
|
|
7
|
+
} from '@plone/volto/helpers/Blocks/Blocks';
|
|
8
|
+
import find from 'lodash/find';
|
|
9
|
+
import includes from 'lodash/includes';
|
|
10
|
+
import some from 'lodash/some';
|
|
11
|
+
import first from 'lodash/first';
|
|
9
12
|
import { makeEditor } from './editor';
|
|
10
13
|
|
|
11
14
|
// case sensitive; first in an inner array is the default and preffered format
|
|
@@ -145,10 +148,10 @@ export const isSingleBlockTypeActive = (editor, format) => {
|
|
|
145
148
|
};
|
|
146
149
|
|
|
147
150
|
export const isBlockActive = (editor, format) => {
|
|
148
|
-
const aliasList =
|
|
151
|
+
const aliasList = find(formatAliases, (x) => includes(x, format));
|
|
149
152
|
|
|
150
153
|
if (aliasList) {
|
|
151
|
-
const aliasFound =
|
|
154
|
+
const aliasFound = some(aliasList, (y) => {
|
|
152
155
|
return isSingleBlockTypeActive(editor, y);
|
|
153
156
|
});
|
|
154
157
|
|
|
@@ -163,17 +166,17 @@ export const isBlockActive = (editor, format) => {
|
|
|
163
166
|
export const getBlockTypeContextData = (editor, format) => {
|
|
164
167
|
let isActive, defaultFormat, matcher;
|
|
165
168
|
|
|
166
|
-
const aliasList =
|
|
169
|
+
const aliasList = find(formatAliases, (x) => includes(x, format));
|
|
167
170
|
|
|
168
171
|
if (aliasList) {
|
|
169
|
-
const aliasFound =
|
|
172
|
+
const aliasFound = some(aliasList, (y) => {
|
|
170
173
|
return isSingleBlockTypeActive(editor, y);
|
|
171
174
|
});
|
|
172
175
|
|
|
173
176
|
if (aliasFound) {
|
|
174
177
|
isActive = true;
|
|
175
|
-
defaultFormat =
|
|
176
|
-
matcher = (n) =>
|
|
178
|
+
defaultFormat = first(aliasList);
|
|
179
|
+
matcher = (n) => includes(aliasList, n.type);
|
|
177
180
|
|
|
178
181
|
return { isActive, defaultFormat, matcher };
|
|
179
182
|
}
|
package/src/utils/selection.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import castArray from 'lodash/castArray';
|
|
2
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
2
3
|
import { Editor, Transforms, Range, Node } from 'slate';
|
|
3
4
|
import { ReactEditor } from 'slate-react';
|
|
4
|
-
import { isCursorInList
|
|
5
|
+
import { isCursorInList } from '@plone/volto-slate/utils/lists';
|
|
6
|
+
import { makeEditor } from '@plone/volto-slate/utils/editor';
|
|
5
7
|
import { LI } from '@plone/volto-slate/constants';
|
|
6
8
|
import config from '@plone/volto/registry';
|
|
7
9
|
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
blockHasValue,
|
|
8
8
|
getBlocksFieldname,
|
|
9
9
|
getBlocksLayoutFieldname,
|
|
10
|
-
} from '@plone/volto/helpers';
|
|
10
|
+
} from '@plone/volto/helpers/Blocks/Blocks';
|
|
11
11
|
import { Transforms, Editor, Node, Text, Path } from 'slate';
|
|
12
12
|
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
13
|
-
import
|
|
13
|
+
import omit from 'lodash/omit';
|
|
14
14
|
import config from '@plone/volto/registry';
|
|
15
15
|
|
|
16
16
|
function fromEntries(pairs) {
|
|
@@ -12,7 +12,7 @@ import { defineMessages, injectIntl } from 'react-intl';
|
|
|
12
12
|
import { FormFieldWrapper } from '@plone/volto/components/manage/Widgets';
|
|
13
13
|
import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
|
|
14
14
|
import { serializeNodes } from '@plone/volto-slate/editor/render';
|
|
15
|
-
import { makeEditor } from '@plone/volto-slate/utils';
|
|
15
|
+
import { makeEditor } from '@plone/volto-slate/utils/editor';
|
|
16
16
|
import deserialize from '@plone/volto-slate/editor/deserialize';
|
|
17
17
|
|
|
18
18
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Menu, Tab } from 'semantic-ui-react';
|
|
3
|
-
import
|
|
3
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
4
|
import { ObjectWidget } from '@plone/volto/components/manage/Widgets';
|
|
5
5
|
|
|
6
6
|
export const ObjectByTypeWidget = (props) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|