TopicTextEditor.GetNativeEditor() Method - Author-it On-Premises - Author-it

Author-it Development Documentation

Gets the native editor control (SubSystems.TE.Tern object) from the text editor in Author.

Returns: Object

Usage example:

using AuthorIT.Extensibility;

using SubSystems.TE;

namespace EditorPlugin

{

    public class EditorPlugin : IPlugin

    {

        private Tern _TE;

        public EditorPlugin(AitApplicationProxy _proxy)

        {

            _proxy.BookEditorOpenEventHandler(OnBookEditorOpen);

            _proxy.SelectedTextChangedHandler(OnSelectedTextChanged);

    }

        private void OnBookEditorOpen(object sender, ProofingEventArgs e)

        {

      // TER editor can be set when BookEditor or TopicEditor is opened

            _TE = (Tern)e.TextEditor.GetNativeEditor();

            string version =_TE.ProductVersion;

    }

        private void OnSelectedTextChanged(object sender, ProofingEventArgs e)

        {

      // TER editor can also be accessed individually on each event

            Tern objTE = (Tern)e.TextEditor.GetNativeEditor();

            int line = 0, col = 0;

            objTE.GetTerCursorPos(out line, ref col);

    }

  }

}