dante-editor 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +6 -0
 - data/app/assets/javascripts/dante.js +7 -6
 - data/app/assets/javascripts/dante/article.js.coffee +56 -0
 - data/app/assets/javascripts/dante/behaviors/image.js.coffee +9 -9
 - data/app/assets/javascripts/dante/behaviors/list.js.coffee +2 -2
 - data/app/assets/javascripts/dante/behaviors/paste.js.coffee +3 -0
 - data/app/assets/javascripts/dante/dante.js.coffee.erb +2 -0
 - data/app/assets/javascripts/dante/editor.js.coffee +71 -40
 - data/app/assets/javascripts/dante/popovers/anchor.js.coffee +82 -0
 - data/app/assets/javascripts/dante/popovers/card.js.coffee +103 -0
 - data/app/assets/javascripts/dante/popovers/image.js.coffee +112 -0
 - data/app/assets/javascripts/dante/popovers/typeahead.js.coffee +125 -0
 - data/app/assets/javascripts/dante/tooltip_widgets/embed.js.coffee +3 -3
 - data/app/assets/javascripts/dante/tooltip_widgets/extract.js.coffee +12 -3
 - data/app/assets/javascripts/dante/tooltip_widgets/uploader.js.coffee +1 -1
 - data/bower.json +1 -1
 - data/dist/js/dante-editor.js +608 -455
 - data/lib/dante-editor/version.rb +1 -1
 - data/source/non_editable.erb +45 -0
 - data/source/partials/_existing_content.erb +35 -0
 - metadata +9 -3
 - data/app/assets/javascripts/dante/popover.js.coffee +0 -424
 
| 
         @@ -20,7 +20,7 @@ class Dante.View.TooltipWidget.Uploader extends Dante.View.TooltipWidget 
     | 
|
| 
       20 
20 
     | 
    
         
             
                    <img src='' data-height='' data-width='' data-image-id='' class='graf-image' data-delayed-src=''>
         
     | 
| 
       21 
21 
     | 
    
         
             
                  </div>
         
     | 
| 
       22 
22 
     | 
    
         
             
                  <figcaption contenteditable='true' data-default-value='Type caption for image (optional)' class='imageCaption'>
         
     | 
| 
       23 
     | 
    
         
            -
                    <span class='defaultValue' 
     | 
| 
      
 23 
     | 
    
         
            +
                    <span class='defaultValue'>#{@current_editor.image_caption_placeholder}</span>
         
     | 
| 
       24 
24 
     | 
    
         
             
                    <br>
         
     | 
| 
       25 
25 
     | 
    
         
             
                  </figcaption>
         
     | 
| 
       26 
26 
     | 
    
         
             
                </figure>"
         
     | 
    
        data/bower.json
    CHANGED
    
    
    
        data/dist/js/dante-editor.js
    CHANGED
    
    | 
         @@ -5,10 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
                  PopOver: {},
         
     | 
| 
       6 
6 
     | 
    
         
             
                  Menu: {}
         
     | 
| 
       7 
7 
     | 
    
         
             
                },
         
     | 
| 
      
 8 
     | 
    
         
            +
                Article: {},
         
     | 
| 
       8 
9 
     | 
    
         
             
                defaults: {
         
     | 
| 
       9 
10 
     | 
    
         
             
                  image_placeholder: '../images/dante/media-loading-placeholder.png'
         
     | 
| 
       10 
11 
     | 
    
         
             
                },
         
     | 
| 
       11 
     | 
    
         
            -
                version: "0.1. 
     | 
| 
      
 12 
     | 
    
         
            +
                version: "0.1.7"
         
     | 
| 
       12 
13 
     | 
    
         
             
              };
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
            }).call(this);
         
     | 
| 
         @@ -483,7 +484,7 @@ 
     | 
|
| 
       483 
484 
     | 
    
         
             
                };
         
     | 
| 
       484 
485 
     | 
    
         | 
| 
       485 
486 
     | 
    
         
             
                Editor.prototype.initialize = function(opts) {
         
     | 
| 
       486 
     | 
    
         
            -
                  var bodyplaceholder, embedplaceholder, extractplaceholder,  
     | 
| 
      
 487 
     | 
    
         
            +
                  var bodyplaceholder, embedplaceholder, extractplaceholder, titleplaceholder;
         
     | 
| 
       487 
488 
     | 
    
         
             
                  if (opts == null) {
         
     | 
| 
       488 
489 
     | 
    
         
             
                    opts = {};
         
     | 
| 
       489 
490 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -495,9 +496,11 @@ 
     | 
|
| 
       495 
496 
     | 
    
         
             
                  this.upload_url = opts.upload_url || "/uploads.json";
         
     | 
| 
       496 
497 
     | 
    
         
             
                  this.upload_callback = opts.upload_callback;
         
     | 
| 
       497 
498 
     | 
    
         
             
                  this.image_delete_callback = opts.image_delete_callback;
         
     | 
| 
      
 499 
     | 
    
         
            +
                  this.image_caption_placeholder = opts.image_caption_placeholder || "Type caption for image (optional)";
         
     | 
| 
       498 
500 
     | 
    
         
             
                  this.oembed_url = opts.oembed_url || ("http://api.embed.ly/1/oembed?key=" + opts.api_key + "&url=");
         
     | 
| 
       499 
501 
     | 
    
         
             
                  this.extract_url = opts.extract_url || ("http://api.embed.ly/1/extract?key=" + opts.api_key + "&url=");
         
     | 
| 
       500 
502 
     | 
    
         
             
                  this.default_loading_placeholder = opts.default_loading_placeholder || Dante.defaults.image_placeholder;
         
     | 
| 
      
 503 
     | 
    
         
            +
                  this.embed_caption_placeholder = opts.embed_caption_placeholder || "Type caption for embed (optional)";
         
     | 
| 
       501 
504 
     | 
    
         
             
                  this.store_url = opts.store_url;
         
     | 
| 
       502 
505 
     | 
    
         
             
                  this.store_method = opts.store_method || "POST";
         
     | 
| 
       503 
506 
     | 
    
         
             
                  this.store_success_handler = opts.store_success_handler;
         
     | 
| 
         @@ -513,16 +516,17 @@ 
     | 
|
| 
       513 
516 
     | 
    
         
             
                  this.suggest_resource_handler = opts.suggest_resource_handler || null;
         
     | 
| 
       514 
517 
     | 
    
         
             
                  opts.base_widgets || (opts.base_widgets = ["uploader", "embed", "embed_extract"]);
         
     | 
| 
       515 
518 
     | 
    
         
             
                  opts.base_behaviors || (opts.base_behaviors = ["save", "image", "paste", "list", "suggest"]);
         
     | 
| 
      
 519 
     | 
    
         
            +
                  opts.base_popovers || (opts.base_popovers = ["anchor", "typeahead", "card", "align"]);
         
     | 
| 
       516 
520 
     | 
    
         
             
                  this.widgets = [];
         
     | 
| 
       517 
521 
     | 
    
         
             
                  this.behaviors = [];
         
     | 
| 
      
 522 
     | 
    
         
            +
                  this.popovers = [];
         
     | 
| 
       518 
523 
     | 
    
         
             
                  window.debugMode = opts.debug || false;
         
     | 
| 
       519 
524 
     | 
    
         
             
                  if (window.debugMode) {
         
     | 
| 
       520 
525 
     | 
    
         
             
                    $(this.el).addClass("debug");
         
     | 
| 
       521 
526 
     | 
    
         
             
                  }
         
     | 
| 
       522 
527 
     | 
    
         
             
                  titleplaceholder = opts.title_placeholder || 'Title';
         
     | 
| 
       523 
528 
     | 
    
         
             
                  this.title_placeholder = "<span class='defaultValue defaultValue--root'>" + titleplaceholder + "</span><br>";
         
     | 
| 
       524 
     | 
    
         
            -
                  title = opts.title || '';
         
     | 
| 
       525 
     | 
    
         
            -
                  this.title = title;
         
     | 
| 
      
 529 
     | 
    
         
            +
                  this.title = opts.title || '';
         
     | 
| 
       526 
530 
     | 
    
         
             
                  bodyplaceholder = opts.body_placeholder || 'Tell your story…';
         
     | 
| 
       527 
531 
     | 
    
         
             
                  this.body_placeholder = "<span class='defaultValue defaultValue--root'>" + bodyplaceholder + "</span><br>";
         
     | 
| 
       528 
532 
     | 
    
         
             
                  embedplaceholder = opts.embed_placeholder || 'Paste a YouTube, Vine, Vimeo, or other video link, and press Enter';
         
     | 
| 
         @@ -617,6 +621,49 @@ 
     | 
|
| 
       617 
621 
     | 
    
         
             
                  }
         
     | 
| 
       618 
622 
     | 
    
         
             
                };
         
     | 
| 
       619 
623 
     | 
    
         | 
| 
      
 624 
     | 
    
         
            +
                Editor.prototype.intializePopOvers = function(opts) {
         
     | 
| 
      
 625 
     | 
    
         
            +
                  var base_popovers, self;
         
     | 
| 
      
 626 
     | 
    
         
            +
                  base_popovers = opts.base_popovers;
         
     | 
| 
      
 627 
     | 
    
         
            +
                  self = this;
         
     | 
| 
      
 628 
     | 
    
         
            +
                  if (base_popovers.indexOf("anchor") >= 0) {
         
     | 
| 
      
 629 
     | 
    
         
            +
                    this.pop_over = new Dante.Editor.PopOver({
         
     | 
| 
      
 630 
     | 
    
         
            +
                      editor: this
         
     | 
| 
      
 631 
     | 
    
         
            +
                    });
         
     | 
| 
      
 632 
     | 
    
         
            +
                    this.pop_over.render().hide();
         
     | 
| 
      
 633 
     | 
    
         
            +
                  }
         
     | 
| 
      
 634 
     | 
    
         
            +
                  if (base_popovers.indexOf("typeahead") >= 0) {
         
     | 
| 
      
 635 
     | 
    
         
            +
                    this.pop_over_typeahead = new Dante.Editor.PopOverTypeAhead({
         
     | 
| 
      
 636 
     | 
    
         
            +
                      editor: this
         
     | 
| 
      
 637 
     | 
    
         
            +
                    });
         
     | 
| 
      
 638 
     | 
    
         
            +
                    this.popovers.push(this.pop_over_typeahead);
         
     | 
| 
      
 639 
     | 
    
         
            +
                  }
         
     | 
| 
      
 640 
     | 
    
         
            +
                  if (base_popovers.indexOf("card") >= 0) {
         
     | 
| 
      
 641 
     | 
    
         
            +
                    this.pop_over_card = new Dante.Editor.PopOverCard({
         
     | 
| 
      
 642 
     | 
    
         
            +
                      editor: this
         
     | 
| 
      
 643 
     | 
    
         
            +
                    });
         
     | 
| 
      
 644 
     | 
    
         
            +
                    this.popovers.push(this.pop_over_card);
         
     | 
| 
      
 645 
     | 
    
         
            +
                  }
         
     | 
| 
      
 646 
     | 
    
         
            +
                  if (base_popovers.indexOf("align") >= 0) {
         
     | 
| 
      
 647 
     | 
    
         
            +
                    this.pop_over_align = new Dante.Editor.ImageTooltip({
         
     | 
| 
      
 648 
     | 
    
         
            +
                      editor: this
         
     | 
| 
      
 649 
     | 
    
         
            +
                    });
         
     | 
| 
      
 650 
     | 
    
         
            +
                    this.popovers.push(this.pop_over_align);
         
     | 
| 
      
 651 
     | 
    
         
            +
                  }
         
     | 
| 
      
 652 
     | 
    
         
            +
                  if (opts.extra_popovers) {
         
     | 
| 
      
 653 
     | 
    
         
            +
                    _.each(opts.extra_popovers, (function(_this) {
         
     | 
| 
      
 654 
     | 
    
         
            +
                      return function(w) {
         
     | 
| 
      
 655 
     | 
    
         
            +
                        if (!w.current_editor) {
         
     | 
| 
      
 656 
     | 
    
         
            +
                          w.current_editor = self;
         
     | 
| 
      
 657 
     | 
    
         
            +
                        }
         
     | 
| 
      
 658 
     | 
    
         
            +
                        return _this.popovers.push(w);
         
     | 
| 
      
 659 
     | 
    
         
            +
                      };
         
     | 
| 
      
 660 
     | 
    
         
            +
                    })(this));
         
     | 
| 
      
 661 
     | 
    
         
            +
                  }
         
     | 
| 
      
 662 
     | 
    
         
            +
                  return this.popovers.forEach(function(p) {
         
     | 
| 
      
 663 
     | 
    
         
            +
                    return p.render().hide();
         
     | 
| 
      
 664 
     | 
    
         
            +
                  });
         
     | 
| 
      
 665 
     | 
    
         
            +
                };
         
     | 
| 
      
 666 
     | 
    
         
            +
             
     | 
| 
       620 
667 
     | 
    
         
             
                Editor.prototype.getContent = function() {
         
     | 
| 
       621 
668 
     | 
    
         
             
                  return $(this.el).find(".section-inner").html();
         
     | 
| 
       622 
669 
     | 
    
         
             
                };
         
     | 
| 
         @@ -643,22 +690,7 @@ 
     | 
|
| 
       643 
690 
     | 
    
         
             
                    editor: this,
         
     | 
| 
       644 
691 
     | 
    
         
             
                    widgets: this.widgets
         
     | 
| 
       645 
692 
     | 
    
         
             
                  });
         
     | 
| 
       646 
     | 
    
         
            -
                  this. 
     | 
| 
       647 
     | 
    
         
            -
                    editor: this
         
     | 
| 
       648 
     | 
    
         
            -
                  });
         
     | 
| 
       649 
     | 
    
         
            -
                  this.pop_over.render().hide();
         
     | 
| 
       650 
     | 
    
         
            -
                  this.pop_over_typeahead = new Dante.Editor.PopOverTypeAhead({
         
     | 
| 
       651 
     | 
    
         
            -
                    editor: this
         
     | 
| 
       652 
     | 
    
         
            -
                  });
         
     | 
| 
       653 
     | 
    
         
            -
                  this.pop_over_typeahead.render().hide();
         
     | 
| 
       654 
     | 
    
         
            -
                  this.pop_over_card = new Dante.Editor.PopOverCard({
         
     | 
| 
       655 
     | 
    
         
            -
                    editor: this
         
     | 
| 
       656 
     | 
    
         
            -
                  });
         
     | 
| 
       657 
     | 
    
         
            -
                  this.pop_over_card.render().hide();
         
     | 
| 
       658 
     | 
    
         
            -
                  this.pop_over_align = new Dante.Editor.ImageTooltip({
         
     | 
| 
       659 
     | 
    
         
            -
                    editor: this
         
     | 
| 
       660 
     | 
    
         
            -
                  });
         
     | 
| 
       661 
     | 
    
         
            -
                  this.pop_over_align.render().hide();
         
     | 
| 
      
 693 
     | 
    
         
            +
                  this.intializePopOvers(this.editor_options);
         
     | 
| 
       662 
694 
     | 
    
         
             
                  return this.tooltip_view.render().hide();
         
     | 
| 
       663 
695 
     | 
    
         
             
                };
         
     | 
| 
       664 
696 
     | 
    
         | 
| 
         @@ -1051,7 +1083,7 @@ 
     | 
|
| 
       1051 
1083 
     | 
    
         
             
                    } else if (!prev) {
         
     | 
| 
       1052 
1084 
     | 
    
         
             
                      this.setRangeAt(this.$el.find(".section-inner p")[0]);
         
     | 
| 
       1053 
1085 
     | 
    
         
             
                    }
         
     | 
| 
       1054 
     | 
    
         
            -
                    return this.displayTooltipAt( 
     | 
| 
      
 1086 
     | 
    
         
            +
                    return this.displayTooltipAt(this.findSelected());
         
     | 
| 
       1055 
1087 
     | 
    
         
             
                  }
         
     | 
| 
       1056 
1088 
     | 
    
         
             
                };
         
     | 
| 
       1057 
1089 
     | 
    
         | 
| 
         @@ -1101,22 +1133,12 @@ 
     | 
|
| 
       1101 
1133 
     | 
    
         
             
                    this.markAsSelected(anchor_node);
         
     | 
| 
       1102 
1134 
     | 
    
         
             
                  }
         
     | 
| 
       1103 
1135 
     | 
    
         
             
                  utils.log("HANDLING Behavior KEYDOWN");
         
     | 
| 
       1104 
     | 
    
         
            -
                  _.each(this.behaviors, (function(_this) {
         
     | 
| 
       1105 
     | 
    
         
            -
                    return function(b) {
         
     | 
| 
       1106 
     | 
    
         
            -
                      if (b.handleKeyDown) {
         
     | 
| 
       1107 
     | 
    
         
            -
                        return b.handleKeyDown(e, parent);
         
     | 
| 
       1108 
     | 
    
         
            -
                      }
         
     | 
| 
       1109 
     | 
    
         
            -
                    };
         
     | 
| 
       1110 
     | 
    
         
            -
                  })(this));
         
     | 
| 
       1111 
     | 
    
         
            -
                  if (!this["continue"]) {
         
     | 
| 
       1112 
     | 
    
         
            -
                    return false;
         
     | 
| 
       1113 
     | 
    
         
            -
                  }
         
     | 
| 
       1114 
1136 
     | 
    
         
             
                  if (e.which === TAB) {
         
     | 
| 
       1115 
1137 
     | 
    
         
             
                    this.handleTab(anchor_node);
         
     | 
| 
       1116 
1138 
     | 
    
         
             
                    return false;
         
     | 
| 
       1117 
1139 
     | 
    
         
             
                  }
         
     | 
| 
       1118 
1140 
     | 
    
         
             
                  if (e.which === ENTER) {
         
     | 
| 
       1119 
     | 
    
         
            -
                     
     | 
| 
      
 1141 
     | 
    
         
            +
                    this.findSelected().removeClass("is-selected");
         
     | 
| 
       1120 
1142 
     | 
    
         
             
                    utils.log(this.isLastChar());
         
     | 
| 
       1121 
1143 
     | 
    
         
             
                    utils.log("HANDLING WIDGET ENTER");
         
     | 
| 
       1122 
1144 
     | 
    
         
             
                    _.each(this.widgets, (function(_this) {
         
     | 
| 
         @@ -1135,8 +1157,8 @@ 
     | 
|
| 
       1135 
1157 
     | 
    
         
             
                    if (parent.hasClass("graf--iframe") || parent.hasClass("graf--figure")) {
         
     | 
| 
       1136 
1158 
     | 
    
         
             
                      if (this.isLastChar()) {
         
     | 
| 
       1137 
1159 
     | 
    
         
             
                        this.handleLineBreakWith("p", parent);
         
     | 
| 
       1138 
     | 
    
         
            -
                        this.setRangeAtText( 
     | 
| 
       1139 
     | 
    
         
            -
                         
     | 
| 
      
 1160 
     | 
    
         
            +
                        this.setRangeAtText(this.findSelected()[0]);
         
     | 
| 
      
 1161 
     | 
    
         
            +
                        this.findSelected().trigger("mouseup");
         
     | 
| 
       1140 
1162 
     | 
    
         
             
                        return false;
         
     | 
| 
       1141 
1163 
     | 
    
         
             
                      } else {
         
     | 
| 
       1142 
1164 
     | 
    
         
             
                        return false;
         
     | 
| 
         @@ -1169,7 +1191,7 @@ 
     | 
|
| 
       1169 
1191 
     | 
    
         
             
                          });
         
     | 
| 
       1170 
1192 
     | 
    
         
             
                          $(node).append("<br>");
         
     | 
| 
       1171 
1193 
     | 
    
         
             
                        }
         
     | 
| 
       1172 
     | 
    
         
            -
                        return _this.displayTooltipAt( 
     | 
| 
      
 1194 
     | 
    
         
            +
                        return _this.displayTooltipAt(_this.findSelected());
         
     | 
| 
       1173 
1195 
     | 
    
         
             
                      };
         
     | 
| 
       1174 
1196 
     | 
    
         
             
                    })(this), 2);
         
     | 
| 
       1175 
1197 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -1215,9 +1237,19 @@ 
     | 
|
| 
       1215 
1237 
     | 
    
         
             
                  if (anchor_node) {
         
     | 
| 
       1216 
1238 
     | 
    
         
             
                    if (!_.isEmpty($(anchor_node).text())) {
         
     | 
| 
       1217 
1239 
     | 
    
         
             
                      this.tooltip_view.hide();
         
     | 
| 
       1218 
     | 
    
         
            -
                       
     | 
| 
      
 1240 
     | 
    
         
            +
                      $(anchor_node).removeClass("graf--empty");
         
     | 
| 
       1219 
1241 
     | 
    
         
             
                    }
         
     | 
| 
       1220 
1242 
     | 
    
         
             
                  }
         
     | 
| 
      
 1243 
     | 
    
         
            +
                  _.each(this.behaviors, (function(_this) {
         
     | 
| 
      
 1244 
     | 
    
         
            +
                    return function(b) {
         
     | 
| 
      
 1245 
     | 
    
         
            +
                      if (b.handleKeyDown) {
         
     | 
| 
      
 1246 
     | 
    
         
            +
                        return b.handleKeyDown(e, parent);
         
     | 
| 
      
 1247 
     | 
    
         
            +
                      }
         
     | 
| 
      
 1248 
     | 
    
         
            +
                    };
         
     | 
| 
      
 1249 
     | 
    
         
            +
                  })(this));
         
     | 
| 
      
 1250 
     | 
    
         
            +
                  if (!this["continue"]) {
         
     | 
| 
      
 1251 
     | 
    
         
            +
                    return false;
         
     | 
| 
      
 1252 
     | 
    
         
            +
                  }
         
     | 
| 
       1221 
1253 
     | 
    
         
             
                };
         
     | 
| 
       1222 
1254 
     | 
    
         | 
| 
       1223 
1255 
     | 
    
         
             
                Editor.prototype.handleKeyUp = function(e, node) {
         
     | 
| 
         @@ -1234,17 +1266,6 @@ 
     | 
|
| 
       1234 
1266 
     | 
    
         
             
                  anchor_node = this.getNode();
         
     | 
| 
       1235 
1267 
     | 
    
         
             
                  utils_anchor_node = utils.getNode();
         
     | 
| 
       1236 
1268 
     | 
    
         
             
                  this.handleTextSelection(anchor_node);
         
     | 
| 
       1237 
     | 
    
         
            -
                  utils.log("HANDLING Behavior KEYUPS");
         
     | 
| 
       1238 
     | 
    
         
            -
                  _.each(this.behaviors, (function(_this) {
         
     | 
| 
       1239 
     | 
    
         
            -
                    return function(b) {
         
     | 
| 
       1240 
     | 
    
         
            -
                      if (b.handleKeyUp) {
         
     | 
| 
       1241 
     | 
    
         
            -
                        return b.handleKeyUp(e);
         
     | 
| 
       1242 
     | 
    
         
            -
                      }
         
     | 
| 
       1243 
     | 
    
         
            -
                    };
         
     | 
| 
       1244 
     | 
    
         
            -
                  })(this));
         
     | 
| 
       1245 
     | 
    
         
            -
                  if (!this["continue"]) {
         
     | 
| 
       1246 
     | 
    
         
            -
                    return false;
         
     | 
| 
       1247 
     | 
    
         
            -
                  }
         
     | 
| 
       1248 
1269 
     | 
    
         
             
                  if (e.which === BACKSPACE) {
         
     | 
| 
       1249 
1270 
     | 
    
         
             
                    if ($(utils_anchor_node).hasClass("postField--body")) {
         
     | 
| 
       1250 
1271 
     | 
    
         
             
                      utils.log("ALL GONE from UP");
         
     | 
| 
         @@ -1282,7 +1303,18 @@ 
     | 
|
| 
       1282 
1303 
     | 
    
         
             
                    }
         
     | 
| 
       1283 
1304 
     | 
    
         
             
                  }
         
     | 
| 
       1284 
1305 
     | 
    
         
             
                  if (_.contains([LEFTARROW, UPARROW, RIGHTARROW, DOWNARROW], e.which)) {
         
     | 
| 
       1285 
     | 
    
         
            -
                     
     | 
| 
      
 1306 
     | 
    
         
            +
                    this.handleArrowForKeyUp(e);
         
     | 
| 
      
 1307 
     | 
    
         
            +
                  }
         
     | 
| 
      
 1308 
     | 
    
         
            +
                  utils.log("HANDLING Behavior KEYUPS");
         
     | 
| 
      
 1309 
     | 
    
         
            +
                  _.each(this.behaviors, (function(_this) {
         
     | 
| 
      
 1310 
     | 
    
         
            +
                    return function(b) {
         
     | 
| 
      
 1311 
     | 
    
         
            +
                      if (b.handleKeyUp) {
         
     | 
| 
      
 1312 
     | 
    
         
            +
                        return b.handleKeyUp(e);
         
     | 
| 
      
 1313 
     | 
    
         
            +
                      }
         
     | 
| 
      
 1314 
     | 
    
         
            +
                    };
         
     | 
| 
      
 1315 
     | 
    
         
            +
                  })(this));
         
     | 
| 
      
 1316 
     | 
    
         
            +
                  if (!this["continue"]) {
         
     | 
| 
      
 1317 
     | 
    
         
            +
                    return false;
         
     | 
| 
       1286 
1318 
     | 
    
         
             
                  }
         
     | 
| 
       1287 
1319 
     | 
    
         
             
                };
         
     | 
| 
       1288 
1320 
     | 
    
         | 
| 
         @@ -1290,6 +1322,7 @@ 
     | 
|
| 
       1290 
1322 
     | 
    
         
             
                  var anchor_node, parent;
         
     | 
| 
       1291 
1323 
     | 
    
         
             
                  anchor_node = this.getNode();
         
     | 
| 
       1292 
1324 
     | 
    
         
             
                  parent = $(anchor_node);
         
     | 
| 
      
 1325 
     | 
    
         
            +
                  this.hidePlaceholder(parent);
         
     | 
| 
       1293 
1326 
     | 
    
         
             
                  utils.log("HANDLING Behavior KEYPRESS");
         
     | 
| 
       1294 
1327 
     | 
    
         
             
                  return _.each(this.behaviors, (function(_this) {
         
     | 
| 
       1295 
1328 
     | 
    
         
             
                    return function(b) {
         
     | 
| 
         @@ -1341,7 +1374,7 @@ 
     | 
|
| 
       1341 
1374 
     | 
    
         
             
                  if (_.isUndefined(element)) {
         
     | 
| 
       1342 
1375 
     | 
    
         
             
                    return;
         
     | 
| 
       1343 
1376 
     | 
    
         
             
                  }
         
     | 
| 
       1344 
     | 
    
         
            -
                   
     | 
| 
      
 1377 
     | 
    
         
            +
                  this.findSelected().removeClass("is-mediaFocused is-selected");
         
     | 
| 
       1345 
1378 
     | 
    
         
             
                  $(element).addClass("is-selected");
         
     | 
| 
       1346 
1379 
     | 
    
         
             
                  if ($(element).hasClass("graf--first")) {
         
     | 
| 
       1347 
1380 
     | 
    
         
             
                    this.reachedTop = true;
         
     | 
| 
         @@ -1623,182 +1656,118 @@ 
     | 
|
| 
       1623 
1656 
     | 
    
         
             
                  return $item;
         
     | 
| 
       1624 
1657 
     | 
    
         
             
                };
         
     | 
| 
       1625 
1658 
     | 
    
         | 
| 
      
 1659 
     | 
    
         
            +
                Editor.prototype.findSelected = function() {
         
     | 
| 
      
 1660 
     | 
    
         
            +
                  return $(this.el).find(".is-selected");
         
     | 
| 
      
 1661 
     | 
    
         
            +
                };
         
     | 
| 
      
 1662 
     | 
    
         
            +
             
     | 
| 
       1626 
1663 
     | 
    
         
             
                return Editor;
         
     | 
| 
       1627 
1664 
     | 
    
         | 
| 
       1628 
1665 
     | 
    
         
             
              })(Dante.View);
         
     | 
| 
       1629 
1666 
     | 
    
         | 
| 
       1630 
1667 
     | 
    
         
             
            }).call(this);
         
     | 
| 
       1631 
1668 
     | 
    
         
             
            (function() {
         
     | 
| 
       1632 
     | 
    
         
            -
              var  
     | 
| 
      
 1669 
     | 
    
         
            +
              var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
         
     | 
| 
      
 1670 
     | 
    
         
            +
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
       1633 
1671 
     | 
    
         
             
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
       1634 
1672 
     | 
    
         | 
| 
       1635 
     | 
    
         
            -
              Dante. 
     | 
| 
       1636 
     | 
    
         
            -
                __extends( 
     | 
| 
      
 1673 
     | 
    
         
            +
              Dante.Article = (function(_super) {
         
     | 
| 
      
 1674 
     | 
    
         
            +
                __extends(Article, _super);
         
     | 
| 
       1637 
1675 
     | 
    
         | 
| 
       1638 
     | 
    
         
            -
                function  
     | 
| 
       1639 
     | 
    
         
            -
                   
     | 
| 
      
 1676 
     | 
    
         
            +
                function Article() {
         
     | 
| 
      
 1677 
     | 
    
         
            +
                  this.start = __bind(this.start, this);
         
     | 
| 
      
 1678 
     | 
    
         
            +
                  return Article.__super__.constructor.apply(this, arguments);
         
     | 
| 
       1640 
1679 
     | 
    
         
             
                }
         
     | 
| 
       1641 
1680 
     | 
    
         | 
| 
       1642 
     | 
    
         
            -
                 
     | 
| 
       1643 
     | 
    
         
            -
             
     | 
| 
       1644 
     | 
    
         
            -
              })(Dante.View);
         
     | 
| 
       1645 
     | 
    
         
            -
             
     | 
| 
       1646 
     | 
    
         
            -
            }).call(this);
         
     | 
| 
       1647 
     | 
    
         
            -
            (function() {
         
     | 
| 
       1648 
     | 
    
         
            -
              var utils,
         
     | 
| 
       1649 
     | 
    
         
            -
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
       1650 
     | 
    
         
            -
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
       1651 
     | 
    
         
            -
             
     | 
| 
       1652 
     | 
    
         
            -
              utils = Dante.utils;
         
     | 
| 
       1653 
     | 
    
         
            -
             
     | 
| 
       1654 
     | 
    
         
            -
              Dante.View.Behavior.Suggest = (function(_super) {
         
     | 
| 
       1655 
     | 
    
         
            -
                __extends(Suggest, _super);
         
     | 
| 
      
 1681 
     | 
    
         
            +
                Article.prototype.el = "body";
         
     | 
| 
       1656 
1682 
     | 
    
         | 
| 
       1657 
     | 
    
         
            -
                 
     | 
| 
       1658 
     | 
    
         
            -
                   
     | 
| 
       1659 
     | 
    
         
            -
             
     | 
| 
      
 1683 
     | 
    
         
            +
                Article.prototype.events = {
         
     | 
| 
      
 1684 
     | 
    
         
            +
                  "mouseover .markup--anchor": "displayPopOver",
         
     | 
| 
      
 1685 
     | 
    
         
            +
                  "mouseout  .markup--anchor": "hidePopOver"
         
     | 
| 
      
 1686 
     | 
    
         
            +
                };
         
     | 
| 
       1660 
1687 
     | 
    
         | 
| 
       1661 
     | 
    
         
            -
                 
     | 
| 
      
 1688 
     | 
    
         
            +
                Article.prototype.initialize = function(opts) {
         
     | 
| 
       1662 
1689 
     | 
    
         
             
                  if (opts == null) {
         
     | 
| 
       1663 
1690 
     | 
    
         
             
                    opts = {};
         
     | 
| 
       1664 
1691 
     | 
    
         
             
                  }
         
     | 
| 
       1665 
     | 
    
         
            -
                  this. 
     | 
| 
       1666 
     | 
    
         
            -
                  this. 
     | 
| 
       1667 
     | 
    
         
            -
                   
     | 
| 
       1668 
     | 
    
         
            -
                  return this.fetch_results = [];
         
     | 
| 
      
 1692 
     | 
    
         
            +
                  this.options = opts;
         
     | 
| 
      
 1693 
     | 
    
         
            +
                  this.popovers = [];
         
     | 
| 
      
 1694 
     | 
    
         
            +
                  return opts.base_popovers || (opts.base_popovers = ["anchor", "card"]);
         
     | 
| 
       1669 
1695 
     | 
    
         
             
                };
         
     | 
| 
       1670 
1696 
     | 
    
         | 
| 
       1671 
     | 
    
         
            -
                 
     | 
| 
       1672 
     | 
    
         
            -
                   
     | 
| 
      
 1697 
     | 
    
         
            +
                Article.prototype.start = function() {
         
     | 
| 
      
 1698 
     | 
    
         
            +
                  this.render();
         
     | 
| 
      
 1699 
     | 
    
         
            +
                  return this.appendMenus();
         
     | 
| 
       1673 
1700 
     | 
    
         
             
                };
         
     | 
| 
       1674 
1701 
     | 
    
         | 
| 
       1675 
     | 
    
         
            -
                 
     | 
| 
       1676 
     | 
    
         
            -
                   
     | 
| 
       1677 
     | 
    
         
            -
                  return this. 
     | 
| 
      
 1702 
     | 
    
         
            +
                Article.prototype.appendMenus = function() {
         
     | 
| 
      
 1703 
     | 
    
         
            +
                  this.intializePopOvers(this.options);
         
     | 
| 
      
 1704 
     | 
    
         
            +
                  return this.removeEditables();
         
     | 
| 
       1678 
1705 
     | 
    
         
             
                };
         
     | 
| 
       1679 
1706 
     | 
    
         | 
| 
       1680 
     | 
    
         
            -
                 
     | 
| 
       1681 
     | 
    
         
            -
             
     | 
| 
       1682 
     | 
    
         
            -
             
     | 
| 
      
 1707 
     | 
    
         
            +
                Article.prototype.render = function() {};
         
     | 
| 
      
 1708 
     | 
    
         
            +
             
     | 
| 
      
 1709 
     | 
    
         
            +
                Article.prototype.removeEditables = function() {
         
     | 
| 
      
 1710 
     | 
    
         
            +
                  return $(this.el).find("[contenteditable]").removeAttr("contenteditable");
         
     | 
| 
       1683 
1711 
     | 
    
         
             
                };
         
     | 
| 
       1684 
1712 
     | 
    
         | 
| 
       1685 
     | 
    
         
            -
                 
     | 
| 
       1686 
     | 
    
         
            -
                   
     | 
| 
       1687 
     | 
    
         
            -
             
     | 
| 
       1688 
     | 
    
         
            -
             
     | 
| 
       1689 
     | 
    
         
            -
             
     | 
| 
       1690 
     | 
    
         
            -
                     
     | 
| 
       1691 
     | 
    
         
            -
             
     | 
| 
       1692 
     | 
    
         
            -
                     
     | 
| 
       1693 
     | 
    
         
            -
                     
     | 
| 
       1694 
     | 
    
         
            -
             
     | 
| 
       1695 
     | 
    
         
            -
             
     | 
| 
      
 1713 
     | 
    
         
            +
                Article.prototype.intializePopOvers = function(opts) {
         
     | 
| 
      
 1714 
     | 
    
         
            +
                  var base_popovers, self;
         
     | 
| 
      
 1715 
     | 
    
         
            +
                  base_popovers = opts.base_popovers;
         
     | 
| 
      
 1716 
     | 
    
         
            +
                  self = this;
         
     | 
| 
      
 1717 
     | 
    
         
            +
                  if (base_popovers.indexOf("anchor") >= 0) {
         
     | 
| 
      
 1718 
     | 
    
         
            +
                    this.pop_over = new Dante.Editor.PopOver({
         
     | 
| 
      
 1719 
     | 
    
         
            +
                      editor: this
         
     | 
| 
      
 1720 
     | 
    
         
            +
                    });
         
     | 
| 
      
 1721 
     | 
    
         
            +
                    this.popovers.push(this.pop_over);
         
     | 
| 
      
 1722 
     | 
    
         
            +
                  }
         
     | 
| 
      
 1723 
     | 
    
         
            +
                  if (base_popovers.indexOf("card") >= 0) {
         
     | 
| 
      
 1724 
     | 
    
         
            +
                    this.pop_over_card = new Dante.Editor.PopOverCard({
         
     | 
| 
      
 1725 
     | 
    
         
            +
                      editor: this
         
     | 
| 
      
 1726 
     | 
    
         
            +
                    });
         
     | 
| 
      
 1727 
     | 
    
         
            +
                    this.popovers.push(this.pop_over_card);
         
     | 
| 
      
 1728 
     | 
    
         
            +
                  }
         
     | 
| 
      
 1729 
     | 
    
         
            +
                  if (opts.extra_popovers) {
         
     | 
| 
      
 1730 
     | 
    
         
            +
                    _.each(opts.extra_popovers, (function(_this) {
         
     | 
| 
      
 1731 
     | 
    
         
            +
                      return function(w) {
         
     | 
| 
      
 1732 
     | 
    
         
            +
                        if (!w.current_editor) {
         
     | 
| 
      
 1733 
     | 
    
         
            +
                          w.current_editor = self;
         
     | 
| 
      
 1734 
     | 
    
         
            +
                        }
         
     | 
| 
      
 1735 
     | 
    
         
            +
                        return _this.popovers.push(w);
         
     | 
| 
       1696 
1736 
     | 
    
         
             
                      };
         
     | 
| 
       1697 
1737 
     | 
    
         
             
                    })(this));
         
     | 
| 
       1698 
1738 
     | 
    
         
             
                  }
         
     | 
| 
      
 1739 
     | 
    
         
            +
                  return this.popovers.forEach(function(p) {
         
     | 
| 
      
 1740 
     | 
    
         
            +
                    return p.render().hide();
         
     | 
| 
      
 1741 
     | 
    
         
            +
                  });
         
     | 
| 
       1699 
1742 
     | 
    
         
             
                };
         
     | 
| 
       1700 
1743 
     | 
    
         | 
| 
       1701 
     | 
    
         
            -
                 
     | 
| 
       1702 
     | 
    
         
            -
                   
     | 
| 
       1703 
     | 
    
         
            -
                    return this.fetchResults(e);
         
     | 
| 
       1704 
     | 
    
         
            -
                  }
         
     | 
| 
      
 1744 
     | 
    
         
            +
                Article.prototype.displayPopOver = function(ev) {
         
     | 
| 
      
 1745 
     | 
    
         
            +
                  return this.pop_over.displayAt(ev);
         
     | 
| 
       1705 
1746 
     | 
    
         
             
                };
         
     | 
| 
       1706 
1747 
     | 
    
         | 
| 
       1707 
     | 
    
         
            -
                 
     | 
| 
       1708 
     | 
    
         
            -
                   
     | 
| 
       1709 
     | 
    
         
            -
                    this.desintegratePopOver(e);
         
     | 
| 
       1710 
     | 
    
         
            -
                  }
         
     | 
| 
       1711 
     | 
    
         
            -
                  if (this.json_request) {
         
     | 
| 
       1712 
     | 
    
         
            -
                    this.json_request.abort();
         
     | 
| 
       1713 
     | 
    
         
            -
                  }
         
     | 
| 
       1714 
     | 
    
         
            -
                  return this.getResults((function(_this) {
         
     | 
| 
       1715 
     | 
    
         
            -
                    return function(e) {
         
     | 
| 
       1716 
     | 
    
         
            -
                      _this.displayPopOver(e);
         
     | 
| 
       1717 
     | 
    
         
            -
                      return _this.editor.pop_over_typeahead.appendData(_this.fetch_results);
         
     | 
| 
       1718 
     | 
    
         
            -
                    };
         
     | 
| 
       1719 
     | 
    
         
            -
                  })(this));
         
     | 
| 
      
 1748 
     | 
    
         
            +
                Article.prototype.hidePopOver = function(ev) {
         
     | 
| 
      
 1749 
     | 
    
         
            +
                  return this.pop_over.hide(ev);
         
     | 
| 
       1720 
1750 
     | 
    
         
             
                };
         
     | 
| 
       1721 
1751 
     | 
    
         | 
| 
       1722 
     | 
    
         
            -
                 
     | 
| 
       1723 
     | 
    
         
            -
                  var q;
         
     | 
| 
       1724 
     | 
    
         
            -
                  q = this.editor.getSelectionStart().textContent.replace("@", "");
         
     | 
| 
       1725 
     | 
    
         
            -
                  clearTimeout(this.timeout);
         
     | 
| 
       1726 
     | 
    
         
            -
                  return this.timeout = setTimeout((function(_this) {
         
     | 
| 
       1727 
     | 
    
         
            -
                    return function() {
         
     | 
| 
       1728 
     | 
    
         
            -
                      return _this.json_request = $.ajax({
         
     | 
| 
       1729 
     | 
    
         
            -
                        url: "" + _this.editor.suggest_url + "?" + _this.editor.suggest_query_param + "=" + q,
         
     | 
| 
       1730 
     | 
    
         
            -
                        method: "get",
         
     | 
| 
       1731 
     | 
    
         
            -
                        dataType: "json"
         
     | 
| 
       1732 
     | 
    
         
            -
                      }).success(function(data) {
         
     | 
| 
       1733 
     | 
    
         
            -
                        if (_this.editor.suggest_handler) {
         
     | 
| 
       1734 
     | 
    
         
            -
                          _this.fetch_results = _this.editor.suggest_handler(data);
         
     | 
| 
       1735 
     | 
    
         
            -
                        } else {
         
     | 
| 
       1736 
     | 
    
         
            -
                          _this.fetch_results = data;
         
     | 
| 
       1737 
     | 
    
         
            -
                        }
         
     | 
| 
       1738 
     | 
    
         
            -
                        if (cb) {
         
     | 
| 
       1739 
     | 
    
         
            -
                          return cb(e);
         
     | 
| 
       1740 
     | 
    
         
            -
                        }
         
     | 
| 
       1741 
     | 
    
         
            -
                      }).error(function(data, err) {
         
     | 
| 
       1742 
     | 
    
         
            -
                        return console.log("error fetching results");
         
     | 
| 
       1743 
     | 
    
         
            -
                      });
         
     | 
| 
       1744 
     | 
    
         
            -
                    };
         
     | 
| 
       1745 
     | 
    
         
            -
                  })(this), this.editor.suggest_query_timeout);
         
     | 
| 
       1746 
     | 
    
         
            -
                };
         
     | 
| 
      
 1752 
     | 
    
         
            +
                return Article;
         
     | 
| 
       1747 
1753 
     | 
    
         | 
| 
       1748 
     | 
    
         
            -
             
     | 
| 
       1749 
     | 
    
         
            -
                  return $(this.editor.getSelectionStart()).hasClass("markup--query");
         
     | 
| 
       1750 
     | 
    
         
            -
                };
         
     | 
| 
      
 1754 
     | 
    
         
            +
              })(Dante.View);
         
     | 
| 
       1751 
1755 
     | 
    
         | 
| 
       1752 
     | 
    
         
            -
             
     | 
| 
       1753 
     | 
    
         
            -
             
     | 
| 
       1754 
     | 
    
         
            -
             
     | 
| 
      
 1756 
     | 
    
         
            +
            }).call(this);
         
     | 
| 
      
 1757 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 1758 
     | 
    
         
            +
              var __hasProp = {}.hasOwnProperty,
         
     | 
| 
      
 1759 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
       1755 
1760 
     | 
    
         | 
| 
       1756 
     | 
    
         
            -
             
     | 
| 
       1757 
     | 
    
         
            -
             
     | 
| 
       1758 
     | 
    
         
            -
                  sel = void 0;
         
     | 
| 
       1759 
     | 
    
         
            -
                  range = void 0;
         
     | 
| 
       1760 
     | 
    
         
            -
                  if (window.getSelection) {
         
     | 
| 
       1761 
     | 
    
         
            -
                    sel = window.getSelection();
         
     | 
| 
       1762 
     | 
    
         
            -
                    if (sel.getRangeAt && sel.rangeCount) {
         
     | 
| 
       1763 
     | 
    
         
            -
                      range = sel.getRangeAt(0);
         
     | 
| 
       1764 
     | 
    
         
            -
                      range.deleteContents();
         
     | 
| 
       1765 
     | 
    
         
            -
                      el = document.createElement('div');
         
     | 
| 
       1766 
     | 
    
         
            -
                      el.innerHTML = html;
         
     | 
| 
       1767 
     | 
    
         
            -
                      frag = document.createDocumentFragment();
         
     | 
| 
       1768 
     | 
    
         
            -
                      node = void 0;
         
     | 
| 
       1769 
     | 
    
         
            -
                      lastNode = void 0;
         
     | 
| 
       1770 
     | 
    
         
            -
                      while (node = el.firstChild) {
         
     | 
| 
       1771 
     | 
    
         
            -
                        lastNode = frag.appendChild(node);
         
     | 
| 
       1772 
     | 
    
         
            -
                      }
         
     | 
| 
       1773 
     | 
    
         
            -
                      firstNode = frag.firstChild;
         
     | 
| 
       1774 
     | 
    
         
            -
                      range.insertNode(frag);
         
     | 
| 
       1775 
     | 
    
         
            -
                      if (lastNode) {
         
     | 
| 
       1776 
     | 
    
         
            -
                        range = range.cloneRange();
         
     | 
| 
       1777 
     | 
    
         
            -
                        range.setStartAfter(lastNode);
         
     | 
| 
       1778 
     | 
    
         
            -
                        if (selectPastedContent) {
         
     | 
| 
       1779 
     | 
    
         
            -
                          range.setStartBefore(firstNode);
         
     | 
| 
       1780 
     | 
    
         
            -
                        } else {
         
     | 
| 
       1781 
     | 
    
         
            -
                          range.collapse(true);
         
     | 
| 
       1782 
     | 
    
         
            -
                        }
         
     | 
| 
       1783 
     | 
    
         
            -
                        sel.removeAllRanges();
         
     | 
| 
       1784 
     | 
    
         
            -
                        sel.addRange(range);
         
     | 
| 
       1785 
     | 
    
         
            -
                      }
         
     | 
| 
       1786 
     | 
    
         
            -
                    }
         
     | 
| 
       1787 
     | 
    
         
            -
                  } else if ((sel = document.selection) && sel.type !== 'Control') {
         
     | 
| 
       1788 
     | 
    
         
            -
                    originalRange = sel.createRange();
         
     | 
| 
       1789 
     | 
    
         
            -
                    originalRange.collapse(true);
         
     | 
| 
       1790 
     | 
    
         
            -
                    sel.createRange().pasteHTML(html);
         
     | 
| 
       1791 
     | 
    
         
            -
                    if (selectPastedContent) {
         
     | 
| 
       1792 
     | 
    
         
            -
                      range = sel.createRange();
         
     | 
| 
       1793 
     | 
    
         
            -
                      range.setEndPoint('StartToStart', originalRange);
         
     | 
| 
       1794 
     | 
    
         
            -
                      range.select();
         
     | 
| 
       1795 
     | 
    
         
            -
                    }
         
     | 
| 
       1796 
     | 
    
         
            -
                  }
         
     | 
| 
       1797 
     | 
    
         
            -
                };
         
     | 
| 
      
 1761 
     | 
    
         
            +
              Dante.View.Behavior = (function(_super) {
         
     | 
| 
      
 1762 
     | 
    
         
            +
                __extends(Behavior, _super);
         
     | 
| 
       1798 
1763 
     | 
    
         | 
| 
       1799 
     | 
    
         
            -
                 
     | 
| 
      
 1764 
     | 
    
         
            +
                function Behavior() {
         
     | 
| 
      
 1765 
     | 
    
         
            +
                  return Behavior.__super__.constructor.apply(this, arguments);
         
     | 
| 
      
 1766 
     | 
    
         
            +
                }
         
     | 
| 
       1800 
1767 
     | 
    
         | 
| 
       1801 
     | 
    
         
            -
             
     | 
| 
      
 1768 
     | 
    
         
            +
                return Behavior;
         
     | 
| 
      
 1769 
     | 
    
         
            +
             
     | 
| 
      
 1770 
     | 
    
         
            +
              })(Dante.View);
         
     | 
| 
       1802 
1771 
     | 
    
         | 
| 
       1803 
1772 
     | 
    
         
             
            }).call(this);
         
     | 
| 
       1804 
1773 
     | 
    
         
             
            (function() {
         
     | 
| 
         @@ -1809,94 +1778,15 @@ 
     | 
|
| 
       1809 
1778 
     | 
    
         | 
| 
       1810 
1779 
     | 
    
         
             
              utils = Dante.utils;
         
     | 
| 
       1811 
1780 
     | 
    
         | 
| 
       1812 
     | 
    
         
            -
              Dante.View.Behavior. 
     | 
| 
       1813 
     | 
    
         
            -
                 
     | 
| 
      
 1781 
     | 
    
         
            +
              Dante.View.Behavior.Image = (function(_super) {
         
     | 
| 
      
 1782 
     | 
    
         
            +
                var BACKSPACE, DOWNARROW, ENTER, LEFTARROW, RIGHTARROW, SPACEBAR, TAB, UPARROW;
         
     | 
| 
       1814 
1783 
     | 
    
         | 
| 
       1815 
     | 
    
         
            -
                 
     | 
| 
       1816 
     | 
    
         
            -
             
     | 
| 
       1817 
     | 
    
         
            -
             
     | 
| 
       1818 
     | 
    
         
            -
             
     | 
| 
       1819 
     | 
    
         
            -
             
     | 
| 
       1820 
     | 
    
         
            -
             
     | 
| 
       1821 
     | 
    
         
            -
                  if (opts == null) {
         
     | 
| 
       1822 
     | 
    
         
            -
                    opts = {};
         
     | 
| 
       1823 
     | 
    
         
            -
                  }
         
     | 
| 
       1824 
     | 
    
         
            -
                  return this.editor = opts.current_editor;
         
     | 
| 
       1825 
     | 
    
         
            -
                };
         
     | 
| 
       1826 
     | 
    
         
            -
             
     | 
| 
       1827 
     | 
    
         
            -
                Paste.prototype.handlePaste = function(ev, parent) {
         
     | 
| 
       1828 
     | 
    
         
            -
                  var cbd, nodes, paste_el, pastedText;
         
     | 
| 
       1829 
     | 
    
         
            -
                  utils.log("pasted!");
         
     | 
| 
       1830 
     | 
    
         
            -
                  pastedText = void 0;
         
     | 
| 
       1831 
     | 
    
         
            -
                  if (window.clipboardData && window.clipboardData.getData) {
         
     | 
| 
       1832 
     | 
    
         
            -
                    pastedText = window.clipboardData.getData('Text');
         
     | 
| 
       1833 
     | 
    
         
            -
                  } else if (ev.originalEvent.clipboardData && ev.originalEvent.clipboardData.getData) {
         
     | 
| 
       1834 
     | 
    
         
            -
                    cbd = ev.originalEvent.clipboardData;
         
     | 
| 
       1835 
     | 
    
         
            -
                    pastedText = _.isEmpty(cbd.getData('text/html')) ? cbd.getData('text/plain') : cbd.getData('text/html');
         
     | 
| 
       1836 
     | 
    
         
            -
                  }
         
     | 
| 
       1837 
     | 
    
         
            -
                  utils.log("Process and handle text...");
         
     | 
| 
       1838 
     | 
    
         
            -
                  utils.log(pastedText);
         
     | 
| 
       1839 
     | 
    
         
            -
                  if (pastedText.match(/<\/*[a-z][^>]+?>/gi)) {
         
     | 
| 
       1840 
     | 
    
         
            -
                    utils.log("HTML DETECTED ON PASTE");
         
     | 
| 
       1841 
     | 
    
         
            -
                    pastedText = pastedText.replace(/<div>([\w\W]*?)<\/div>/gi, '<p>$1</p>');
         
     | 
| 
       1842 
     | 
    
         
            -
                    document.body.appendChild($("<div id='" + (this.editor.paste_element_id.replace('#', '')) + "' class='dante-paste'></div>")[0]);
         
     | 
| 
       1843 
     | 
    
         
            -
                    paste_el = $(this.editor.paste_element_id);
         
     | 
| 
       1844 
     | 
    
         
            -
                    paste_el.html("<span>" + pastedText + "</span>");
         
     | 
| 
       1845 
     | 
    
         
            -
                    nodes = $(paste_el.html()).insertBefore($(parent));
         
     | 
| 
       1846 
     | 
    
         
            -
                    this.editor.parseInitialMess();
         
     | 
| 
       1847 
     | 
    
         
            -
             
     | 
| 
       1848 
     | 
    
         
            -
                    /*
         
     | 
| 
       1849 
     | 
    
         
            -
                    @editor.setupElementsClasses $(@editor.paste_element_id), (e)=>
         
     | 
| 
       1850 
     | 
    
         
            -
                       * e is the target object which is cleaned
         
     | 
| 
       1851 
     | 
    
         
            -
                      nodes = $(e.html()).insertAfter($(parent))
         
     | 
| 
       1852 
     | 
    
         
            -
                       *remove paste div since we wont use it until the next paste
         
     | 
| 
       1853 
     | 
    
         
            -
                      e.remove()
         
     | 
| 
       1854 
     | 
    
         
            -
                       *set caret on newly created node
         
     | 
| 
       1855 
     | 
    
         
            -
                      last_node = nodes.last()[0]
         
     | 
| 
       1856 
     | 
    
         
            -
                      num = last_node.childNodes.length
         
     | 
| 
       1857 
     | 
    
         
            -
                      @editor.setRangeAt(last_node, num)
         
     | 
| 
       1858 
     | 
    
         
            -
                      
         
     | 
| 
       1859 
     | 
    
         
            -
                       *select new node
         
     | 
| 
       1860 
     | 
    
         
            -
                      new_node = $(@editor.getNode())
         
     | 
| 
       1861 
     | 
    
         
            -
                      @editor.markAsSelected(new_node)
         
     | 
| 
       1862 
     | 
    
         
            -
                      @editor.displayTooltipAt($(@editor.el).find(".is-selected"))
         
     | 
| 
       1863 
     | 
    
         
            -
                      
         
     | 
| 
       1864 
     | 
    
         
            -
                       * wrap new images
         
     | 
| 
       1865 
     | 
    
         
            -
                      @editor.handleUnwrappedImages(nodes)
         
     | 
| 
       1866 
     | 
    
         
            -
                    
         
     | 
| 
       1867 
     | 
    
         
            -
                       *scroll to element top
         
     | 
| 
       1868 
     | 
    
         
            -
                      top = new_node.offset().top
         
     | 
| 
       1869 
     | 
    
         
            -
                      $('html, body').animate
         
     | 
| 
       1870 
     | 
    
         
            -
                        scrollTop: top
         
     | 
| 
       1871 
     | 
    
         
            -
                      , 20
         
     | 
| 
       1872 
     | 
    
         
            -
                     */
         
     | 
| 
       1873 
     | 
    
         
            -
                    this.editor["continue"] = false;
         
     | 
| 
       1874 
     | 
    
         
            -
                    return false;
         
     | 
| 
       1875 
     | 
    
         
            -
                  }
         
     | 
| 
       1876 
     | 
    
         
            -
                };
         
     | 
| 
       1877 
     | 
    
         
            -
             
     | 
| 
       1878 
     | 
    
         
            -
                return Paste;
         
     | 
| 
       1879 
     | 
    
         
            -
             
     | 
| 
       1880 
     | 
    
         
            -
              })(Dante.View.Behavior);
         
     | 
| 
       1881 
     | 
    
         
            -
             
     | 
| 
       1882 
     | 
    
         
            -
            }).call(this);
         
     | 
| 
       1883 
     | 
    
         
            -
            (function() {
         
     | 
| 
       1884 
     | 
    
         
            -
              var utils,
         
     | 
| 
       1885 
     | 
    
         
            -
                __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
         
     | 
| 
       1886 
     | 
    
         
            -
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
       1887 
     | 
    
         
            -
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
       1888 
     | 
    
         
            -
             
     | 
| 
       1889 
     | 
    
         
            -
              utils = Dante.utils;
         
     | 
| 
       1890 
     | 
    
         
            -
             
     | 
| 
       1891 
     | 
    
         
            -
              Dante.View.Behavior.Image = (function(_super) {
         
     | 
| 
       1892 
     | 
    
         
            -
                var BACKSPACE, DOWNARROW, ENTER, LEFTARROW, RIGHTARROW, SPACEBAR, TAB, UPARROW;
         
     | 
| 
       1893 
     | 
    
         
            -
             
     | 
| 
       1894 
     | 
    
         
            -
                __extends(Image, _super);
         
     | 
| 
       1895 
     | 
    
         
            -
             
     | 
| 
       1896 
     | 
    
         
            -
                function Image() {
         
     | 
| 
       1897 
     | 
    
         
            -
                  this.handleArrowForKeyUp = __bind(this.handleArrowForKeyUp, this);
         
     | 
| 
       1898 
     | 
    
         
            -
                  this.handleArrowForKeyDown = __bind(this.handleArrowForKeyDown, this);
         
     | 
| 
       1899 
     | 
    
         
            -
                  return Image.__super__.constructor.apply(this, arguments);
         
     | 
| 
      
 1784 
     | 
    
         
            +
                __extends(Image, _super);
         
     | 
| 
      
 1785 
     | 
    
         
            +
             
     | 
| 
      
 1786 
     | 
    
         
            +
                function Image() {
         
     | 
| 
      
 1787 
     | 
    
         
            +
                  this.handleArrowForKeyUp = __bind(this.handleArrowForKeyUp, this);
         
     | 
| 
      
 1788 
     | 
    
         
            +
                  this.handleArrowForKeyDown = __bind(this.handleArrowForKeyDown, this);
         
     | 
| 
      
 1789 
     | 
    
         
            +
                  return Image.__super__.constructor.apply(this, arguments);
         
     | 
| 
       1900 
1790 
     | 
    
         
             
                }
         
     | 
| 
       1901 
1791 
     | 
    
         | 
| 
       1902 
1792 
     | 
    
         
             
                BACKSPACE = 8;
         
     | 
| 
         @@ -1997,11 +1887,11 @@ 
     | 
|
| 
       1997 
1887 
     | 
    
         
             
                    if ($(e.target).hasClass("graf--figure")) {
         
     | 
| 
       1998 
1888 
     | 
    
         
             
                      e.preventDefault();
         
     | 
| 
       1999 
1889 
     | 
    
         
             
                      if (this.editor.image_delete_callback) {
         
     | 
| 
       2000 
     | 
    
         
            -
                        this.editor.image_delete_callback( 
     | 
| 
      
 1890 
     | 
    
         
            +
                        this.editor.image_delete_callback(this.editor.findSelected().find("img").data());
         
     | 
| 
       2001 
1891 
     | 
    
         
             
                      }
         
     | 
| 
       2002 
1892 
     | 
    
         
             
                      utils.log("Replacing selected node");
         
     | 
| 
       2003 
     | 
    
         
            -
                      this.editor.replaceWith("p",  
     | 
| 
       2004 
     | 
    
         
            -
                      this.editor.setRangeAt( 
     | 
| 
      
 1893 
     | 
    
         
            +
                      this.editor.replaceWith("p", this.editor.findSelected());
         
     | 
| 
      
 1894 
     | 
    
         
            +
                      this.editor.setRangeAt(this.editor.findSelected()[0]);
         
     | 
| 
       2005 
1895 
     | 
    
         
             
                      this.editor.pop_over_align.hide();
         
     | 
| 
       2006 
1896 
     | 
    
         
             
                      utils.log("Focus on the previous graf");
         
     | 
| 
       2007 
1897 
     | 
    
         
             
                      this.editor["continue"] = false;
         
     | 
| 
         @@ -2036,11 +1926,11 @@ 
     | 
|
| 
       2036 
1926 
     | 
    
         
             
                      }
         
     | 
| 
       2037 
1927 
     | 
    
         
             
                    }
         
     | 
| 
       2038 
1928 
     | 
    
         
             
                  }
         
     | 
| 
       2039 
     | 
    
         
            -
                  if (_.isUndefined(parent) || parent.length === 0 &&  
     | 
| 
       2040 
     | 
    
         
            -
                    node =  
     | 
| 
      
 1929 
     | 
    
         
            +
                  if (_.isUndefined(parent) || parent.length === 0 && this.editor.findSelected().hasClass("is-mediaFocused")) {
         
     | 
| 
      
 1930 
     | 
    
         
            +
                    node = this.editor.findSelected().find("figcaption");
         
     | 
| 
       2041 
1931 
     | 
    
         
             
                    node.find(".defaultValue").remove();
         
     | 
| 
       2042 
1932 
     | 
    
         
             
                    this.editor.setRangeAt(node[0]);
         
     | 
| 
       2043 
     | 
    
         
            -
                     
     | 
| 
      
 1933 
     | 
    
         
            +
                    this.editor.findSelected().removeClass("is-mediaFocused");
         
     | 
| 
       2044 
1934 
     | 
    
         
             
                    this.editor.pop_over_align.hide();
         
     | 
| 
       2045 
1935 
     | 
    
         
             
                    return false;
         
     | 
| 
       2046 
1936 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -2057,8 +1947,8 @@ 
     | 
|
| 
       2057 
1947 
     | 
    
         
             
                    case "ArrowDown":
         
     | 
| 
       2058 
1948 
     | 
    
         
             
                    case "Down":
         
     | 
| 
       2059 
1949 
     | 
    
         
             
                      if (_.isUndefined(current_node) || !current_node.exists()) {
         
     | 
| 
       2060 
     | 
    
         
            -
                        if ( 
     | 
| 
       2061 
     | 
    
         
            -
                          current_node =  
     | 
| 
      
 1950 
     | 
    
         
            +
                        if (this.editor.findSelected().exists()) {
         
     | 
| 
      
 1951 
     | 
    
         
            +
                          current_node = this.editor.findSelected();
         
     | 
| 
       2062 
1952 
     | 
    
         
             
                        }
         
     | 
| 
       2063 
1953 
     | 
    
         
             
                      }
         
     | 
| 
       2064 
1954 
     | 
    
         
             
                      next_node = current_node.next();
         
     | 
| 
         @@ -2156,7 +2046,6 @@ 
     | 
|
| 
       2156 
2046 
     | 
    
         
             
                        n = current_node.prev(".graf");
         
     | 
| 
       2157 
2047 
     | 
    
         
             
                        num = n[0].childNodes.length;
         
     | 
| 
       2158 
2048 
     | 
    
         
             
                        utils.log("4 up");
         
     | 
| 
       2159 
     | 
    
         
            -
                        this.editor.skip_keyup = true;
         
     | 
| 
       2160 
2049 
     | 
    
         
             
                        this.editor.markAsSelected(prev_node);
         
     | 
| 
       2161 
2050 
     | 
    
         
             
                        return false;
         
     | 
| 
       2162 
2051 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -2268,7 +2157,7 @@ 
     | 
|
| 
       2268 
2157 
     | 
    
         
             
                  }
         
     | 
| 
       2269 
2158 
     | 
    
         
             
                  this.editor.addClassesToElement($list[0]);
         
     | 
| 
       2270 
2159 
     | 
    
         
             
                  this.editor.replaceWith("li", $paragraph);
         
     | 
| 
       2271 
     | 
    
         
            -
                  $li =  
     | 
| 
      
 2160 
     | 
    
         
            +
                  $li = this.editor.findSelected();
         
     | 
| 
       2272 
2161 
     | 
    
         
             
                  this.editor.setElementName($li[0]);
         
     | 
| 
       2273 
2162 
     | 
    
         
             
                  $li.html(content).wrap($list);
         
     | 
| 
       2274 
2163 
     | 
    
         
             
                  if ($li.find("br").length === 0) {
         
     | 
| 
         @@ -2349,7 +2238,7 @@ 
     | 
|
| 
       2349 
2238 
     | 
    
         
             
                    $list.before($li);
         
     | 
| 
       2350 
2239 
     | 
    
         
             
                    content = $li.html();
         
     | 
| 
       2351 
2240 
     | 
    
         
             
                    this.editor.replaceWith("p", $li);
         
     | 
| 
       2352 
     | 
    
         
            -
                    $paragraph =  
     | 
| 
      
 2241 
     | 
    
         
            +
                    $paragraph = this.editor.findSelected();
         
     | 
| 
       2353 
2242 
     | 
    
         
             
                    $paragraph.removeClass("graf--empty").html(content).attr("name", utils.generateUniqueName());
         
     | 
| 
       2354 
2243 
     | 
    
         
             
                    if ($list.children().length === 0) {
         
     | 
| 
       2355 
2244 
     | 
    
         
             
                      $list.remove();
         
     | 
| 
         @@ -2362,6 +2251,86 @@ 
     | 
|
| 
       2362 
2251 
     | 
    
         | 
| 
       2363 
2252 
     | 
    
         
             
              })(Dante.View.Behavior);
         
     | 
| 
       2364 
2253 
     | 
    
         | 
| 
      
 2254 
     | 
    
         
            +
            }).call(this);
         
     | 
| 
      
 2255 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 2256 
     | 
    
         
            +
              var utils,
         
     | 
| 
      
 2257 
     | 
    
         
            +
                __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
         
     | 
| 
      
 2258 
     | 
    
         
            +
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
      
 2259 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
      
 2260 
     | 
    
         
            +
             
     | 
| 
      
 2261 
     | 
    
         
            +
              utils = Dante.utils;
         
     | 
| 
      
 2262 
     | 
    
         
            +
             
     | 
| 
      
 2263 
     | 
    
         
            +
              Dante.View.Behavior.Paste = (function(_super) {
         
     | 
| 
      
 2264 
     | 
    
         
            +
                __extends(Paste, _super);
         
     | 
| 
      
 2265 
     | 
    
         
            +
             
     | 
| 
      
 2266 
     | 
    
         
            +
                function Paste() {
         
     | 
| 
      
 2267 
     | 
    
         
            +
                  this.handlePaste = __bind(this.handlePaste, this);
         
     | 
| 
      
 2268 
     | 
    
         
            +
                  return Paste.__super__.constructor.apply(this, arguments);
         
     | 
| 
      
 2269 
     | 
    
         
            +
                }
         
     | 
| 
      
 2270 
     | 
    
         
            +
             
     | 
| 
      
 2271 
     | 
    
         
            +
                Paste.prototype.initialize = function(opts) {
         
     | 
| 
      
 2272 
     | 
    
         
            +
                  if (opts == null) {
         
     | 
| 
      
 2273 
     | 
    
         
            +
                    opts = {};
         
     | 
| 
      
 2274 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2275 
     | 
    
         
            +
                  return this.editor = opts.current_editor;
         
     | 
| 
      
 2276 
     | 
    
         
            +
                };
         
     | 
| 
      
 2277 
     | 
    
         
            +
             
     | 
| 
      
 2278 
     | 
    
         
            +
                Paste.prototype.handlePaste = function(ev, parent) {
         
     | 
| 
      
 2279 
     | 
    
         
            +
                  var cbd, nodes, paste_el, pastedText;
         
     | 
| 
      
 2280 
     | 
    
         
            +
                  utils.log("pasted!");
         
     | 
| 
      
 2281 
     | 
    
         
            +
                  this.editor.hidePlaceholder($(parent));
         
     | 
| 
      
 2282 
     | 
    
         
            +
                  pastedText = void 0;
         
     | 
| 
      
 2283 
     | 
    
         
            +
                  if (window.clipboardData && window.clipboardData.getData) {
         
     | 
| 
      
 2284 
     | 
    
         
            +
                    pastedText = window.clipboardData.getData('Text');
         
     | 
| 
      
 2285 
     | 
    
         
            +
                  } else if (ev.originalEvent.clipboardData && ev.originalEvent.clipboardData.getData) {
         
     | 
| 
      
 2286 
     | 
    
         
            +
                    cbd = ev.originalEvent.clipboardData;
         
     | 
| 
      
 2287 
     | 
    
         
            +
                    pastedText = _.isEmpty(cbd.getData('text/html')) ? cbd.getData('text/plain') : cbd.getData('text/html');
         
     | 
| 
      
 2288 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2289 
     | 
    
         
            +
                  utils.log("Process and handle text...");
         
     | 
| 
      
 2290 
     | 
    
         
            +
                  utils.log(pastedText);
         
     | 
| 
      
 2291 
     | 
    
         
            +
                  if (pastedText.match(/<\/*[a-z][^>]+?>/gi)) {
         
     | 
| 
      
 2292 
     | 
    
         
            +
                    utils.log("HTML DETECTED ON PASTE");
         
     | 
| 
      
 2293 
     | 
    
         
            +
                    pastedText = pastedText.replace(/<div>([\w\W]*?)<\/div>/gi, '<p>$1</p>');
         
     | 
| 
      
 2294 
     | 
    
         
            +
                    document.body.appendChild($("<div id='" + (this.editor.paste_element_id.replace('#', '')) + "' class='dante-paste'></div>")[0]);
         
     | 
| 
      
 2295 
     | 
    
         
            +
                    paste_el = $(this.editor.paste_element_id);
         
     | 
| 
      
 2296 
     | 
    
         
            +
                    paste_el.html("<span>" + pastedText + "</span>");
         
     | 
| 
      
 2297 
     | 
    
         
            +
                    nodes = $(paste_el.html()).insertBefore($(parent));
         
     | 
| 
      
 2298 
     | 
    
         
            +
                    this.editor.parseInitialMess();
         
     | 
| 
      
 2299 
     | 
    
         
            +
             
     | 
| 
      
 2300 
     | 
    
         
            +
                    /*
         
     | 
| 
      
 2301 
     | 
    
         
            +
                    @editor.setupElementsClasses $(@editor.paste_element_id), (e)=>
         
     | 
| 
      
 2302 
     | 
    
         
            +
                       * e is the target object which is cleaned
         
     | 
| 
      
 2303 
     | 
    
         
            +
                      nodes = $(e.html()).insertAfter($(parent))
         
     | 
| 
      
 2304 
     | 
    
         
            +
                       *remove paste div since we wont use it until the next paste
         
     | 
| 
      
 2305 
     | 
    
         
            +
                      e.remove()
         
     | 
| 
      
 2306 
     | 
    
         
            +
                       *set caret on newly created node
         
     | 
| 
      
 2307 
     | 
    
         
            +
                      last_node = nodes.last()[0]
         
     | 
| 
      
 2308 
     | 
    
         
            +
                      num = last_node.childNodes.length
         
     | 
| 
      
 2309 
     | 
    
         
            +
                      @editor.setRangeAt(last_node, num)
         
     | 
| 
      
 2310 
     | 
    
         
            +
                      
         
     | 
| 
      
 2311 
     | 
    
         
            +
                       *select new node
         
     | 
| 
      
 2312 
     | 
    
         
            +
                      new_node = $(@editor.getNode())
         
     | 
| 
      
 2313 
     | 
    
         
            +
                      @editor.markAsSelected(new_node)
         
     | 
| 
      
 2314 
     | 
    
         
            +
                      @editor.displayTooltipAt($(@editor.el).find(".is-selected"))
         
     | 
| 
      
 2315 
     | 
    
         
            +
                      
         
     | 
| 
      
 2316 
     | 
    
         
            +
                       * wrap new images
         
     | 
| 
      
 2317 
     | 
    
         
            +
                      @editor.handleUnwrappedImages(nodes)
         
     | 
| 
      
 2318 
     | 
    
         
            +
                    
         
     | 
| 
      
 2319 
     | 
    
         
            +
                       *scroll to element top
         
     | 
| 
      
 2320 
     | 
    
         
            +
                      top = new_node.offset().top
         
     | 
| 
      
 2321 
     | 
    
         
            +
                      $('html, body').animate
         
     | 
| 
      
 2322 
     | 
    
         
            +
                        scrollTop: top
         
     | 
| 
      
 2323 
     | 
    
         
            +
                      , 20
         
     | 
| 
      
 2324 
     | 
    
         
            +
                     */
         
     | 
| 
      
 2325 
     | 
    
         
            +
                    this.editor["continue"] = false;
         
     | 
| 
      
 2326 
     | 
    
         
            +
                    return false;
         
     | 
| 
      
 2327 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2328 
     | 
    
         
            +
                };
         
     | 
| 
      
 2329 
     | 
    
         
            +
             
     | 
| 
      
 2330 
     | 
    
         
            +
                return Paste;
         
     | 
| 
      
 2331 
     | 
    
         
            +
             
     | 
| 
      
 2332 
     | 
    
         
            +
              })(Dante.View.Behavior);
         
     | 
| 
      
 2333 
     | 
    
         
            +
             
     | 
| 
       2365 
2334 
     | 
    
         
             
            }).call(this);
         
     | 
| 
       2366 
2335 
     | 
    
         
             
            (function() {
         
     | 
| 
       2367 
2336 
     | 
    
         
             
              var utils,
         
     | 
| 
         @@ -2438,6 +2407,163 @@ 
     | 
|
| 
       2438 
2407 
     | 
    
         | 
| 
       2439 
2408 
     | 
    
         
             
              })(Dante.View.Behavior);
         
     | 
| 
       2440 
2409 
     | 
    
         | 
| 
      
 2410 
     | 
    
         
            +
            }).call(this);
         
     | 
| 
      
 2411 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 2412 
     | 
    
         
            +
              var utils,
         
     | 
| 
      
 2413 
     | 
    
         
            +
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
      
 2414 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
      
 2415 
     | 
    
         
            +
             
     | 
| 
      
 2416 
     | 
    
         
            +
              utils = Dante.utils;
         
     | 
| 
      
 2417 
     | 
    
         
            +
             
     | 
| 
      
 2418 
     | 
    
         
            +
              Dante.View.Behavior.Suggest = (function(_super) {
         
     | 
| 
      
 2419 
     | 
    
         
            +
                __extends(Suggest, _super);
         
     | 
| 
      
 2420 
     | 
    
         
            +
             
     | 
| 
      
 2421 
     | 
    
         
            +
                function Suggest() {
         
     | 
| 
      
 2422 
     | 
    
         
            +
                  return Suggest.__super__.constructor.apply(this, arguments);
         
     | 
| 
      
 2423 
     | 
    
         
            +
                }
         
     | 
| 
      
 2424 
     | 
    
         
            +
             
     | 
| 
      
 2425 
     | 
    
         
            +
                Suggest.prototype.initialize = function(opts) {
         
     | 
| 
      
 2426 
     | 
    
         
            +
                  if (opts == null) {
         
     | 
| 
      
 2427 
     | 
    
         
            +
                    opts = {};
         
     | 
| 
      
 2428 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2429 
     | 
    
         
            +
                  this.actionEvent = opts.title;
         
     | 
| 
      
 2430 
     | 
    
         
            +
                  this.editor = opts.current_editor;
         
     | 
| 
      
 2431 
     | 
    
         
            +
                  this._name = null;
         
     | 
| 
      
 2432 
     | 
    
         
            +
                  return this.fetch_results = [];
         
     | 
| 
      
 2433 
     | 
    
         
            +
                };
         
     | 
| 
      
 2434 
     | 
    
         
            +
             
     | 
| 
      
 2435 
     | 
    
         
            +
                Suggest.prototype.displayPopOver = function(ev) {
         
     | 
| 
      
 2436 
     | 
    
         
            +
                  return this.editor.pop_over_typeahead.displayAt(this.editor.getSelectionStart());
         
     | 
| 
      
 2437 
     | 
    
         
            +
                };
         
     | 
| 
      
 2438 
     | 
    
         
            +
             
     | 
| 
      
 2439 
     | 
    
         
            +
                Suggest.prototype.hidePopOver = function(ev) {
         
     | 
| 
      
 2440 
     | 
    
         
            +
                  console.log("display popover from typeahead");
         
     | 
| 
      
 2441 
     | 
    
         
            +
                  return this.editor.pop_over_typeahead.displayAt(ev);
         
     | 
| 
      
 2442 
     | 
    
         
            +
                };
         
     | 
| 
      
 2443 
     | 
    
         
            +
             
     | 
| 
      
 2444 
     | 
    
         
            +
                Suggest.prototype.desintegratePopOver = function(e) {
         
     | 
| 
      
 2445 
     | 
    
         
            +
                  $(this.editor.getSelectionStart()).remove();
         
     | 
| 
      
 2446 
     | 
    
         
            +
                  return this.pasteHtmlAtCaret(this.editor.getSelectionStart().textContent, false);
         
     | 
| 
      
 2447 
     | 
    
         
            +
                };
         
     | 
| 
      
 2448 
     | 
    
         
            +
             
     | 
| 
      
 2449 
     | 
    
         
            +
                Suggest.prototype.handleKeyPress = function(e) {
         
     | 
| 
      
 2450 
     | 
    
         
            +
                  if (!this.insideQuery()) {
         
     | 
| 
      
 2451 
     | 
    
         
            +
                    if (e.keyCode === 64) {
         
     | 
| 
      
 2452 
     | 
    
         
            +
                      e.preventDefault();
         
     | 
| 
      
 2453 
     | 
    
         
            +
                      return this.pasteHtmlAtCaret(this.wrapperTemplate("@"), false);
         
     | 
| 
      
 2454 
     | 
    
         
            +
                    }
         
     | 
| 
      
 2455 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 2456 
     | 
    
         
            +
                    console.log("ok let's search");
         
     | 
| 
      
 2457 
     | 
    
         
            +
                    return this.getResults((function(_this) {
         
     | 
| 
      
 2458 
     | 
    
         
            +
                      return function(e) {
         
     | 
| 
      
 2459 
     | 
    
         
            +
                        return _this.fetchResults(e);
         
     | 
| 
      
 2460 
     | 
    
         
            +
                      };
         
     | 
| 
      
 2461 
     | 
    
         
            +
                    })(this));
         
     | 
| 
      
 2462 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2463 
     | 
    
         
            +
                };
         
     | 
| 
      
 2464 
     | 
    
         
            +
             
     | 
| 
      
 2465 
     | 
    
         
            +
                Suggest.prototype.handleKeyUp = function(e) {
         
     | 
| 
      
 2466 
     | 
    
         
            +
                  if (this.insideQuery()) {
         
     | 
| 
      
 2467 
     | 
    
         
            +
                    return this.fetchResults(e);
         
     | 
| 
      
 2468 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2469 
     | 
    
         
            +
                };
         
     | 
| 
      
 2470 
     | 
    
         
            +
             
     | 
| 
      
 2471 
     | 
    
         
            +
                Suggest.prototype.fetchResults = function(e) {
         
     | 
| 
      
 2472 
     | 
    
         
            +
                  if (this.getResults.length < 1) {
         
     | 
| 
      
 2473 
     | 
    
         
            +
                    this.desintegratePopOver(e);
         
     | 
| 
      
 2474 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2475 
     | 
    
         
            +
                  if (this.json_request) {
         
     | 
| 
      
 2476 
     | 
    
         
            +
                    this.json_request.abort();
         
     | 
| 
      
 2477 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2478 
     | 
    
         
            +
                  return this.getResults((function(_this) {
         
     | 
| 
      
 2479 
     | 
    
         
            +
                    return function(e) {
         
     | 
| 
      
 2480 
     | 
    
         
            +
                      _this.displayPopOver(e);
         
     | 
| 
      
 2481 
     | 
    
         
            +
                      return _this.editor.pop_over_typeahead.appendData(_this.fetch_results);
         
     | 
| 
      
 2482 
     | 
    
         
            +
                    };
         
     | 
| 
      
 2483 
     | 
    
         
            +
                  })(this));
         
     | 
| 
      
 2484 
     | 
    
         
            +
                };
         
     | 
| 
      
 2485 
     | 
    
         
            +
             
     | 
| 
      
 2486 
     | 
    
         
            +
                Suggest.prototype.getResults = function(cb, e) {
         
     | 
| 
      
 2487 
     | 
    
         
            +
                  var q;
         
     | 
| 
      
 2488 
     | 
    
         
            +
                  q = this.editor.getSelectionStart().textContent.replace("@", "");
         
     | 
| 
      
 2489 
     | 
    
         
            +
                  clearTimeout(this.timeout);
         
     | 
| 
      
 2490 
     | 
    
         
            +
                  return this.timeout = setTimeout((function(_this) {
         
     | 
| 
      
 2491 
     | 
    
         
            +
                    return function() {
         
     | 
| 
      
 2492 
     | 
    
         
            +
                      return _this.json_request = $.ajax({
         
     | 
| 
      
 2493 
     | 
    
         
            +
                        url: "" + _this.editor.suggest_url + "?" + _this.editor.suggest_query_param + "=" + q,
         
     | 
| 
      
 2494 
     | 
    
         
            +
                        method: "get",
         
     | 
| 
      
 2495 
     | 
    
         
            +
                        dataType: "json"
         
     | 
| 
      
 2496 
     | 
    
         
            +
                      }).success(function(data) {
         
     | 
| 
      
 2497 
     | 
    
         
            +
                        if (_this.editor.suggest_handler) {
         
     | 
| 
      
 2498 
     | 
    
         
            +
                          _this.fetch_results = _this.editor.suggest_handler(data);
         
     | 
| 
      
 2499 
     | 
    
         
            +
                        } else {
         
     | 
| 
      
 2500 
     | 
    
         
            +
                          _this.fetch_results = data;
         
     | 
| 
      
 2501 
     | 
    
         
            +
                        }
         
     | 
| 
      
 2502 
     | 
    
         
            +
                        if (cb) {
         
     | 
| 
      
 2503 
     | 
    
         
            +
                          return cb(e);
         
     | 
| 
      
 2504 
     | 
    
         
            +
                        }
         
     | 
| 
      
 2505 
     | 
    
         
            +
                      }).error(function(data, err) {
         
     | 
| 
      
 2506 
     | 
    
         
            +
                        return console.log("error fetching results");
         
     | 
| 
      
 2507 
     | 
    
         
            +
                      });
         
     | 
| 
      
 2508 
     | 
    
         
            +
                    };
         
     | 
| 
      
 2509 
     | 
    
         
            +
                  })(this), this.editor.suggest_query_timeout);
         
     | 
| 
      
 2510 
     | 
    
         
            +
                };
         
     | 
| 
      
 2511 
     | 
    
         
            +
             
     | 
| 
      
 2512 
     | 
    
         
            +
                Suggest.prototype.insideQuery = function() {
         
     | 
| 
      
 2513 
     | 
    
         
            +
                  return $(this.editor.getSelectionStart()).hasClass("markup--query");
         
     | 
| 
      
 2514 
     | 
    
         
            +
                };
         
     | 
| 
      
 2515 
     | 
    
         
            +
             
     | 
| 
      
 2516 
     | 
    
         
            +
                Suggest.prototype.wrapperTemplate = function(name) {
         
     | 
| 
      
 2517 
     | 
    
         
            +
                  return "<span class='markup--query'>" + name + "</span>";
         
     | 
| 
      
 2518 
     | 
    
         
            +
                };
         
     | 
| 
      
 2519 
     | 
    
         
            +
             
     | 
| 
      
 2520 
     | 
    
         
            +
                Suggest.prototype.pasteHtmlAtCaret = function(html, selectPastedContent) {
         
     | 
| 
      
 2521 
     | 
    
         
            +
                  var el, firstNode, frag, lastNode, node, originalRange, range, sel;
         
     | 
| 
      
 2522 
     | 
    
         
            +
                  sel = void 0;
         
     | 
| 
      
 2523 
     | 
    
         
            +
                  range = void 0;
         
     | 
| 
      
 2524 
     | 
    
         
            +
                  if (window.getSelection) {
         
     | 
| 
      
 2525 
     | 
    
         
            +
                    sel = window.getSelection();
         
     | 
| 
      
 2526 
     | 
    
         
            +
                    if (sel.getRangeAt && sel.rangeCount) {
         
     | 
| 
      
 2527 
     | 
    
         
            +
                      range = sel.getRangeAt(0);
         
     | 
| 
      
 2528 
     | 
    
         
            +
                      range.deleteContents();
         
     | 
| 
      
 2529 
     | 
    
         
            +
                      el = document.createElement('div');
         
     | 
| 
      
 2530 
     | 
    
         
            +
                      el.innerHTML = html;
         
     | 
| 
      
 2531 
     | 
    
         
            +
                      frag = document.createDocumentFragment();
         
     | 
| 
      
 2532 
     | 
    
         
            +
                      node = void 0;
         
     | 
| 
      
 2533 
     | 
    
         
            +
                      lastNode = void 0;
         
     | 
| 
      
 2534 
     | 
    
         
            +
                      while (node = el.firstChild) {
         
     | 
| 
      
 2535 
     | 
    
         
            +
                        lastNode = frag.appendChild(node);
         
     | 
| 
      
 2536 
     | 
    
         
            +
                      }
         
     | 
| 
      
 2537 
     | 
    
         
            +
                      firstNode = frag.firstChild;
         
     | 
| 
      
 2538 
     | 
    
         
            +
                      range.insertNode(frag);
         
     | 
| 
      
 2539 
     | 
    
         
            +
                      if (lastNode) {
         
     | 
| 
      
 2540 
     | 
    
         
            +
                        range = range.cloneRange();
         
     | 
| 
      
 2541 
     | 
    
         
            +
                        range.setStartAfter(lastNode);
         
     | 
| 
      
 2542 
     | 
    
         
            +
                        if (selectPastedContent) {
         
     | 
| 
      
 2543 
     | 
    
         
            +
                          range.setStartBefore(firstNode);
         
     | 
| 
      
 2544 
     | 
    
         
            +
                        } else {
         
     | 
| 
      
 2545 
     | 
    
         
            +
                          range.collapse(true);
         
     | 
| 
      
 2546 
     | 
    
         
            +
                        }
         
     | 
| 
      
 2547 
     | 
    
         
            +
                        sel.removeAllRanges();
         
     | 
| 
      
 2548 
     | 
    
         
            +
                        sel.addRange(range);
         
     | 
| 
      
 2549 
     | 
    
         
            +
                      }
         
     | 
| 
      
 2550 
     | 
    
         
            +
                    }
         
     | 
| 
      
 2551 
     | 
    
         
            +
                  } else if ((sel = document.selection) && sel.type !== 'Control') {
         
     | 
| 
      
 2552 
     | 
    
         
            +
                    originalRange = sel.createRange();
         
     | 
| 
      
 2553 
     | 
    
         
            +
                    originalRange.collapse(true);
         
     | 
| 
      
 2554 
     | 
    
         
            +
                    sel.createRange().pasteHTML(html);
         
     | 
| 
      
 2555 
     | 
    
         
            +
                    if (selectPastedContent) {
         
     | 
| 
      
 2556 
     | 
    
         
            +
                      range = sel.createRange();
         
     | 
| 
      
 2557 
     | 
    
         
            +
                      range.setEndPoint('StartToStart', originalRange);
         
     | 
| 
      
 2558 
     | 
    
         
            +
                      range.select();
         
     | 
| 
      
 2559 
     | 
    
         
            +
                    }
         
     | 
| 
      
 2560 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2561 
     | 
    
         
            +
                };
         
     | 
| 
      
 2562 
     | 
    
         
            +
             
     | 
| 
      
 2563 
     | 
    
         
            +
                return Suggest;
         
     | 
| 
      
 2564 
     | 
    
         
            +
             
     | 
| 
      
 2565 
     | 
    
         
            +
              })(Dante.View.Behavior);
         
     | 
| 
      
 2566 
     | 
    
         
            +
             
     | 
| 
       2441 
2567 
     | 
    
         
             
            }).call(this);
         
     | 
| 
       2442 
2568 
     | 
    
         
             
            (function() {
         
     | 
| 
       2443 
2569 
     | 
    
         
             
              var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
         
     | 
| 
         @@ -2505,7 +2631,7 @@ 
     | 
|
| 
       2505 
2631 
     | 
    
         
             
                };
         
     | 
| 
       2506 
2632 
     | 
    
         | 
| 
       2507 
2633 
     | 
    
         
             
                Uploader.prototype.insertTemplate = function() {
         
     | 
| 
       2508 
     | 
    
         
            -
                  return "<figure contenteditable='false' class='graf graf--figure is-defaultValue' name='" + (utils.generateUniqueName()) + "' tabindex='0'> <div style='' class='aspectRatioPlaceholder is-locked'> <div style='padding-bottom: 100%;' class='aspect-ratio-fill'></div> <img src='' data-height='' data-width='' data-image-id='' class='graf-image' data-delayed-src=''> </div> <figcaption contenteditable='true' data-default-value='Type caption for image (optional)' class='imageCaption'> <span class='defaultValue'> 
     | 
| 
      
 2634 
     | 
    
         
            +
                  return "<figure contenteditable='false' class='graf graf--figure is-defaultValue' name='" + (utils.generateUniqueName()) + "' tabindex='0'> <div style='' class='aspectRatioPlaceholder is-locked'> <div style='padding-bottom: 100%;' class='aspect-ratio-fill'></div> <img src='' data-height='' data-width='' data-image-id='' class='graf-image' data-delayed-src=''> </div> <figcaption contenteditable='true' data-default-value='Type caption for image (optional)' class='imageCaption'> <span class='defaultValue'>" + this.current_editor.image_caption_placeholder + "</span> <br> </figcaption> </figure>";
         
     | 
| 
       2509 
2635 
     | 
    
         
             
                };
         
     | 
| 
       2510 
2636 
     | 
    
         | 
| 
       2511 
2637 
     | 
    
         
             
                Uploader.prototype.uploadExistentImage = function(image_element, opts) {
         
     | 
| 
         @@ -2814,7 +2940,7 @@ 
     | 
|
| 
       2814 
2940 
     | 
    
         
             
                };
         
     | 
| 
       2815 
2941 
     | 
    
         | 
| 
       2816 
2942 
     | 
    
         
             
                Embed.prototype.embedTemplate = function() {
         
     | 
| 
       2817 
     | 
    
         
            -
                  return "<figure contenteditable='false' class='graf--figure graf--iframe graf--first' name='504e' tabindex='0'> <div class='iframeContainer'> <iframe frameborder='0' width='700' height='393' data-media-id='' src='' data-height='480' data-width='854'> </iframe> </div> <figcaption contenteditable='true' data-default-value=' 
     | 
| 
      
 2943 
     | 
    
         
            +
                  return "<figure contenteditable='false' class='graf--figure graf--iframe graf--first' name='504e' tabindex='0'> <div class='iframeContainer'> <iframe frameborder='0' width='700' height='393' data-media-id='' src='' data-height='480' data-width='854'> </iframe> </div> <figcaption contenteditable='true' data-default-value='" + this.current_editor.embed_caption_placeholder + "' class='imageCaption'> <a rel='nofollow' class='markup--anchor markup--figure-anchor' data-href='' href='' target='_blank'> </a> </figcaption> </figure>";
         
     | 
| 
       2818 
2944 
     | 
    
         
             
                };
         
     | 
| 
       2819 
2945 
     | 
    
         | 
| 
       2820 
2946 
     | 
    
         
             
                Embed.prototype.displayEmbedPlaceHolder = function() {
         
     | 
| 
         @@ -2828,12 +2954,14 @@ 
     | 
|
| 
       2828 
2954 
     | 
    
         
             
                };
         
     | 
| 
       2829 
2955 
     | 
    
         | 
| 
       2830 
2956 
     | 
    
         
             
                Embed.prototype.getEmbedFromNode = function(node) {
         
     | 
| 
      
 2957 
     | 
    
         
            +
                  var url;
         
     | 
| 
       2831 
2958 
     | 
    
         
             
                  this.node = $(node);
         
     | 
| 
       2832 
2959 
     | 
    
         
             
                  this.node_name = this.node.attr("name");
         
     | 
| 
       2833 
2960 
     | 
    
         
             
                  this.node.addClass("spinner");
         
     | 
| 
       2834 
     | 
    
         
            -
                   
     | 
| 
      
 2961 
     | 
    
         
            +
                  url = "" + this.current_editor.oembed_url + ($(this.node).text()) + "&scheme=https";
         
     | 
| 
      
 2962 
     | 
    
         
            +
                  return $.getJSON(url).success((function(_this) {
         
     | 
| 
       2835 
2963 
     | 
    
         
             
                    return function(data) {
         
     | 
| 
       2836 
     | 
    
         
            -
                      var iframe_src, replaced_node, tmpl 
     | 
| 
      
 2964 
     | 
    
         
            +
                      var iframe_src, replaced_node, tmpl;
         
     | 
| 
       2837 
2965 
     | 
    
         
             
                      _this.node = $("[name=" + _this.node_name + "]");
         
     | 
| 
       2838 
2966 
     | 
    
         
             
                      iframe_src = $(data.html).prop("src");
         
     | 
| 
       2839 
2967 
     | 
    
         
             
                      tmpl = $(_this.embedTemplate());
         
     | 
| 
         @@ -2896,7 +3024,7 @@ 
     | 
|
| 
       2896 
3024 
     | 
    
         
             
                };
         
     | 
| 
       2897 
3025 
     | 
    
         | 
| 
       2898 
3026 
     | 
    
         
             
                EmbedExtract.prototype.extractTemplate = function() {
         
     | 
| 
       2899 
     | 
    
         
            -
                  return "<div class='graf graf--mixtapeEmbed is-selected' name=''> <a target='_blank' data-media-id='' class='js-mixtapeImage mixtapeImage mixtapeImage--empty u-ignoreBlock' href=''> </a> <a data-tooltip-type='link' data-tooltip-position='bottom' data-tooltip='' title='' class='markup--anchor markup--mixtapeEmbed-anchor' data-href='' href='' target='_blank'> <strong class='markup--strong markup--mixtapeEmbed-strong' 
     | 
| 
      
 3027 
     | 
    
         
            +
                  return "<div class='graf graf--mixtapeEmbed is-selected' name=''> <a target='_blank' data-media-id='' class='js-mixtapeImage mixtapeImage mixtapeImage--empty u-ignoreBlock' href=''> </a> <a data-tooltip-type='link' data-tooltip-position='bottom' data-tooltip='' title='' class='markup--anchor markup--mixtapeEmbed-anchor' data-href='' href='' target='_blank'> <strong class='markup--strong markup--mixtapeEmbed-strong'> </strong> <em class='markup--em markup--mixtapeEmbed-em'> </em> </a> </div>";
         
     | 
| 
       2900 
3028 
     | 
    
         
             
                };
         
     | 
| 
       2901 
3029 
     | 
    
         | 
| 
       2902 
3030 
     | 
    
         
             
                EmbedExtract.prototype.displayExtractPlaceHolder = function() {
         
     | 
| 
         @@ -3077,165 +3205,44 @@ 
     | 
|
| 
       3077 
3205 
     | 
    
         
             
            (function() {
         
     | 
| 
       3078 
3206 
     | 
    
         
             
              var utils,
         
     | 
| 
       3079 
3207 
     | 
    
         
             
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
       3080 
     | 
    
         
            -
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
       3081 
     | 
    
         
            -
             
     | 
| 
       3082 
     | 
    
         
            -
              utils = Dante.utils;
         
     | 
| 
       3083 
     | 
    
         
            -
             
     | 
| 
       3084 
     | 
    
         
            -
              Dante.Editor.PopOver = (function(_super) {
         
     | 
| 
       3085 
     | 
    
         
            -
                __extends(PopOver, _super);
         
     | 
| 
       3086 
     | 
    
         
            -
             
     | 
| 
       3087 
     | 
    
         
            -
                function PopOver() {
         
     | 
| 
       3088 
     | 
    
         
            -
                  return PopOver.__super__.constructor.apply(this, arguments);
         
     | 
| 
       3089 
     | 
    
         
            -
                }
         
     | 
| 
       3090 
     | 
    
         
            -
             
     | 
| 
       3091 
     | 
    
         
            -
                PopOver.prototype.el = "body";
         
     | 
| 
       3092 
     | 
    
         
            -
             
     | 
| 
       3093 
     | 
    
         
            -
                PopOver.prototype.events = {
         
     | 
| 
       3094 
     | 
    
         
            -
                  "mouseover .popover--tooltip": "cancelHide",
         
     | 
| 
       3095 
     | 
    
         
            -
                  "mouseout  .popover--tooltip": "hide"
         
     | 
| 
       3096 
     | 
    
         
            -
                };
         
     | 
| 
       3097 
     | 
    
         
            -
             
     | 
| 
       3098 
     | 
    
         
            -
                PopOver.prototype.initialize = function(opts) {
         
     | 
| 
       3099 
     | 
    
         
            -
                  if (opts == null) {
         
     | 
| 
       3100 
     | 
    
         
            -
                    opts = {};
         
     | 
| 
       3101 
     | 
    
         
            -
                  }
         
     | 
| 
       3102 
     | 
    
         
            -
                  utils.log("initialized popover");
         
     | 
| 
       3103 
     | 
    
         
            -
                  this.pop_over_element = ".popover--tooltip";
         
     | 
| 
       3104 
     | 
    
         
            -
                  this.editor = opts.editor;
         
     | 
| 
       3105 
     | 
    
         
            -
                  this.hideTimeout;
         
     | 
| 
       3106 
     | 
    
         
            -
                  return this.settings = {
         
     | 
| 
       3107 
     | 
    
         
            -
                    timeout: 300
         
     | 
| 
       3108 
     | 
    
         
            -
                  };
         
     | 
| 
       3109 
     | 
    
         
            -
                };
         
     | 
| 
       3110 
     | 
    
         
            -
             
     | 
| 
       3111 
     | 
    
         
            -
                PopOver.prototype.template = function() {
         
     | 
| 
       3112 
     | 
    
         
            -
                  return "<div class='dante-popover popover--tooltip popover--Linktooltip popover--bottom is-active'> <div class='popover-inner'> <a href='#' target='_blank'> Link </a> </div> <div class='popover-arrow'> </div> </div>";
         
     | 
| 
       3113 
     | 
    
         
            -
                };
         
     | 
| 
       3114 
     | 
    
         
            -
             
     | 
| 
       3115 
     | 
    
         
            -
                PopOver.prototype.positionAt = function(ev) {
         
     | 
| 
       3116 
     | 
    
         
            -
                  var left_value, popover_width, target, target_height, target_offset, target_positions, target_width, top_value, wrapperOffset;
         
     | 
| 
       3117 
     | 
    
         
            -
                  target = $(ev.currentTarget);
         
     | 
| 
       3118 
     | 
    
         
            -
                  wrapperOffset = target.closest('article.postArticle').offset();
         
     | 
| 
       3119 
     | 
    
         
            -
                  target_positions = this.resolveTargetPosition(target);
         
     | 
| 
       3120 
     | 
    
         
            -
                  target_offset = target.offset();
         
     | 
| 
       3121 
     | 
    
         
            -
                  target_width = target.outerWidth();
         
     | 
| 
       3122 
     | 
    
         
            -
                  target_height = target.outerHeight();
         
     | 
| 
       3123 
     | 
    
         
            -
                  popover_width = this.findElement().outerWidth();
         
     | 
| 
       3124 
     | 
    
         
            -
                  top_value = target_positions.top + target_height;
         
     | 
| 
       3125 
     | 
    
         
            -
                  left_value = target_offset.left + (target_width / 2) - (popover_width / 2) - wrapperOffset.left;
         
     | 
| 
       3126 
     | 
    
         
            -
                  this.findElement().css("top", top_value).css("left", left_value).show();
         
     | 
| 
       3127 
     | 
    
         
            -
                  return this.handleDirection(target);
         
     | 
| 
       3128 
     | 
    
         
            -
                };
         
     | 
| 
       3129 
     | 
    
         
            -
             
     | 
| 
       3130 
     | 
    
         
            -
                PopOver.prototype.displayAt = function(ev) {
         
     | 
| 
       3131 
     | 
    
         
            -
                  var target;
         
     | 
| 
       3132 
     | 
    
         
            -
                  this.cancelHide();
         
     | 
| 
       3133 
     | 
    
         
            -
                  target = $(ev.currentTarget);
         
     | 
| 
       3134 
     | 
    
         
            -
                  this.findElement().find(".popover-inner a").text(target.attr('href')).attr('href', target.attr("href"));
         
     | 
| 
       3135 
     | 
    
         
            -
                  this.positionAt(ev);
         
     | 
| 
       3136 
     | 
    
         
            -
                  this.findElement().css("pointer-events", "auto");
         
     | 
| 
       3137 
     | 
    
         
            -
                  return $(this.el).show();
         
     | 
| 
       3138 
     | 
    
         
            -
                };
         
     | 
| 
       3139 
     | 
    
         
            -
             
     | 
| 
       3140 
     | 
    
         
            -
                PopOver.prototype.cancelHide = function() {
         
     | 
| 
       3141 
     | 
    
         
            -
                  utils.log("Cancel Hide");
         
     | 
| 
       3142 
     | 
    
         
            -
                  return clearTimeout(this.hideTimeout);
         
     | 
| 
       3143 
     | 
    
         
            -
                };
         
     | 
| 
       3144 
     | 
    
         
            -
             
     | 
| 
       3145 
     | 
    
         
            -
                PopOver.prototype.hide = function(ev) {
         
     | 
| 
       3146 
     | 
    
         
            -
                  this.cancelHide();
         
     | 
| 
       3147 
     | 
    
         
            -
                  return this.hideTimeout = setTimeout((function(_this) {
         
     | 
| 
       3148 
     | 
    
         
            -
                    return function() {
         
     | 
| 
       3149 
     | 
    
         
            -
                      return _this.findElement().hide();
         
     | 
| 
       3150 
     | 
    
         
            -
                    };
         
     | 
| 
       3151 
     | 
    
         
            -
                  })(this), this.settings.timeout);
         
     | 
| 
       3152 
     | 
    
         
            -
                };
         
     | 
| 
       3153 
     | 
    
         
            -
             
     | 
| 
       3154 
     | 
    
         
            -
                PopOver.prototype.resolveTargetPosition = function(target) {
         
     | 
| 
       3155 
     | 
    
         
            -
                  if (target.parents(".graf--mixtapeEmbed").exists()) {
         
     | 
| 
       3156 
     | 
    
         
            -
                    return target.parents(".graf--mixtapeEmbed").position();
         
     | 
| 
       3157 
     | 
    
         
            -
                  } else {
         
     | 
| 
       3158 
     | 
    
         
            -
                    return target.position();
         
     | 
| 
       3159 
     | 
    
         
            -
                  }
         
     | 
| 
       3160 
     | 
    
         
            -
                };
         
     | 
| 
       3161 
     | 
    
         
            -
             
     | 
| 
       3162 
     | 
    
         
            -
                PopOver.prototype.handleDirection = function(target) {
         
     | 
| 
       3163 
     | 
    
         
            -
                  if (target.parents(".graf--mixtapeEmbed").exists()) {
         
     | 
| 
       3164 
     | 
    
         
            -
                    return this.findElement().removeClass("popover--bottom").addClass("popover--top");
         
     | 
| 
       3165 
     | 
    
         
            -
                  } else {
         
     | 
| 
       3166 
     | 
    
         
            -
                    return this.findElement().removeClass("popover--top").addClass("popover--bottom");
         
     | 
| 
       3167 
     | 
    
         
            -
                  }
         
     | 
| 
       3168 
     | 
    
         
            -
                };
         
     | 
| 
       3169 
     | 
    
         
            -
             
     | 
| 
       3170 
     | 
    
         
            -
                PopOver.prototype.findElement = function() {
         
     | 
| 
       3171 
     | 
    
         
            -
                  return $(this.el).find(this.pop_over_element);
         
     | 
| 
       3172 
     | 
    
         
            -
                };
         
     | 
| 
       3173 
     | 
    
         
            -
             
     | 
| 
       3174 
     | 
    
         
            -
                PopOver.prototype.render = function() {
         
     | 
| 
       3175 
     | 
    
         
            -
                  return $(this.template()).insertAfter(this.editor.$el);
         
     | 
| 
       3176 
     | 
    
         
            -
                };
         
     | 
| 
       3177 
     | 
    
         
            -
             
     | 
| 
       3178 
     | 
    
         
            -
                return PopOver;
         
     | 
| 
      
 3208 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
       3179 
3209 
     | 
    
         | 
| 
       3180 
     | 
    
         
            -
               
     | 
| 
      
 3210 
     | 
    
         
            +
              utils = Dante.utils;
         
     | 
| 
       3181 
3211 
     | 
    
         | 
| 
       3182 
     | 
    
         
            -
              Dante.Editor. 
     | 
| 
       3183 
     | 
    
         
            -
                __extends( 
     | 
| 
      
 3212 
     | 
    
         
            +
              Dante.Editor.PopOver = (function(_super) {
         
     | 
| 
      
 3213 
     | 
    
         
            +
                __extends(PopOver, _super);
         
     | 
| 
       3184 
3214 
     | 
    
         | 
| 
       3185 
     | 
    
         
            -
                function  
     | 
| 
       3186 
     | 
    
         
            -
                  return  
     | 
| 
      
 3215 
     | 
    
         
            +
                function PopOver() {
         
     | 
| 
      
 3216 
     | 
    
         
            +
                  return PopOver.__super__.constructor.apply(this, arguments);
         
     | 
| 
       3187 
3217 
     | 
    
         
             
                }
         
     | 
| 
       3188 
3218 
     | 
    
         | 
| 
       3189 
     | 
    
         
            -
                 
     | 
| 
      
 3219 
     | 
    
         
            +
                PopOver.prototype.el = "body";
         
     | 
| 
       3190 
3220 
     | 
    
         | 
| 
       3191 
     | 
    
         
            -
                 
     | 
| 
       3192 
     | 
    
         
            -
                  "mouseover .popover-- 
     | 
| 
       3193 
     | 
    
         
            -
                  "mouseout  .popover-- 
     | 
| 
       3194 
     | 
    
         
            -
                  "click .typeahead-item": "handleOptionSelection"
         
     | 
| 
      
 3221 
     | 
    
         
            +
                PopOver.prototype.events = {
         
     | 
| 
      
 3222 
     | 
    
         
            +
                  "mouseover .popover--tooltip": "cancelHide",
         
     | 
| 
      
 3223 
     | 
    
         
            +
                  "mouseout  .popover--tooltip": "hide"
         
     | 
| 
       3195 
3224 
     | 
    
         
             
                };
         
     | 
| 
       3196 
3225 
     | 
    
         | 
| 
       3197 
     | 
    
         
            -
                 
     | 
| 
      
 3226 
     | 
    
         
            +
                PopOver.prototype.initialize = function(opts) {
         
     | 
| 
       3198 
3227 
     | 
    
         
             
                  if (opts == null) {
         
     | 
| 
       3199 
3228 
     | 
    
         
             
                    opts = {};
         
     | 
| 
       3200 
3229 
     | 
    
         
             
                  }
         
     | 
| 
       3201 
     | 
    
         
            -
                  this.pop_over_element = "popover--typeahead";
         
     | 
| 
       3202 
3230 
     | 
    
         
             
                  utils.log("initialized popover");
         
     | 
| 
      
 3231 
     | 
    
         
            +
                  this.pop_over_element = ".popover--tooltip";
         
     | 
| 
       3203 
3232 
     | 
    
         
             
                  this.editor = opts.editor;
         
     | 
| 
       3204 
3233 
     | 
    
         
             
                  this.hideTimeout;
         
     | 
| 
       3205 
     | 
    
         
            -
                  this.settings = {
         
     | 
| 
      
 3234 
     | 
    
         
            +
                  return this.settings = {
         
     | 
| 
       3206 
3235 
     | 
    
         
             
                    timeout: 300
         
     | 
| 
       3207 
3236 
     | 
    
         
             
                  };
         
     | 
| 
       3208 
     | 
    
         
            -
                  return this.typeaheadStyles();
         
     | 
| 
       3209 
     | 
    
         
            -
                };
         
     | 
| 
       3210 
     | 
    
         
            -
             
     | 
| 
       3211 
     | 
    
         
            -
                PopOverTypeAhead.prototype.template = function() {
         
     | 
| 
       3212 
     | 
    
         
            -
                  return "<div class='dante-popover popover--typeahead js-popover typeahead typeahead--mention popover--maxWidth360 popover--bottom is-active'> <div class='popover-inner js-popover-inner'> <ul></ul> </div> <div class='popover-arrow' style='left: 297px;'></div> </div>";
         
     | 
| 
       3213 
     | 
    
         
            -
                };
         
     | 
| 
       3214 
     | 
    
         
            -
             
     | 
| 
       3215 
     | 
    
         
            -
                PopOverTypeAhead.prototype.popoverItem = function(item) {
         
     | 
| 
       3216 
     | 
    
         
            -
                  return "<li class='typeahead-item' data-action-value='" + item.text + "' data-action='typeahead-populate' data-id='" + item.id + "' data-type='" + item.type + "' data-href='" + item.href + "'> <div class='dante-avatar'> <img src='" + item.avatar + "' class='avatar-image avatar-image--icon' alt='" + item.text + "'> <span class='avatar-text'>" + item.text + "</span> <em class='avatar-description'>" + item.description + "</em> </div> </li>";
         
     | 
| 
       3217 
     | 
    
         
            -
                };
         
     | 
| 
       3218 
     | 
    
         
            -
             
     | 
| 
       3219 
     | 
    
         
            -
                PopOverTypeAhead.prototype.typeaheadStyles = function() {
         
     | 
| 
       3220 
     | 
    
         
            -
                  return this.classesForCurrent = "typeahead typeahead--mention popover--maxWidth360";
         
     | 
| 
       3221 
     | 
    
         
            -
                };
         
     | 
| 
       3222 
     | 
    
         
            -
             
     | 
| 
       3223 
     | 
    
         
            -
                PopOverTypeAhead.prototype.handleOptionSelection = function(ev) {
         
     | 
| 
       3224 
     | 
    
         
            -
                  var data;
         
     | 
| 
       3225 
     | 
    
         
            -
                  ev.preventDefault;
         
     | 
| 
       3226 
     | 
    
         
            -
                  console.log("Select option here!");
         
     | 
| 
       3227 
     | 
    
         
            -
                  data = $(ev.currentTarget).data();
         
     | 
| 
       3228 
     | 
    
         
            -
                  $(".markup--query").replaceWith(this.linkTemplate(data));
         
     | 
| 
       3229 
     | 
    
         
            -
                  return this.hide(0);
         
     | 
| 
       3230 
3237 
     | 
    
         
             
                };
         
     | 
| 
       3231 
3238 
     | 
    
         | 
| 
       3232 
     | 
    
         
            -
                 
     | 
| 
       3233 
     | 
    
         
            -
                  return "< 
     | 
| 
      
 3239 
     | 
    
         
            +
                PopOver.prototype.template = function() {
         
     | 
| 
      
 3240 
     | 
    
         
            +
                  return "<div class='dante-popover popover--tooltip popover--Linktooltip popover--bottom is-active'> <div class='popover-inner'> <a href='#' target='_blank'> Link </a> </div> <div class='popover-arrow'> </div> </div>";
         
     | 
| 
       3234 
3241 
     | 
    
         
             
                };
         
     | 
| 
       3235 
3242 
     | 
    
         | 
| 
       3236 
     | 
    
         
            -
                 
     | 
| 
       3237 
     | 
    
         
            -
                  var left_value, popover_width, target_height, target_offset, target_positions, target_width, top_value, wrapperOffset;
         
     | 
| 
       3238 
     | 
    
         
            -
                  target = $( 
     | 
| 
      
 3243 
     | 
    
         
            +
                PopOver.prototype.positionAt = function(ev) {
         
     | 
| 
      
 3244 
     | 
    
         
            +
                  var left_value, popover_width, target, target_height, target_offset, target_positions, target_width, top_value, wrapperOffset;
         
     | 
| 
      
 3245 
     | 
    
         
            +
                  target = $(ev.currentTarget);
         
     | 
| 
       3239 
3246 
     | 
    
         
             
                  wrapperOffset = target.closest('article.postArticle').offset();
         
     | 
| 
       3240 
3247 
     | 
    
         
             
                  target_positions = this.resolveTargetPosition(target);
         
     | 
| 
       3241 
3248 
     | 
    
         
             
                  target_offset = target.offset();
         
     | 
| 
         @@ -3248,42 +3255,31 @@ 
     | 
|
| 
       3248 
3255 
     | 
    
         
             
                  return this.handleDirection(target);
         
     | 
| 
       3249 
3256 
     | 
    
         
             
                };
         
     | 
| 
       3250 
3257 
     | 
    
         | 
| 
       3251 
     | 
    
         
            -
                 
     | 
| 
      
 3258 
     | 
    
         
            +
                PopOver.prototype.displayAt = function(ev) {
         
     | 
| 
      
 3259 
     | 
    
         
            +
                  var target;
         
     | 
| 
       3252 
3260 
     | 
    
         
             
                  this.cancelHide();
         
     | 
| 
       3253 
     | 
    
         
            -
                   
     | 
| 
      
 3261 
     | 
    
         
            +
                  target = $(ev.currentTarget);
         
     | 
| 
      
 3262 
     | 
    
         
            +
                  this.findElement().find(".popover-inner a").text(target.attr('href')).attr('href', target.attr("href"));
         
     | 
| 
      
 3263 
     | 
    
         
            +
                  this.positionAt(ev);
         
     | 
| 
      
 3264 
     | 
    
         
            +
                  this.findElement().css("pointer-events", "auto");
         
     | 
| 
      
 3265 
     | 
    
         
            +
                  return $(this.el).show();
         
     | 
| 
       3254 
3266 
     | 
    
         
             
                };
         
     | 
| 
       3255 
3267 
     | 
    
         | 
| 
       3256 
     | 
    
         
            -
                 
     | 
| 
      
 3268 
     | 
    
         
            +
                PopOver.prototype.cancelHide = function() {
         
     | 
| 
       3257 
3269 
     | 
    
         
             
                  utils.log("Cancel Hide");
         
     | 
| 
       3258 
3270 
     | 
    
         
             
                  return clearTimeout(this.hideTimeout);
         
     | 
| 
       3259 
3271 
     | 
    
         
             
                };
         
     | 
| 
       3260 
3272 
     | 
    
         | 
| 
       3261 
     | 
    
         
            -
                 
     | 
| 
       3262 
     | 
    
         
            -
                  return $(this.el).find("." + this.pop_over_element);
         
     | 
| 
       3263 
     | 
    
         
            -
                };
         
     | 
| 
       3264 
     | 
    
         
            -
             
     | 
| 
       3265 
     | 
    
         
            -
                PopOverTypeAhead.prototype.hide = function(ev, timeout) {
         
     | 
| 
       3266 
     | 
    
         
            -
                  if (timeout == null) {
         
     | 
| 
       3267 
     | 
    
         
            -
                    timeout = this.settings.timeout;
         
     | 
| 
       3268 
     | 
    
         
            -
                  }
         
     | 
| 
      
 3273 
     | 
    
         
            +
                PopOver.prototype.hide = function(ev) {
         
     | 
| 
       3269 
3274 
     | 
    
         
             
                  this.cancelHide();
         
     | 
| 
       3270 
3275 
     | 
    
         
             
                  return this.hideTimeout = setTimeout((function(_this) {
         
     | 
| 
       3271 
3276 
     | 
    
         
             
                    return function() {
         
     | 
| 
       3272 
3277 
     | 
    
         
             
                      return _this.findElement().hide();
         
     | 
| 
       3273 
3278 
     | 
    
         
             
                    };
         
     | 
| 
       3274 
     | 
    
         
            -
                  })(this), timeout);
         
     | 
| 
       3275 
     | 
    
         
            -
                };
         
     | 
| 
       3276 
     | 
    
         
            -
             
     | 
| 
       3277 
     | 
    
         
            -
                PopOverTypeAhead.prototype.appendData = function(data) {
         
     | 
| 
       3278 
     | 
    
         
            -
                  this.findElement().find(".popover-inner ul").html("");
         
     | 
| 
       3279 
     | 
    
         
            -
                  return _.each(data, (function(_this) {
         
     | 
| 
       3280 
     | 
    
         
            -
                    return function(item) {
         
     | 
| 
       3281 
     | 
    
         
            -
                      return _this.findElement().find(".popover-inner ul").append(_this.popoverItem(item));
         
     | 
| 
       3282 
     | 
    
         
            -
                    };
         
     | 
| 
       3283 
     | 
    
         
            -
                  })(this));
         
     | 
| 
      
 3279 
     | 
    
         
            +
                  })(this), this.settings.timeout);
         
     | 
| 
       3284 
3280 
     | 
    
         
             
                };
         
     | 
| 
       3285 
3281 
     | 
    
         | 
| 
       3286 
     | 
    
         
            -
                 
     | 
| 
      
 3282 
     | 
    
         
            +
                PopOver.prototype.resolveTargetPosition = function(target) {
         
     | 
| 
       3287 
3283 
     | 
    
         
             
                  if (target.parents(".graf--mixtapeEmbed").exists()) {
         
     | 
| 
       3288 
3284 
     | 
    
         
             
                    return target.parents(".graf--mixtapeEmbed").position();
         
     | 
| 
       3289 
3285 
     | 
    
         
             
                  } else {
         
     | 
| 
         @@ -3291,7 +3287,7 @@ 
     | 
|
| 
       3291 
3287 
     | 
    
         
             
                  }
         
     | 
| 
       3292 
3288 
     | 
    
         
             
                };
         
     | 
| 
       3293 
3289 
     | 
    
         | 
| 
       3294 
     | 
    
         
            -
                 
     | 
| 
      
 3290 
     | 
    
         
            +
                PopOver.prototype.handleDirection = function(target) {
         
     | 
| 
       3295 
3291 
     | 
    
         
             
                  if (target.parents(".graf--mixtapeEmbed").exists()) {
         
     | 
| 
       3296 
3292 
     | 
    
         
             
                    return this.findElement().removeClass("popover--bottom").addClass("popover--top");
         
     | 
| 
       3297 
3293 
     | 
    
         
             
                  } else {
         
     | 
| 
         @@ -3299,13 +3295,25 @@ 
     | 
|
| 
       3299 
3295 
     | 
    
         
             
                  }
         
     | 
| 
       3300 
3296 
     | 
    
         
             
                };
         
     | 
| 
       3301 
3297 
     | 
    
         | 
| 
       3302 
     | 
    
         
            -
                 
     | 
| 
      
 3298 
     | 
    
         
            +
                PopOver.prototype.findElement = function() {
         
     | 
| 
      
 3299 
     | 
    
         
            +
                  return $(this.el).find(this.pop_over_element);
         
     | 
| 
      
 3300 
     | 
    
         
            +
                };
         
     | 
| 
      
 3301 
     | 
    
         
            +
             
     | 
| 
      
 3302 
     | 
    
         
            +
                PopOver.prototype.render = function() {
         
     | 
| 
       3303 
3303 
     | 
    
         
             
                  return $(this.template()).insertAfter(this.editor.$el);
         
     | 
| 
       3304 
3304 
     | 
    
         
             
                };
         
     | 
| 
       3305 
3305 
     | 
    
         | 
| 
       3306 
     | 
    
         
            -
                return  
     | 
| 
      
 3306 
     | 
    
         
            +
                return PopOver;
         
     | 
| 
       3307 
3307 
     | 
    
         | 
| 
       3308 
     | 
    
         
            -
              })(Dante. 
     | 
| 
      
 3308 
     | 
    
         
            +
              })(Dante.View);
         
     | 
| 
      
 3309 
     | 
    
         
            +
             
     | 
| 
      
 3310 
     | 
    
         
            +
            }).call(this);
         
     | 
| 
      
 3311 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 3312 
     | 
    
         
            +
              var utils,
         
     | 
| 
      
 3313 
     | 
    
         
            +
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
      
 3314 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
      
 3315 
     | 
    
         
            +
             
     | 
| 
      
 3316 
     | 
    
         
            +
              utils = Dante.utils;
         
     | 
| 
       3309 
3317 
     | 
    
         | 
| 
       3310 
3318 
     | 
    
         
             
              Dante.Editor.PopOverCard = (function(_super) {
         
     | 
| 
       3311 
3319 
     | 
    
         
             
                __extends(PopOverCard, _super);
         
     | 
| 
         @@ -3395,6 +3403,14 @@ 
     | 
|
| 
       3395 
3403 
     | 
    
         | 
| 
       3396 
3404 
     | 
    
         
             
              })(Dante.Editor.PopOver);
         
     | 
| 
       3397 
3405 
     | 
    
         | 
| 
      
 3406 
     | 
    
         
            +
            }).call(this);
         
     | 
| 
      
 3407 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 3408 
     | 
    
         
            +
              var utils,
         
     | 
| 
      
 3409 
     | 
    
         
            +
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
      
 3410 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
      
 3411 
     | 
    
         
            +
             
     | 
| 
      
 3412 
     | 
    
         
            +
              utils = Dante.utils;
         
     | 
| 
      
 3413 
     | 
    
         
            +
             
     | 
| 
       3398 
3414 
     | 
    
         
             
              Dante.Editor.ImageTooltip = (function(_super) {
         
     | 
| 
       3399 
3415 
     | 
    
         
             
                __extends(ImageTooltip, _super);
         
     | 
| 
       3400 
3416 
     | 
    
         | 
| 
         @@ -3502,6 +3518,142 @@ 
     | 
|
| 
       3502 
3518 
     | 
    
         | 
| 
       3503 
3519 
     | 
    
         
             
              })(Dante.Editor.PopOver);
         
     | 
| 
       3504 
3520 
     | 
    
         | 
| 
      
 3521 
     | 
    
         
            +
            }).call(this);
         
     | 
| 
      
 3522 
     | 
    
         
            +
            (function() {
         
     | 
| 
      
 3523 
     | 
    
         
            +
              var utils,
         
     | 
| 
      
 3524 
     | 
    
         
            +
                __hasProp = {}.hasOwnProperty,
         
     | 
| 
      
 3525 
     | 
    
         
            +
                __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
         
     | 
| 
      
 3526 
     | 
    
         
            +
             
     | 
| 
      
 3527 
     | 
    
         
            +
              utils = Dante.utils;
         
     | 
| 
      
 3528 
     | 
    
         
            +
             
     | 
| 
      
 3529 
     | 
    
         
            +
              Dante.Editor.PopOverTypeAhead = (function(_super) {
         
     | 
| 
      
 3530 
     | 
    
         
            +
                __extends(PopOverTypeAhead, _super);
         
     | 
| 
      
 3531 
     | 
    
         
            +
             
     | 
| 
      
 3532 
     | 
    
         
            +
                function PopOverTypeAhead() {
         
     | 
| 
      
 3533 
     | 
    
         
            +
                  return PopOverTypeAhead.__super__.constructor.apply(this, arguments);
         
     | 
| 
      
 3534 
     | 
    
         
            +
                }
         
     | 
| 
      
 3535 
     | 
    
         
            +
             
     | 
| 
      
 3536 
     | 
    
         
            +
                PopOverTypeAhead.prototype.el = "body";
         
     | 
| 
      
 3537 
     | 
    
         
            +
             
     | 
| 
      
 3538 
     | 
    
         
            +
                PopOverTypeAhead.prototype.events = {
         
     | 
| 
      
 3539 
     | 
    
         
            +
                  "mouseover .popover--typeahead": "cancelHide",
         
     | 
| 
      
 3540 
     | 
    
         
            +
                  "mouseout  .popover--typeahead": "hide",
         
     | 
| 
      
 3541 
     | 
    
         
            +
                  "click .typeahead-item": "handleOptionSelection"
         
     | 
| 
      
 3542 
     | 
    
         
            +
                };
         
     | 
| 
      
 3543 
     | 
    
         
            +
             
     | 
| 
      
 3544 
     | 
    
         
            +
                PopOverTypeAhead.prototype.initialize = function(opts) {
         
     | 
| 
      
 3545 
     | 
    
         
            +
                  if (opts == null) {
         
     | 
| 
      
 3546 
     | 
    
         
            +
                    opts = {};
         
     | 
| 
      
 3547 
     | 
    
         
            +
                  }
         
     | 
| 
      
 3548 
     | 
    
         
            +
                  this.pop_over_element = "popover--typeahead";
         
     | 
| 
      
 3549 
     | 
    
         
            +
                  utils.log("initialized popover");
         
     | 
| 
      
 3550 
     | 
    
         
            +
                  this.editor = opts.editor;
         
     | 
| 
      
 3551 
     | 
    
         
            +
                  this.hideTimeout;
         
     | 
| 
      
 3552 
     | 
    
         
            +
                  this.settings = {
         
     | 
| 
      
 3553 
     | 
    
         
            +
                    timeout: 300
         
     | 
| 
      
 3554 
     | 
    
         
            +
                  };
         
     | 
| 
      
 3555 
     | 
    
         
            +
                  return this.typeaheadStyles();
         
     | 
| 
      
 3556 
     | 
    
         
            +
                };
         
     | 
| 
      
 3557 
     | 
    
         
            +
             
     | 
| 
      
 3558 
     | 
    
         
            +
                PopOverTypeAhead.prototype.template = function() {
         
     | 
| 
      
 3559 
     | 
    
         
            +
                  return "<div class='dante-popover popover--typeahead js-popover typeahead typeahead--mention popover--maxWidth360 popover--bottom is-active'> <div class='popover-inner js-popover-inner'> <ul></ul> </div> <div class='popover-arrow' style='left: 297px;'></div> </div>";
         
     | 
| 
      
 3560 
     | 
    
         
            +
                };
         
     | 
| 
      
 3561 
     | 
    
         
            +
             
     | 
| 
      
 3562 
     | 
    
         
            +
                PopOverTypeAhead.prototype.popoverItem = function(item) {
         
     | 
| 
      
 3563 
     | 
    
         
            +
                  return "<li class='typeahead-item' data-action-value='" + item.text + "' data-action='typeahead-populate' data-id='" + item.id + "' data-type='" + item.type + "' data-href='" + item.href + "'> <div class='dante-avatar'> <img src='" + item.avatar + "' class='avatar-image avatar-image--icon' alt='" + item.text + "'> <span class='avatar-text'>" + item.text + "</span> <em class='avatar-description'>" + item.description + "</em> </div> </li>";
         
     | 
| 
      
 3564 
     | 
    
         
            +
                };
         
     | 
| 
      
 3565 
     | 
    
         
            +
             
     | 
| 
      
 3566 
     | 
    
         
            +
                PopOverTypeAhead.prototype.typeaheadStyles = function() {
         
     | 
| 
      
 3567 
     | 
    
         
            +
                  return this.classesForCurrent = "typeahead typeahead--mention popover--maxWidth360";
         
     | 
| 
      
 3568 
     | 
    
         
            +
                };
         
     | 
| 
      
 3569 
     | 
    
         
            +
             
     | 
| 
      
 3570 
     | 
    
         
            +
                PopOverTypeAhead.prototype.handleOptionSelection = function(ev) {
         
     | 
| 
      
 3571 
     | 
    
         
            +
                  var data;
         
     | 
| 
      
 3572 
     | 
    
         
            +
                  ev.preventDefault;
         
     | 
| 
      
 3573 
     | 
    
         
            +
                  console.log("Select option here!");
         
     | 
| 
      
 3574 
     | 
    
         
            +
                  data = $(ev.currentTarget).data();
         
     | 
| 
      
 3575 
     | 
    
         
            +
                  $(".markup--query").replaceWith(this.linkTemplate(data));
         
     | 
| 
      
 3576 
     | 
    
         
            +
                  return this.hide(0);
         
     | 
| 
      
 3577 
     | 
    
         
            +
                };
         
     | 
| 
      
 3578 
     | 
    
         
            +
             
     | 
| 
      
 3579 
     | 
    
         
            +
                PopOverTypeAhead.prototype.linkTemplate = function(data) {
         
     | 
| 
      
 3580 
     | 
    
         
            +
                  return "<a href='#' data-type='" + data.type + "' data-href='" + data.href + "' data-id='" + data.id + "' class='markup--user markup--p-user'> " + data.actionValue + " </a>";
         
     | 
| 
      
 3581 
     | 
    
         
            +
                };
         
     | 
| 
      
 3582 
     | 
    
         
            +
             
     | 
| 
      
 3583 
     | 
    
         
            +
                PopOverTypeAhead.prototype.positionAt = function(target) {
         
     | 
| 
      
 3584 
     | 
    
         
            +
                  var left_value, popover_width, target_height, target_offset, target_positions, target_width, top_value, wrapperOffset;
         
     | 
| 
      
 3585 
     | 
    
         
            +
                  target = $(target);
         
     | 
| 
      
 3586 
     | 
    
         
            +
                  wrapperOffset = target.closest('article.postArticle').offset();
         
     | 
| 
      
 3587 
     | 
    
         
            +
                  target_positions = this.resolveTargetPosition(target);
         
     | 
| 
      
 3588 
     | 
    
         
            +
                  target_offset = target.offset();
         
     | 
| 
      
 3589 
     | 
    
         
            +
                  target_width = target.outerWidth();
         
     | 
| 
      
 3590 
     | 
    
         
            +
                  target_height = target.outerHeight();
         
     | 
| 
      
 3591 
     | 
    
         
            +
                  popover_width = this.findElement().outerWidth();
         
     | 
| 
      
 3592 
     | 
    
         
            +
                  top_value = target_positions.top + target_height;
         
     | 
| 
      
 3593 
     | 
    
         
            +
                  left_value = target_offset.left + (target_width / 2) - (popover_width / 2) - wrapperOffset.left;
         
     | 
| 
      
 3594 
     | 
    
         
            +
                  this.findElement().css("top", top_value).css("left", left_value).show();
         
     | 
| 
      
 3595 
     | 
    
         
            +
                  return this.handleDirection(target);
         
     | 
| 
      
 3596 
     | 
    
         
            +
                };
         
     | 
| 
      
 3597 
     | 
    
         
            +
             
     | 
| 
      
 3598 
     | 
    
         
            +
                PopOverTypeAhead.prototype.displayAt = function(ev) {
         
     | 
| 
      
 3599 
     | 
    
         
            +
                  this.cancelHide();
         
     | 
| 
      
 3600 
     | 
    
         
            +
                  return this.positionAt(ev);
         
     | 
| 
      
 3601 
     | 
    
         
            +
                };
         
     | 
| 
      
 3602 
     | 
    
         
            +
             
     | 
| 
      
 3603 
     | 
    
         
            +
                PopOverTypeAhead.prototype.cancelHide = function() {
         
     | 
| 
      
 3604 
     | 
    
         
            +
                  utils.log("Cancel Hide");
         
     | 
| 
      
 3605 
     | 
    
         
            +
                  return clearTimeout(this.hideTimeout);
         
     | 
| 
      
 3606 
     | 
    
         
            +
                };
         
     | 
| 
      
 3607 
     | 
    
         
            +
             
     | 
| 
      
 3608 
     | 
    
         
            +
                PopOverTypeAhead.prototype.findElement = function() {
         
     | 
| 
      
 3609 
     | 
    
         
            +
                  return $(this.el).find("." + this.pop_over_element);
         
     | 
| 
      
 3610 
     | 
    
         
            +
                };
         
     | 
| 
      
 3611 
     | 
    
         
            +
             
     | 
| 
      
 3612 
     | 
    
         
            +
                PopOverTypeAhead.prototype.hide = function(ev, timeout) {
         
     | 
| 
      
 3613 
     | 
    
         
            +
                  if (timeout == null) {
         
     | 
| 
      
 3614 
     | 
    
         
            +
                    timeout = this.settings.timeout;
         
     | 
| 
      
 3615 
     | 
    
         
            +
                  }
         
     | 
| 
      
 3616 
     | 
    
         
            +
                  this.cancelHide();
         
     | 
| 
      
 3617 
     | 
    
         
            +
                  return this.hideTimeout = setTimeout((function(_this) {
         
     | 
| 
      
 3618 
     | 
    
         
            +
                    return function() {
         
     | 
| 
      
 3619 
     | 
    
         
            +
                      return _this.findElement().hide();
         
     | 
| 
      
 3620 
     | 
    
         
            +
                    };
         
     | 
| 
      
 3621 
     | 
    
         
            +
                  })(this), timeout);
         
     | 
| 
      
 3622 
     | 
    
         
            +
                };
         
     | 
| 
      
 3623 
     | 
    
         
            +
             
     | 
| 
      
 3624 
     | 
    
         
            +
                PopOverTypeAhead.prototype.appendData = function(data) {
         
     | 
| 
      
 3625 
     | 
    
         
            +
                  this.findElement().find(".popover-inner ul").html("");
         
     | 
| 
      
 3626 
     | 
    
         
            +
                  return _.each(data, (function(_this) {
         
     | 
| 
      
 3627 
     | 
    
         
            +
                    return function(item) {
         
     | 
| 
      
 3628 
     | 
    
         
            +
                      return _this.findElement().find(".popover-inner ul").append(_this.popoverItem(item));
         
     | 
| 
      
 3629 
     | 
    
         
            +
                    };
         
     | 
| 
      
 3630 
     | 
    
         
            +
                  })(this));
         
     | 
| 
      
 3631 
     | 
    
         
            +
                };
         
     | 
| 
      
 3632 
     | 
    
         
            +
             
     | 
| 
      
 3633 
     | 
    
         
            +
                PopOverTypeAhead.prototype.resolveTargetPosition = function(target) {
         
     | 
| 
      
 3634 
     | 
    
         
            +
                  if (target.parents(".graf--mixtapeEmbed").exists()) {
         
     | 
| 
      
 3635 
     | 
    
         
            +
                    return target.parents(".graf--mixtapeEmbed").position();
         
     | 
| 
      
 3636 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 3637 
     | 
    
         
            +
                    return target.position();
         
     | 
| 
      
 3638 
     | 
    
         
            +
                  }
         
     | 
| 
      
 3639 
     | 
    
         
            +
                };
         
     | 
| 
      
 3640 
     | 
    
         
            +
             
     | 
| 
      
 3641 
     | 
    
         
            +
                PopOverTypeAhead.prototype.handleDirection = function(target) {
         
     | 
| 
      
 3642 
     | 
    
         
            +
                  if (target.parents(".graf--mixtapeEmbed").exists()) {
         
     | 
| 
      
 3643 
     | 
    
         
            +
                    return this.findElement().removeClass("popover--bottom").addClass("popover--top");
         
     | 
| 
      
 3644 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 3645 
     | 
    
         
            +
                    return this.findElement().removeClass("popover--top").addClass("popover--bottom");
         
     | 
| 
      
 3646 
     | 
    
         
            +
                  }
         
     | 
| 
      
 3647 
     | 
    
         
            +
                };
         
     | 
| 
      
 3648 
     | 
    
         
            +
             
     | 
| 
      
 3649 
     | 
    
         
            +
                PopOverTypeAhead.prototype.render = function() {
         
     | 
| 
      
 3650 
     | 
    
         
            +
                  return $(this.template()).insertAfter(this.editor.$el);
         
     | 
| 
      
 3651 
     | 
    
         
            +
                };
         
     | 
| 
      
 3652 
     | 
    
         
            +
             
     | 
| 
      
 3653 
     | 
    
         
            +
                return PopOverTypeAhead;
         
     | 
| 
      
 3654 
     | 
    
         
            +
             
     | 
| 
      
 3655 
     | 
    
         
            +
              })(Dante.Editor.PopOver);
         
     | 
| 
      
 3656 
     | 
    
         
            +
             
     | 
| 
       3505 
3657 
     | 
    
         
             
            }).call(this);
         
     | 
| 
       3506 
3658 
     | 
    
         
             
            (function() {
         
     | 
| 
       3507 
3659 
     | 
    
         
             
              var utils,
         
     | 
| 
         @@ -3817,4 +3969,5 @@ 
     | 
|
| 
       3817 
3969 
     | 
    
         | 
| 
       3818 
3970 
     | 
    
         | 
| 
       3819 
3971 
     | 
    
         | 
| 
      
 3972 
     | 
    
         
            +
             
     | 
| 
       3820 
3973 
     | 
    
         
             
            ;
         
     |