saveComponent(component, parent, isNew, original) {
    this.editForm.detach();
    const parentContainer = parent ? parent.formioContainer : this.container;
    const parentComponent = parent ? parent.formioComponent : this;
    this.dialog.close();
    const path = parentContainer ? this.getComponentsPath(component, parentComponent.component) : '';
    if (!original) {
      original = parent.formioContainer.find((comp) => comp.id === component.id);
    }
    const index = parentContainer ? parentContainer.indexOf(original) : 0;
    if (index !== -1) {
      let submissionData = this.editForm.submission.data;
      submissionData = submissionData.componentJson || submissionData;
      if (submissionData.components && this.originalDefaultValue) {
        submissionData.components = this.originalDefaultValue.components;
      }
      const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];

      this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);

      this.hook('beforeSaveComponentSettings', submissionData);

      let comp = null;
      parentComponent.getComponents().forEach((component) => {
        if (component.component.key === original.key) {
          comp = component;
        }
      });
      const originalComp = comp?.component;
      const originalComponentSchema = comp?.schema;
      const isParentSaveChildMethod = this.isParentSaveChildMethod(parent.formioComponent);

      if (parentContainer && !isParentSaveChildMethod) {
        parentContainer[index] = submissionData;
        if (comp) {
          comp.component = submissionData;
        }
      }
      else if (isParentSaveChildMethod) {
        parent.formioComponent.saveChildComponent(submissionData);
      }

      const rebuild = parentComponent.rebuild() || Promise.resolve();
      return rebuild.then(() => {
        parentComponent.resetValue();
        const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
        this.emitSaveComponentEvent(
          schema,
          originalComp,
          parentComponent.schema,
          path,
          index,
          isNew,
          originalComponentSchema
        );
        this.emit('change', this.form);
        this.highlightInvalidComponents();

        if (this.isComponentCreated) {
          const component = parent.formioComponent.components[0];
          this.moveComponent(component);
          this.isComponentCreated = false;
        }
      });
    }

    this.highlightInvalidComponents();
    return Promise.resolve();
  }
Called when a new component is saved.
@param {Component} component - The component instance to save.
@param {Component} parent - The parent component.
@param {boolean} isNew - If this is a new component.
@param {Component} original - The original component.
@returns {boolean} - If the component was saved.