Skip to content

Commit b0026f2

Browse files
committed
fix: linting errors
1 parent 2e46deb commit b0026f2

3 files changed

Lines changed: 75 additions & 69 deletions

File tree

src/livecodes/UI/templates.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { templatesScreen } from '../html';
2-
import { debounce } from '../utils/utils';
32
import type { EventsManager, Template } from '../models';
3+
import { debounce } from '../utils/utils';
44

55
export const createTemplatesContainer = (
66
eventsManager: EventsManager,
@@ -53,12 +53,12 @@ export const noUserTemplates = () => `
5353
<div class="description alert">${window.deps.translateString('templates.noUserTemplates.heading', 'You have no saved templates.')}</div>
5454
<div class="description help">
5555
${window.deps.translateString(
56-
'templates.noUserTemplates.desc',
57-
'You can save a project as a template from <wbr />(App&nbsp;menu&nbsp;&gt;&nbsp;Save&nbsp;as&nbsp;&gt; Template).',
58-
{
59-
isHTML: true,
60-
},
61-
)}
56+
'templates.noUserTemplates.desc',
57+
'You can save a project as a template from <wbr />(App&nbsp;menu&nbsp;&gt;&nbsp;Save&nbsp;as&nbsp;&gt; Template).',
58+
{
59+
isHTML: true,
60+
},
61+
)}
6262
</div>
6363
</div>
6464
`;

src/livecodes/core.ts

Lines changed: 57 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,18 @@ const loadStyles = () =>
250250
isHeadless
251251
? Promise.resolve()
252252
: Promise.all(
253-
[
254-
snackbarUrl,
255-
...(isLite
256-
? []
257-
: [
258-
lunaObjViewerStylesUrl,
259-
lunaDataGridStylesUrl,
260-
lunaDomViewerStylesUrl,
261-
lunaConsoleStylesUrl,
262-
]),
263-
].map((url) => loadStylesheet(url, undefined, '#app-styles')),
264-
);
253+
[
254+
snackbarUrl,
255+
...(isLite
256+
? []
257+
: [
258+
lunaObjViewerStylesUrl,
259+
lunaDataGridStylesUrl,
260+
lunaDomViewerStylesUrl,
261+
lunaConsoleStylesUrl,
262+
]),
263+
].map((url) => loadStylesheet(url, undefined, '#app-styles')),
264+
);
265265

266266
let lastRun = { time: 0, result: '' };
267267
const createIframe = (container: HTMLElement, result = '', service = sandboxService) =>
@@ -353,11 +353,12 @@ const createIframe = (container: HTMLElement, result = '', service = sandboxServ
353353

354354
iframe.remove(); // avoid changing browser history
355355
const { markup, style, script } = getConfig();
356-
const query = `?markup=${markup.language}&style=${style.language}&script=${script.language
357-
}&isEmbed=${isEmbed}&isLoggedIn=${Boolean(authService?.isLoggedIn())}&appCDN=${getAppCDN()}`;
356+
const query = `?markup=${markup.language}&style=${style.language}&script=${
357+
script.language
358+
}&isEmbed=${isEmbed}&isLoggedIn=${Boolean(authService?.isLoggedIn())}&appCDN=${getAppCDN()}`;
358359
const scrollPosition =
359360
params.scrollPosition === false ||
360-
(iframeScrollPosition.x === 0 && iframeScrollPosition.y === 0)
361+
(iframeScrollPosition.x === 0 && iframeScrollPosition.y === 0)
361362
? ''
362363
: `#livecodes-scroll-position:${iframeScrollPosition.x},${iframeScrollPosition.y}`;
363364
iframe.src = service.getResultUrl() + query + scrollPosition;
@@ -504,7 +505,7 @@ const createEditors = async (config: Config) => {
504505
language: languageIsEnabled(config.markup.language, config)
505506
? config.markup.language
506507
: (config.languages?.find((lang) => getLanguageEditorId(lang) === 'markup') as Language) ||
507-
'html',
508+
'html',
508509
value: languageIsEnabled(config.markup.language, config) ? config.markup.content || '' : '',
509510
};
510511
const styleOptions: EditorOptions = {
@@ -514,7 +515,7 @@ const createEditors = async (config: Config) => {
514515
language: languageIsEnabled(config.style.language, config)
515516
? config.style.language
516517
: (config.languages?.find((lang) => getLanguageEditorId(lang) === 'style') as Language) ||
517-
'css',
518+
'css',
518519
value: languageIsEnabled(config.style.language, config) ? config.style.content || '' : '',
519520
};
520521
const scriptOptions: EditorOptions = {
@@ -524,7 +525,7 @@ const createEditors = async (config: Config) => {
524525
language: languageIsEnabled(config.script.language, config)
525526
? config.script.language
526527
: (config.languages?.find((lang) => getLanguageEditorId(lang) === 'script') as Language) ||
527-
'javascript',
528+
'javascript',
528529
value: languageIsEnabled(config.script.language, config) ? config.script.content || '' : '',
529530
};
530531

@@ -981,12 +982,12 @@ const getResultPage = async ({
981982
blockly:
982983
scriptLanguage === 'blockly'
983984
? ((await customEditors.blockly?.getContent({
984-
baseUrl,
985-
editors,
986-
config: getConfig(),
987-
html: compiledMarkup,
988-
eventsManager,
989-
})) as BlocklyContent)
985+
baseUrl,
986+
editors,
987+
config: getConfig(),
988+
html: compiledMarkup,
989+
eventsManager,
990+
})) as BlocklyContent)
990991
: {},
991992
});
992993
const compiledScript = scriptCompileResult.code;
@@ -1327,28 +1328,28 @@ const share = async (
13271328
const config = getConfig();
13281329
const content = contentOnly
13291330
? {
1330-
...getContentConfig(config),
1331-
markup: {
1332-
...config.markup,
1333-
title: undefined,
1334-
hideTitle: undefined,
1335-
},
1336-
style: {
1337-
...config.style,
1338-
title: undefined,
1339-
hideTitle: undefined,
1340-
},
1341-
script: {
1342-
...config.script,
1343-
title: undefined,
1344-
hideTitle: undefined,
1345-
},
1346-
tools: {
1347-
...config.tools,
1348-
enabled: defaultConfig.tools.enabled,
1349-
status: config.tools.status === 'none' ? defaultConfig.tools.status : config.tools.status,
1350-
},
1351-
}
1331+
...getContentConfig(config),
1332+
markup: {
1333+
...config.markup,
1334+
title: undefined,
1335+
hideTitle: undefined,
1336+
},
1337+
style: {
1338+
...config.style,
1339+
title: undefined,
1340+
hideTitle: undefined,
1341+
},
1342+
script: {
1343+
...config.script,
1344+
title: undefined,
1345+
hideTitle: undefined,
1346+
},
1347+
tools: {
1348+
...config.tools,
1349+
enabled: defaultConfig.tools.enabled,
1350+
status: config.tools.status === 'none' ? defaultConfig.tools.status : config.tools.status,
1351+
},
1352+
}
13521353
: config;
13531354

13541355
const currentUrl = (location.origin + location.pathname).split('/').slice(0, -1).join('/') + '/';
@@ -1630,7 +1631,7 @@ const setSavedStatus = async () => {
16301631
!!(
16311632
savedConfig &&
16321633
JSON.stringify(getContentConfig(savedConfig)) ===
1633-
JSON.stringify(getContentConfig(getConfig()))
1634+
JSON.stringify(getContentConfig(getConfig()))
16341635
);
16351636

16361637
const projectTitle = UI.getProjectTitleElement();
@@ -1812,12 +1813,12 @@ const login = async () =>
18121813
const displayName = user.displayName || user.username;
18131814
const loginSuccessMessage = displayName
18141815
? window.deps.translateString(
1815-
'core.login.successWithName',
1816-
'Logged in as: {{name}}',
1817-
{
1818-
name: displayName,
1819-
},
1820-
)
1816+
'core.login.successWithName',
1817+
'Logged in as: {{name}}',
1818+
{
1819+
name: displayName,
1820+
},
1821+
)
18211822
: window.deps.translateString('core.login.success', 'Logged in successfully');
18221823
notifications.success(loginSuccessMessage);
18231824
displayLoggedIn(user);
@@ -2590,9 +2591,9 @@ const handleKeyboardShortcutsScreen = () => {
25902591
<tr>
25912592
<td>${item.title}</td>
25922593
<td>${item.hotkey
2593-
?.split('+')
2594-
.map((key) => `<kbd>${capitalize(key)}</kbd>`)
2595-
.join(' ')}</td>
2594+
?.split('+')
2595+
.map((key) => `<kbd>${capitalize(key)}</kbd>`)
2596+
.join(' ')}</td>
25962597
</tr>
25972598
`,
25982599
)

src/livecodes/html/templates.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
<a href="#" data-target="templates-user" data-i18n="templates.user.heading">My Templates</a>
1212
</li>
1313
</ul>
14-
<div class="templates-search-container">
15-
<label for="templates-search-input" class="visually-hidden" data-i18n="templates.search.label">Search templates</label>
16-
<input id="templates-search-input" type="search" placeholder="Search templates..." aria-label="Search templates by language" />
17-
</div>
14+
<div class="templates-search-container">
15+
<label for="templates-search-input" class="visually-hidden" data-i18n="templates.search.label"
16+
>Search templates</label
17+
>
18+
<input
19+
id="templates-search-input"
20+
type="search"
21+
placeholder="Search templates..."
22+
aria-label="Search templates by language"
23+
/>
24+
</div>
1825

1926
<div id="templates-starter" class="tab-content active">
2027
<div class="modal-screen">
@@ -32,5 +39,3 @@
3239
</div>
3340
</div>
3441
</div>
35-
36-

0 commit comments

Comments
 (0)