StringEditor.js 541 B

123456789101112131415161718192021222324252627282930313233
  1. import { BaseNodeEditor } from '../BaseNodeEditor.js';
  2. import { createElementFromJSON } from '../NodeEditorUtils.js';
  3. export class StringEditor extends BaseNodeEditor {
  4. constructor() {
  5. const { element, inputNode } = createElementFromJSON( {
  6. inputType: 'string',
  7. inputConnection: false
  8. } );
  9. super( 'String', inputNode, 350 );
  10. element.addEventListener( 'changeInput', () => this.invalidate() );
  11. this.add( element );
  12. }
  13. get stringNode() {
  14. return this.value;
  15. }
  16. getURL() {
  17. return this.stringNode.value;
  18. }
  19. }