From 495b1571ca6efc8dcbb4b85f9d7bf370ee522248 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 10 Apr 2014 13:44:20 -0600 Subject: [PATCH] Add 'editor' class to ReactEditorView wrapper for backward compatibility --- spec/editor-component-spec.coffee | 6 +++--- src/react-editor-view.coffee | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index b80d32874..15b08af33 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -283,7 +283,7 @@ describe "EditorComponent", -> expect(region1Rect.top).toBe 1 * lineHeightInPixels expect(region1Rect.height).toBe 1 * lineHeightInPixels expect(region1Rect.left).toBe scrollViewClientLeft + 6 * charWidth - expect(region1Rect.right).toBe node.clientWidth + expect(Math.ceil(region1Rect.right)).toBe node.clientWidth # TODO: Remove ceiling when react-wrapper is removed region2Rect = regions[1].getBoundingClientRect() expect(region2Rect.top).toBe 2 * lineHeightInPixels @@ -300,13 +300,13 @@ describe "EditorComponent", -> expect(region1Rect.top).toBe 1 * lineHeightInPixels expect(region1Rect.height).toBe 1 * lineHeightInPixels expect(region1Rect.left).toBe scrollViewClientLeft + 6 * charWidth - expect(region1Rect.right).toBe node.clientWidth + expect(Math.ceil(region1Rect.right)).toBe node.clientWidth # TODO: Remove ceiling when react-wrapper is removed region2Rect = regions[1].getBoundingClientRect() expect(region2Rect.top).toBe 2 * lineHeightInPixels expect(region2Rect.height).toBe 3 * lineHeightInPixels expect(region2Rect.left).toBe scrollViewClientLeft + 0 - expect(region2Rect.right).toBe node.clientWidth + expect(Math.ceil(region2Rect.right)).toBe node.clientWidth # TODO: Remove ceiling when react-wrapper is removed region3Rect = regions[2].getBoundingClientRect() expect(region3Rect.top).toBe 5 * lineHeightInPixels diff --git a/src/react-editor-view.coffee b/src/react-editor-view.coffee index 1e463d203..47b46344d 100644 --- a/src/react-editor-view.coffee +++ b/src/react-editor-view.coffee @@ -4,7 +4,7 @@ EditorComponent = require './editor-component' module.exports = class ReactEditorView extends View - @content: -> @div class: 'react-wrapper' + @content: -> @div class: 'editor react-wrapper' constructor: (@editor) -> super @@ -14,7 +14,7 @@ class ReactEditorView extends View afterAttach: (onDom) -> return unless onDom @attached = true - @component = React.renderComponent(EditorComponent({@editor}), @element) + @component = React.renderComponent(EditorComponent({@editor, parentView: this}), @element) @trigger 'editor:attached', [this] beforeDetach: ->