I am writing a plugin where I intend to move my selected text under one of the existing headings of the document. I intend to do so by adding a command move/classify in context menu. The context menu should dynamically generate all headings and create a submenu and picking a heading should move text under that heading.
I would appreciate it if you can point me to the right API component for this.
Thanks in advance.