mjml-social
Advanced tools
Comparing version 4.14.1 to 4.15.0
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -20,5 +19,3 @@ value: true | ||
}); | ||
var _Social = _interopRequireDefault(require("./Social")); | ||
var _SocialElement = _interopRequireDefault(require("./SocialElement")); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,30 +8,19 @@ value: true | ||
exports.default = void 0; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _isNil2 = _interopRequireDefault(require("lodash/isNil")); | ||
var _mjmlCore = require("mjml-core"); | ||
let MjSocial = /*#__PURE__*/function (_BodyComponent) { | ||
let MjSocial = exports.default = /*#__PURE__*/function (_BodyComponent) { | ||
(0, _inherits2.default)(MjSocial, _BodyComponent); | ||
var _super = (0, _createSuper2.default)(MjSocial); | ||
function MjSocial() { | ||
(0, _classCallCheck2.default)(this, MjSocial); | ||
return _super.apply(this, arguments); | ||
return (0, _callSuper2.default)(this, MjSocial, arguments); | ||
} | ||
(0, _createClass2.default)(MjSocial, [{ | ||
key: "getStyles", | ||
value: // eslint-disable-next-line class-methods-use-this | ||
value: | ||
// eslint-disable-next-line class-methods-use-this | ||
function getStyles() { | ||
@@ -49,7 +37,5 @@ return { | ||
const base = {}; | ||
if (this.getAttribute('inner-padding')) { | ||
base.padding = this.getAttribute('inner-padding'); | ||
} | ||
return ['border-radius', 'color', 'font-family', 'font-size', 'font-weight', 'font-style', 'icon-size', 'icon-height', 'icon-padding', 'text-padding', 'line-height', 'text-decoration'].filter(e => !(0, _isNil2.default)(this.getAttribute(e))).reduce((res, attr) => { | ||
@@ -147,4 +133,2 @@ res[attr] = this.getAttribute(attr); | ||
}(_mjmlCore.BodyComponent); | ||
exports.default = MjSocial; | ||
(0, _defineProperty2.default)(MjSocial, "componentName", 'mj-social'); | ||
@@ -151,0 +135,0 @@ (0, _defineProperty2.default)(MjSocial, "allowedAttributes", { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,19 +8,10 @@ value: true | ||
exports.default = void 0; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _each2 = _interopRequireDefault(require("lodash/each")); | ||
var _get2 = _interopRequireDefault(require("lodash/get")); | ||
var _mjmlCore = require("mjml-core"); | ||
const IMG_BASE_URL = 'https://www.mailjet.com/images/theme/v1/icons/ico-social/'; | ||
@@ -102,17 +92,13 @@ const defaultSocialNetworks = { | ||
(0, _each2.default)(defaultSocialNetworks, (val, key) => { | ||
defaultSocialNetworks[`${key}-noshare`] = { ...val, | ||
defaultSocialNetworks[`${key}-noshare`] = { | ||
...val, | ||
'share-url': '[[URL]]' | ||
}; | ||
}); | ||
let MjSocialElement = /*#__PURE__*/function (_BodyComponent) { | ||
let MjSocialElement = exports.default = /*#__PURE__*/function (_BodyComponent) { | ||
(0, _inherits2.default)(MjSocialElement, _BodyComponent); | ||
var _super = (0, _createSuper2.default)(MjSocialElement); | ||
function MjSocialElement() { | ||
(0, _classCallCheck2.default)(this, MjSocialElement); | ||
return _super.apply(this, arguments); | ||
return (0, _callSuper2.default)(this, MjSocialElement, arguments); | ||
} | ||
(0, _createClass2.default)(MjSocialElement, [{ | ||
@@ -171,8 +157,7 @@ key: "getStyles", | ||
let href = this.getAttribute('href'); | ||
if (href && (0, _get2.default)(socialNetwork, 'share-url')) { | ||
href = socialNetwork['share-url'].replace('[[URL]]', href); | ||
} | ||
const attrs = ['icon-size', 'icon-height', 'srcset', 'sizes', 'src', 'background-color'].reduce((r, attr) => ({ ...r, | ||
const attrs = ['icon-size', 'icon-height', 'srcset', 'sizes', 'src', 'background-color'].reduce((r, attr) => ({ | ||
...r, | ||
[attr]: this.getAttribute(attr) || socialNetwork[attr] | ||
@@ -267,4 +252,2 @@ }), {}); | ||
}(_mjmlCore.BodyComponent); | ||
exports.default = MjSocialElement; | ||
(0, _defineProperty2.default)(MjSocialElement, "componentName", 'mj-social-element'); | ||
@@ -304,2 +287,3 @@ (0, _defineProperty2.default)(MjSocialElement, "endingTag", true); | ||
(0, _defineProperty2.default)(MjSocialElement, "defaultAttributes", { | ||
alt: '', | ||
align: 'left', | ||
@@ -306,0 +290,0 @@ color: '#000', |
{ | ||
"name": "mjml-social", | ||
"description": "mjml-social", | ||
"version": "4.14.1", | ||
"version": "4.15.0", | ||
"main": "lib/index.js", | ||
@@ -26,3 +26,3 @@ "files": [ | ||
"lodash": "^4.17.21", | ||
"mjml-core": "4.14.1" | ||
"mjml-core": "4.15.0" | ||
}, | ||
@@ -33,3 +33,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "988819de3375867c09585d28f555166b97415200" | ||
"gitHead": "af922bd11c16f4182057077a8a060b7a7f7cc4e3" | ||
} |
@@ -7,2 +7,8 @@ ## mj-social | ||
<aside class="warning"> | ||
`mj-social-element`'s `name` attribute is a shortcut for some common social elements. <br /> | ||
You should avoid rely too much on this as those icons are hosted by Mailjet for their Email Builder.<br /> | ||
Use <a href="#custom-social-element">custom element syntax instead.</a> | ||
</aside> | ||
Displays calls-to-action for various social networks with their associated logo. You can add social networks with the `mj-social-element` tag. | ||
@@ -22,5 +28,8 @@ | ||
</mj-social-element> | ||
<mj-social-element name="twitter" href="https://mjml.io/"> | ||
<mj-social-element name="twitter" href="https://mjml.io/"> | ||
</mj-social-element> | ||
<mj-social-element name="x" href="https://mjml.io/"> | ||
X | ||
</mj-social-element> | ||
</mj-social> | ||
@@ -78,3 +87,3 @@ </mj-column> | ||
align | string | left/right/center | center | ||
alt | string | image alt attribute | none | ||
alt | string | image alt attribute | '' | ||
background-color | color | icon color | Each social `name` has its own default | ||
@@ -112,2 +121,3 @@ border-radius | px | border radius | 3px | ||
- x | ||
@@ -114,0 +124,0 @@ - pinterest |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24741
153
+ Addedcliui@8.0.1(transitive)
+ Addedhtmlparser2@9.1.0(transitive)
+ Addedjuice@10.0.1(transitive)
+ Addedmjml-core@4.15.0(transitive)
+ Addedmjml-migrate@4.15.0(transitive)
+ Addedmjml-parser-xml@4.15.0(transitive)
+ Addedyargs@17.7.2(transitive)
+ Addedyargs-parser@21.1.1(transitive)
- Removedcliui@7.0.4(transitive)
- Removeddetect-node@2.0.4(transitive)
- Removedjuice@9.1.0(transitive)
- Removedmjml-core@4.14.1(transitive)
- Removedmjml-migrate@4.14.1(transitive)
- Removedmjml-parser-xml@4.14.1(transitive)
- Removedyargs@16.2.0(transitive)
- Removedyargs-parser@20.2.9(transitive)
Updatedmjml-core@4.15.0