@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 1.8 kB
JavaScript
import*as Common from"../../../../core/common/common.js";import*as i18n from"../../../../core/i18n/i18n.js";import*as FormatterActions from"../../../../entrypoints/formatter_worker/FormatterActions.js";import*as UI from"../../legacy.js";import resourceSourceFrameStyles from"./resourceSourceFrame.css.legacy.js";import{SourceFrameImpl}from"./SourceFrame.js";const UIStrings={find:"Find"},str_=i18n.i18n.registerUIStrings("ui/legacy/components/source_frame/ResourceSourceFrame.ts",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class ResourceSourceFrame extends SourceFrameImpl{givenContentType;resourceInternal;constructor(e,r,t){super((()=>e.requestContent()),t),this.givenContentType=r,this.resourceInternal=e}static createSearchableView(e,r,t){return new SearchableContainer(e,r,t)}getContentType(){return this.givenContentType}get resource(){return this.resourceInternal}populateTextAreaContextMenu(e,r,t){super.populateTextAreaContextMenu(e,r,t),e.appendApplicableItems(this.resourceInternal)}}export class SearchableContainer extends UI.Widget.VBox{sourceFrame;constructor(e,r,t){super(!0),this.registerRequiredCSS(resourceSourceFrameStyles);const o=Common.ResourceType.ResourceType.simplifyContentType(r),n=new ResourceSourceFrame(e,o);this.sourceFrame=n;const s=FormatterActions.FORMATTABLE_MEDIA_TYPES.includes(o);n.setCanPrettyPrint(s,t);const a=new UI.SearchableView.SearchableView(n,n);a.element.classList.add("searchable-view"),a.setPlaceholder(i18nString(UIStrings.find)),n.show(a.element),n.setSearchableView(a),a.show(this.contentElement);const i=new UI.Toolbar.Toolbar("toolbar",this.contentElement);n.toolbarItems().then((e=>{e.map((e=>i.appendToolbarItem(e)))}))}async revealPosition(e,r){this.sourceFrame.revealPosition({lineNumber:e,columnNumber:r},!0)}}