diff --git a/src/trix/controllers/input_controller.coffee b/src/trix/controllers/input_controller.coffee index 218b7947a..5b39b90f1 100644 --- a/src/trix/controllers/input_controller.coffee +++ b/src/trix/controllers/input_controller.coffee @@ -119,7 +119,7 @@ class Trix.InputController extends Trix.BasicObject Promise.all(operations).then (files) => @handleInput -> @delegate?.inputControllerWillAttachFiles() - @responder?.insertFile(file) for file in files + @responder?.insertFiles(files) @requestRender() # Input handlers diff --git a/src/trix/inspector/views/performance_view.coffee b/src/trix/inspector/views/performance_view.coffee index 76bd6ad6f..b0a6e66f9 100644 --- a/src/trix/inspector/views/performance_view.coffee +++ b/src/trix/inspector/views/performance_view.coffee @@ -11,6 +11,7 @@ Trix.Inspector.registerView class extends Trix.Inspector.View @data = {} @track("documentView.render") @track("documentView.sync") + @track("documentView.garbageCollectCachedViews") @track("composition.replaceHTML") @render() diff --git a/src/trix/models/composition.coffee b/src/trix/models/composition.coffee index 59e278a84..eede5dff1 100644 --- a/src/trix/models/composition.coffee +++ b/src/trix/models/composition.coffee @@ -113,6 +113,14 @@ class Trix.Composition extends Trix.BasicObject attachment = Trix.Attachment.attachmentForFile(file) @insertAttachment(attachment) + insertFiles: (files) -> + text = new Trix.Text + for file in files when @delegate?.compositionShouldAcceptFile(file) + attachment = Trix.Attachment.attachmentForFile(file) + attachmentText = Trix.Text.textForAttachmentWithAttributes(attachment, @currentAttributes) + text = text.appendText(attachmentText) + @insertText(text) + insertAttachment: (attachment) -> text = Trix.Text.textForAttachmentWithAttributes(attachment, @currentAttributes) @insertText(text) diff --git a/src/trix/views/object_view.coffee b/src/trix/views/object_view.coffee index 43c38ff91..e9e40eb9d 100644 --- a/src/trix/views/object_view.coffee +++ b/src/trix/views/object_view.coffee @@ -36,7 +36,8 @@ class Trix.ObjectView extends Trix.BasicObject recordChildView: (view) -> view.parentView = this view.rootView = @rootView - @childViews.push(view) + unless view in @childViews + @childViews.push(view) view getAllChildViews: ->