• bindTwoStepCaretToAttribute( options = { options.view, options.model, options.emitter, options.attribute, options.locale } )


    This helper enables the two-step caret (phantom) movement behavior for the given Model attribute on arrow right () and left () key press.

    Thanks to this (phantom) caret movement the user is able to type before/after as well as at the beginning/end of an attribute.

    Note: This helper support right–to–left (Arabic, Hebrew, etc.) content by mirroring its behavior but for the sake of simplicity examples showcase only left–to–right use–cases.

    Forward movement

    "Entering" an attribute:

    When this behavior is enabled for the a attribute and the selection is right before it (at the attribute boundary), pressing the right arrow key will not move the selection but update its attributes accordingly:

    • When enabled:

      foo{}<$text a="true">bar</$text>

      foo<$text a="true">{}bar</$text>
    • When disabled:

      foo{}<$text a="true">bar</$text>

      foo<$text a="true">b{}ar</$text>
    "Leaving" an attribute:
    • When enabled:

      <$text a="true">bar{}</$text>baz

      <$text a="true">bar</$text>{}baz
    • When disabled:

      <$text a="true">bar{}</$text>baz

      <$text a="true">bar</$text>b{}az

    Backward movement

    • When enabled:

      <$text a="true">bar</$text>{}baz

      <$text a="true">bar{}</$text>baz
    • When disabled:

      <$text a="true">bar</$text>{}baz

      <$text a="true">ba{}r</$text>b{}az


    options : Object

    Helper options.

    options.view : View

    View controller instance.

    options.model : Model

    Data model instance.

    options.emitter : Emitter

    The emitter to which this behavior should be added (e.g. a plugin instance).

    options.attribute : String

    Attribute for which this behavior will be added.

    options.locale : Locale

    The locale instance.