Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
fix toggling buttons when caret is not in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
linkesch committed Mar 3, 2015
1 parent ddfe0f0 commit 910cc75
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions dist/js/medium-editor-insert-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,12 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
range, $current, $p, activeAddon;

if (!selection || selection.rangeCount === 0) {
return;
$current = $el;
} else {
range = selection.getRangeAt(0);
$current = $(range.commonAncestorContainer);
}

range = selection.getRangeAt(0);
$current = $(range.commonAncestorContainer);
$p = $current.is('p') ? $current : $current.closest('p');

this.clean();
Expand Down
Loading

0 comments on commit 910cc75

Please sign in to comment.