Cursor pointer moves to first position onclick textarea using CK-Editor
<p>I am using <code>CK-Editor 4</code>. In which I have created Directive. When I click on Textarea my cursor pointer is Move to First position. I want my cursor position should be available when I click in any of the Place inside Textarea. It should not be able to move first or last position until I click on last position.</p>

<pre><code>vpb.directive('ckeInline', function ($timeout, $parse, $rootScope,$) {
return {
require: "ngModel",
link: function (scope, element, attrs, ngModel) {
  if (attrs.ckeInlineShowtitle) ngModel = "";
  isMobile = $(".ipad, .ipod, .android").length &gt; 0;

  var destroy_this_editor = function(id)
  {

      setTimeout(function () {
        try{
            CKEDITOR.instances[id].destroy(true);
        } catch (ex) {
        }
      },500)

  }

  if (!isMobile) {
      var create_and_focus = function () {
          if (scope.setup.edit_mode || attrs.ckeNonEditMode) {
              attrs.$set('contenteditable', true);
              var a_id = attrs.ckeInlineId;
              var menu_selector = attrs.ckeInlineMenu;
              //get editor
              //create editor if doesn't exist
              var e = CKEDITOR.instances[a_id];
              if (!e) {
                  element.menu = $(menu_selector);
                  //set up behavior for menu
                  uif.wire_up_menu(element, scope);
                  //hide all menu bars
                  $("nav.text-editor-menu-bar").hide();
                  //create editor
                  var config = {
                      toolbar: "More",
                      on: {
                          'blur': function () {
                              save_editor_content(function () {
                                  destroy_this_editor(a_id);
                              });
                          },
                          'focusout': function () {
                              save_editor_content(function () {
                                  destroy_this_editor(a_id);
                              });
                          },
                          'focus': function () {
                              //show the current menu
                              element.menu.show();
                              //fix menu width
                              uif.stretch_menu(element);
                          },
                          'instanceReady': function (event,element) {
 //----------------I think,Here i want logic to set caret sign or set mouse 
 //pointer to appropriate place
                              // event.editor.focus();
                              // element.focus();
                          }
                      }
                  };
                  if (attrs.ckeInlineToolbar) {
                      config.toolbar = attrs.ckeInlineToolbar;
                  }

                  var editor = CKEDITOR.inline(a_id, config);
                  if (attrs.ckeInlineOnInit) {
                      uif.apply_scope($rootScope, $parse(attrs.ckeInlineOnInit));
                  }
              }
              else
              {
                  e.focus();
                  element.focus();
              }
          } else
          {
              attrs.$set('contenteditable', false);
          }
    }
    element.click(function () {
      create_and_focus();
    });

    if (attrs.ckeInlineFocusWatch) {
      scope.$watch(function () {
        return $parse(attrs.ckeInlineFocusWatch);
      }, function () {
          if (attrs.ckeInlineFocusCondition == undefined || $parse(attrs.ckeInlineFocusCondition)() == true) {
            create_and_focus();
          }
        })
    }

    var saving = false;


    var save_editor_content = function (cb) {
        if (!saving)
        {
            saving = true;
            var a_id = attrs.ckeInlineId;
            if (a_id) {
                var editor = CKEDITOR.instances[a_id];
              if (editor) {
                var menu_selector = attrs.ckeInlineMenu;
                element.menu.hide();
                  //attrs.$set('contenteditable', false);
                var newValue = editor.getData().replace(/&amp;nbsp;/, ' ');
                if (ngModel.$modelValue != newValue) {
                    if (attrs.ckeInlineBlurBool) {
                        $parse(attrs.ckeInlineBlurBool).assign($rootScope, false);
                    }
                    ngModel.$setViewValue(newValue);
                    if (attrs.ckeInlineSave) {
                        uif.apply_scope(scope, $parse(attrs.ckeInlineSave));
                    }

                        $timeout(function () {
                            saving = false;
                            if (cb) cb();
                        }, 1100)
                } else
                {
                    saving = false;
                    $rootScope.setup.blcok_edits = false;
                    $rootScope.setup.block_all_editors = false;
                    if (cb) cb();
                }
              }
            }
            else
            {
                saving = false;
            }
        }
    };
  } else if (attrs.ckeNonEditMode) {
    attrs.$set('contenteditable', true);
    element.blur(function () {
      ngModel.$setViewValue(element.html().replace(/&amp;nbsp;/, ' '));
      if (attrs.ckeInlineSave) {
        uif.apply_scope(scope, $parse(attrs.ckeInlineSave));
      }
    })
  }
}
}
});
</code></pre>