@@ -278,7 +278,7 @@ const PreviewObject = observer(class PreviewObject extends React.Component
+ return
;
})}
) : ''}
diff --git a/src/ts/component/selection/provider.tsx b/src/ts/component/selection/provider.tsx
index f41a31db97..95b3132649 100644
--- a/src/ts/component/selection/provider.tsx
+++ b/src/ts/component/selection/provider.tsx
@@ -158,10 +158,10 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
});
if (keyboard.isShift()) {
- let target = $(e.target).closest('.selectable');
- let type = target.attr('data-type') as I.SelectType;
- let id = target.attr('data-id');
- let ids = this.get(type);
+ const target = $(e.target).closest('.selectable');
+ const type = target.attr('data-type') as I.SelectType;
+ const id = target.attr('data-id');
+ const ids = this.get(type);
if (!ids.length && (id != focused)) {
this.set(type, ids.concat([ focused ]));
@@ -242,7 +242,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
} else {
let needCheck = false;
if (keyboard.isCtrlOrMeta()) {
- for (let i in I.SelectType) {
+ for (const i in I.SelectType) {
const idsOnStart = this.idsOnStart.get(I.SelectType[i]) || [];
needCheck = needCheck || Boolean(idsOnStart.length);
};
@@ -285,7 +285,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
};
initIds () {
- for (let i in I.SelectType) {
+ for (const i in I.SelectType) {
this.ids.set(I.SelectType[i], []);
};
};
@@ -385,7 +385,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
checkNodes (e: any) {
if (!this._isMounted) {
- return
+ return;
};
const { focused, range } = focus.state;
@@ -476,7 +476,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
if (withChildren) {
ids.forEach(id => this.getChildrenIds(id, ids));
} else {
- let childrenIds = [];
+ const childrenIds = [];
ids.forEach(id => this.getChildrenIds(id, childrenIds));
ids = ids.filter(it => !childrenIds.includes(it));
};
@@ -486,7 +486,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
};
checkSelected (type: I.SelectType) {
- let ids = this.get(type, true);
+ const ids = this.get(type, true);
if (!ids.length) {
return;
};
@@ -508,7 +508,7 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
return;
};
- for (let childId of childrenIds) {
+ for (const childId of childrenIds) {
ids.push(childId);
this.getChildrenIds(childId, ids);
};
@@ -527,11 +527,11 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
$('.isSelectionSelected').removeClass('isSelectionSelected');
- for (let i in I.SelectType) {
+ for (const i in I.SelectType) {
const type = I.SelectType[i];
const ids = this.get(type, true);
- for (let id of ids) {
+ for (const id of ids) {
$(`#selectable-${id}`).addClass('isSelectionSelected');
if (type == I.SelectType.Block) {
@@ -567,9 +567,9 @@ const SelectionProvider = observer(class SelectionProvider extends React.Compone
return;
};
- let props = child.props || {};
- let children = props.children;
- let dataset = props.dataset || {};
+ const props = child.props || {};
+ const children = props.children;
+ const dataset = props.dataset || {};
if (children) {
child = React.cloneElement(child, { children: this.injectProps(children) });
diff --git a/src/ts/component/util/graph.tsx b/src/ts/component/util/graph.tsx
index 40cc3528ae..c9da646bb8 100644
--- a/src/ts/component/util/graph.tsx
+++ b/src/ts/component/util/graph.tsx
@@ -129,13 +129,13 @@ const Graph = observer(class Graph extends React.Component
{
}, [ transfer ]);
d3.select(this.canvas)
- .call(d3.drag().
+ .call(d3.drag().
subject(() => this.subject).
on('start', (e: any, d: any) => this.onDragStart(e)).
on('drag', (e: any, d: any) => this.onDragMove(e)).
on('end', (e: any, d: any) => this.onDragEnd(e))
)
- .call(this.zoom)
+ .call(this.zoom)
.call(this.zoom.transform, d3.zoomIdentity.translate(0, 0).scale(1.5))
.on('click', (e: any) => {
const [ x, y ] = d3.pointer(e);
@@ -246,7 +246,7 @@ const Graph = observer(class Graph extends React.Component {
onZoom ({ transform }) {
this.send('onZoom', { transform });
- };
+ };
onPreviewShow (data: any) {
if (this.isPreviewDisabled || !this.subject) {
@@ -351,8 +351,8 @@ const Graph = observer(class Graph extends React.Component {
case 'onTransform': {
d3.select(this.canvas)
- .call(this.zoom)
- .call(this.zoom.transform, d3.zoomIdentity.translate(data.x, data.y).scale(data.k))
+ .call(this.zoom)
+ .call(this.zoom.transform, d3.zoomIdentity.translate(data.x, data.y).scale(data.k));
break;
};
diff --git a/src/ts/component/util/iconEmoji.tsx b/src/ts/component/util/iconEmoji.tsx
index 4436b4760f..b682dcce2f 100644
--- a/src/ts/component/util/iconEmoji.tsx
+++ b/src/ts/component/util/iconEmoji.tsx
@@ -75,10 +75,10 @@ const IconEmoji = observer(class IconEmoji extends React.Component {
};
} else
if (hash) {
- element =
{ e.preventDefault(); }} />;
+ element =
{ e.preventDefault(); }} />;
} else
if (iconClass) {
- element =
+ element =
;
};
if (!element) {
diff --git a/src/ts/component/util/iconObject.tsx b/src/ts/component/util/iconObject.tsx
index 43328cf271..11cacb467e 100644
--- a/src/ts/component/util/iconObject.tsx
+++ b/src/ts/component/util/iconObject.tsx
@@ -195,7 +195,7 @@ const IconObject = observer(class IconObject extends React.Component {
let icon = null;
let icn = [];
- let onLetter = () => {
+ const onLetter = () => {
cn.push('withLetter');
icn = icn.concat([ 'iconCommon', 'c' + iconSize ]);
icon =
;
diff --git a/src/ts/component/util/marker.tsx b/src/ts/component/util/marker.tsx
index 08b5ac6ff0..249c34b166 100644
--- a/src/ts/component/util/marker.tsx
+++ b/src/ts/component/util/marker.tsx
@@ -69,11 +69,11 @@ const Marker = observer(class Marker extends React.Component {
switch (type) {
case I.TextStyle.Bulleted:
- inner =
e.preventDefault()} />
+ inner =
e.preventDefault()} />;
break;
case I.TextStyle.Numbered:
- inner =
+ inner = ;
break;
case I.TextStyle.Checkbox:
diff --git a/src/ts/component/widget/index.tsx b/src/ts/component/widget/index.tsx
index e650396d50..5af0e550dc 100644
--- a/src/ts/component/widget/index.tsx
+++ b/src/ts/component/widget/index.tsx
@@ -332,7 +332,12 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component {
getData (subId: string, callBack?: () => void) {
const { block, isPreview } = this.props;
const child = this.getTargetBlock();
- const { targetBlockId } = child?.content;
+
+ if (!child) {
+ return;
+ };
+
+ const { targetBlockId } = child.content;
const sorts = [];
const filters: I.Filter[] = [
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotIn, value: UtilObject.getSystemTypes() },
@@ -420,7 +425,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component {
let blockId = '';
let event = 'ScreenHome';
- let data: any = { view: 'Widget' };
+ const data: any = { view: 'Widget' };
if (!isPreview) {
blockId = block.id;
diff --git a/src/ts/component/widget/list/item.tsx b/src/ts/component/widget/list/item.tsx
index 6d0c5d9fde..e382f2ed1f 100644
--- a/src/ts/component/widget/list/item.tsx
+++ b/src/ts/component/widget/list/item.tsx
@@ -125,7 +125,7 @@ const WidgetListItem = observer(class WidgetListItem extends React.Component {
const blocks = blockStore.getBlocks(rootId, it => it.isDataview());
- for (let block of blocks) {
+ for (const block of blocks) {
this.dbClearBlock(rootId, block.id);
};
@@ -127,7 +127,7 @@ class Action {
};
remove (rootId: string, blockId: string, blockIds: string[]) {
- let next = blockStore.getNextBlock(rootId, blockId, -1, (it: any) => {
+ const next = blockStore.getNextBlock(rootId, blockId, -1, (it: any) => {
return it.type == I.BlockType.Text;
});
@@ -246,7 +246,7 @@ class Action {
callBack(message);
};
- let { details } = message;
+ const { details } = message;
let toast = '';
let subId = '';
diff --git a/src/ts/lib/analytics.ts b/src/ts/lib/analytics.ts
index dbb5d4705b..08006aa6c4 100644
--- a/src/ts/lib/analytics.ts
+++ b/src/ts/lib/analytics.ts
@@ -106,7 +106,7 @@ class Analytics {
return;
};
- let converted: any = {};
+ const converted: any = {};
let param: any = {};
// Code mappers for common events
@@ -330,7 +330,7 @@ class Analytics {
param.context = String(Storage.get(KEY_CONTEXT) || '');
param.originalId = String(Storage.get(KEY_ORIGINAL_ID) || '');
- for (let k of KEYS) {
+ for (const k of KEYS) {
if (undefined !== data[k]) {
converted[k] = data[k];
};
diff --git a/src/ts/lib/api/command.ts b/src/ts/lib/api/command.ts
index e0335c45ad..e2fcb77cf1 100644
--- a/src/ts/lib/api/command.ts
+++ b/src/ts/lib/api/command.ts
@@ -1469,7 +1469,7 @@ const ObjectSetLayout = (contextId: string, layout: I.ObjectLayout, callBack?: (
dispatcher.request(ObjectSetLayout.name, request, callBack);
};
-const ObjectSetIsFavorite = (contextId: string, isFavorite: boolean, callBack?: (message: any) => void) => {
+const ObjectSetIsFavorite = (contextId: string, isFavorite: boolean, callBack?: (message: any) => void) => {
const request = new Rpc.Object.SetIsFavorite.Request();
request.setContextid(contextId);
diff --git a/src/ts/lib/api/dispatcher.ts b/src/ts/lib/api/dispatcher.ts
index 653e403e90..7e0319ad0d 100644
--- a/src/ts/lib/api/dispatcher.ts
+++ b/src/ts/lib/api/dispatcher.ts
@@ -962,7 +962,7 @@ class Dispatcher {
let title = '';
let text = '';
let textConfirm = '';
- let showPopup = [ I.ProgressType.Import, I.ProgressType.Export ].includes(type) && [ I.ProgressState.Done, I.ProgressState.Error ].includes(state);
+ const showPopup = [ I.ProgressType.Import, I.ProgressType.Export ].includes(type) && [ I.ProgressState.Done, I.ProgressState.Error ].includes(state);
switch (state) {
case I.ProgressState.Error: {
diff --git a/src/ts/lib/api/mapper.ts b/src/ts/lib/api/mapper.ts
index 6df928d737..d4bb951601 100644
--- a/src/ts/lib/api/mapper.ts
+++ b/src/ts/lib/api/mapper.ts
@@ -1,6 +1,6 @@
import { Rpc } from 'protobuf/pb/protos/commands_pb';
import Model from 'protobuf/pkg/lib/pb/model/protos/models_pb';
-import { I, M, UtilCommon, Encode, Decode } from 'Lib';
+import { I, M, UtilCommon, Encode, Decode } from 'Lib';
export const Mapper = {
diff --git a/src/ts/lib/history.ts b/src/ts/lib/history.ts
index 3b97951fe7..3a1f526015 100644
--- a/src/ts/lib/history.ts
+++ b/src/ts/lib/history.ts
@@ -4,7 +4,7 @@ class History {
index = 0;
clear () {
- this.list = []
+ this.list = [];
this.index = 0;
};
diff --git a/src/ts/lib/keyboard.ts b/src/ts/lib/keyboard.ts
index ea41e951ab..b1b7f7b797 100644
--- a/src/ts/lib/keyboard.ts
+++ b/src/ts/lib/keyboard.ts
@@ -292,10 +292,10 @@ class Keyboard {
return;
};
- let targetId = '';
- let position = I.BlockPosition.Bottom;
- let rootId = '';
- let details: any = {};
+ const targetId = '';
+ const position = I.BlockPosition.Bottom;
+ const rootId = '';
+ const details: any = {};
let flags: I.ObjectFlag[] = [ I.ObjectFlag.SelectType ];
if (!rootId) {
@@ -402,7 +402,7 @@ class Keyboard {
};
if (!isPopup) {
- let prev = history.entries[history.index - 1];
+ const prev = history.entries[history.index - 1];
if (account && !prev) {
return false;
diff --git a/src/ts/lib/mark.ts b/src/ts/lib/mark.ts
index ce7ad8f020..69681d5116 100644
--- a/src/ts/lib/mark.ts
+++ b/src/ts/lib/mark.ts
@@ -78,7 +78,7 @@ class Mark {
{ key: '~~', type: I.MarkType.Strike },
];
- for (let item of Markdown) {
+ for (const item of Markdown) {
const non = UtilCommon.regexEscape(item.key.substring(0, 1));
const k = UtilCommon.regexEscape(item.key);
this.regexpMarkdown.push({
@@ -93,8 +93,8 @@ class Mark {
return marks;
};
- let map = UtilCommon.mapToArray(marks, 'type');
- let type = mark.type;
+ const map = UtilCommon.mapToArray(marks, 'type');
+ const type = mark.type;
let add = true;
map[type] = map[type] || [];
@@ -102,8 +102,8 @@ class Mark {
for (let i = 0; i < map[type].length; ++i) {
let del = false;
- let el = map[type][i];
- let overlap = this.overlap(mark.range, el.range);
+ const el = map[type][i];
+ const overlap = this.overlap(mark.range, el.range);
switch (overlap) {
case Overlap.Equal:
@@ -198,8 +198,8 @@ class Mark {
marks = (marks || []).slice().sort(this.sort);
for (let i = 0; i < marks.length; ++i) {
- let mark = marks[i];
- let prev = marks[(i - 1)];
+ const mark = marks[i];
+ const prev = marks[(i - 1)];
let del = false;
if (mark.range.from >= text.length) {
@@ -237,7 +237,7 @@ class Mark {
};
if (mark.range.from > mark.range.to) {
- let t = mark.range.to;
+ const t = mark.range.to;
mark.range.to = mark.range.from;
mark.range.from = t;
};
@@ -247,13 +247,13 @@ class Mark {
};
getInRange (marks: I.Mark[], type: I.MarkType, range: I.TextRange): any {
- let map = UtilCommon.mapToArray(marks, 'type');
+ const map = UtilCommon.mapToArray(marks, 'type');
if (!map[type] || !map[type].length) {
return null;
};
- for (let mark of map[type]) {
- let overlap = this.overlap(range, mark.range);
+ for (const mark of map[type]) {
+ const overlap = this.overlap(range, mark.range);
if ([ Overlap.Inner, Overlap.InnerLeft, Overlap.InnerRight, Overlap.Equal ].indexOf(overlap) >= 0) {
return mark;
};
@@ -264,7 +264,7 @@ class Mark {
adjust (marks: I.Mark[], from: number, length: number) {
marks = marks || [];
- for (let mark of marks) {
+ for (const mark of marks) {
if ((mark.range.from <= from) && (mark.range.to > from)) {
mark.range.to += length;
} else
@@ -281,11 +281,11 @@ class Mark {
text = String(text || '');
marks = this.checkRanges(text, marks || []);
- let r = text.split('');
- let parts: I.Mark[] = [];
+ const r = text.split('');
+ const parts: I.Mark[] = [];
let borders: any[] = [];
- let ranges: any[] = [];
- let hasParam = [
+ const ranges: any[] = [];
+ const hasParam = [
I.MarkType.Link,
I.MarkType.Object,
I.MarkType.Color,
@@ -294,7 +294,7 @@ class Mark {
I.MarkType.Emoji,
];
- for (let mark of marks) {
+ for (const mark of marks) {
borders.push(Number(mark.range.from));
borders.push(Number(mark.range.to));
};
@@ -313,8 +313,8 @@ class Mark {
ranges.push({ from: borders[i], to: borders[i + 1] });
};
- for (let range of ranges) {
- for (let mark of marks) {
+ for (const range of ranges) {
+ for (const mark of marks) {
if ((mark.range.from <= range.from) && (mark.range.to >= range.to)) {
parts.push({
type: mark.type,
@@ -358,14 +358,14 @@ class Mark {
};
// Render mentions
- for (let mark of marks) {
+ for (const mark of marks) {
if (mark.type == I.MarkType.Mention) {
render(mark);
};
};
// Render everything except mentions
- for (let mark of parts) {
+ for (const mark of parts) {
if (mark.type != I.MarkType.Mention) {
render(mark);
};
@@ -384,7 +384,7 @@ class Mark {
html = html.replace(/
/g, '\n');
// Remove inner tags from mentions and emoji
- let obj = $(`${html}
`);
+ const obj = $(`${html}
`);
obj.find('mention').removeAttr('class').each((i: number, item: any) => {
item = $(item);
@@ -418,7 +418,7 @@ class Mark {
html = html.replace(/contenteditable="[^"]+"/g, '');
let text = html;
- let marks: any[] = [];
+ const marks: any[] = [];
// TODO: find classes by color or background
html.replace(/]*?)>([^<]*)<\/font>/g, (s: string, p1: string, p2: string) => {
@@ -455,21 +455,21 @@ class Mark {
p2 = String(p2 || '').trim();
p3 = String(p3 || '').trim();
- let end = p1 == '/';
- let offset = Number(text.indexOf(s)) || 0;
- let type = Tags.indexOf(p2);
+ const end = p1 == '/';
+ const offset = Number(text.indexOf(s)) || 0;
+ const type = Tags.indexOf(p2);
if (end) {
for (let i = 0; i < marks.length; ++i) {
- let m = marks[i];
+ const m = marks[i];
if ((m.type == type) && !m.range.to) {
marks[i].range.to = offset;
break;
};
};
} else {
- let pm = p3.match(rp);
- let param = pm ? pm[1]: '';
+ const pm = p3.match(rp);
+ const param = pm ? pm[1]: '';
marks.push({
type,
@@ -488,8 +488,8 @@ class Mark {
fromMarkdown (html: string, marks: I.Mark[], restricted: I.MarkType[]): { marks: I.Mark[], text: string, marksChanged: boolean } {
let text = html;
- let test = /[`\*_~\[]{1}/.test(text);
- let checked = marks.filter(it => [ I.MarkType.Code ].includes(it.type));
+ const test = /[`\*_~\[]{1}/.test(text);
+ const checked = marks.filter(it => [ I.MarkType.Code ].includes(it.type));
let marksChanged = false;
if (!test) {
@@ -497,7 +497,7 @@ class Mark {
};
// Markdown
- for (let item of this.regexpMarkdown) {
+ for (const item of this.regexpMarkdown) {
if (restricted.includes(item.type)) {
continue;
};
@@ -510,9 +510,9 @@ class Mark {
p4 = String(p4 || '');
p5 = String(p5 || '');
- let from = (Number(text.indexOf(s)) || 0) + p1.length;
- let to = from + p3.length;
- let replace = (p1 + p3 + ' ').replace(new RegExp('\\$', 'g'), '$$$');
+ const from = (Number(text.indexOf(s)) || 0) + p1.length;
+ const to = from + p3.length;
+ const replace = (p1 + p3 + ' ').replace(new RegExp('\\$', 'g'), '$$$');
let check = true;
for (const mark of checked) {
@@ -539,13 +539,13 @@ class Mark {
p2 = String(p2 || '');
p3 = String(p3 || '');
- let from = (Number(text.indexOf(s)) || 0);
- let to = from + p1.length;
- let innerIdx = [];
+ const from = (Number(text.indexOf(s)) || 0);
+ const to = from + p1.length;
+ const innerIdx = [];
// Remove inner links and adjust other marks to new range
for (let i = 0; i < marks.length; ++i) {
- let mark = marks[i];
+ const mark = marks[i];
if ((mark.range.from >= from) && (mark.range.to <= from + p1.length + p2.length + 4)) {
if ([ I.MarkType.Link, I.MarkType.Object ].includes(mark.type)) {
marks.splice(i, 1);
@@ -558,7 +558,7 @@ class Mark {
this.adjust(marks, from, -(p2.length + 4));
- for (let i of innerIdx) {
+ for (const i of innerIdx) {
marks[i].range.from = from;
marks[i].range.to = to;
};
@@ -576,11 +576,11 @@ class Mark {
// Unicode symbols
fromUnicode (html: string, marks: I.Mark[]): string {
- let checked = marks.filter(it => [ I.MarkType.Code, I.MarkType.Link ].includes(it.type));
+ const checked = marks.filter(it => [ I.MarkType.Code, I.MarkType.Link ].includes(it.type));
let text = html;
- let keys = Object.keys(Patterns).map(it => UtilCommon.regexEscape(it));
- let reg = new RegExp('(' + keys.join('|') + ')', 'g');
- let test = reg.test(text);
+ const keys = Object.keys(Patterns).map(it => UtilCommon.regexEscape(it));
+ const reg = new RegExp('(' + keys.join('|') + ')', 'g');
+ const test = reg.test(text);
if (!test) {
return text;
@@ -635,7 +635,7 @@ class Mark {
toggleLink (newMark: I.Mark, marks: I.Mark[]) {
for (let i = 0; i < marks.length; ++i) {
- let mark = marks[i];
+ const mark = marks[i];
if ([ I.MarkType.Link, I.MarkType.Object ].includes(mark.type) &&
(mark.range.from >= newMark.range.from) &&
(mark.range.to <= newMark.range.to)
diff --git a/src/ts/lib/scrollOnMove.ts b/src/ts/lib/scrollOnMove.ts
index 2168b12834..608c51ac12 100644
--- a/src/ts/lib/scrollOnMove.ts
+++ b/src/ts/lib/scrollOnMove.ts
@@ -58,14 +58,14 @@ class ScrollOnMove {
};
adjustWindowScroll (param: any) {
- let {
+ const {
viewportX, viewportY,
isInLeftEdge, isInRightEdge, isInTopEdge, isInBottomEdge,
edgeLeft, edgeRight, edgeTop, edgeBottom,
} = param;
- let maxScrollX = this.documentWidth - this.viewportWidth;
- let maxScrollY = this.documentHeight - this.viewportHeight;
+ const maxScrollX = this.documentWidth - this.viewportWidth;
+ const maxScrollY = this.documentHeight - this.viewportHeight;
let currentScrollX = 0;
let currentScrollY = 0;
let container;
@@ -81,13 +81,13 @@ class ScrollOnMove {
currentScrollY = window.pageYOffset;
};
- let canScrollUp = (currentScrollY > 0);
- let canScrollDown = (currentScrollY < maxScrollY);
- let canScrollLeft = (currentScrollX > 0);
- let canScrollRight = (currentScrollX < maxScrollX);
+ const canScrollUp = (currentScrollY > 0);
+ const canScrollDown = (currentScrollY < maxScrollY);
+ const canScrollLeft = (currentScrollX > 0);
+ const canScrollRight = (currentScrollX < maxScrollX);
let nextScrollX = currentScrollX;
let nextScrollY = currentScrollY;
- let maxStep = 10;
+ const maxStep = 10;
let intensity = 0;
if (isInLeftEdge && canScrollLeft) {
@@ -128,15 +128,15 @@ class ScrollOnMove {
};
onMouseMove (x: number, y: number) {
- let edgeTop = BORDER;
- let edgeLeft = BORDER;
- let edgeBottom = this.viewportHeight - BORDER;
- let edgeRight = this.viewportWidth - BORDER;
+ const edgeTop = BORDER;
+ const edgeLeft = BORDER;
+ const edgeBottom = this.viewportHeight - BORDER;
+ const edgeRight = this.viewportWidth - BORDER;
- let isInLeftEdge = x < edgeLeft;
- let isInRightEdge = x > edgeRight;
- let isInTopEdge = y < edgeTop;
- let isInBottomEdge = y > edgeBottom;
+ const isInLeftEdge = x < edgeLeft;
+ const isInRightEdge = x > edgeRight;
+ const isInTopEdge = y < edgeTop;
+ const isInBottomEdge = y > edgeBottom;
if (!(isInLeftEdge || isInRightEdge || isInTopEdge || isInBottomEdge)) {
this.clear();
diff --git a/src/ts/lib/storage.ts b/src/ts/lib/storage.ts
index 989cce962c..03c5d1305a 100644
--- a/src/ts/lib/storage.ts
+++ b/src/ts/lib/storage.ts
@@ -27,7 +27,7 @@ class Storage {
};
get (key: string): any {
- let o = String(this.storage[key] || '');
+ const o = String(this.storage[key] || '');
if (this.isSpaceKey(key)) {
if (o) {
@@ -53,7 +53,7 @@ class Storage {
let o = this.get(key);
if (typeof o === 'object') {
- for (let i in obj) {
+ for (const i in obj) {
o[i] = obj[i];
};
} else {
diff --git a/src/ts/lib/survey.ts b/src/ts/lib/survey.ts
index 130c77d58f..9f7dcd17d4 100644
--- a/src/ts/lib/survey.ts
+++ b/src/ts/lib/survey.ts
@@ -4,16 +4,16 @@ import Surveys from 'json/survey.json';
class Survey {
- check (type: I.SurveyType) {
+ check (type: I.SurveyType) {
const fn = `check${I.SurveyType[type]}`;
if (this[fn]) {
this[fn]();
};
- };
+ };
- show (type: I.SurveyType) {
- const prefix = `survey${type}`;
+ show (type: I.SurveyType) {
+ const prefix = `survey${type}`;
popupStore.open('confirm', {
data: {
@@ -29,49 +29,49 @@ class Survey {
});
analytics.event('SurveyShow', { type });
- };
+ };
- onConfirm (type: I.SurveyType) {
- const { account } = authStore;
- const survey = Surveys[type];
+ onConfirm (type: I.SurveyType) {
+ const { account } = authStore;
+ const survey = Surveys[type];
const param: any = {};
param[type] = param[type] || {};
- switch (type) {
+ switch (type) {
default:
param[type].complete = true;
break;
- case I.SurveyType.Pmf:
- param[type].time = UtilCommon.time();
- break;
- };
+ case I.SurveyType.Pmf:
+ param[type].time = UtilCommon.time();
+ break;
+ };
Storage.set('survey', param);
Renderer.send('urlOpen', UtilCommon.sprintf(survey.url, account.id));
- analytics.event('SurveyOpen', { type });
- };
+ analytics.event('SurveyOpen', { type });
+ };
- onSkip (type: I.SurveyType) {
+ onSkip (type: I.SurveyType) {
const param: any = {};
param[type] = param[type] || {};
- switch (type) {
+ switch (type) {
default:
param[type].complete = true;
break;
- case I.SurveyType.Pmf:
- param[type].cancel = true;
- param[type].time = UtilCommon.time();
- break;
- };
+ case I.SurveyType.Pmf:
+ param[type].cancel = true;
+ param[type].time = UtilCommon.time();
+ break;
+ };
Storage.set('survey', param);
analytics.event('SurveySkip', { type });
- };
+ };
getStorage (type: I.SurveyType) {
const obj = Storage.get('survey') || {};
@@ -82,14 +82,14 @@ class Survey {
return this.getStorage(type).complete;
};
- checkPmf () {
+ checkPmf () {
const time = UtilCommon.time();
const timeRegister = Number(Storage.get('timeRegister')) || 0;
const storage = Storage.get('survey') || {};
- const obj = storage[I.SurveyType.Pmf] || {};
- const lastTime = Number(Storage.get('lastSurveyTime')) || Number(obj.time) || 0;
- const lastCanceled = Number(Storage.get('lastSurveyCanceled')) || obj.cancel || false;
- const surveyTime = (timeRegister <= time - 86400 * 7) && (lastTime <= time - 86400 * 30);
+ const obj = storage[I.SurveyType.Pmf] || {};
+ const lastTime = Number(Storage.get('lastSurveyTime')) || Number(obj.time) || 0;
+ const lastCanceled = Number(Storage.get('lastSurveyCanceled')) || obj.cancel || false;
+ const surveyTime = (timeRegister <= time - 86400 * 7) && (lastTime <= time - 86400 * 30);
const randSeed = 10000000;
const rand = UtilCommon.rand(0, randSeed);
@@ -99,50 +99,50 @@ class Survey {
return;
};
- if (!popupStore.isOpen() && !lastCanceled && surveyTime) {
- this.show(I.SurveyType.Pmf);
- };
- };
+ if (!popupStore.isOpen() && !lastCanceled && surveyTime) {
+ this.show(I.SurveyType.Pmf);
+ };
+ };
- checkRegister () {
- const timeRegister = Number(Storage.get('timeRegister')) || 0;
+ checkRegister () {
+ const timeRegister = Number(Storage.get('timeRegister')) || 0;
const isComplete = this.isComplete(I.SurveyType.Register);
- const surveyTime = timeRegister && ((UtilCommon.time() - 86400 * 7 - timeRegister) > 0);
+ const surveyTime = timeRegister && ((UtilCommon.time() - 86400 * 7 - timeRegister) > 0);
- if (!isComplete && surveyTime && !popupStore.isOpen()) {
- this.show(I.SurveyType.Register);
- };
- };
+ if (!isComplete && surveyTime && !popupStore.isOpen()) {
+ this.show(I.SurveyType.Register);
+ };
+ };
- checkDelete () {
- const isComplete = this.isComplete(I.SurveyType.Delete);
+ checkDelete () {
+ const isComplete = this.isComplete(I.SurveyType.Delete);
- if (!isComplete) {
- this.show(I.SurveyType.Delete);
- };
- };
+ if (!isComplete) {
+ this.show(I.SurveyType.Delete);
+ };
+ };
- checkObject () {
- const timeRegister = Number(Storage.get('timeRegister')) || 0;
+ checkObject () {
+ const timeRegister = Number(Storage.get('timeRegister')) || 0;
const isComplete = this.isComplete(I.SurveyType.Object);
- if (isComplete || !timeRegister) {
- return;
- };
+ if (isComplete || !timeRegister) {
+ return;
+ };
UtilData.search({
filters: [
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.In, value: UtilObject.getPageLayouts() },
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotIn, value: UtilObject.getSystemTypes() },
- { operator: I.FilterOperator.And, relationKey: 'createdDate', condition: I.FilterCondition.Greater, value: timeRegister + 30 }
+ { operator: I.FilterOperator.And, relationKey: 'createdDate', condition: I.FilterCondition.Greater, value: timeRegister + 30 }
],
limit: 50,
}, (message: any) => {
- if (!message.error.code && (message.records.length >= 50)) {
- this.show(I.SurveyType.Object);
- };
- });
- };
+ if (!message.error.code && (message.records.length >= 50)) {
+ this.show(I.SurveyType.Object);
+ };
+ });
+ };
}
diff --git a/src/ts/lib/util/common.ts b/src/ts/lib/util/common.ts
index 5bc8889008..5e144dd6cd 100644
--- a/src/ts/lib/util/common.ts
+++ b/src/ts/lib/util/common.ts
@@ -14,15 +14,19 @@ class UtilCommon {
};
sprintf (...args: any[]) {
- let regex = /%%|%(\d+\$)?([-+#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;
- let a = args, i = 0, format = a[i++];
- let pad = function (str, len, chr, leftJustify) {
- let padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr);
+ const regex = /%%|%(\d+\$)?([-+#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;
+ const a = args;
+
+ let i = 0;
+
+ const format = a[i++];
+ const pad = function (str, len, chr, leftJustify) {
+ const padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr);
return leftJustify ? str + padding : padding + str;
};
- let justify = function (value, prefix, leftJustify, minWidth, zeroPad) {
- let diff = minWidth - value.length;
+ const justify = function (value, prefix, leftJustify, minWidth, zeroPad) {
+ const diff = minWidth - value.length;
if (diff > 0) {
if (leftJustify || !zeroPad) {
value = pad(value, minWidth, ' ', leftJustify);
@@ -33,21 +37,21 @@ class UtilCommon {
return value;
};
- let formatBaseX = function (value, base, prefix, leftJustify, minWidth, precision, zeroPad) {
- let number = value >>> 0;
+ const formatBaseX = function (value, base, prefix, leftJustify, minWidth, precision, zeroPad) {
+ const number = value >>> 0;
prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] || '';
value = prefix + pad(number.toString(base), precision || 0, '0', false);
return justify(value, prefix, leftJustify, minWidth, zeroPad);
};
- let formatString = function (value, leftJustify, minWidth, precision, zeroPad) {
+ const formatString = function (value, leftJustify, minWidth, precision, zeroPad) {
if (precision != null) {
value = value.slice(0, precision);
};
return justify(value, '', leftJustify, minWidth, zeroPad);
};
- let doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) {
+ const doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) {
if (substring == '%%') return '%';
let leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false;
for (let j = 0; flags && j < flags.length; j++) switch (flags.charAt(j)) {
@@ -103,7 +107,7 @@ class UtilCommon {
case 'd': {
let number = +value;
number = parseInt(String(number));
- let prefix = number < 0 ? '-' : positivePrefix;
+ const prefix = number < 0 ? '-' : positivePrefix;
value = prefix + pad(String(Math.abs(number)), precision, '0', false);
return justify(value, prefix, leftJustify, minWidth, zeroPad);
};
@@ -113,10 +117,10 @@ class UtilCommon {
case 'F':
case 'g':
case 'G': {
- let number = +value;
- let prefix = number < 0 ? '-' : positivePrefix;
- let method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
- let textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
+ const number = +value;
+ const prefix = number < 0 ? '-' : positivePrefix;
+ const method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
+ const textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
value = prefix + Math.abs(number)[method](precision);
return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform]();
@@ -170,7 +174,7 @@ class UtilCommon {
// Clear object for smaller console output
objectClear (o: any) {
- for (let k in o) {
+ for (const k in o) {
if (typeof o[k] === 'object') {
o[k] = this.objectClear(o[k]);
if (!this.objectLength(o[k])) {
@@ -188,13 +192,13 @@ class UtilCommon {
};
fieldsMap (a: any[]) {
- let o = {};
+ const o = {};
for (let i = 0; i < a.length; ++i) {
if ((a[i].constructor === Array) && (a[i].length == 2)) {
- let value = a[i][1];
+ const value = a[i][1];
let v = '';
- for (let k in value) {
+ for (const k in value) {
if (value[k]) {
v = value[k];
break;
@@ -211,11 +215,11 @@ class UtilCommon {
o1 = o1 || {};
o2 = o2 || {};
- let k1 = Object.keys(o1);
- let k2 = Object.keys(o2);
- let v1 = Object.values(o1);
- let v2 = Object.values(o2);
- let sort = (c1: any, c2: any) => {
+ const k1 = Object.keys(o1);
+ const k2 = Object.keys(o2);
+ const v1 = Object.values(o1);
+ const v2 = Object.values(o2);
+ const sort = (c1: any, c2: any) => {
if (c1 > c2) return 1;
if (c1 < c2) return -1;
return 0;
@@ -303,7 +307,7 @@ class UtilCommon {
cacheImages (images: string[], callBack?: () => void) {
let loaded = 0;
- let cb = () => {
+ const cb = () => {
loaded++;
if ((loaded == images.length) && callBack) {
callBack();
@@ -356,7 +360,7 @@ class UtilCommon {
};
parseDate (value: string, format?: I.DateFormat): number {
- let [ date, time ] = String(value || '').split(' ');
+ const [ date, time ] = String(value || '').split(' ');
let d: any = 0;
let m: any = 0;
let y: any = 0;
@@ -401,7 +405,7 @@ class UtilCommon {
let s = String(n);
if ((s = s + '').length < c ) {
++c;
- let m = c - s.length;
+ const m = c - s.length;
return new Array(m).join('0') + s;
} else {
return s;
@@ -411,10 +415,10 @@ class UtilCommon {
const f: any = {
// Day
d: () => {
- return pad(f.j(), 2);
+ return pad(f.j(), 2);
},
D: () => {
- let t = f.l();
+ const t = f.l();
return t.substring(0,3);
},
j: () => {
@@ -506,16 +510,16 @@ class UtilCommon {
};
let delta = this.time() - t;
- let d = Math.floor(delta / 86400);
+ const d = Math.floor(delta / 86400);
delta -= d * 86400;
- let h = Math.floor(delta / 3600);
+ const h = Math.floor(delta / 3600);
delta -= h * 3600;
- let m = Math.floor(delta / 60);
+ const m = Math.floor(delta / 60);
delta -= m * 60;
- let s = delta;
+ const s = delta;
if (d > 0) {
return this.sprintf('%d days ago', d);
@@ -550,16 +554,16 @@ class UtilCommon {
return '';
};
- let d = Math.floor(t / 86400);
+ const d = Math.floor(t / 86400);
t -= d * 86400;
- let h = Math.floor(t / 3600);
+ const h = Math.floor(t / 3600);
t -= h * 3600;
- let m = Math.floor(t / 60);
+ const m = Math.floor(t / 60);
t -= m * 60;
- let s = t;
+ const s = t;
if (d > 0) {
return this.sprintf('%dd', d);
@@ -577,7 +581,7 @@ class UtilCommon {
};
round (v: number, l: number) {
- let d = Math.pow(10, l);
+ const d = Math.pow(10, l);
return d > 0 ? Math.round(v * d) / d : Math.round(v);
};
@@ -621,8 +625,8 @@ class UtilCommon {
mapToArray (list: any[], field: string): any {
list = list|| [] as any[];
- let map = {} as any;
- for (let item of list) {
+ const map = {} as any;
+ for (const item of list) {
map[item[field]] = map[item[field]] || [];
map[item[field]].push(item);
};
@@ -639,7 +643,7 @@ class UtilCommon {
unmap (map: any) {
let ret: any[] = [] as any[];
- for (let field in map) {
+ for (const field in map) {
ret = ret.concat(map[field]);
};
return ret;
@@ -689,7 +693,7 @@ class UtilCommon {
};
getSelectionRange (): Range {
- let sel: Selection = window.getSelection();
+ const sel: Selection = window.getSelection();
let range: Range = null;
if (sel && (sel.rangeCount > 0)) {
@@ -701,7 +705,7 @@ class UtilCommon {
getSelectionRect () {
let rect: any = { x: 0, y: 0, width: 0, height: 0 };
- let range = this.getSelectionRange();
+ const range = this.getSelectionRange();
if (range) {
rect = range.getBoundingClientRect() as DOMRect;
};
@@ -788,7 +792,7 @@ class UtilCommon {
};
getRoute (path: string): { page: string, action: string, id: string } {
- let route = path.split('/');
+ const route = path.split('/');
route.shift();
const page = String(route[0] || 'index');
@@ -928,7 +932,7 @@ class UtilCommon {
};
const files: any[] = [];
- for (let item of items) {
+ for (const item of items) {
if (item.kind != 'file') {
continue;
};
@@ -946,8 +950,8 @@ class UtilCommon {
return [];
};
- let ret = [];
- for (let item of items) {
+ const ret = [];
+ for (const item of items) {
if ((item.kind == 'string') && (item.type == 'text/html')) {
ret.push(item);
};
@@ -970,7 +974,7 @@ class UtilCommon {
};
};
- for (let item of items) {
+ for (const item of items) {
item.getAsString(cb);
};
};
@@ -980,16 +984,16 @@ class UtilCommon {
return;
};
- let ret: any[] = [];
+ const ret: any[] = [];
let n = 0;
- let cb = () => {
+ const cb = () => {
n++;
if (n == items.length) {
callBack({ ...data, files: ret });
};
};
- for (let item of items) {
+ for (const item of items) {
if (item.path) {
ret.push({ name: item.name, path: item.path });
cb();
diff --git a/src/ts/lib/util/data.ts b/src/ts/lib/util/data.ts
index 84f8955aca..a4e48f8e09 100644
--- a/src/ts/lib/util/data.ts
+++ b/src/ts/lib/util/data.ts
@@ -682,9 +682,8 @@ class UtilData {
noDeps: false,
}, param);
- let { subId, ids, keys, noDeps } = param;
-
- ids = UtilCommon.arrayUnique(ids.filter(it => it));
+ const { subId, keys, noDeps } = param;
+ const ids = UtilCommon.arrayUnique(param.ids.filter(it => it));
if (!subId) {
console.error('[UtilData].subscribeIds: subId is empty');
diff --git a/src/ts/lib/util/file.ts b/src/ts/lib/util/file.ts
index 36a19520f2..17d1a2ac67 100644
--- a/src/ts/lib/util/file.ts
+++ b/src/ts/lib/util/file.ts
@@ -22,10 +22,10 @@ class UtilFile {
return Number.isInteger(n) ? 0 : afterComma;
};
- let unit = 1024;
- let g = v / (unit * unit * unit);
- let m = v / (unit * unit);
- let k = v / unit;
+ const unit = 1024;
+ const g = v / (unit * unit * unit);
+ const m = v / (unit * unit);
+ const k = v / unit;
if (g >= 1) {
v = UtilCommon.sprintf(`%0.${trimmer(g, 2)}fGB`, UtilCommon.round(g, trimmer(g, 2)));
} else if (m > 1) {
@@ -47,7 +47,7 @@ class UtilFile {
let icon = 'other';
if (mime) {
- let a: string[] = mime.split(';');
+ const a: string[] = mime.split(';');
if (a.length) {
t = a[0].split('/');
};
@@ -98,7 +98,7 @@ class UtilFile {
icon = 'presentation';
};
- for (let k in Constant.extension) {
+ for (const k in Constant.extension) {
if (Constant.extension[k].indexOf(e) >= 0) {
icon = k;
break;
@@ -132,7 +132,7 @@ class UtilFile {
loadPreviewBase64 (file: any, param: any, success?: (image: string, param: any) => void, error?: (error: string) => void) {
this.loadPreviewCanvas(file, param, (canvas: any) => {
- let image = canvas.toDataURL(param.type, param.quality);
+ const image = canvas.toDataURL(param.type, param.quality);
if (image && success) {
success(image, { width: canvas.width, height: canvas.height });
diff --git a/src/ts/lib/util/menu.ts b/src/ts/lib/util/menu.ts
index f267ffcecd..0248129280 100644
--- a/src/ts/lib/util/menu.ts
+++ b/src/ts/lib/util/menu.ts
@@ -53,13 +53,13 @@ class UtilMenu {
};
getBlockObject () {
- let ret: any[] = [
+ const ret: any[] = [
{ type: I.BlockType.Page, id: 'existing', icon: 'existing', lang: 'Existing', arrow: true },
];
let i = 0;
- let items = UtilData.getObjectTypesForNewObject({ withSet: true, withCollection: true });
+ const items = UtilData.getObjectTypesForNewObject({ withSet: true, withCollection: true });
- for (let type of items) {
+ for (const type of items) {
ret.push({
id: 'object' + i++,
type: I.BlockType.Page,
@@ -97,7 +97,7 @@ class UtilMenu {
types.sort(UtilData.sortByName);
let i = 0;
- for (let type of types) {
+ for (const type of types) {
ret.push({
type: I.BlockType.Page,
id: 'object' + i++,
@@ -182,10 +182,10 @@ class UtilMenu {
};
getBgColors () {
- let items: any[] = [
+ const items: any[] = [
{ id: 'bgColor-default', name: translate('commonDefault'), value: '', className: 'default', isBgColor: true }
];
- for (let color of Constant.textColor) {
+ for (const color of Constant.textColor) {
items.push({ id: 'bgColor-' + color, name: translate('textColor-' + color), value: color, className: color, isBgColor: true });
};
return items;
@@ -327,7 +327,7 @@ class UtilMenu {
c._sortWeight_ = getWeight(c.description);
} else
if (c.aliases && c.aliases.length) {
- for (let alias of c.aliases) {
+ for (const alias of c.aliases) {
if (alias.match(regC)) {
ret = true;
break;
diff --git a/src/ts/lib/util/smile.ts b/src/ts/lib/util/smile.ts
index 53032733bc..7113c99a8a 100644
--- a/src/ts/lib/util/smile.ts
+++ b/src/ts/lib/util/smile.ts
@@ -46,11 +46,11 @@ class UtilSmile {
return '';
};
- let codeUnits = [];
+ const codeUnits = [];
let highSurrogate;
let lowSurrogate;
let index = -1;
- let length = points.length;
+ const length = points.length;
let result = '';
while (++index < length) {
@@ -61,7 +61,7 @@ class UtilSmile {
point > 0x10ffff || // not a valid Unicode code point
Math.floor(point) != point // not an integer
) {
- throw RangeError('Invalid code point: ' + point)
+ throw RangeError('Invalid code point: ' + point);
};
if (point <= 0xffff) {
@@ -78,7 +78,7 @@ class UtilSmile {
};
if ((index + 1 === length) || (codeUnits.length > MAX_SIZE)) {
- result += String.fromCharCode.apply(null, codeUnits)
+ result += String.fromCharCode.apply(null, codeUnits);
codeUnits.length = 0;
};
};
@@ -98,8 +98,8 @@ class UtilSmile {
let uni = item.unified;
if (item.skin_variations && (skin > 1)) {
- let skinCode = SKINS[(skin - 1)];
- let skinItem = item.skin_variations[skinCode];
+ const skinCode = SKINS[(skin - 1)];
+ const skinItem = item.skin_variations[skinCode];
if (skinItem && skinItem.unified) {
uni = skinItem.unified;
};
@@ -108,7 +108,7 @@ class UtilSmile {
};
uncompress (item: any) {
- for (let key in item) {
+ for (const key in item) {
if (!Mapping[key]) {
continue;
};
@@ -166,7 +166,7 @@ class UtilSmile {
return this.cache[icon];
};
- let cp = [];
+ const cp = [];
for (let i = 0; i < icon.length; ++i) {
cp.push(icon.charCodeAt(i));
};
@@ -199,7 +199,7 @@ class UtilSmile {
strip (t: string) {
const r = /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g;
- return t.replace(r, '');
+ return t.replace(r, '');
};
};
diff --git a/src/ts/model/content/table.ts b/src/ts/model/content/table.ts
index 272983e0f6..f026080942 100644
--- a/src/ts/model/content/table.ts
+++ b/src/ts/model/content/table.ts
@@ -19,4 +19,4 @@ class BlockContentTableRow implements I.ContentTableRow {
export {
BlockContentTableRow,
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/src/ts/store/block.ts b/src/ts/store/block.ts
index 191b9148e5..2e839f91b7 100644
--- a/src/ts/store/block.ts
+++ b/src/ts/store/block.ts
@@ -268,7 +268,7 @@ class BlockStore {
let ret = false;
- for (let childId of element.childrenIds) {
+ for (const childId of element.childrenIds) {
ret = this.checkIsChild(rootId, childId, blockId);
if (ret) {
break;
diff --git a/src/ts/store/common.ts b/src/ts/store/common.ts
index f1291b9936..b5b95eeb8c 100644
--- a/src/ts/store/common.ts
+++ b/src/ts/store/common.ts
@@ -164,7 +164,7 @@ class CommonStore {
};
get isSidebarFixed(): boolean {
- return Boolean(this.isSidebarFixedValue) || Storage.get('isSidebarFixed');
+ return Boolean(this.isSidebarFixedValue) || Storage.get('isSidebarFixed');
};
get theme(): string {
diff --git a/src/ts/store/db.ts b/src/ts/store/db.ts
index e02deb24ab..5bafe96d07 100644
--- a/src/ts/store/db.ts
+++ b/src/ts/store/db.ts
@@ -6,44 +6,44 @@ import Constant from 'json/constant.json';
class DbStore {
- public relationMap: Map = observable(new Map());
+ public relationMap: Map = observable(new Map());
public relationKeyMap: any = {};
- public viewMap: Map = observable.map(new Map());
- public recordMap: Map = observable.map(new Map());
- public metaMap: Map = observable.map(new Map());
+ public viewMap: Map = observable.map(new Map());
+ public recordMap: Map = observable.map(new Map());
+ public metaMap: Map = observable.map(new Map());
public groupMap: Map = observable.map(new Map());
- constructor() {
- makeObservable(this, {
+ constructor() {
+ makeObservable(this, {
clearAll: action,
relationsSet: action,
- viewsSet: action,
+ viewsSet: action,
viewsSort: action,
- viewsClear: action,
- viewAdd: action,
- viewUpdate: action,
- viewDelete: action,
- metaSet: action,
- metaClear: action,
- recordsSet: action,
- recordsClear: action,
- recordAdd: action,
- recordDelete: action,
+ viewsClear: action,
+ viewAdd: action,
+ viewUpdate: action,
+ viewDelete: action,
+ metaSet: action,
+ metaClear: action,
+ recordsSet: action,
+ recordsClear: action,
+ recordAdd: action,
+ recordDelete: action,
groupsSet: action,
groupsAdd: action,
groupsRemove: action,
groupsClear: action,
- });
- }
+ });
+ }
clearAll () {
- this.relationMap.clear();
- this.viewMap.clear();
- this.recordMap.clear();
- this.metaMap.clear();
+ this.relationMap.clear();
+ this.viewMap.clear();
+ this.recordMap.clear();
+ this.metaMap.clear();
};
- relationsSet (rootId: string, blockId: string, list: any[]) {
+ relationsSet (rootId: string, blockId: string, list: any[]) {
const key = this.getId(rootId, blockId);
const relations = (this.relationMap.get(this.getId(rootId, blockId)) || []).
concat(list.map(it => ({ relationKey: it.relationKey, format: it.format })));
@@ -58,7 +58,7 @@ class DbStore {
this.relationMap.set(key, relations.map(it => ({ relationKey: it.relationKey, format: it.format })));
};
- viewsSet (rootId: string, blockId: string, list: I.View[]) {
+ viewsSet (rootId: string, blockId: string, list: I.View[]) {
const key = this.getId(rootId, blockId);
const views = this.getViews(rootId, blockId);
@@ -94,11 +94,11 @@ class DbStore {
this.viewsSet(rootId, blockId, views);
};
- viewsClear (rootId: string, blockId: string) {
+ viewsClear (rootId: string, blockId: string) {
this.viewMap.delete(this.getId(rootId, blockId));
};
- viewAdd (rootId: string, blockId: string, item: any) {
+ viewAdd (rootId: string, blockId: string, item: any) {
const views = this.getViews(rootId, blockId);
const view = this.getView(rootId, blockId, item.id);
@@ -109,7 +109,7 @@ class DbStore {
};
};
- viewUpdate (rootId: string, blockId: string, item: any) {
+ viewUpdate (rootId: string, blockId: string, item: any) {
const views = this.getViews(rootId, blockId);
const idx = views.findIndex(it => it.id == item.id);
@@ -123,11 +123,11 @@ class DbStore {
set(views[idx], item);
};
- viewDelete (rootId: string, blockId: string, id: string) {
+ viewDelete (rootId: string, blockId: string, id: string) {
this.viewMap.set(this.getId(rootId, blockId), this.getViews(rootId, blockId).filter(it => it.id != id));
};
- metaSet (rootId: string, blockId: string, meta: any) {
+ metaSet (rootId: string, blockId: string, meta: any) {
const data = this.metaMap.get(this.getId(rootId, blockId));
if (data) {
@@ -150,26 +150,26 @@ class DbStore {
};
};
- metaClear (rootId: string, blockId: string) {
+ metaClear (rootId: string, blockId: string) {
this.metaMap.delete(this.getId(rootId, blockId));
};
- recordsSet (rootId: string, blockId: string, list: string[]) {
+ recordsSet (rootId: string, blockId: string, list: string[]) {
this.recordMap.set(this.getId(rootId, blockId), observable.array(list));
};
- recordsClear (rootId: string, blockId: string) {
+ recordsClear (rootId: string, blockId: string) {
this.recordMap.delete(this.getId(rootId, blockId));
};
- recordAdd (rootId: string, blockId: string, id: string, index: number) {
+ recordAdd (rootId: string, blockId: string, id: string, index: number) {
const records = this.getRecords(rootId, blockId);
records.splice(index, 0, id);
this.recordsSet(rootId, blockId, records);
};
- recordDelete (rootId: string, blockId: string, id: string) {
+ recordDelete (rootId: string, blockId: string, id: string) {
this.recordMap.set(this.getId(rootId, blockId), this.getRecords(rootId, blockId).filter(it => it != id));
};
@@ -224,11 +224,11 @@ class DbStore {
return (this.relationMap.get(this.getId(rootId, blockId)) || []).map(it => it.relationKey);
};
- getObjectRelations (rootId: string, blockId: string): any[] {
+ getObjectRelations (rootId: string, blockId: string): any[] {
return this.getObjectRelationKeys(rootId, blockId).map(it => this.getRelationByKey(it)).filter(it => it);
};
- getRelationByKey (relationKey: string): any {
+ getRelationByKey (relationKey: string): any {
const id = relationKey ? this.relationKeyMap[relationKey] : '';
return id ? this.getRelationById(id) : null;
};
@@ -247,15 +247,15 @@ class DbStore {
return object._empty_ ? null : object;
};
- getViews (rootId: string, blockId: string): I.View[] {
+ getViews (rootId: string, blockId: string): I.View[] {
return this.viewMap.get(this.getId(rootId, blockId)) || [];
};
- getView (rootId: string, blockId: string, id: string): I.View {
+ getView (rootId: string, blockId: string, id: string): I.View {
return this.getViews(rootId, blockId).find(it => it.id == id);
};
- getMeta (rootId: string, blockId: string) {
+ getMeta (rootId: string, blockId: string) {
const map = this.metaMap.get(this.getId(rootId, blockId)) || {};
return {
@@ -266,7 +266,7 @@ class DbStore {
};
};
- getRecords (rootId: string, blockId: string) {
+ getRecords (rootId: string, blockId: string) {
return this.recordMap.get(this.getId(rootId, blockId)) || [];
};
diff --git a/src/ts/store/detail.ts b/src/ts/store/detail.ts
index 01f95cb939..c91a5e83f3 100644
--- a/src/ts/store/detail.ts
+++ b/src/ts/store/detail.ts
@@ -103,12 +103,12 @@ class DetailStore {
};
/** Idempotent. Clears any data stored with rootId, if there happens to be any. */
- public clear (rootId: string): void {
+ public clear (rootId: string): void {
this.map.delete(rootId);
};
/** Idempotent. Clears all of the data stored in DetailStore, if there happens to be any */
- public clearAll (): void {
+ public clearAll (): void {
this.map.clear();
};
diff --git a/src/ts/store/menu.ts b/src/ts/store/menu.ts
index bba394125b..b703be2068 100644
--- a/src/ts/store/menu.ts
+++ b/src/ts/store/menu.ts
@@ -169,7 +169,7 @@ class MenuStore {
getTimeout (items: I.Menu[]): number {
let t = 0;
- for (let item of items) {
+ for (const item of items) {
if (!item.param.noAnimation) {
t = Constant.delay.menu;
};
diff --git a/webpack.config.js b/webpack.config.js
index 82ec0c61ba..19b2f3b40e 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -12,8 +12,8 @@ module.exports = (env, argv) => {
optimization: {
minimize: false,
removeAvailableModules: true,
- removeEmptyChunks: true,
- splitChunks: false,
+ removeEmptyChunks: true,
+ splitChunks: false,
},
entry: './src/ts/entry.tsx',
@@ -22,14 +22,14 @@ module.exports = (env, argv) => {
extensions: [ '.ts', '.tsx', '.js', '.jsx' ],
alias: {
protobuf: path.resolve(__dirname, 'dist/lib'),
- json: path.resolve(__dirname, 'src/json'),
- Lib: path.resolve(__dirname, 'src/ts/lib'),
+ json: path.resolve(__dirname, 'src/json'),
+ Lib: path.resolve(__dirname, 'src/ts/lib'),
Store: path.resolve(__dirname, 'src/ts/store'),
Component: path.resolve(__dirname, 'src/ts/component'),
Interface: path.resolve(__dirname, 'src/ts/interface'),
Model: path.resolve(__dirname, 'src/ts/model'),
Docs: path.resolve(__dirname, 'src/ts/docs'),
- },
+ },
modules: [
path.resolve('./src/'),
path.resolve('./electron/'),
@@ -55,7 +55,7 @@ module.exports = (env, argv) => {
port,
client: {
progress: false,
- },
+ },
},
module: {
diff --git a/webpack.node.config.js b/webpack.node.config.js
index d69bed22db..0984baad63 100644
--- a/webpack.node.config.js
+++ b/webpack.node.config.js
@@ -5,8 +5,8 @@ module.exports = (env) => {
optimization: {
minimize: false,
removeAvailableModules: false,
- removeEmptyChunks: false,
- splitChunks: false,
+ removeEmptyChunks: false,
+ splitChunks: false,
},
entry: './electron.js',
@@ -21,4 +21,4 @@ module.exports = (env) => {
}
};
-};
+};
\ No newline at end of file