StringEditor.js 571 B

1234567891011121314151617181920212223242526272829303132333435
  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. this.setOutputLength( 1 );
  11. element.addEventListener( 'changeInput', () => this.invalidate() );
  12. this.add( element );
  13. }
  14. get stringNode() {
  15. return this.value;
  16. }
  17. getURL() {
  18. return this.stringNode.value;
  19. }
  20. }