Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!!TASK: Remove plow-js #3306

Merged
merged 19 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8603b0c
TASK: Remove plow-js from `@neos-project/neos-ui-sagas`
grebaldi Dec 22, 2022
171e8d0
TASK: Remove plow-js from `@neos-project/neos-ui-backend-connector`
grebaldi Dec 23, 2022
a849341
TASK: Remove plow-js from `@neos-project/neos-ui-ckeditor5-bindings`
grebaldi Dec 23, 2022
5d6b9de
TASK: Remove plow-js from `@neos-project/neos-ui-contentrepository`
grebaldi Dec 24, 2022
5366ff9
TASK: Remove plow-js from `@neos-project/neos-ui-guest-frame`
grebaldi Dec 24, 2022
6282a44
TASK: Remove plow-js from `@neos-project/react-ui-components`
grebaldi Dec 25, 2022
4d1baf9
TASK: Remove plow-js from `@neos-project/neos-ui-editors`
grebaldi Dec 25, 2022
cf9a45c
TASK: Remove plow-js from `@neos-project/neos-ui-validators`
grebaldi Dec 26, 2022
eeb6b51
TASK: Remove plow-js from `@neos-project/neos-ui-inspector`
grebaldi Dec 26, 2022
9a47f88
TASK: Remove plow-js from `@neos-project/neos-ui-redux-store`
grebaldi Dec 26, 2022
d64b583
TASK: Remove plow-js from `@neos-project/neos-ui`
grebaldi Dec 27, 2022
8adb3be
TASK: Remove plow-js from `@neos-project/neos-ui-views`
grebaldi Jan 2, 2023
02ef655
Merge remote-tracking branch 'origin/8.3' into task/3118/remove-plow-js
mhsdesign Mar 10, 2023
29336f2
Merge remote-tracking branch 'upstream/8.3' into task/3118/remove-plo…
grebaldi May 25, 2023
84e9302
Merge branch '9.0' into task/3118/remove-plow-js
grebaldi Sep 28, 2023
c5a28f2
TASK: Remove remaining references to plow-js after 9.0 merge
grebaldi Sep 28, 2023
425dd42
TASK: Satisfy linter
grebaldi Sep 28, 2023
60262de
Merge remote-tracking branch 'origin/9.0' into task/3118/remove-plow-js
markusguenther Nov 9, 2023
f34f62c
TASK: Allow development versions for CI
markusguenther Nov 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions Classes/Service/NodePolicyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ public function getDisallowedProperties(Node $node): array
};

$disallowedProperties = array_filter(array_keys($node->nodeType->getProperties()), $filter);
$disallowedProperties = array_values($disallowedProperties);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi :D why has this been added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array_filter leaves keys intact. Through json_encode this can lead to arrays being serialized as objects. array_values makes sure that we always end up with a strictly numerical array.


return $disallowedProperties;
}
}
3 changes: 1 addition & 2 deletions packages/neos-ui-backend-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
},
"dependencies": {
"@neos-project/neos-ts-interfaces": "workspace:*",
"@neos-project/utils-helpers": "workspace:*",
"plow-js": "3.0.0"
"@neos-project/utils-helpers": "workspace:*"
},
"license": "GNU GPLv3"
}
8 changes: 4 additions & 4 deletions packages/neos-ui-backend-connector/src/FlowQuery/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as operations from './Operations/index';
import {$get} from 'plow-js';

import fetchWithErrorHandling from '../FetchWithErrorHandling/index';
import {Node, NodeContextPath, ContextProperties} from '@neos-project/neos-ts-interfaces';
import {Routes} from '../Endpoints';
Expand Down Expand Up @@ -33,7 +33,7 @@ export const createNodeEnvelope = (node: NodeEnvelope | NodeContextPath) => {
let contextPath = '';

if (typeof node === 'object') {
contextPath = $get(['contextPath'], node) || $get(['$node'], node);
contextPath = node?.contextPath || node?.$node;
} else if (typeof node === 'string') {
contextPath = node;
}
Expand Down Expand Up @@ -103,8 +103,8 @@ export default (routes: Routes) => {
//
const q = (context: ContextProperties | string, ignoreMiddleware: boolean = false) => {
let finalContext: NodeContextPath[];
if (typeof context === 'object' && typeof $get(['contextPath'], context) === 'string') {
finalContext = [$get(['contextPath'], context) as string];
if (typeof context === 'object' && typeof context?.contextPath === 'string') {
finalContext = [context?.contextPath as string];
} else if (typeof context === 'string') {
finalContext = [context];
} else if (Array.isArray(context)) {
Expand Down
3 changes: 1 addition & 2 deletions packages/neos-ui-ckeditor5-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"@neos-project/utils-helpers": "workspace:*",
"classnames": "^2.2.3",
"lodash.debounce": "^4.0.8",
"lodash.omit": "^4.5.0",
"plow-js": "3.0.0"
"lodash.omit": "^4.5.0"
},
"peerDependencies": {
"prop-types": "^15.5.10",
Expand Down
20 changes: 10 additions & 10 deletions packages/neos-ui-ckeditor5-bindings/src/EditorToolbar/LinkButton.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {$get, $transform} from 'plow-js';

import LinkInput from '@neos-project/neos-ui-editors/src/Library/LinkInput';

import {IconButton} from '@neos-project/react-ui-components';
Expand All @@ -10,8 +10,8 @@ import {selectors, actions} from '@neos-project/neos-ui-redux-store';

import style from './LinkButton.module.css';

@connect($transform({
isOpen: selectors.UI.ContentCanvas.isLinkEditorOpen
@connect(state => ({
isOpen: selectors.UI.ContentCanvas.isLinkEditorOpen(state)
}), {
toggle: actions.UI.ContentCanvas.toggleLinkEditor
})
Expand All @@ -35,7 +35,7 @@ export default class LinkButton extends PureComponent {

handleLinkButtonClick = () => {
if (this.props.isOpen) {
if ($get('link', this.props.formattingUnderCursor) !== undefined) {
if (this.props.formattingUnderCursor?.link !== undefined) {
// We need to remove all attributes before unsetting the link
this.props.executeCommand('linkTitle', false, false);
this.props.executeCommand('linkRelNofollow', false, false);
Expand Down Expand Up @@ -87,7 +87,7 @@ export default class LinkButton extends PureComponent {
{isOpen ? (
<div className={style.linkButton__flyout}>
<LinkInput
linkingOptions={$get('linking', inlineEditorOptions)}
linkingOptions={inlineEditorOptions?.linking}
linkValue={this.getLinkValue()}
linkTitleValue={this.getLinkTitleValue()}
linkRelNofollowValue={this.getLinkRelValue()}
Expand All @@ -107,22 +107,22 @@ export default class LinkButton extends PureComponent {
}

getLinkValue() {
return $get('link', this.props.formattingUnderCursor) || '';
return this.props.formattingUnderCursor?.link || '';
}

getLinkTitleValue() {
return $get('linkTitle', this.props.formattingUnderCursor) || '';
return this.props.formattingUnderCursor?.linkTitle || '';
}

getLinkRelValue() {
return $get('linkRelNofollow', this.props.formattingUnderCursor) || false;
return this.props.formattingUnderCursor?.linkRelNofollow || false;
}

getLinkTargetValue() {
return $get('linkTargetBlank', this.props.formattingUnderCursor) || false;
return this.props.formattingUnderCursor?.linkTargetBlank || false;
}

getLinkDownloadValue() {
return $get('linkDownload', this.props.formattingUnderCursor) || false;
return this.props.formattingUnderCursor?.linkDownload || false;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {DropDown, CheckBox, Button} from '@neos-project/react-ui-components';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {$get} from 'plow-js';

import {neos} from '@neos-project/neos-ui-decorators';
import ckeIcons from './icons';
Expand Down Expand Up @@ -54,7 +53,7 @@ export default class TableDropDownButton extends PureComponent {
className={style.checkBox}
onClick={() => this.handleClick(item.commandName)}
>
<CheckBox isChecked={$get(item.commandName, this.props.formattingUnderCursor)} />
<CheckBox isChecked={this.props.formattingUnderCursor?.[item.commandName]} />
{this.props.i18nRegistry.translate(item.label)}
</label>
) : <Button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {$transform} from 'plow-js';

import {neos} from '@neos-project/neos-ui-decorators';
import {selectors} from '@neos-project/neos-ui-redux-store';
Expand All @@ -11,10 +10,10 @@ import EditorToolbar from './EditorToolbar';

export {EditorToolbar};

@connect($transform({
focusedNodeType: selectors.CR.Nodes.focusedNodeTypeSelector,
currentlyEditedPropertyName: selectors.UI.ContentCanvas.currentlyEditedPropertyName,
formattingUnderCursor: selectors.UI.ContentCanvas.formattingUnderCursor
@connect(state => ({
focusedNodeType: selectors.CR.Nodes.focusedNodeTypeSelector(state),
currentlyEditedPropertyName: selectors.UI.ContentCanvas.currentlyEditedPropertyName(state),
formattingUnderCursor: selectors.UI.ContentCanvas.formattingUnderCursor(state)
}))
@neos(globalRegistry => ({
nodeTypesRegistry: globalRegistry.get('@neos-project/neos-ui-contentrepository')
Expand Down
74 changes: 39 additions & 35 deletions packages/neos-ui-ckeditor5-bindings/src/manifest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CkEditorConfigRegistry from './registry/CkEditorConfigRegistry';
import {$add, $get, $or} from 'plow-js';
import {stripTags} from '@neos-project/utils-helpers';

import DisabledAutoparagraphMode from './plugins/disabledAutoparagraphMode';
Expand All @@ -25,10 +24,15 @@ import InsideTable from './plugins/insideTable';
import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat';

const addPlugin = (Plugin, isEnabled) => (ckEditorConfiguration, options) => {
// we duplicate editorOptions here so it would be possible to write smth like `$get('formatting.sup')`
// LEGACY: we duplicate editorOptions here so it would be possible to write smth like `$get('formatting.sup')`
if (!isEnabled || isEnabled(options.editorOptions, options)) {
ckEditorConfiguration.plugins = ckEditorConfiguration.plugins || [];
return $add('plugins', Plugin, ckEditorConfiguration);
return {
...ckEditorConfiguration,
plugins: [
...(ckEditorConfiguration.plugins ?? []),
Plugin
]
};
}
return ckEditorConfiguration;
};
Expand Down Expand Up @@ -71,7 +75,7 @@ export default ckEditorRegistry => {
Thus, to e.g. only adjust the CKEditor config if a certain formatting option is enabled, you can do the following:

config.set('doSmthWithConfig', (ckeConfig, {editorOptions}) => {
if ($get(['formatting', 'myCustomField'], editorOptions)) {
if (editorOptions?.formatting.?myCustomField) {
ckeConfig.mySetting = true;
}
return ckeConfig;
Expand Down Expand Up @@ -103,42 +107,42 @@ export default ckEditorRegistry => {
config.set('essentials', addPlugin(Essentials));
config.set('paragraph', addPlugin(Paragraph));
config.set('disabledAutoparagraphMode', addPlugin(DisabledAutoparagraphMode, disableAutoparagraph));
config.set('sub', addPlugin(Sub, $get('formatting.sub')));
config.set('sup', addPlugin(Sup, $get('formatting.sup')));
config.set('bold', addPlugin(Bold, $get('formatting.strong')));
config.set('italic', addPlugin(Italic, $get('formatting.em')));
config.set('underline', addPlugin(Underline, $get('formatting.underline')));
config.set('strikethrough', addPlugin(Strikethrough, $get('formatting.strikethrough')));
config.set('link', addPlugin(Link, $get('formatting.a')));
config.set('linkTargetBlank', addPlugin(LinkTargetBlank, $get('formatting.a')));
config.set('linkRelNofollow', addPlugin(LinkRelNofollow, $get('formatting.a')));
config.set('linkDownload', addPlugin(LinkDownload, $get('formatting.a')));
config.set('linkTitle', addPlugin(LinkTitle, $get('formatting.a')));
config.set('table', addPlugin(Table, i => $get('formatting.table', i)));
config.set('insideTable', addPlugin(InsideTable, i => $get('formatting.table', i)));
config.set('removeFormat', addPlugin(RemoveFormat, $get('formatting.removeFormat')));
config.set('list', addPlugin(List, $or(
$get('formatting.ul'),
$get('formatting.ol')
config.set('sub', addPlugin(Sub, editorOptions => editorOptions?.formatting?.sub));
config.set('sup', addPlugin(Sup, editorOptions => editorOptions?.formatting?.sup));
config.set('bold', addPlugin(Bold, editorOptions => editorOptions?.formatting?.strong));
config.set('italic', addPlugin(Italic, editorOptions => editorOptions?.formatting?.em));
config.set('underline', addPlugin(Underline, editorOptions => editorOptions?.formatting?.underline));
config.set('strikethrough', addPlugin(Strikethrough, editorOptions => editorOptions?.formatting?.strikethrough));
config.set('link', addPlugin(Link, editorOptions => editorOptions?.formatting?.a));
config.set('linkTargetBlank', addPlugin(LinkTargetBlank, editorOptions => editorOptions?.formatting?.a));
config.set('linkRelNofollow', addPlugin(LinkRelNofollow, editorOptions => editorOptions?.formatting?.a));
config.set('linkDownload', addPlugin(LinkDownload, editorOptions => editorOptions?.formatting?.a));
config.set('linkTitle', addPlugin(LinkTitle, editorOptions => editorOptions?.formatting?.a));
config.set('table', addPlugin(Table, editorOptions => editorOptions?.formatting?.table));
config.set('insideTable', addPlugin(InsideTable, editorOptions => editorOptions?.formatting?.table));
config.set('removeFormat', addPlugin(RemoveFormat, editorOptions => editorOptions?.formatting?.removeFormat));
config.set('list', addPlugin(List, editorOptions => (
editorOptions?.formatting?.ul
|| editorOptions?.formatting?.ol
)));
config.set('alignment', addPlugin(Alignment, $or(
$get('formatting.left'),
$get('formatting.center'),
$get('formatting.right'),
$get('formatting.justify')
config.set('alignment', addPlugin(Alignment, editorOptions => (
editorOptions?.formatting?.left
|| editorOptions?.formatting?.center
|| editorOptions?.formatting?.right
|| editorOptions?.formatting?.justify
)));
config.set('heading', addPlugin(Heading, $or(
$get('formatting.h1'),
$get('formatting.h2'),
$get('formatting.h3'),
$get('formatting.h4'),
$get('formatting.h5'),
$get('formatting.h6')
config.set('heading', addPlugin(Heading, editorOptions => (
editorOptions?.formatting?.h1
|| editorOptions?.formatting?.h2
|| editorOptions?.formatting?.h3
|| editorOptions?.formatting?.h4
|| editorOptions?.formatting?.h5
|| editorOptions?.formatting?.h6
)));

// Custom Plugin that automatically converts <i> to <em> for italics
// @fixes https://github.com/neos/neos-ui/issues/2906
config.set('italicWithEm', addPlugin(ItalicWithEm, $get('formatting.em')));
config.set('italicWithEm', addPlugin(ItalicWithEm, editorOptions => editorOptions?.formatting?.em));

//
// @see https://docs.ckeditor.com/ckeditor5/latest/features/headings.html#configuring-heading-levels
Expand Down
Loading