Sha256: 220b091dad8ef21976854408389910f0b2e0d227e31469e59efd8c2a0cc24603
Contents?: true
Size: 921 Bytes
Versions: 4
Compression:
Stored size: 921 Bytes
Contents
#= require trix/inspector/view Trix.Inspector.registerView class extends Trix.Inspector.View title: "Selection" template: "selection" events: "trix-selection-change": -> @render() "trix-render": -> @render() render: -> @document = @editor.getDocument() @range = @editor.getSelectedRange() @locationRange = @composition.getLocationRange() @characters = @getCharacters() super getCharacters: -> chars = [] utf16string = Trix.UTF16String.box(@document.toString()) rangeIsExpanded = @range[0] isnt @range[1] position = 0 while position < utf16string.length string = utf16string.charAt(position).toString() string = "⏎" if string is "\n" selected = rangeIsExpanded and (position >= @range[0] and position < @range[1]) chars.push({string, selected}) position++ chars getTitle: -> "#{@title} (#{@range.join()})"
Version data entries
4 entries across 4 versions & 1 rubygems