Skip to content

Commit fbe6de7

Browse files
committed
fix(ifInline & ifEmbed): corrected the behaviour of these 2 functions
1 parent 0308e70 commit fbe6de7

8 files changed

Lines changed: 19 additions & 19 deletions

File tree

dist/embed.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.es2015.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.es2015.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/embed.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/modules/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function normalAsyncEmbed(_this, urlToText) {
154154

155155
export function asyncEmbed(_this, urlToText) {
156156
return new Promise(function (resolve) {
157-
if (!ifInline(_this.options, _this.service))
157+
if (ifInline(_this.options, _this.service))
158158
inlineAsyncEmbed(_this, urlToText).then((output) => resolve([output, _this.embeds]));
159159
else
160160
normalAsyncEmbed(_this, urlToText).then((embeds) => resolve([_this.output, embeds]))
@@ -193,5 +193,5 @@ function normalEmbed(_this){
193193
}
194194

195195
export function embed(_this){
196-
return (!ifInline(_this.options, _this.service)) ? inlineEmbed(_this) : normalEmbed(_this)
196+
return (ifInline(_this.options, _this.service)) ? inlineEmbed(_this) : normalEmbed(_this)
197197
}

src/js/modules/map/map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default class Gmap {
7171
for (var i in promises) {
7272
let [latitude, longitude] = coordinatesArr[i];
7373
let text = Gmap.template((allMatches[i])[0], latitude, longitude, this.options);
74-
if (!ifInline(this.options, this.service)) {
74+
if (ifInline(this.options, this.service)) {
7575
this.output = this.output.replace(this.regex, (regexMatch) => {
7676
return `<span class="ejs-location">${Gmap.locationText(regexMatch)}</span>${text}`
7777
})

src/js/modules/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ export function matches(regex, input) {
9797
* @return {boolean} True if it should be embedded
9898
*/
9999
export function ifEmbed(options, service) {
100-
return ((options.excludeEmbed.indexOf(service) == -1) && (options.excludeEmbed !== 'all'));
100+
return ((options.excludeEmbed.indexOf(service) == -1) || (options.excludeEmbed === 'all'));
101101
}
102102

103103
export function ifInline(options, service) {
104-
return ((options.inlineEmbed.indexOf(service) == -1) && (options.inlineEmbed !== 'all'));
104+
return ((options.inlineEmbed.indexOf(service) == -1) || (options.inlineEmbed !== 'all'));
105105
}
106106

107107
/**

0 commit comments

Comments
 (0)