Skip to content

Commit

Permalink
release: small fixes
Browse files Browse the repository at this point in the history
### Bug Fixes:
- **Fix excerpt more** filter interaction inside the Gutenberg when excerpt block is used.
- **Fix mega menu** opening on tablet devices.

### Improvements
- **Updated internal dependencies**
-  **Update Google Fonts**​:​ Get the newest Google fonts from the public font library.
- **Feature usage tracking improvements** for Header/Footer Builder in the Customizer.
  • Loading branch information
preda-bogdan authored Mar 12, 2024
2 parents 0dcb9d2 + 8ab100d commit 3bf339f
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ type Props = {

const BuilderItem: React.FC<Props> = (props) => {
const { componentId, currentSection, slot, row, index } = props;
const { actions, builder, sidebarItems } = useContext(BuilderContext);
const { actions, builder, sidebarItems, device } =
useContext(BuilderContext);

const itemDetails =
window.NeveReactCustomize.HFG[builder].items[componentId];
Expand Down Expand Up @@ -52,11 +53,13 @@ const BuilderItem: React.FC<Props> = (props) => {
})
);

window.tiTrk?.with('neve').set(`${componentId}_removed`, {
feature: builder + '_builder',
featureComponent: 'component-removed',
featureValue: { row, slot, item: componentId },
});
window.tiTrk
?.with('neve')
.set(`${componentId}__${device}_${builder}_removed`, {
feature: builder + '_builder',
featureComponent: 'component-removed',
featureValue: { row, slot, item: componentId, device },
});
};

const iconSize = 18;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const ComponentsPopover: React.FC<Props> = ({

const url = window.NeveReactCustomize.upsellComponentsLink;

const { builder, actions, sidebarItems } = useContext(BuilderContext);
const { builder, actions, sidebarItems, device } =
useContext(BuilderContext);
const { updateLayout, setSidebarItems } = actions;

const addItemToSlot = (itemId: string) => {
Expand All @@ -37,11 +38,19 @@ const ComponentsPopover: React.FC<Props> = ({
updateLayout(rowId, slotId, nextItems);
setSidebarItems(sidebarItems.filter((i) => i.id !== itemId));

window.tiTrk?.with('neve').set(`${itemId}_added`, {
feature: builder + '_builder',
featureComponent: 'component-added',
featureValue: { row: rowId, slot: slotId, item: itemId },
});
window.tiTrk
?.with('neve')
.set(`${itemId}__${device}_${builder}_added`, {
feature: builder + '_builder',
featureComponent: 'component-added',
featureValue: {
row: rowId,
slot: slotId,
item: itemId,
device,
trigger: 'popover',
},
});
closePopup();
};

Expand Down
22 changes: 21 additions & 1 deletion assets/apps/customizer-controls/src/builder/components/Slot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = {
};

const Slot: React.FC<Props> = ({ items, slotId, rowId, className }) => {
const { currentSection, builder, actions, dragging } =
const { currentSection, builder, actions, dragging, device } =
useContext(BuilderContext);
const { updateLayout, onDragStart } = actions;

Expand All @@ -44,6 +44,26 @@ const Slot: React.FC<Props> = ({ items, slotId, rowId, className }) => {
const nextState = newState.map((item) => {
return { id: item.id };
});

// Track the added components.
nextState
?.filter((item) => !items.some((i) => i.id === item.id))
?.forEach((item) => {
window.tiTrk
?.with('neve')
.set(`${item.id}__${device}_${builder}_added`, {
feature: builder + '_builder',
featureComponent: 'component-added',
featureValue: {
row: rowId,
slot: slotId,
item: item.id,
device,
trigger: 'drag-and-drop',
},
});
});

updateLayout(rowId, slotId, nextState);
}}
>
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/components/elements/_mega-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
.neve-mega-menu > .sub-menu {
left: 50% !important;
right: unset !important;
transform: translateX(-50%);
transform: translateX(-50%) !important;
position: absolute;
padding: 20px 10px;
top: auto;
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

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

6 changes: 5 additions & 1 deletion globals/google-fonts.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Updated on 19/02/24
* Updated on 11/03/24
*
* @package neve
*/
Expand Down Expand Up @@ -584,6 +584,7 @@
'Holtwood One SC' => array( '400',),
'Homemade Apple' => array( '400',),
'Homenaje' => array( '400',),
'Honk' => array( '400',),
'Hubballi' => array( '400',),
'Hurricane' => array( '400',),
'IBM Plex Mono' => array( '100', '200', '300', '400', '500', '600', '700', '100italic', '200italic', '300italic', '400italic', '500italic', '600italic', '700italic',),
Expand Down Expand Up @@ -1340,6 +1341,7 @@
'Rubik Doodle Triangles' => array( '400',),
'Rubik Gemstones' => array( '400',),
'Rubik Glitch' => array( '400',),
'Rubik Glitch Pop' => array( '400',),
'Rubik Iso' => array( '400',),
'Rubik Lines' => array( '400',),
'Rubik Maps' => array( '400',),
Expand Down Expand Up @@ -1429,6 +1431,7 @@
'Sintony' => array( '400', '700',),
'Sirin Stencil' => array( '400',),
'Six Caps' => array( '400',),
'Sixtyfour' => array( '400',),
'Skranji' => array( '400', '700',),
'Slabo 13px' => array( '400',),
'Slabo 27px' => array( '400',),
Expand Down Expand Up @@ -1605,6 +1608,7 @@
'Wix Madefor Display' => array( '400', '500', '600', '700', '800',),
'Wix Madefor Text' => array( '400', '500', '600', '700', '800', '400italic', '500italic', '600italic', '700italic', '800italic',),
'Work Sans' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900', '100italic', '200italic', '300italic', '400italic', '500italic', '600italic', '700italic', '800italic', '900italic',),
'Workbench' => array( '400',),
'Xanh Mono' => array( '400', '400italic',),
'Yaldevi' => array( '200', '300', '400', '500', '600', '700',),
'Yanone Kaffeesatz' => array( '200', '300', '400', '500', '600', '700',),
Expand Down
34 changes: 33 additions & 1 deletion inc/views/template_parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
class Template_Parts extends Base_View {
use Layout;

/**
* Use to temporary disable excerpt functionality.
*
* @var bool
*/
private $disable_excerpt = false;
/**
* Function that is run after instantiation.
*
Expand All @@ -34,6 +40,25 @@ public function init() {
add_action( 'neve_blog_post_template_part_content', array( $this, 'render_post' ) );
add_filter( 'excerpt_more', array( $this, 'link_excerpt_more' ) );
add_filter( 'the_content_more_link', array( $this, 'link_excerpt_more' ) );
add_filter( 'render_block_data', array( $this, 'temporary_disable_excerpt_more' ), -99, 3 );
}

/**
* Checks if a query block has the excerpt more block added to avoid duplicate read more.
*
* @param array $block_data Block data.
* @param array $block_type Block type.
* @param array $attributes Block attributes.
*
* @return array
*/
public function temporary_disable_excerpt_more( $block_data, $block_type, $attributes ) {

if ( 'core/post-excerpt' === $block_type['blockName'] ) {
$this->disable_excerpt = true;
}
return $block_data;

}

/**
Expand Down Expand Up @@ -211,7 +236,7 @@ protected function post_class( $post_id = null, $additional = '' ) {
$class .= ' nv-non-grid-article';
}
}

// Filter the Core classes for missing components.
$is_thumbnail_inactive = ! in_array( 'thumbnail', $this->get_ordered_components(), true );
if ( $is_thumbnail_inactive ) {
Expand Down Expand Up @@ -417,6 +442,13 @@ private function get_excerpt( $post_id = null ) {
* @return string
*/
public function link_excerpt_more( $moretag, $post_id = null ) {


if ( $this->disable_excerpt ) {
$this->disable_excerpt = false;
return $moretag;
}

$new_moretag = '&hellip;&nbsp;';

if ( $moretag !== ' [&hellip;]' ) {
Expand Down

0 comments on commit 3bf339f

Please sign in to comment.