Skip to content

Commit

Permalink
TASK: Removes plow-js usage from PlaceholderInsert plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
markusguenther committed Oct 4, 2024
1 parent f57e863 commit 71244d4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { connect } from "react-redux";
import { SelectBox } from "@neos-project/react-ui-components";
import React, { PureComponent } from "react";
import { neos } from "@neos-project/neos-ui-decorators";
import { $transform } from "plow-js";
import { selectors } from "@neos-project/neos-ui-redux-store";

export const parentNodeContextPath = contextPath => {
Expand All @@ -21,9 +20,9 @@ export const parentNodeContextPath = contextPath => {
};

@connect(
$transform({
nodesByContextPath: selectors.CR.Nodes.nodesByContextPathSelector,
focusedNode: selectors.CR.Nodes.focusedSelector
state => ({
nodesByContextPath: selectors.CR.Nodes.nodesByContextPathSelector(state),
focusedNode: selectors.CR.Nodes.focusedSelector(state)
})
)
@neos(globalRegistry => ({
Expand Down
13 changes: 9 additions & 4 deletions Resources/Private/PlaceholderInsert/src/manifest.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import manifest from "@neos-project/neos-ui-extensibility";
import PlaceholderInsertDropdown from "./PlaceholderInsertDropdown";
import placeholderInsertPlugin from "./placeholderInsertPlugin";
import { $add, $get } from "plow-js";

const addPlugin = (Plugin, isEnabled) => (ckEditorConfiguration, options) => {
if (!isEnabled || isEnabled(options.editorOptions, options)) {
ckEditorConfiguration.plugins = ckEditorConfiguration.plugins || [];
return $add("plugins", Plugin, ckEditorConfiguration);
return {
...ckEditorConfiguration,
plugins: [
...(ckEditorConfiguration.plugins ?? []),
Plugin
]
};
}
return ckEditorConfiguration;
};
Expand All @@ -17,12 +22,12 @@ manifest("Neos.Form.Builder:PlaceholderInsert", {}, globalRegistry => {
.get("richtextToolbar");
richtextToolbar.set("placeholderInsertt", {
component: PlaceholderInsertDropdown,
isVisible: $get("formatting.placeholderInsert")
isVisible: editorOptions => editorOptions?.formatting?.placeholderInsert
});

const config = globalRegistry.get("ckEditor5").get("config");
config.set(
"placeholderInsert",
addPlugin(placeholderInsertPlugin, $get("formatting.placeholderInsert"))
addPlugin(placeholderInsertPlugin, editorOptions => editorOptions?.formatting?.placeholderInsert)
);
});
3 changes: 2 additions & 1 deletion Resources/Public/JavaScript/PlaceholderInsert/Plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Resources/Public/JavaScript/PlaceholderInsert/Plugin.js.map

Large diffs are not rendered by default.

0 comments on commit 71244d4

Please sign in to comment.