Skip to content

Commit

Permalink
fix table of contents color not working
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan-shafi committed Feb 4, 2024
1 parent c579fb0 commit 3c3e8b3
Show file tree
Hide file tree
Showing 7 changed files with 133,754 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/blocks.build.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'e9d234bba9157d0307bb');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '2eaa6e7bfd9c3fc3f669');
133,731 changes: 133,730 additions & 1 deletion dist/blocks.build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/blocks.build.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/priority.build.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '31d6cfe0d16ae931b73c');
<?php return array('dependencies' => array(), 'version' => 'bf4427955793c56378a0');
9 changes: 9 additions & 0 deletions dist/priority.build.js

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

2 changes: 1 addition & 1 deletion dist/priority.build.js.map

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

26 changes: 11 additions & 15 deletions src/blocks/table-of-contents/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,33 +716,29 @@ export const inspectorControls = (props) => {
const { updateBlockAttributes } =
dispatch("core/block-editor") || dispatch("core/editor");
const { getBlocks } = select("core/block-editor") || select("core/editor");
const createColorSetting = (
value,
label,
onChange = (newValue) => setAttributes({ [label]: newValue }),
) => ({
value,
onChange,
const createColorSetting = (attrKey, label) => ({
value: attributes[attrKey],
onChange: (newValue) => setAttributes({ [attrKey]: newValue }),
label: __(label),
});

const getColorSettings = () => {
const settings = [
createColorSetting(titleColor, "Title Color"),
createColorSetting(titleBackgroundColor, "Title Background Color"),
createColorSetting(listColor, "List Color"),
createColorSetting(listBackgroundColor, "List Background Color"),
createColorSetting("titleColor", "Title Color", "titleColor"),
createColorSetting("titleBackgroundColor", "Title Background Color"),
createColorSetting("listColor", "List Color"),
createColorSetting("listBackgroundColor", "List Background Color"),
...(listStyle !== "plain"
? [
createColorSetting(
listIconColor,
"listIconColor",
listStyle === "numbered"
? "Item number color"
: "List icon color",
),
]
: []),
];

return settings.filter((setting) => Object.keys(setting).length > 0);
};

Expand Down Expand Up @@ -1143,10 +1139,10 @@ export const editorDisplay = (props) => {
{
<style
dangerouslySetInnerHTML={{
__html: `#ub_table-of-contents-${blockID} .ub_table-of-contents-container li{
__html: `#block-${blockID} .ub_table-of-contents-container li{
color: ${listIconColor};
}
#ub_table-of-contents-${blockID} .ub_table-of-contents-container a{
#block-${blockID} .ub_table-of-contents-container a{
color: ${listColor};
}`,
}}
Expand Down

0 comments on commit 3c3e8b3

Please sign in to comment.