Editors and EditorWindows use the same persistence rules as other UnityEngine.Object types when crossing the Play Mode barrier.
This means that you can declare serialized variables and they will persist, but other variables will be transient.
See serializing a field to learn how to serialize fields, and what types are serializable by Unity.
As Editor and EditorWindow are UnityEngine.Object types you can serialize fields into them, and they will persist while they're open.
See persisting changes to learn how to correctly modify serialized variables.