File tree Expand file tree Collapse file tree 5 files changed +292
-234
lines changed
modals/modalContents/buttonBuilder Expand file tree Collapse file tree 5 files changed +292
-234
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
1212 HLP_ViewFieldDeclaration ,
1313} from 'packages/core/src/parsers/syntaxHighlighting/HLPs' ;
1414import { SyntaxHighlighting } from 'packages/core/src/parsers/syntaxHighlighting/SyntaxHighlighting' ;
15- import { expectType } from '.. /utils/Utils' ;
15+ import { expectType } from 'packages/core/src /utils/Utils' ;
1616
1717export class SyntaxHighlightingAPI {
1818 public readonly plugin : IPlugin ;
Original file line number Diff line number Diff line change 148148 buttonConfig .backgroundImage = file ;
149149 });
150150 }
151+
152+ function resetBackgroundImage(): void {
153+ buttonConfig .backgroundImage = undefined ;
154+ }
151155 </script >
152156
153157<SettingComponent name =" Label" description =" The label shown on the button." >
178182</SettingComponent >
179183
180184<SettingComponent name =" Background image" description =" A background image to use in the button." >
181- <span style ="word-break: break-word" >{buttonConfig .backgroundImage ?? ' none' }</span >
185+ <span style ="word-break: break-word" >{buttonConfig .backgroundImage || ' none' }</span >
182186 <Button variant ={ButtonStyleType .PRIMARY } onclick ={() => changeBackgroundImage ()} tooltip =" Select from vault"
183187 >Change</Button
184188 >
189+ <Button variant ={ButtonStyleType .DEFAULT } onclick ={() => resetBackgroundImage ()} tooltip =" Reset to none"
190+ ><Icon plugin ={plugin } iconName =" x" ></Icon ></Button
191+ >
185192</SettingComponent >
186193
187194<SettingComponent
Original file line number Diff line number Diff line change 11export class TestComponent {
2- loaded : boolean ;
3- used : boolean ;
4- callbacks : ( ( ) => void ) [ ] ;
2+ loaded : boolean ;
3+ used : boolean ;
4+ callbacks : ( ( ) => void ) [ ] ;
55
6- constructor ( ) {
7- this . loaded = false ;
8- this . used = false ;
9- this . callbacks = [ ] ;
10- }
6+ constructor ( ) {
7+ this . loaded = false ;
8+ this . used = false ;
9+ this . callbacks = [ ] ;
10+ }
1111
12- load ( ) {
13- if ( this . loaded ) {
14- throw new Error ( 'Attempted double load of TestComponent' ) ;
15- }
16- if ( this . used ) {
17- throw new Error ( 'Attempted reuse of TestComponent' ) ;
18- }
19- this . loaded = true ;
20- }
12+ load ( ) {
13+ if ( this . loaded ) {
14+ throw new Error ( 'Attempted double load of TestComponent' ) ;
15+ }
16+ if ( this . used ) {
17+ throw new Error ( 'Attempted reuse of TestComponent' ) ;
18+ }
19+ this . loaded = true ;
20+ }
2121
22- unload ( ) {
23- if ( ! this . loaded && ! this . used ) {
24- throw new Error ( 'Attempted unload of TestComponent before it was loaded' ) ;
25- }
26- if ( ! this . loaded && this . used ) {
27- throw new Error ( 'Attempted double unload of TestComponent' ) ;
28- }
29- this . loaded = false ;
30- this . used = true ;
31- this . callbacks . forEach ( cb => cb ( ) ) ;
32- }
22+ unload ( ) {
23+ if ( ! this . loaded && ! this . used ) {
24+ throw new Error ( 'Attempted unload of TestComponent before it was loaded' ) ;
25+ }
26+ if ( ! this . loaded && this . used ) {
27+ throw new Error ( 'Attempted double unload of TestComponent' ) ;
28+ }
29+ this . loaded = false ;
30+ this . used = true ;
31+ this . callbacks . forEach ( cb => cb ( ) ) ;
32+ }
3333
34- register ( callback : ( ) => void ) {
35- if ( this . used ) {
36- throw new Error ( 'Attempted to register callback after TestComponent was used. The callback will never be called.' ) ;
37- }
34+ register ( callback : ( ) => void ) {
35+ if ( this . used ) {
36+ throw new Error (
37+ 'Attempted to register callback after TestComponent was used. The callback will never be called.' ,
38+ ) ;
39+ }
3840
39- this . callbacks . push ( callback ) ;
40- }
41- }
41+ this . callbacks . push ( callback ) ;
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments