Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/playground/block_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Entry.BlockView = class BlockView {
}

this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu;
this.mouseHandler = function (e) {
this.mouseHandler = function(e) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ·

Suggested change
this.mouseHandler = function(e) {
this.mouseHandler = function (e) {

(_.result(that.block.events, 'mousedown') || []).forEach((fn) => {
if (Entry.documentMousedown) {
Entry.documentMousedown.notify(e);
Expand Down Expand Up @@ -608,7 +608,7 @@ Entry.BlockView = class BlockView {
const mouseDownCoordinate = this.mouseDownCoordinate;
const diff = Math.sqrt(
Math.pow(mouseEvent.pageX - mouseDownCoordinate.x, 2) +
Math.pow(mouseEvent.pageY - mouseDownCoordinate.y, 2)
Math.pow(mouseEvent.pageY - mouseDownCoordinate.y, 2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ····

Suggested change
Math.pow(mouseEvent.pageY - mouseDownCoordinate.y, 2)
Math.pow(mouseEvent.pageY - mouseDownCoordinate.y, 2)

);
if (this.dragMode == Entry.DRAG_MODE_DRAG || diff > Entry.BlockView.DRAG_RADIUS) {
const blockView = this;
Expand Down Expand Up @@ -1019,9 +1019,8 @@ Entry.BlockView = class BlockView {
magnet = this.magnet.previous;
const dragHeight = dragBlock.getBelowHeight();
const nextX = _get(dragBlock, 'magnet.next.x');
transform = `translate(${pos.scaleX + magnet.x - nextX},${
pos.scaleY + magnet.y - dragHeight
})`;
transform = `translate(${pos.scaleX + magnet.x - nextX},${pos.scaleY + magnet.y - dragHeight
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <max-len> reported by reviewdog 🐶
This line has a length of 108. Maximum allowed is 100.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ⏎····················

Suggested change
transform = `translate(${pos.scaleX + magnet.x - nextX},${pos.scaleY + magnet.y - dragHeight
transform = `translate(${pos.scaleX + magnet.x - nextX},${
pos.scaleY + magnet.y - dragHeight

})`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Delete ····

Suggested change
})`;
})`;

}

const $shadow = $(shadow);
Expand Down Expand Up @@ -1642,7 +1641,7 @@ Entry.BlockView = class BlockView {
halfWidth = 20;
}
return {
getBoundingClientRect: function () {
getBoundingClientRect: function() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ·

Suggested change
getBoundingClientRect: function() {
getBoundingClientRect: function () {

const coord = this.getAbsoluteCoordinate();
const boardOffset = this._board.relativeOffset;
const magnet = this.magnet[selector];
Expand Down Expand Up @@ -1767,7 +1766,7 @@ Entry.BlockView = class BlockView {
canvas.height = height;
const ctx = canvas.getContext('2d');

img.onload = function () {
img.onload = function() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ·

Suggested change
img.onload = function() {
img.onload = function () {

try {
ctx.drawImage(img, 0, 0, width, height);
const data = canvas.toDataURL('image/png');
Expand All @@ -1780,7 +1779,7 @@ Entry.BlockView = class BlockView {
}
};

img.onerror = function () {
img.onerror = function() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ·

Suggested change
img.onerror = function() {
img.onerror = function () {

return reject('error occured');
};
img.src = src;
Expand Down
11 changes: 6 additions & 5 deletions src/playground/blocks/block_expansion_weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ const { getStateOptions, getCityOptions, locationData } = require('../../util/lo
const { callApi } = require('../../util/common');

function resolveData(weatherData, type, dateStr) {
const defaultData = Entry.EXPANSION_BLOCK.weather.defaultData;
try {
let key = Entry.EXPANSION_BLOCK.weather.getDate(dateStr);
if (type === 'now') {
return weatherData[Object.keys(weatherData)[0]];
key = Object.keys(weatherData)[0];
} else if (type === 'hour') {
return weatherData[dateStr];
} else {
return weatherData[Entry.EXPANSION_BLOCK.weather.getDate(dateStr)];
key = dateStr;
}
return weatherData[key] || defaultData;
} catch (e) {
return Entry.EXPANSION_BLOCK.weather.defaultData;
return defaultData;
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/playground/field/textInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ Entry.FieldTextInput = class FieldTextInput extends Entry.Field {

applyValue(value, isNotUpdate) {
let result = value;

if (this.optionWidget) {
switch (this.optionWidget.type) {
case 'angleWidget':
Expand All @@ -289,6 +290,12 @@ Entry.FieldTextInput = class FieldTextInput extends Entry.Field {
this.optionInput.val(result);
}

if (this._block?.data?.type === 'function_field_label') {
const reg = /(%\d)/im;
if (result && reg.test(result)) {
result = result.replace(/%(\d)/gi, '$1');
}
}
this.setValue(result);
this._setTextValue();
this.resize();
Expand Down Expand Up @@ -318,6 +325,11 @@ Entry.FieldTextInput = class FieldTextInput extends Entry.Field {
delete this.optionInput;
}

const reg = /(%\d)/im;
if (this.value && reg.test(this.value)) {
this.applyValue(this.value.replace(/%(\d)/gi, '$1'));
}

super.destroyOption(skipCommand, forceCommand);
}

Expand Down
Loading