-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
117618b
commit e0a88ad
Showing
5 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import Edit from './edit'; | ||
import classnames from 'classnames' | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { __ } = wp.i18n; | ||
const { createBlock, getBlockAttributes, registerBlockType } = wp.blocks; | ||
|
||
/** | ||
* Block constants | ||
*/ | ||
const name = 'actionTagOffline'; | ||
const title = __('Every Action Offline Action Embed'); | ||
const keywords = [ | ||
__('Advocacy'), | ||
__('ActionTag'), | ||
__('tinypixel'), | ||
]; | ||
const blockAttributes = { | ||
url: { | ||
type: 'string', | ||
}, | ||
file: { | ||
type: 'string', | ||
}, | ||
meta: { | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
}; | ||
|
||
const schema = { | ||
div: { | ||
classes: ['wp-block-every-action-action-tag'], | ||
}, | ||
}; | ||
|
||
registerBlockType('every-action/every-action-offline-embed', { | ||
title: title, | ||
description: __('Embed Every Action Event Forms by adding the form link.'), | ||
icon: { | ||
src: 'megaphone', | ||
}, | ||
category: 'common', | ||
keywords: keywords, | ||
attributes: blockAttributes, | ||
supports: { | ||
html: false, | ||
align: ['wide'], | ||
}, | ||
edit: Edit, | ||
save({ attributes, className }) { | ||
const { url } = attributes; | ||
let actionTagContent = null; | ||
if(url) { | ||
let match = /(.*)\/\/(.*)\/(.*)/g.exec(url); | ||
if(match) { | ||
actionTagContent = `\ | ||
<div class="every-action-embed">\ | ||
<div class="oa-page-embed"\ | ||
data-page-url="${match[1]}${match[2]}${match[3]}">\ | ||
</div>\ | ||
</div>`; | ||
} | ||
} | ||
|
||
if(actionTagContent) { | ||
return ( | ||
<div | ||
className={ | ||
classnames( | ||
className, | ||
)} | ||
> | ||
<script type="text/javascript" src="https://d1aqhv4sn5kxtx.cloudfront.net/actiontag/at.js" crossorigin="anonymous"></script> | ||
<div dangerouslySetInnerHTML={{ __html: actionTagContent }} /> | ||
<noscript><a href={url}>{__('View this action on Every Action')}</a></noscript> | ||
</div> | ||
); | ||
} | ||
|
||
return "there was a problem 🤭"; | ||
|
||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
host: '10.0.0.236', | ||
host: 'localhost', | ||
proxy: 'http://bedrock.lndo.site', | ||
port: 3000, | ||
ui: { | ||
|