Skip to content

Commit

Permalink
updated testData and compiled the code for simple-image support
Browse files Browse the repository at this point in the history
  • Loading branch information
miadabdi committed Dec 24, 2020
1 parent dd5b598 commit ae64009
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
7 changes: 6 additions & 1 deletion build/Parser.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ var edjsParser = function () {
var imgClass = config.image.imgClass || "";
var imageSrc;

if (config.image.path === "absolute") {
if (data.url) {
// simple-image was used and the image probably is not uploaded to this server
// therefore, we use the absolute path provided in data.url
// so, config.image.path property is useless in this case!
imageSrc = data.url;
} else if (config.image.path === "absolute") {
imageSrc = data.file.url;
} else {
imageSrc = config.image.path.replace(/<(.+)>/, function (match, p1) {
Expand Down
7 changes: 6 additions & 1 deletion build/Parser.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ var defaultParsers = {
var imgClass = config.image.imgClass || "";
var imageSrc;

if (config.image.path === "absolute") {
if (data.url) {
// simple-image was used and the image probably is not uploaded to this server
// therefore, we use the absolute path provided in data.url
// so, config.image.path property is useless in this case!
imageSrc = data.url;
} else if (config.image.path === "absolute") {
imageSrc = data.file.url;
} else {
imageSrc = config.image.path.replace(/<(.+)>/, function (match, p1) {
Expand Down
8 changes: 7 additions & 1 deletion build/Parser.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ var defaultParsers = {
} ${data.withBackground ? "img-bg" : ""}`;
const imgClass = config.image.imgClass || "";
let imageSrc;
if (config.image.path === "absolute") {

if (data.url) {
// simple-image was used and the image probably is not uploaded to this server
// therefore, we use the absolute path provided in data.url
// so, config.image.path property is useless in this case!
imageSrc = data.url;
} else if (config.image.path === "absolute") {
imageSrc = data.file.url;
} else {
imageSrc = config.image.path.replace(
Expand Down
10 changes: 10 additions & 0 deletions test/testData.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"time": 1601898039654,
"blocks": [{
"type": "image",
"data": {
"url": "https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg",
"caption": "Roadster // tesla.com",
"withBorder": false,
"withBackground": false,
"stretched": true
}
},
{
"type": "paragraph",
"data": {
"text": "Hello There, it is a test post related to <a href=\"https://google.com\">Google</a> which is the <b>biggest</b> search engine!"
Expand Down

0 comments on commit ae64009

Please sign in to comment.