From 4133ae9e8e9abd6849bba8c77f0dda8112b8261b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A3=AE=E6=9C=AC=E9=9B=85=E4=B9=9F?= Date: Thu, 14 Nov 2024 17:40:35 +0900 Subject: [PATCH] Edit and delete deprecated files --- .../card-item/deprecated/0.20.2/component.js | 240 --------------- .../_pro/card-item/deprecated/0.20.2/save.js | 5 - .../card-item/deprecated/0.20.3/component.js | 242 ---------------- .../_pro/card-item/deprecated/0.20.3/save.js | 5 - .../card-item/deprecated/0.20.4/component.js | 250 ---------------- .../_pro/card-item/deprecated/0.20.4/save.js | 5 - .../card-item/deprecated/0.20.5/component.js | 255 ---------------- .../_pro/card-item/deprecated/0.20.5/save.js | 5 - .../card-item/deprecated/0.20.6/component.js | 267 ----------------- .../_pro/card-item/deprecated/0.20.6/save.js | 5 - .../card-item/deprecated/0.60.1/component.js | 274 ------------------ .../_pro/card-item/deprecated/0.60.1/save.js | 5 - src/blocks/_pro/card-item/deprecated/index.js | 30 -- .../_pro/card/deprecated/hooks/0.0.1/index.js | 3 - .../_pro/card/deprecated/hooks/index.js | 4 - .../card/deprecated/save/0.0.0/component.js | 52 ---- .../_pro/card/deprecated/save/0.0.0/save.js | 11 - .../card/deprecated/save/0.37.4/component.js | 53 ---- .../_pro/card/deprecated/save/0.37.4/save.js | 11 - .../card/deprecated/save/0.40.0/component.js | 72 ----- .../_pro/card/deprecated/save/0.40.0/save.js | 11 - .../card/deprecated/save/0.60.1/component.js | 64 ---- .../_pro/card/deprecated/save/0.60.1/save.js | 5 - src/blocks/_pro/card/deprecated/save/index.js | 20 -- .../vk-blocks__card__deprecated-0-60-1.html | 20 -- ...cated-0-60-1__button-linkTarget-blank.html | 20 -- 26 files changed, 1934 deletions(-) delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.2/component.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.2/save.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.3/component.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.3/save.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.4/component.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.4/save.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.5/component.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.5/save.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.6/component.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.20.6/save.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.60.1/component.js delete mode 100644 src/blocks/_pro/card-item/deprecated/0.60.1/save.js delete mode 100644 src/blocks/_pro/card/deprecated/hooks/0.0.1/index.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.0.0/component.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.0.0/save.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.37.4/component.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.37.4/save.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.40.0/component.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.40.0/save.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.60.1/component.js delete mode 100644 src/blocks/_pro/card/deprecated/save/0.60.1/save.js delete mode 100644 test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1.html delete mode 100644 test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1__button-linkTarget-blank.html diff --git a/src/blocks/_pro/card-item/deprecated/0.20.2/component.js b/src/blocks/_pro/card-item/deprecated/0.20.2/component.js deleted file mode 100644 index df99d3e62..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.2/component.js +++ /dev/null @@ -1,240 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { fixBrokenUnicode } from '@vkblocks/utils/depModules'; -import { RichText, MediaUpload } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; -import { Component } from '@wordpress/element'; -import { dispatch } from '@wordpress/data'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class CardItem extends Component { - render() { - const { setAttributes, attributes, clientId } = this.props.value; - let { - layout, - // eslint-disable-next-line camelcase - col_xs, - // eslint-disable-next-line camelcase - col_sm, - // eslint-disable-next-line camelcase - col_md, - // eslint-disable-next-line camelcase - col_lg, - // eslint-disable-next-line camelcase - col_xl, - // eslint-disable-next-line camelcase - display_image, - // eslint-disable-next-line camelcase - display_btn, - // eslint-disable-next-line camelcase - btn_text, - title, - // eslint-disable-next-line camelcase - excerpt_text, - image, - url, - activeControl, - linkTarget, - rel, - } = attributes; - - const align = JSON.parse(fixBrokenUnicode(activeControl)); - const for_ = this.props.for_; - - const isEdit = () => { - if (for_ === 'edit') { - return true; - } else if ('save') { - return false; - } - }; - - let imgContainerClass; - if (layout === 'card-horizontal') { - } else if (layout === 'media') { - imgContainerClass = 'vk_post_imgOuter media-img'; - } else if (layout === 'card') { - layout = layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-noborder') { - layout = 'card ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } - - const deleteImgBtn = () => { - dispatch('core/block-editor').updateBlockAttributes(clientId, { - image: null, - }); - }; - - const uploadImgBtn = image => { - const imageParsed = JSON.parse( fixBrokenUnicode(image) ); - return ( - setAttributes({ image: JSON.stringify(value) })} - type="image" - className={"vk_post_imgOuter_img card-img-top"} - value={image} - render={({ open }) => ( - <> - {!imageParsed ? ( - - ) : ( - <> - {imageParsed.alt} - - - )} - - )} - /> - ); - }; - - const renderImage = display_image => { - if (display_image) { - if (isEdit(for_)) { - return ( - <> -
-
- {uploadImgBtn(image)} -
- - ); - } else { - return ( -
- {switchAddUrltoImage(url)} -
- ); - } - } - }; - - const switchAddUrltoImage = (url) => { - const overlay =
; - if (url) { - return ( - - {overlay} - - ); - } - return overlay; - }; - - const renderExcerpt = (align) => { - const titleTag = 'p'; - const titleClass = `vk_post_excerpt card-text text-${align.text}`; - if (isEdit(for_)) { - return ( - - setAttributes({ excerpt_text: value }) - } - placeholder={__( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', - 'vk-blocks-pro' - )} - /> - ); - } - return ( - - ); - }; - - const renderButton = (display_btn) => { - if (display_btn) { - return ( - - {btn_text} - - ); - } - }; - - const renderTitle = (align) => { - const titleTag = 'h5'; - const titleClass = `vk_post_title card-title text-${align.title}`; - if (isEdit(for_)) { - return ( - setAttributes({ title: value })} - placeholder={__('Title', 'vk-blocks-pro')} - /> - ); - } - return ( - - - - ); - }; - - let imageStyle; - if (image) { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - imageStyle = { - backgroundImage: `url(${imageParsed.sizes.full.url})`, - }; - } else { - imageStyle = {}; - } - - const btnClass = display_btn ? 'vk_post-btn-display' : ''; - - return ( -
- {renderImage(display_image)} -
- {renderTitle(align)} - {renderExcerpt(align)} -
- {renderButton(display_btn)} -
-
-
- ); - } -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.2/save.js b/src/blocks/_pro/card-item/deprecated/0.20.2/save.js deleted file mode 100644 index 1a1058146..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.2/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { CardItem } from './component'; - -export default function save(props) { - return ; -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.3/component.js b/src/blocks/_pro/card-item/deprecated/0.20.3/component.js deleted file mode 100644 index 60a92a087..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.3/component.js +++ /dev/null @@ -1,242 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { fixBrokenUnicode } from '@vkblocks/utils/depModules'; -import { RichText, MediaUpload } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; -import { Fragment, Component } from '@wordpress/element'; -import { dispatch } from '@wordpress/data'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class DepComponent extends Component { - render() { - const { setAttributes, attributes, clientId } = this.props.value; - let { - layout, - col_xs, - col_sm, - col_md, - col_lg, - col_xl, - display_image, - display_btn, - btn_text, - title, - excerpt_text, - image, - url, - activeControl, - linkTarget, - rel, - } = attributes; - - const align = JSON.parse(fixBrokenUnicode(activeControl)); - const for_ = this.props.for_; - - const isEdit = () => { - if (for_ === 'edit') { - return true; - } else if ('save') { - return false; - } - }; - - let imgContainerClass; - if (layout === 'card-horizontal') { - } else if (layout === 'media') { - imgContainerClass = 'vk_post_imgOuter media-img'; - } else if (layout === 'card') { - layout = layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-noborder') { - layout = 'card ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } - - const deleteImgBtn = () => { - dispatch('core/block-editor').updateBlockAttributes(clientId, { - image: null, - }); - }; - - const uploadImgBtn = (image) => { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - return ( - - setAttributes({ image: JSON.stringify(value) }) - } - type="image" - className={'vk_post_imgOuter_img card-img-top'} - value={image} - render={({ open }) => ( - - {!imageParsed ? ( - - ) : ( - - {imageParsed.alt} - - - )} - - )} - /> - ); - }; - - const renderImage = (display_image) => { - if (display_image) { - if (isEdit(for_)) { - return ( - -
-
- {uploadImgBtn(image)} -
-
- ); - } - return ( -
- {switchAddUrltoImage(url)} -
- ); - } - }; - - const switchAddUrltoImage = (url) => { - const overlay =
; - if (url) { - return ( - - {overlay} - - ); - } - return overlay; - }; - - const renderExcerpt = (align) => { - const titleTag = 'p'; - const titleClass = `vk_post_excerpt card-text text-${align.text}`; - if (isEdit(for_)) { - return ( - - setAttributes({ excerpt_text: value }) - } - placeholder={__( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', - 'vk-blocks-pro' - )} - /> - ); - } - return ( - - ); - }; - - const renderButton = (display_btn, align) => { - if (display_btn) { - return ( - - ); - } - }; - - const renderTitle = (align) => { - const titleTag = 'h5'; - const titleClass = `vk_post_title card-title text-${align.title}`; - if (isEdit(for_)) { - return ( - setAttributes({ title: value })} - placeholder={__('Title', 'vk-blocks-pro')} - /> - ); - } - return ( - - - - ); - }; - - let imageStyle; - if (image) { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - imageStyle = { - backgroundImage: `url(${imageParsed.sizes.full.url})`, - }; - } else { - imageStyle = {}; - } - - const btnClass = display_btn ? 'vk_post-btn-display' : ''; - - return ( -
- {renderImage(display_image)} -
- {renderTitle(align)} - {renderExcerpt(align)} - {renderButton(display_btn, align)} -
-
- ); - } -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.3/save.js b/src/blocks/_pro/card-item/deprecated/0.20.3/save.js deleted file mode 100644 index 7111bb197..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.3/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { DepComponent } from './component'; - -export default function save(props) { - return ; -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.4/component.js b/src/blocks/_pro/card-item/deprecated/0.20.4/component.js deleted file mode 100644 index 9c2e9b094..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.4/component.js +++ /dev/null @@ -1,250 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { fixBrokenUnicode } from '@vkblocks/utils/depModules'; -import { RichText, MediaUpload } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; -import { Component } from '@wordpress/element'; -import { dispatch } from '@wordpress/data'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class DepComponent2 extends Component { - render() { - const { setAttributes, attributes, clientId } = this.props.value; - - let { - className, - layout, - col_xs, - col_sm, - col_md, - col_lg, - col_xl, - display_image, - display_btn, - btn_text, - title, - excerpt_text, - image, - url, - activeControl, - linkTarget, - rel, - } = attributes; - - const align = JSON.parse(fixBrokenUnicode(activeControl)); - const for_ = this.props.for_; - - const isEdit = () => { - if (for_ === 'edit') { - return true; - } else if ('save') { - return false; - } - }; - - let imgContainerClass; - if (layout === 'card-horizontal') { - } else if (layout === 'media') { - imgContainerClass = 'vk_post_imgOuter media-img'; - } else if (layout === 'card') { - layout = layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-noborder') { - layout = 'card ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-imageRound') { - layout = 'card card-noborder ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } - - const deleteImgBtn = () => { - dispatch('core/block-editor').updateBlockAttributes(clientId, { - image: null, - }); - }; - - const uploadImgBtn = (image) => { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - return ( - - setAttributes({ image: JSON.stringify(value) }) - } - type="image" - className={'vk_post_imgOuter_img card-img-top'} - value={image} - render={({ open }) => ( - <> - {!imageParsed ? ( - - ) : ( - <> - {imageParsed.alt} - - - )} - - )} - /> - ); - }; - - const renderImage = (display_image) => { - if (display_image) { - if (isEdit(for_)) { - return ( - <> -
-
- {uploadImgBtn(image)} -
- - ); - } - return ( -
- {switchAddUrltoImage(url)} -
- ); - } - }; - - const switchAddUrltoImage = (url) => { - const overlay =
; - if (url) { - return ( - - {overlay} - - ); - } - return overlay; - }; - - const renderExcerpt = (align) => { - const titleTag = 'p'; - const titleClass = `vk_post_excerpt card-text has-text-align-${align.text}`; - if (isEdit(for_)) { - return ( - - setAttributes({ excerpt_text: value }) - } - placeholder={__( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', - 'vk-blocks-pro' - )} - /> - ); - } - return ( - - ); - }; - - const renderButton = (display_btn, align) => { - if (display_btn) { - return ( - - ); - } - }; - - const renderTitle = (align) => { - const titleTag = 'h5'; - const titleClass = `vk_post_title card-title has-text-align-${align.title}`; - if (isEdit(for_)) { - return ( - setAttributes({ title: value })} - placeholder={__('Title', 'vk-blocks-pro')} - /> - ); - } - return ( - - - - ); - }; - - let imageStyle; - if (image) { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - imageStyle = { - backgroundImage: `url(${imageParsed.sizes.full.url})`, - }; - } else { - imageStyle = {}; - } - - const btnClass = display_btn ? 'vk_post-btn-display' : ''; - - return ( -
- {renderImage(display_image)} -
- {renderTitle(align)} - {renderExcerpt(align)} - - {renderButton(display_btn, align)} -
-
- ); - } -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.4/save.js b/src/blocks/_pro/card-item/deprecated/0.20.4/save.js deleted file mode 100644 index 84f84c046..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.4/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { DepComponent2 } from './component'; - -export default function save(props) { - return ; -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.5/component.js b/src/blocks/_pro/card-item/deprecated/0.20.5/component.js deleted file mode 100644 index 625abb45f..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.5/component.js +++ /dev/null @@ -1,255 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { fixBrokenUnicode } from '@vkblocks/utils/depModules'; -import { RichText, MediaUpload } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; -import { Component } from '@wordpress/element'; -import { dispatch } from '@wordpress/data'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class DepComponent3 extends Component { - render() { - const { setAttributes, attributes, className, clientId } = this.props; - let { - layout, - col_xs, - col_sm, - col_md, - col_lg, - col_xl, - display_image, - display_btn, - btn_text, - title, - excerpt_text, - image, - url, - activeControl, - linkTarget, - rel, - } = attributes; - - const align = JSON.parse(fixBrokenUnicode(activeControl)); - const for_ = this.props.for_; - - const isEdit = () => { - if (for_ === 'edit') { - return true; - } else if ('save') { - return false; - } - }; - - let imgContainerClass; - if (layout === 'card-horizontal') { - } else if (layout === 'media') { - imgContainerClass = 'vk_post_imgOuter media-img'; - } else if (layout === 'card') { - layout = layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-noborder') { - layout = 'card ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-imageRound') { - layout = 'card card-noborder ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } - - const deleteImgBtn = () => { - dispatch('core/block-editor').updateBlockAttributes(clientId, { - image: null, - }); - }; - - const uploadImgBtn = (image) => { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - return ( - - setAttributes({ image: JSON.stringify(value) }) - } - type="image" - className={'vk_post_imgOuter_img card-img-top'} - value={image} - render={({ open }) => ( - <> - {!imageParsed ? ( - - ) : ( - <> - {imageParsed.alt} - - - )} - - )} - /> - ); - }; - - const renderImage = (display_image) => { - if (display_image) { - if (isEdit(for_)) { - return ( - <> -
-
- {uploadImgBtn(image)} -
- - ); - } - return ( -
- {switchAddUrltoImage(url)} -
- ); - } - }; - - const switchAddUrltoImage = (url) => { - const overlay =
; - if (url) { - return ( - - {overlay} - - ); - } - return overlay; - }; - - const renderExcerpt = (align) => { - const titleTag = 'p'; - const titleClass = `vk_post_excerpt card-text has-text-align-${align.text}`; - if (isEdit(for_)) { - return ( - - setAttributes({ excerpt_text: value }) - } - placeholder={__( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', - 'vk-blocks-pro' - )} - /> - ); - } - return ( - - ); - }; - - const renderButton = (display_btn, align) => { - if (display_btn) { - return ( - - ); - } - }; - - const renderTitle = (align) => { - const titleTag = 'h5'; - const titleClass = `vk_post_title card-title has-text-align-${align.title}`; - if (isEdit(for_)) { - return ( - setAttributes({ title: value })} - placeholder={__('Title', 'vk-blocks-pro')} - /> - ); - } else if (!isEdit(for_) && !url) { - return ( - - ); - } - return ( - - - - ); - }; - - let imageStyle; - if (image) { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - imageStyle = { - backgroundImage: `url(${imageParsed.sizes.full.url})`, - }; - } else { - imageStyle = {}; - } - - const btnClass = display_btn ? 'vk_post-btn-display' : ''; - - return ( -
- {renderImage(display_image)} -
- {renderTitle(align)} - {renderExcerpt(align)} - {renderButton(display_btn, align)} -
-
- ); - } -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.5/save.js b/src/blocks/_pro/card-item/deprecated/0.20.5/save.js deleted file mode 100644 index d225fd6c2..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.5/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { DepComponent3 } from './component'; - -export default function save(props) { - return ; -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.6/component.js b/src/blocks/_pro/card-item/deprecated/0.20.6/component.js deleted file mode 100644 index 706e58cc8..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.6/component.js +++ /dev/null @@ -1,267 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { fixBrokenUnicode } from '@vkblocks/utils/depModules'; -import { RichText, MediaUpload, InnerBlocks } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; -import { Component } from '@wordpress/element'; -import { dispatch } from '@wordpress/data'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class DepComponentXxlAdd extends Component { - render() { - const { setAttributes, attributes, className, clientId } = this.props; - let { - layout, - col_xs, - col_sm, - col_md, - col_lg, - col_xl, - display_title, - display_excerpt, - display_image, - display_btn, - btn_text, - title, - excerpt_text, - image, - url, - activeControl, - linkTarget, - rel, - } = attributes; - - const align = JSON.parse(fixBrokenUnicode(activeControl)); - const for_ = this.props.for_; - - const isEdit = () => { - if (for_ === 'edit') { - return true; - } else if ('save') { - return false; - } - }; - - let imgContainerClass; - if (layout === 'card-horizontal') { - } else if (layout === 'media') { - imgContainerClass = 'vk_post_imgOuter media-img'; - } else if (layout === 'card') { - layout = layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-noborder') { - layout = 'card ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-imageRound') { - layout = 'card card-noborder ' + layout + ' card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } - - const deleteImgBtn = () => { - dispatch('core/block-editor').updateBlockAttributes(clientId, { - image: null, - }); - }; - - const uploadImgBtn = (image) => { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - return ( - - setAttributes({ image: JSON.stringify(value) }) - } - type="image" - className={'vk_post_imgOuter_img card-img-top'} - value={image} - render={({ open }) => ( - <> - {!imageParsed ? ( - - ) : ( - <> - {imageParsed.alt} - - - )} - - )} - /> - ); - }; - - const renderImage = (display_image) => { - if (display_image) { - if (isEdit(for_)) { - return ( - <> -
-
- {uploadImgBtn(image)} -
- - ); - } - return ( -
- {switchAddUrltoImage(url)} -
- ); - } - }; - - const switchAddUrltoImage = (url) => { - const overlay =
; - if (url) { - return ( - - {overlay} - - ); - } - return overlay; - }; - - const renderExcerpt = (align, display_excerpt) => { - if (display_excerpt) { - const titleTag = 'p'; - const titleClass = `vk_post_excerpt card-text has-text-align-${align.text}`; - if (isEdit(for_)) { - return ( - - setAttributes({ excerpt_text: value }) - } - placeholder={__( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', - 'vk-blocks-pro' - )} - /> - ); - } - return ( - - ); - } - }; - - const renderButton = (display_btn, align) => { - if (display_btn) { - return ( - - ); - } - }; - - const renderTitle = (align, display_title) => { - if (display_title) { - const titleTag = 'h5'; - const titleClass = `vk_post_title card-title has-text-align-${align.title}`; - if (isEdit(for_)) { - return ( - - setAttributes({ title: value }) - } - placeholder={__('Title', 'vk-blocks-pro')} - /> - ); - } else if (!isEdit(for_) && !url) { - return ( - - ); - } - return ( - - - - ); - } - }; - - let imageStyle; - if (image) { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - imageStyle = { - backgroundImage: `url(${imageParsed.sizes.full.url})`, - }; - } else { - imageStyle = {}; - } - - const btnClass = display_btn ? 'vk_post-btn-display' : ''; - return ( -
- {renderImage(display_image)} -
- {renderTitle(align, display_title)} - {renderExcerpt(align, display_excerpt)} - {for_ === 'edit' ? ( - - ) : ( - - )} - {renderButton(display_btn, align)} -
-
- ); - } -} diff --git a/src/blocks/_pro/card-item/deprecated/0.20.6/save.js b/src/blocks/_pro/card-item/deprecated/0.20.6/save.js deleted file mode 100644 index ddf25a400..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.20.6/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { DepComponentXxlAdd } from './component'; - -export default function save(props) { - return ; -} diff --git a/src/blocks/_pro/card-item/deprecated/0.60.1/component.js b/src/blocks/_pro/card-item/deprecated/0.60.1/component.js deleted file mode 100644 index 3ea99bbec..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.60.1/component.js +++ /dev/null @@ -1,274 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { fixBrokenUnicode } from '@vkblocks/utils/depModules'; -import { RichText, MediaUpload, InnerBlocks } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; -import { Component } from '@wordpress/element'; -import { dispatch } from '@wordpress/data'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class CardItem extends Component { - render() { - const { setAttributes, attributes, className, clientId } = this.props; - const { - layout, - col_xs, - col_sm, - col_md, - col_lg, - col_xl, - col_xxl, - display_title, - display_excerpt, - display_image, - display_btn, - btn_text, - title, - excerpt_text, - image, - url, - activeControl, - linkTarget, - rel, - } = attributes; - - //ユニコード文字がエスケープされている対策 - const align = JSON.parse(fixBrokenUnicode(activeControl)); - const for_ = this.props.for_; - - const isEdit = () => { - if (for_ === 'edit') { - return true; - } else if ('save') { - return false; - } - }; - - let imgContainerClass; - let layoutClass; - if (layout === 'card-horizontal') { - } else if (layout === 'media') { - layoutClass = 'media'; - imgContainerClass = 'vk_post_imgOuter media-img'; - } else if (layout === 'card') { - layoutClass = 'card card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-noborder') { - layoutClass = 'card card-noborder card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } else if (layout === 'card-imageRound') { - layoutClass = 'card card-noborder card-imageRound card-post'; - imgContainerClass = 'vk_post_imgOuter'; - } - - const deleteImgBtn = () => { - dispatch('core/block-editor').updateBlockAttributes(clientId, { - image: null, - }); - }; - - const uploadImgBtn = (image) => { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - return ( - - setAttributes({ image: JSON.stringify(value) }) - } - type="image" - className={'vk_post_imgOuter_img card-img-top'} - value={image} - render={({ open }) => ( - <> - {!imageParsed ? ( - - ) : ( - <> - {imageParsed.alt} - - - )} - - )} - /> - ); - }; - - const renderImage = (display_image) => { - if (display_image) { - if (isEdit(for_)) { - return ( - <> -
-
- {uploadImgBtn(image)} -
- - ); - } - return ( -
- {switchAddUrltoImage(url)} -
- ); - } - }; - - const switchAddUrltoImage = (url) => { - const overlay =
; - if (url) { - return ( - - {overlay} - - ); - } - return overlay; - }; - - const renderExcerpt = (align, display_excerpt) => { - if (display_excerpt) { - const titleTag = 'p'; - const titleClass = `vk_post_excerpt card-text has-text-align-${align.text}`; - if (isEdit(for_)) { - return ( - - setAttributes({ excerpt_text: value }) - } - placeholder={__( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', - 'vk-blocks-pro' - )} - /> - ); - } - return ( - - ); - } - }; - - const renderButton = (display_btn, align) => { - if (display_btn) { - return ( - - ); - } - }; - - const renderTitle = (align, display_title) => { - if (display_title) { - const titleTag = 'h5'; - const titleClass = `vk_post_title card-title has-text-align-${align.title}`; - if (isEdit(for_)) { - return ( - - setAttributes({ title: value }) - } - placeholder={__('Title', 'vk-blocks-pro')} - /> - ); - } else if (!isEdit(for_) && !url) { - return ( - - ); - } - return ( - - - - ); - } - }; - - let imageStyle; - if (image) { - const imageParsed = JSON.parse(fixBrokenUnicode(image)); - imageStyle = { - backgroundImage: `url(${imageParsed.sizes.full.url})`, - }; - } else { - imageStyle = {}; - } - - const btnClass = display_btn ? 'vk_post-btn-display' : ''; - return ( -
- {renderImage(display_image)} -
- {renderTitle(align, display_title)} - {renderExcerpt(align, display_excerpt)} - {for_ === 'edit' ? ( - - ) : ( - - )} - {renderButton(display_btn, align)} -
-
- ); - } -} diff --git a/src/blocks/_pro/card-item/deprecated/0.60.1/save.js b/src/blocks/_pro/card-item/deprecated/0.60.1/save.js deleted file mode 100644 index 762d6a066..000000000 --- a/src/blocks/_pro/card-item/deprecated/0.60.1/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { CardItem } from './component'; - -export default function save(props) { - return ; -} diff --git a/src/blocks/_pro/card-item/deprecated/index.js b/src/blocks/_pro/card-item/deprecated/index.js index 9a632a53d..497b17fff 100644 --- a/src/blocks/_pro/card-item/deprecated/index.js +++ b/src/blocks/_pro/card-item/deprecated/index.js @@ -1,9 +1,3 @@ -import save0_20_2 from './0.20.2/save'; -import save0_20_3 from './0.20.3/save'; -import save0_20_4 from './0.20.4/save'; -import save0_20_5 from './0.20.5/save'; -import save0_20_6 from './0.20.6/save'; -import save0_60_1 from './0.60.1/save'; import save1_2_4 from './1.2.4/save'; const blockAttributes = { @@ -125,30 +119,6 @@ const deprecated = [ attributes: blockAttributes3, save: save1_2_4, }, - { - attributes: blockAttributes3, - save: save0_60_1, - }, - { - attributes: blockAttributes2, - save: save0_20_6, - }, - { - attributes: blockAttributes2, - save: save0_20_5, - }, - { - attributes: blockAttributes2, - save: save0_20_4, - }, - { - attributes: blockAttributes2, - save: save0_20_3, - }, - { - attributes: blockAttributes, - save: save0_20_2, - }, ]; export default deprecated; diff --git a/src/blocks/_pro/card/deprecated/hooks/0.0.1/index.js b/src/blocks/_pro/card/deprecated/hooks/0.0.1/index.js deleted file mode 100644 index bfccaaeb4..000000000 --- a/src/blocks/_pro/card/deprecated/hooks/0.0.1/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function CardHook({el,attributes}) { - return el -} diff --git a/src/blocks/_pro/card/deprecated/hooks/index.js b/src/blocks/_pro/card/deprecated/hooks/index.js index b8d65723b..80c5c2f95 100644 --- a/src/blocks/_pro/card/deprecated/hooks/index.js +++ b/src/blocks/_pro/card/deprecated/hooks/index.js @@ -1,7 +1,6 @@ import CardHook1_34_1 from './1.34.1' import CardHook1_23_0 from './1.23.0' import CardHook1_0_4 from './1.0.4' -import CardHook0_0_1 from './0.0.1' // saveの数分必要 export default [ @@ -11,7 +10,4 @@ export default [ CardHook1_0_4, CardHook1_0_4, CardHook1_0_4, - // Fix: https://github.com/vektor-inc/vk-blocks-pro/issues/376 - // 存在不明なバージョンの後方互換 - CardHook0_0_1, ]; diff --git a/src/blocks/_pro/card/deprecated/save/0.0.0/component.js b/src/blocks/_pro/card/deprecated/save/0.0.0/component.js deleted file mode 100644 index eabc049d4..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.0.0/component.js +++ /dev/null @@ -1,52 +0,0 @@ -import { InnerBlocks } from '@wordpress/block-editor'; -import { Component } from '@wordpress/element'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class DeprecatedComponent extends Component { - render() { - const for_ = this.props.for_; - const attributes = this.props.attributes; - let innerClass = ''; - let elm; - const ALLOWED_BLOCKS = ['vk-blocks/card-item']; - const TEMPLATE = [ALLOWED_BLOCKS]; - - //編集画面とサイト上の切り替え - if (for_ === 'edit') { - innerClass = 'editting'; - innerClass = innerClass + ' vk_posts-edit'; - innerClass = - innerClass + - ' vk_posts-edit-col-xs-' + - convertToGrid(attributes.col_xs); - innerClass = - innerClass + - ' vk_posts-edit-col-sm-' + - convertToGrid(attributes.col_sm); - innerClass = - innerClass + - ' vk_posts-edit-col-md-' + - convertToGrid(attributes.col_md); - innerClass = - innerClass + - ' vk_posts-edit-col-lg-' + - convertToGrid(attributes.col_lg); - innerClass = - innerClass + - ' vk_posts-edit-col-xl-' + - convertToGrid(attributes.col_xl); - - elm = ( -
- -
- ); - } else if ('save') { - elm = ; - } - return
{elm}
; - } -} diff --git a/src/blocks/_pro/card/deprecated/save/0.0.0/save.js b/src/blocks/_pro/card/deprecated/save/0.0.0/save.js deleted file mode 100644 index c0e8f86b6..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.0.0/save.js +++ /dev/null @@ -1,11 +0,0 @@ -import { DeprecatedComponent } from './component'; - -export default function save({ attributes, className }) { - return ( - - ); -} diff --git a/src/blocks/_pro/card/deprecated/save/0.37.4/component.js b/src/blocks/_pro/card/deprecated/save/0.37.4/component.js deleted file mode 100644 index ed1962767..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.37.4/component.js +++ /dev/null @@ -1,53 +0,0 @@ -import { InnerBlocks } from '@wordpress/block-editor'; -import { Component } from '@wordpress/element'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; - -export class Component0374 extends Component { - render() { - const for_ = this.props.for_; - const attributes = this.props.attributes; - let innerClass = ''; - const className = this.props.className; - let elm; - const ALLOWED_BLOCKS = ['vk-blocks/card-item']; - const TEMPLATE = [ALLOWED_BLOCKS]; - - //編集画面とサイト上の切り替え - if (for_ === 'edit') { - innerClass = 'editting'; - innerClass = innerClass + ' vk_posts-edit'; - innerClass = - innerClass + - ' vk_posts-edit-col-xs-' + - convertToGrid(attributes.col_xs); - innerClass = - innerClass + - ' vk_posts-edit-col-sm-' + - convertToGrid(attributes.col_sm); - innerClass = - innerClass + - ' vk_posts-edit-col-md-' + - convertToGrid(attributes.col_md); - innerClass = - innerClass + - ' vk_posts-edit-col-lg-' + - convertToGrid(attributes.col_lg); - innerClass = - innerClass + - ' vk_posts-edit-col-xl-' + - convertToGrid(attributes.col_xl); - - elm = ( -
- -
- ); - } else if ('save') { - elm = ; - } - return
{elm}
; - } -} diff --git a/src/blocks/_pro/card/deprecated/save/0.37.4/save.js b/src/blocks/_pro/card/deprecated/save/0.37.4/save.js deleted file mode 100644 index 632489fb8..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.37.4/save.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Component0374 } from './component'; - -export default function save({ attributes, className }) { - return ( - - ); -} diff --git a/src/blocks/_pro/card/deprecated/save/0.40.0/component.js b/src/blocks/_pro/card/deprecated/save/0.40.0/component.js deleted file mode 100644 index f55f40acd..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.40.0/component.js +++ /dev/null @@ -1,72 +0,0 @@ -import { InnerBlocks } from '@wordpress/block-editor'; -import { Component } from '@wordpress/element'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; -import classNames from 'classnames'; - -const prefix = 'vk_card_'; - -export class Component0400 extends Component { - render() { - const for_ = this.props.for_; - const attributes = this.props.attributes; - const { clientId } = attributes; - let innerClass = ''; - let className = this.props.className; - let elm; - const ALLOWED_BLOCKS = ['vk-blocks/card-item']; - const TEMPLATE = [ALLOWED_BLOCKS]; - - //編集画面とサイト上の切り替え - if (for_ === 'edit') { - innerClass = 'editting'; - innerClass = innerClass + ' vk_posts-edit'; - innerClass = - innerClass + - ' vk_posts-edit-col-xs-' + - convertToGrid(attributes.col_xs); - innerClass = - innerClass + - ' vk_posts-edit-col-sm-' + - convertToGrid(attributes.col_sm); - innerClass = - innerClass + - ' vk_posts-edit-col-md-' + - convertToGrid(attributes.col_md); - innerClass = - innerClass + - ' vk_posts-edit-col-lg-' + - convertToGrid(attributes.col_lg); - innerClass = - innerClass + - ' vk_posts-edit-col-xl-' + - convertToGrid(attributes.col_xl); - - elm = ( -
- -
- ); - } else if ('save') { - elm = ; - } - - if (className) { - className = className.replace(/vk_card_undefined/g, ''); - } - - return ( -
- {elm} -
- ); - } -} diff --git a/src/blocks/_pro/card/deprecated/save/0.40.0/save.js b/src/blocks/_pro/card/deprecated/save/0.40.0/save.js deleted file mode 100644 index aa9c40ba1..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.40.0/save.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Component0400 } from './component'; - -export default function save({ attributes, className }) { - return ( - - ); -} diff --git a/src/blocks/_pro/card/deprecated/save/0.60.1/component.js b/src/blocks/_pro/card/deprecated/save/0.60.1/component.js deleted file mode 100644 index 32aa023dc..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.60.1/component.js +++ /dev/null @@ -1,64 +0,0 @@ -import { InnerBlocks } from '@wordpress/block-editor'; -import { convertToGrid } from '@vkblocks/utils/convert-to-grid'; -import { Component } from '@wordpress/element'; -import classNames from 'classnames'; - -const prefix = 'vk_card_'; - -export class Card extends Component { - render() { - const for_ = this.props.for_; - const attributes = this.props.attributes; - const { clientId } = attributes; - let innerClass = ''; - let className = this.props.className; - let elm; - const ALLOWED_BLOCKS = ['vk-blocks/card-item']; - const TEMPLATE = [ALLOWED_BLOCKS]; - - //編集画面とサイト上の切り替え - if (for_ === 'edit') { - innerClass = 'editting'; - innerClass += innerClass + ' vk_posts-edit'; - innerClass += - ' vk_posts-edit-col-xs-' + convertToGrid(attributes.col_xs); - innerClass += - ' vk_posts-edit-col-sm-' + convertToGrid(attributes.col_sm); - innerClass += - ' vk_posts-edit-col-md-' + convertToGrid(attributes.col_md); - innerClass += - ' vk_posts-edit-col-lg-' + convertToGrid(attributes.col_lg); - innerClass += - ' vk_posts-edit-col-xl-' + convertToGrid(attributes.col_xl); - innerClass += - ' vk_posts-edit-col-xxl-' + convertToGrid(attributes.col_xxl); - - elm = ( -
- -
- ); - } else if ('save') { - elm = ; - } - - if (className) { - className = className.replace(/vk_card_undefined/g, ''); - } - - return ( -
- {elm} -
- ); - } -} diff --git a/src/blocks/_pro/card/deprecated/save/0.60.1/save.js b/src/blocks/_pro/card/deprecated/save/0.60.1/save.js deleted file mode 100644 index 88b3cf6e0..000000000 --- a/src/blocks/_pro/card/deprecated/save/0.60.1/save.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Card } from './component'; - -export default function save({ attributes }) { - return ; -} diff --git a/src/blocks/_pro/card/deprecated/save/index.js b/src/blocks/_pro/card/deprecated/save/index.js index 685a58711..d8783a46d 100644 --- a/src/blocks/_pro/card/deprecated/save/index.js +++ b/src/blocks/_pro/card/deprecated/save/index.js @@ -1,7 +1,3 @@ -import save000 from './0.0.0/save'; -import save0374 from './0.37.4/save'; -import save0400 from './0.40.0/save'; -import save0601 from './0.60.1/save'; import save1_0_4 from './1.0.4/save'; import save1_23_0 from './1.23.0/save'; import save1_34_1 from './1.34.1/save'; @@ -166,21 +162,5 @@ const deprecated = [ attributes:blockAttributes3, save: save1_0_4 }, - { - attributes: blockAttributes2, - save: save0601, - }, - { - attributes: blockAttributes2, - save: save0400, - }, - { - attributes: blockAttributes, - save: save0374, - }, - { - attributes: blockAttributes, - save: save000, - }, ]; export default deprecated; diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1.html b/test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1.html deleted file mode 100644 index 4eada990f..000000000 --- a/test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1.html +++ /dev/null @@ -1,20 +0,0 @@ - -
-
タイトル

本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文

Read more
-
- \ No newline at end of file diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1__button-linkTarget-blank.html b/test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1__button-linkTarget-blank.html deleted file mode 100644 index 172f56c7c..000000000 --- a/test/e2e-tests/fixtures/blocks/vk-blocks__card__deprecated-0-60-1__button-linkTarget-blank.html +++ /dev/null @@ -1,20 +0,0 @@ - -
-
タイトル

本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文

Read more
-
- \ No newline at end of file