Skip to content

Commit a4e39f7

Browse files
committed
Refactoring
1 parent 42ae992 commit a4e39f7

29 files changed

+115
-11
lines changed

Source/Extension/Schema/Open.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export async function openSchema ( context : ExtensionContext , filePath : strin
146146

147147
return `<img
148148
data-type = '${ type }'
149-
src = '${ asset(`${ title }.png`) }'
149+
src = '${ asset(`Icons/${ title }.png`) }'
150150
title = '${ title }'
151151
>`
152152
}).join('');

Source/Schema/App.js

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ window.addEventListener('message',( event ) => {
136136

137137

138138
const Settings = {
139+
139140
'checkbox' : checkbox ,
140141
'number' : number ,
141142
'radio' : radio ,
@@ -151,7 +152,9 @@ const Settings = {
151152
'page' : simple ,
152153

153154
'video' : simple ,
154-
'url' : url
155+
'url' : url ,
156+
'richtext' : richtext ,
157+
'product_list' : product_list
155158
}
156159

157160

@@ -163,7 +166,7 @@ function settingTemplate ( setting ){
163166

164167
{
165168
const remove = create('div');
166-
remove.innerText = 'x';
169+
remove.innerText = '';
167170
item.appendChild(remove);
168171

169172
remove.addEventListener('click',() => {
@@ -330,7 +333,7 @@ function video_url ( setting ){
330333
for ( const platform of [ 'youtube' , 'vimeo' ] ){
331334

332335
const wrapper = create();
333-
wrapper.classname = 'sidebyside';
336+
wrapper.className = 'sidebyside';
334337

335338
const input = create('input');
336339
input.type = 'checkbox';
@@ -419,6 +422,93 @@ function url ( setting ){
419422

420423

421424

425+
html_settings.appendChild(item);
426+
}
427+
428+
function richtext ( setting ){
429+
430+
const item = settingTemplate(setting);
431+
432+
item.appendChild(create('br'));
433+
item.appendChild(create('br'));
434+
435+
{
436+
item.appendChild(create('br'));
437+
item.appendChild(create('br'));
438+
439+
const label = create('label');
440+
label.innerHTML = `<a> Default </a> <br> content to display.`;
441+
442+
const input = create('textarea');
443+
input.cols = 16;
444+
input.rows = 4;
445+
input.value = setting.default ?? '';
446+
447+
input.addEventListener('change',() => {
448+
settings.default = input.value;
449+
update();
450+
})
451+
452+
item.appendChild(label);
453+
item.appendChild(create('br'));
454+
item.appendChild(input);
455+
}
456+
457+
458+
459+
html_settings.appendChild(item);
460+
}
461+
462+
function product_list ( setting ){
463+
464+
const item = settingTemplate(setting);
465+
466+
item.appendChild(create('br'));
467+
item.appendChild(create('br'));
468+
469+
{
470+
item.appendChild(create('br'));
471+
item.appendChild(create('br'));
472+
473+
const label = create('label');
474+
label.innerHTML = `<a> Limit </a> <br> of collections to include ( 1 - 50 ).`;
475+
476+
const input = create('input');
477+
input.type = 'text';
478+
input.value = setting.limit ?? '';
479+
480+
input.addEventListener('change',() => {
481+
482+
let { value } = input;
483+
484+
value = parseInt(value);
485+
486+
487+
if( Number.isFinite(value) ){
488+
489+
if( value < 1 )
490+
value = 1;
491+
492+
if( value > 50 )
493+
value = 50;
494+
495+
input.value = value;
496+
497+
} else {
498+
value = null;
499+
}
500+
501+
settings.limit = value;
502+
update();
503+
})
504+
505+
item.appendChild(label);
506+
item.appendChild(create('br'));
507+
item.appendChild(input);
508+
}
509+
510+
511+
422512
html_settings.appendChild(item);
423513
}
424514

0 commit comments

Comments
 (0)