Skip to content

Commit

Permalink
Adding Markdown cells now default in edit mode
Browse files Browse the repository at this point in the history
fixes #1250
  • Loading branch information
aaddaamm committed Mar 26, 2015
1 parent 5cd77e3 commit f7315e4
Showing 1 changed file with 13 additions and 10 deletions.
Expand Up @@ -88,15 +88,18 @@
if (bkHelper.isNotebookLocked()) return;

scope.mode = 'edit';
var clickLocation;
var markdownCell = element.find('.markdown-wrapper');
var top = markdownCell.offset().top;
var bottom = top + markdownCell.outerHeight();

if (event.pageY < (top + bottom) / 2) {
clickLocation = 'top';
} else {
clickLocation = 'bottom';

if (event){
var clickLocation;
var markdownCell = element.find('.markdown-wrapper');
var top = markdownCell.offset().top;
var bottom = top + markdownCell.outerHeight();

This comment has been minimized.

Copy link
@samccone

samccone Mar 27, 2015

It is good to be aware of what causes reflows on the page (this is a line that does), reflows can be expensive as far as the cost to perf in the browser. Every-time we access these properties there is a significant cost. In large applications this can start having a cascading effect causing paints and perf to crawl to a halt


check out this great issue from @paulirish on perf on wikipedia because of the "hidden" cost of jquery's show method

jquery/jquery.com#88 (comment)

This comment has been minimized.

Copy link
@scottdraves

scottdraves Mar 28, 2015

Contributor

sam can you elaborate please? that paul irish post was about show/hide but the line you are commenting on is just an outerHeight()?

This comment has been minimized.

Copy link
@paulirish

paulirish Mar 28, 2015

way more detail on it: https://docs.google.com/document/d/1K-mKOqiUiSjgZTEscBLjtjd6E67oiK8H2ztOiq5tigk/pub#h.vwra8t2fwx8t

you wouldnt want this to happen in a loop.. but really... best to profile this new behavior first.


if (event.pageY < (top + bottom) / 2) {
clickLocation = 'top';
} else {
clickLocation = 'bottom';
}
}

var markdown = element.find('.markdown');
Expand All @@ -110,7 +113,7 @@
});
};

preview();
scope.edit();

element.find('.markdown').on('blur', function() {
scope.$apply(function() {
Expand Down

0 comments on commit f7315e4

Please sign in to comment.