mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
Change Editor.proto.split method to use new RootView.proto.addPane method.
RootView.proto.addPane takes a view to add, a sibling to add it next to, an axis along which to add (row or column), and a side (before or after)
This commit is contained in:
parent
5d8affb3e4
commit
ae5d64f06d
@ -468,15 +468,10 @@ class Editor extends View
|
||||
splitDown: ->
|
||||
@split('column', 'after')
|
||||
|
||||
split: (axis, insertMethod) ->
|
||||
unless @parent().hasClass axis
|
||||
container = $$ -> @div class: axis
|
||||
container.insertBefore(this).append(this.detach())
|
||||
|
||||
split: (axis, side) ->
|
||||
return unless rootView = @rootView()
|
||||
editor = new Editor(@getEditorState())
|
||||
this[insertMethod](editor)
|
||||
@rootView().adjustSplitPanes()
|
||||
editor
|
||||
rootView.addPane(editor, this, axis, side)
|
||||
|
||||
remove: (selector, keepData) ->
|
||||
return super if keepData
|
||||
|
@ -78,6 +78,15 @@ class RootView extends View
|
||||
editor.appendTo(@panes)
|
||||
editor.focus()
|
||||
|
||||
|
||||
addPane: (view, sibling, axis, side) ->
|
||||
unless sibling.parent().hasClass(axis)
|
||||
container = $$ -> @div class: axis
|
||||
container.insertBefore(sibling).append(sibling.detach())
|
||||
sibling[side](view)
|
||||
@adjustSplitPanes()
|
||||
view
|
||||
|
||||
adjustSplitPanes: (element = @panes.children(':first'))->
|
||||
if element.hasClass('row')
|
||||
totalUnits = @horizontalGridUnits(element)
|
||||
|
Loading…
Reference in New Issue
Block a user