Skip to content

Commit

Permalink
Merge pull request #2253 from vektor-inc/add/fixed-display/display-hi…
Browse files Browse the repository at this point in the history
…de-timing

[ 固定表示 ] タイマー機能追加
  • Loading branch information
kurudrive authored Nov 25, 2024
2 parents 885683c + a012b2b commit 79f5896
Show file tree
Hide file tree
Showing 11 changed files with 537 additions and 89 deletions.
3 changes: 2 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ e.g.
== Changelog ==

[ Add Block ] Add Post list Slider block.
[ Other ][ Slider ] Refactoring editor script.
[ Add function ][ Fixed Display (Pro) ] Added a timer feature to control block appearance/disappearance and a "Do not show again for returning visitors" option. Session Storage is used, and no personal data is collected or tracked. Since Session Storage is used, the block may reappear after the browser is closed or in private browsing mode.
[ Bug fix ][ Cover ] Fixed an issue where, after setting a link in the Cover block and adding two unstyled headings inside it, the content positioning would not apply upon returning to the editing screen (editing screen only).
[ Bug Fix ][ Grid Column Card (Pro) ] Fixed only dots being displayed as separators.
[ Bug fix ][ Post List (Pro) ] Since WordPress 6.7.1 started outputting contain-intrinsic-size: 3000px 1500px, add a reset for this in .card.
[ Other ][ Slider ] Refactoring editor script.

= 1.91.2 =
[ Bug fix ] Fix checkbox misalignment in the admin panel.
Expand Down
12 changes: 12 additions & 0 deletions src/blocks/_pro/fixed-display/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@
"type": "string",
"default": "svh"
},
"displayAfterSeconds": {
"type": "number",
"default": 0
},
"hideAfterSeconds": {
"type": "number",
"default": 0
},
"dontShowAgain": {
"type": "boolean",
"default": false
},
"clientId": {
"type": "string"
},
Expand Down
39 changes: 39 additions & 0 deletions src/blocks/_pro/fixed-display/deprecated/1.86.0/save.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';

export default function save({ attributes }) {
const {
mode,
position,
scrollTiming,
scrollTimingUnit,
blockId,
scrollPersistVisible,
fixedPositionType,
fixedPositionValue,
fixedPositionUnit,
} = attributes;

const blockProps = useBlockProps.save({
className: `vk_fixed-display vk_fixed-display-mode-${mode} vk_fixed-display-position-${position} ${
['right', 'left'].includes(position)
? `vk_fixed-display-position-from-${fixedPositionType}`
: ''
} vk_fixed-display-${blockId}`,
style: {
[fixedPositionType]: ['right', 'left'].includes(position)
? `${fixedPositionValue}${fixedPositionUnit}`
: undefined,
},
...(mode === 'show-on-scroll' && {
'data-scroll-timing': scrollTiming.toString(),
'data-scroll-timing-unit': scrollTimingUnit,
'data-persist-visible': scrollPersistVisible ? 'true' : 'false',
}),
});

return (
<div {...blockProps}>
<InnerBlocks.Content />
</div>
);
}
21 changes: 21 additions & 0 deletions src/blocks/_pro/fixed-display/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import save1_75_0 from './1.75.0/save';
import save1_81_1 from './1.81.1/save';
import save1_86_0 from './1.86.0/save';

const blockAttributes = {
mode: {
Expand Down Expand Up @@ -54,7 +55,27 @@ const blockAttributes2 = {
},
};

const blockAttributes3 = {
...blockAttributes2,
displayAfterSeconds: {
type: 'number',
default: 0
},
hideAfterSeconds: {
type: 'number',
default: 0
},
dontShowAgain: {
type: 'boolean',
default: false,
},
};

const deprecated = [
{
attributes: blockAttributes3,
save: save1_86_0,
},
{
attributes: blockAttributes2,
save: save1_81_1,
Expand Down
Loading

0 comments on commit 79f5896

Please sign in to comment.