Skip to content

Commit

Permalink
append popovers to simditor el instead of wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed Sep 15, 2014
1 parent 8da1f47 commit a32c570
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions lib/simditor-all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions lib/simditor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions site/assets/scripts/simditor-all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/buttons/popover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Popover extends Module

constructor: (@editor) ->
@el = $('<div class="simditor-popover"></div>')
.appendTo(@editor.wrapper)
.appendTo(@editor.el)
.data('popover', @)
@render()

Expand Down Expand Up @@ -56,16 +56,16 @@ class Popover extends Module

refresh: (position = 'bottom') ->
return unless @active
wrapperOffset = @editor.wrapper.offset()
editorOffset = @editor.el.offset()
targetOffset = @target.offset()
targetH = @target.outerHeight()

if position is 'bottom'
top = targetOffset.top - wrapperOffset.top + targetH
top = targetOffset.top - editorOffset.top + targetH
else if position is 'top'
top = targetOffset.top - wrapperOffset.top - @el.height()
top = targetOffset.top - editorOffset.top - @el.height()

left = Math.min(targetOffset.left - wrapperOffset.left, @editor.wrapper.width() - @el.outerWidth() - 10)
left = Math.min(targetOffset.left - editorOffset.left, @editor.wrapper.width() - @el.outerWidth() - 10)

@el.css({
top: top + @offset.top,
Expand Down
10 changes: 5 additions & 5 deletions src/simditor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ class Popover extends Module

constructor: (@editor) ->
@el = $('<div class="simditor-popover"></div>')
.appendTo(@editor.wrapper)
.appendTo(@editor.el)
.data('popover', @)
@render()

Expand Down Expand Up @@ -2001,16 +2001,16 @@ class Popover extends Module

refresh: (position = 'bottom') ->
return unless @active
wrapperOffset = @editor.wrapper.offset()
editorOffset = @editor.el.offset()
targetOffset = @target.offset()
targetH = @target.outerHeight()

if position is 'bottom'
top = targetOffset.top - wrapperOffset.top + targetH
top = targetOffset.top - editorOffset.top + targetH
else if position is 'top'
top = targetOffset.top - wrapperOffset.top - @el.height()
top = targetOffset.top - editorOffset.top - @el.height()

left = Math.min(targetOffset.left - wrapperOffset.left, @editor.wrapper.width() - @el.outerWidth() - 10)
left = Math.min(targetOffset.left - editorOffset.left, @editor.wrapper.width() - @el.outerWidth() - 10)

@el.css({
top: top + @offset.top,
Expand Down

0 comments on commit a32c570

Please sign in to comment.