Magnet fixes and code simplifications for Dialog Previews.[optigon]

Added compatibility with standard magnets and made the integration code simpler.