Multiple open Editor instances

Multiple open Editor instances

csdatumcsdatum Posts: 30Questions: 10Answers: 0

Our project has a requirement that multiple forms (each having its own table) can be opened at once, side-by-side. Using Editor we have achieved this by using custom display controllers. We have a method that adds an additional custom display controller with a unique key every time a new Editor instance is initialized. I've noticed comments in the forums that mention that multiple Editor instances cannot have a form open to be edited at the same time, but I've been unsuccessful (I probably overlooked it) at locating the documentation that states this. Below are some questions I have related to our attempt to use Editor in this fashion:

  1. Is Editor limited to one instance's form open at a time?
  2. At this point with our approach the only issue we've found is that inputs such as textareas are not allowing the return keystroke to go through. We were hopeful that the fix in 1.8.0 would help our case as well, but since the keydown handler is run for each Editor instance we are encountering an error where the field isn't found. Would it be possible to modify the keydown handler to check if the element is in the current Editor's form before deciding to look for the field and firing preventDefault?
  3. Are there other known issues that we may encounter related to multiple instances open at once?
  4. If our approach is discouraged, are there any other suggested workarounds to have more than one Editor form open at a time?

Thanks in advance for advice or help with this implementation!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Hi,

    I'm not sure that the documentation does actually explicitly state that it can't have multiple instances open at the same time. Equally, it doesn't say that there can be, nor do any of the examples show that it can be, since it can't at the moment :).

    There might be workarounds, but you would run into issues if you tried to do inline editing for example. Editor assumes that there can be only one div.DTE element on the page at a time, which is one of the main limitations. It sounds like you have worked around the other main issue of one modal at a time with a custom display controller.

    We were hopeful that the fix in 1.8.0 would help our case as well, but since the keydown handler is run for each Editor instance we are encountering an error where the field isn't found.

    Yup - this is just one of several quirks I think you might run into, since it isn't currently designed for multiple instances being editable at the same time. The return key handler is on the document at the moment, so it would probably need to check the origin of the return to make sure it was inside the host form's fields.

    Are there other known issues that we may encounter related to multiple instances open at once?

    It hasn't been tested at all! Indeed it is explicitly not designed with this in mind. It might work. It might not!

    Allan

  • csdatumcsdatum Posts: 30Questions: 10Answers: 0

    Allan,
    Thanks for the feedback! We are not using inline or bubble editing on our project so we should be able to avoid the issues around those features. We are also using onReturn: 'none' in all of our instances so we may be avoiding any potential issues around this.

    You mentioned that the return key handler would need to check the origin of the keystroke, would this be something that would provide additional benefit to Editor that you may consider incorporating it? We've been working with our multiple instances for several months and are pleased to see that we've had hardly any issues even though Editor is not designed for this. I believe I can avoid this keydown issue by doing something like stopping propagation before the editor handler is reached, but it's enticing to not rely on such workarounds if the origin check were to be incorporated.

This discussion has been closed.