• Jump To … +
    app.litcoffee csv.litcoffee config.litcoffee contents.litcoffee publish.litcoffee revise.litcoffee transform.litcoffee main.litcoffee rdb.litcoffee config.litcoffee contents.litcoffee publish.litcoffee revise.litcoffee transform.litcoffee columntip.litcoffee cursor.litcoffee rdfbadge.litcoffee wizard.litcoffee score.litcoffee config.litcoffee csv.litcoffee oracle.litcoffee rdb.litcoffee rdf.litcoffee sml.litcoffee transform.litcoffee underscore.litcoffee
  • ¶

    The ‘cursorpos’ directive

    Needs an overhaul. Tracks the current position of the cursor within the subjectTemplate input.

    'use strict'
    
    app = angular.module 'r2rDesignerApp'
    
    app.directive 'cursor', () ->
      restrict: 'A'
      scope:
        content: '='
        cursorpos: '='
      controller: ($scope) ->
      link: (scope, element, attrs) ->
        element.on 'keyup', () ->
          scope.cursorpos = element.prop 'selectionStart'
          scope.$apply()
        element.on 'click', () ->
          scope.cursorpos = element.prop 'selectionStart'
          scope.$apply()