From c7ecad5576252d8671b2df09d444c7efe2bd8e2d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 3 Sep 2015 15:36:42 -0600 Subject: [PATCH] Remove EditorView --- exports/atom.coffee | 18 -- spec/package-manager-spec.coffee | 12 +- spec/spec-helper.coffee | 1 - spec/text-editor-component-spec.coffee | 112 +++++---- src/text-editor-component.coffee | 4 - src/text-editor-element.coffee | 7 - src/text-editor-view.coffee | 324 ------------------------- src/text-editor.coffee | 10 +- 8 files changed, 68 insertions(+), 420 deletions(-) delete mode 100644 src/text-editor-view.coffee diff --git a/exports/atom.coffee b/exports/atom.coffee index c47fb8a79..8e7e639c9 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -75,24 +75,6 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE """ View - Object.defineProperty module.exports, 'EditorView', get: -> - deprecate """ - Requiring `EditorView` from `atom` is no longer supported. - Please require `TextEditorView` from `atom-space-pen-view` instead: - `{TextEditorView} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - require '../src/text-editor-view' - - Object.defineProperty module.exports, 'TextEditorView', get: -> - deprecate """ - Requiring `TextEditorView` from `atom` is no longer supported. - Please require `TextEditorView` from `atom-space-pen-view` instead: - `{TextEditorView} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - require '../src/text-editor-view' - if includeDeprecatedAPIs Object.defineProperty module.exports, 'Git', get: -> deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`" diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 1604209d5..cbe65a650 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -220,22 +220,16 @@ describe "PackageManager", -> atom.workspace.open() runs -> - editorView = atom.views.getView(atom.workspace.getActiveTextEditor()).__spacePenView - legacyCommandListener = jasmine.createSpy("legacyCommandListener") - editorView.command 'activation-command', legacyCommandListener + editorElement = atom.views.getView(atom.workspace.getActiveTextEditor()) editorCommandListener = jasmine.createSpy("editorCommandListener") atom.commands.add 'atom-text-editor', 'activation-command', editorCommandListener - atom.commands.dispatch(editorView[0], 'activation-command') + atom.commands.dispatch(editorElement, 'activation-command') expect(mainModule.activate.callCount).toBe 1 - expect(mainModule.legacyActivationCommandCallCount).toBe 1 expect(mainModule.activationCommandCallCount).toBe 1 - expect(legacyCommandListener.callCount).toBe 1 expect(editorCommandListener.callCount).toBe 1 expect(workspaceCommandListener.callCount).toBe 1 - atom.commands.dispatch(editorView[0], 'activation-command') - expect(mainModule.legacyActivationCommandCallCount).toBe 2 + atom.commands.dispatch(editorElement, 'activation-command') expect(mainModule.activationCommandCallCount).toBe 2 - expect(legacyCommandListener.callCount).toBe 2 expect(editorCommandListener.callCount).toBe 2 expect(workspaceCommandListener.callCount).toBe 2 expect(mainModule.activate.callCount).toBe 1 diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index ffb83cd5a..afe24057d 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -19,7 +19,6 @@ Project = require '../src/project' Workspace = require '../src/workspace' ServiceHub = require 'service-hub' TextEditor = require '../src/text-editor' -TextEditorView = require '../src/text-editor-view' TextEditorElement = require '../src/text-editor-element' TokenizedBuffer = require '../src/tokenized-buffer' TextEditorComponent = require '../src/text-editor-component' diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index e0230fbb8..921e77a23 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1,12 +1,11 @@ _ = require 'underscore-plus' {extend, flatten, toArray, last} = _ -TextEditorView = require '../src/text-editor-view' -TextEditorComponent = require '../src/text-editor-component' +TextEditorElement = require '../src/text-editor-element' nbsp = String.fromCharCode(160) describe "TextEditorComponent", -> - [contentNode, editor, wrapperView, wrapperNode, component, componentNode, verticalScrollbarNode, horizontalScrollbarNode] = [] + [contentNode, editor, wrapperNode, component, componentNode, verticalScrollbarNode, horizontalScrollbarNode] = [] [lineHeightInPixels, charWidth, nextAnimationFrame, noAnimationFrame, tileSize, tileHeightInPixels] = [] beforeEach -> @@ -34,12 +33,13 @@ describe "TextEditorComponent", -> contentNode = document.querySelector('#jasmine-content') contentNode.style.width = '1000px' - wrapperView = new TextEditorView(editor, {tileSize}) - wrapperView.attachToDom() - wrapperNode = wrapperView.element + wrapperNode = new TextEditorElement() + wrapperNode.tileSize = tileSize + wrapperNode.initialize(editor) wrapperNode.setUpdatedSynchronously(false) + jasmine.attachToDOM(wrapperNode) - {component} = wrapperView + {component} = wrapperNode component.setFontFamily('monospace') component.setLineHeight(1.3) component.setFontSize(20) @@ -2384,11 +2384,11 @@ describe "TextEditorComponent", -> inputNode.focus() nextAnimationFrame() expect(componentNode.classList.contains('is-focused')).toBe true - expect(wrapperView.hasClass('is-focused')).toBe true + expect(wrapperNode.classList.contains('is-focused')).toBe true inputNode.blur() nextAnimationFrame() expect(componentNode.classList.contains('is-focused')).toBe false - expect(wrapperView.hasClass('is-focused')).toBe false + expect(wrapperNode.classList.contains('is-focused')).toBe false describe "selection handling", -> cursor = null @@ -2896,17 +2896,18 @@ describe "TextEditorComponent", -> describe "hiding and showing the editor", -> describe "when the editor is hidden when it is mounted", -> it "defers measurement and rendering until the editor becomes visible", -> - wrapperView.remove() + wrapperNode.remove() hiddenParent = document.createElement('div') hiddenParent.style.display = 'none' contentNode.appendChild(hiddenParent) - wrapperView = new TextEditorView(editor, {tileSize}) - wrapperNode = wrapperView.element - wrapperView.appendTo(hiddenParent) + wrapperNode = new TextEditorElement() + wrapperNode.tileSize = tileSize + wrapperNode.initialize(editor) + hiddenParent.appendChild(wrapperNode) - {component} = wrapperView + {component} = wrapperNode componentNode = component.getDomNode() expect(componentNode.querySelectorAll('.line').length).toBe 0 @@ -2917,18 +2918,25 @@ describe "TextEditorComponent", -> describe "when the lineHeight changes while the editor is hidden", -> it "does not attempt to measure the lineHeightInPixels until the editor becomes visible again", -> - wrapperView.hide() + initialLineHeightInPixels = null + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() + initialLineHeightInPixels = editor.getLineHeightInPixels() component.setLineHeight(2) expect(editor.getLineHeightInPixels()).toBe initialLineHeightInPixels - wrapperView.show() + wrapperNode.style.display = '' + component.checkForVisibilityChange() + expect(editor.getLineHeightInPixels()).not.toBe initialLineHeightInPixels describe "when the fontSize changes while the editor is hidden", -> it "does not attempt to measure the lineHeightInPixels or defaultCharWidth until the editor becomes visible again", -> - wrapperView.hide() + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() + initialLineHeightInPixels = editor.getLineHeightInPixels() initialCharWidth = editor.getDefaultCharWidth() @@ -2936,17 +2944,22 @@ describe "TextEditorComponent", -> expect(editor.getLineHeightInPixels()).toBe initialLineHeightInPixels expect(editor.getDefaultCharWidth()).toBe initialCharWidth - wrapperView.show() + wrapperNode.style.display = '' + component.checkForVisibilityChange() + expect(editor.getLineHeightInPixels()).not.toBe initialLineHeightInPixels expect(editor.getDefaultCharWidth()).not.toBe initialCharWidth it "does not re-measure character widths until the editor is shown again", -> - wrapperView.hide() + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() component.setFontSize(22) editor.getBuffer().insert([0, 0], 'a') # regression test against atom/atom#3318 - wrapperView.show() + wrapperNode.style.display = '' + component.checkForVisibilityChange() + editor.setCursorBufferPosition([0, Infinity]) nextAnimationFrame() @@ -2956,22 +2969,29 @@ describe "TextEditorComponent", -> describe "when the fontFamily changes while the editor is hidden", -> it "does not attempt to measure the defaultCharWidth until the editor becomes visible again", -> - wrapperView.hide() + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() + initialLineHeightInPixels = editor.getLineHeightInPixels() initialCharWidth = editor.getDefaultCharWidth() component.setFontFamily('serif') expect(editor.getDefaultCharWidth()).toBe initialCharWidth - wrapperView.show() + wrapperNode.style.display = '' + component.checkForVisibilityChange() + expect(editor.getDefaultCharWidth()).not.toBe initialCharWidth it "does not re-measure character widths until the editor is shown again", -> - wrapperView.hide() + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() component.setFontFamily('serif') - wrapperView.show() + wrapperNode.style.display = '' + component.checkForVisibilityChange() + editor.setCursorBufferPosition([0, Infinity]) nextAnimationFrame() @@ -2986,14 +3006,18 @@ describe "TextEditorComponent", -> it "does not re-measure character widths until the editor is shown again", -> atom.config.set('editor.fontFamily', 'sans-serif') - wrapperView.hide() + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() + atom.themes.applyStylesheet 'test', """ .function.js { font-weight: bold; } """ - wrapperView.show() + wrapperNode.style.display = '' + component.checkForVisibilityChange() + editor.setCursorBufferPosition([0, Infinity]) nextAnimationFrame() @@ -3004,11 +3028,17 @@ describe "TextEditorComponent", -> describe "when lines are changed while the editor is hidden", -> it "does not measure new characters until the editor is shown again", -> editor.setText('') - wrapperView.hide() + + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() + editor.setText('var z = 1') editor.setCursorBufferPosition([0, Infinity]) nextAnimationFrame() - wrapperView.show() + + wrapperNode.style.display = 'none' + component.checkForVisibilityChange() + expect(componentNode.querySelector('.cursor').style['-webkit-transform']).toBe "translate(#{9 * charWidth}px, 0px)" describe "soft wrapping", -> @@ -3138,26 +3168,6 @@ describe "TextEditorComponent", -> nextAnimationFrame() expect(componentNode.querySelector('.placeholder-text')).toBeNull() - describe "legacy editor compatibility", -> - it "triggers the screen-lines-changed event before the editor:display-updated event", -> - editor.setSoftWrapped(true) - - callingOrder = [] - editor.onDidChange -> callingOrder.push 'screen-lines-changed' - wrapperView.on 'editor:display-updated', -> callingOrder.push 'editor:display-updated' - editor.insertText("HELLO! HELLO!\n HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! HELLO! ") - nextAnimationFrame() - - expect(callingOrder).toEqual ['screen-lines-changed', 'editor:display-updated', 'editor:display-updated'] - - it "works with the ::setEditorHeightInLines and ::setEditorWidthInChars helpers", -> - setEditorHeightInLines(wrapperView, 7) - nextAnimationFrame() - expect(componentNode.offsetHeight).toBe lineHeightInPixels * 7 - - setEditorWidthInChars(wrapperView, 10) - expect(componentNode.querySelector('.scroll-view').offsetWidth).toBe charWidth * 10 - describe "grammar data attributes", -> it "adds and updates the grammar data attribute based on the current grammar", -> expect(wrapperNode.dataset.grammar).toBe 'source js' @@ -3172,10 +3182,10 @@ describe "TextEditorComponent", -> describe "detaching and reattaching the editor (regression)", -> it "does not throw an exception", -> - wrapperView.detach() - wrapperView.attachToDom() + wrapperNode.remove() + jasmine.attachToDOM(wrapperNode) - wrapperView.trigger('core:move-right') + atom.commands.dispatch(wrapperNode, 'core:move-right') expect(editor.getCursorBufferPosition()).toEqual [0, 1] diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 36f56a877..47b9a1a5c 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -163,10 +163,6 @@ class TextEditorComponent if @editor.isAlive() @updateParentViewFocusedClassIfNeeded() @updateParentViewMiniClass() - if grim.includeDeprecatedAPIs - @hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved - @hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged - @hostElement.__spacePenView.trigger 'editor:display-updated' readAfterUpdateSync: => @linesComponent.measureCharactersInNewLines() if @isVisible() and not @newState.content.scrollingVertically diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index 55e4e8567..2e3fab355 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -6,7 +6,6 @@ TextBuffer = require 'text-buffer' Grim = require 'grim' TextEditor = require './text-editor' TextEditorComponent = require './text-editor-component' -TextEditorView = null ShadowStyleSheet = null @@ -22,7 +21,6 @@ class TextEditorElement extends HTMLElement createdCallback: -> @emitter = new Emitter @initializeContent() - @createSpacePenShim() if Grim.includeDeprecatedAPIs @addEventListener 'focus', @focused.bind(this) @addEventListener 'blur', @blurred.bind(this) @@ -56,10 +54,6 @@ class TextEditorElement extends HTMLElement @stylesElement = document.head.querySelector('atom-styles') @rootElement = this - createSpacePenShim: -> - TextEditorView ?= require './text-editor-view' - @__spacePenView = new TextEditorView(this) - attachedCallback: -> @buildModel() unless @getModel()? atom.assert(@model.isAlive(), "Attaching a view for a destroyed editor") @@ -90,7 +84,6 @@ class TextEditorElement extends HTMLElement @model.onDidChangeEncoding => @addEncodingAttribute() @model.onDidDestroy => @unmountComponent() @model.onDidChangeMini (mini) => if mini then @addMiniAttribute() else @removeMiniAttribute() - @__spacePenView.setModel(@model) if Grim.includeDeprecatedAPIs @model getModel: -> diff --git a/src/text-editor-view.coffee b/src/text-editor-view.coffee deleted file mode 100644 index 4d513c6f8..000000000 --- a/src/text-editor-view.coffee +++ /dev/null @@ -1,324 +0,0 @@ -{View, $} = require 'space-pen' -{defaults} = require 'underscore-plus' -TextBuffer = require 'text-buffer' -TextEditor = require './text-editor' -TextEditorElement = require './text-editor-element' -TextEditorComponent = require './text-editor-component' -{deprecate} = require 'grim' - -# Deprecated: Represents the entire visual pane in Atom. -# -# The TextEditorView manages the {TextEditor}, which manages the file buffers. -# `TextEditorView` is intentionally sparse. Most of the things you'll want -# to do are on {TextEditor}. -# -# ## Examples -# -# Requiring in packages -# -# ```coffee -# {TextEditorView} = require 'atom' -# -# miniEditorView = new TextEditorView(mini: true) -# ``` -# -# Iterating over the open editor views -# -# ```coffee -# for editorView in atom.workspaceView.getEditorViews() -# console.log(editorView.getModel().getPath()) -# ``` -# -# Subscribing to every current and future editor -# -# ```coffee -# atom.workspace.eachEditorView (editorView) -> -# console.log(editorView.getModel().getPath()) -# ``` -module.exports = -class TextEditorView extends View - # The constructor for setting up an `TextEditorView` instance. - # - # * `modelOrParams` Either an {TextEditor}, or an object with one property, `mini`. - # If `mini` is `true`, a "miniature" `TextEditor` is constructed. - # Typically, this is ideal for scenarios where you need an Atom editor, - # but without all the chrome, like scrollbars, gutter, _e.t.c._. - # - constructor: (modelOrParams, props) -> - # Handle direct construction with an editor or params - unless modelOrParams instanceof HTMLElement - if modelOrParams instanceof TextEditor - model = modelOrParams - else - {editor, mini, placeholderText, attributes} = modelOrParams - model = editor ? new TextEditor - buffer: new TextBuffer - softWrapped: false - tabLength: 2 - softTabs: true - mini: mini - placeholderText: placeholderText - - element = new TextEditorElement - element.tileSize = props?.tileSize - element.setAttribute(name, value) for name, value of attributes if attributes? - element.setModel(model) - return element.__spacePenView - - # Handle construction with an element - @element = modelOrParams - super - - setModel: (@model) -> - @editor = @model - - @root = $(@element.rootElement) - - @scrollView = @root.find('.scroll-view') - - if atom.config.get('editor.useShadowDOM') - @underlayer = $("
").appendTo(this) - @overlayer = $("
").appendTo(this) - else - @underlayer = @find('.highlights').addClass('underlayer') - @overlayer = @find('.lines').addClass('overlayer') - - @hiddenInput = @root.find('.hidden-input') - - @hiddenInput.on = (args...) => - args[0] = 'blur' if args[0] is 'focusout' - $::on.apply(this, args) - - @subscribe atom.config.observe 'editor.showLineNumbers', => - @gutter = @root.find('.gutter') - - @gutter.removeClassFromAllLines = (klass) => - deprecate('Use decorations instead: http://blog.atom.io/2014/07/24/decorations.html') - @gutter.find('.line-number').removeClass(klass) - - @gutter.getLineNumberElement = (bufferRow) => - deprecate('Use decorations instead: http://blog.atom.io/2014/07/24/decorations.html') - @gutter.find("[data-buffer-row='#{bufferRow}']") - - @gutter.addClassToLine = (bufferRow, klass) => - deprecate('Use decorations instead: http://blog.atom.io/2014/07/24/decorations.html') - lines = @gutter.find("[data-buffer-row='#{bufferRow}']") - lines.addClass(klass) - lines.length > 0 - - find: -> - shadowResult = @root.find.apply(@root, arguments) - if shadowResult.length > 0 - shadowResult - else - super - - # Public: Get the underlying editor model for this view. - # - # Returns an {TextEditor} - getModel: -> @model - - getEditor: -> @model - - Object.defineProperty @prototype, 'lineHeight', get: -> @model.getLineHeightInPixels() - Object.defineProperty @prototype, 'charWidth', get: -> @model.getDefaultCharWidth() - Object.defineProperty @prototype, 'firstRenderedScreenRow', get: -> @component.getRenderedRowRange()[0] - Object.defineProperty @prototype, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1] - Object.defineProperty @prototype, 'active', get: -> @is(@getPaneView()?.activeView) - Object.defineProperty @prototype, 'isFocused', get: -> document.activeElement is @element or document.activeElement is @element.component?.hiddenInputComponent?.getDomNode() - Object.defineProperty @prototype, 'mini', get: -> @model?.isMini() - Object.defineProperty @prototype, 'component', get: -> @element?.component - - afterAttach: (onDom) -> - return unless onDom - return if @attached - @attached = true - @trigger 'editor:attached', [this] - - beforeRemove: -> - @trigger 'editor:detached', [this] - @trigger 'editor:will-be-removed', [this] - @attached = false - - remove: (selector, keepData) -> - @model.destroy() unless keepData - super - - scrollTop: (scrollTop) -> - if scrollTop? - @model.setScrollTop(scrollTop) - else - @model.getScrollTop() - - scrollLeft: (scrollLeft) -> - if scrollLeft? - @model.setScrollLeft(scrollLeft) - else - @model.getScrollLeft() - - scrollToBottom: -> - deprecate 'Use TextEditor::scrollToBottom instead. You can get the editor via editorView.getModel()' - @model.setScrollBottom(Infinity) - - scrollToScreenPosition: (screenPosition, options) -> - deprecate 'Use TextEditor::scrollToScreenPosition instead. You can get the editor via editorView.getModel()' - @model.scrollToScreenPosition(screenPosition, options) - - scrollToBufferPosition: (bufferPosition, options) -> - deprecate 'Use TextEditor::scrollToBufferPosition instead. You can get the editor via editorView.getModel()' - @model.scrollToBufferPosition(bufferPosition, options) - - scrollToCursorPosition: -> - deprecate 'Use TextEditor::scrollToCursorPosition instead. You can get the editor via editorView.getModel()' - @model.scrollToCursorPosition() - - pixelPositionForBufferPosition: (bufferPosition) -> - deprecate 'Use TextEditorElement::pixelPositionForBufferPosition instead. You can get the editor via editorView.getModel()' - @model.pixelPositionForBufferPosition(bufferPosition, true) - - pixelPositionForScreenPosition: (screenPosition) -> - deprecate 'Use TextEditorElement::pixelPositionForScreenPosition instead. You can get the editor via editorView.getModel()' - @model.pixelPositionForScreenPosition(screenPosition, true) - - appendToLinesView: (view) -> - view.css('position', 'absolute') - view.css('z-index', 1) - @overlayer.append(view) - - splitLeft: -> - deprecate """ - Use Pane::splitLeft instead. - To duplicate this editor into the split use: - editorView.getPaneView().getModel().splitLeft(copyActiveItem: true) - """ - pane = @getPaneView() - pane?.splitLeft(pane?.copyActiveItem()).activeView - - splitRight: -> - deprecate """ - Use Pane::splitRight instead. - To duplicate this editor into the split use: - editorView.getPaneView().getModel().splitRight(copyActiveItem: true) - """ - pane = @getPaneView() - pane?.splitRight(pane?.copyActiveItem()).activeView - - splitUp: -> - deprecate """ - Use Pane::splitUp instead. - To duplicate this editor into the split use: - editorView.getPaneView().getModel().splitUp(copyActiveItem: true) - """ - pane = @getPaneView() - pane?.splitUp(pane?.copyActiveItem()).activeView - - splitDown: -> - deprecate """ - Use Pane::splitDown instead. - To duplicate this editor into the split use: - editorView.getPaneView().getModel().splitDown(copyActiveItem: true) - """ - pane = @getPaneView() - pane?.splitDown(pane?.copyActiveItem()).activeView - - # Public: Get this {TextEditorView}'s {PaneView}. - # - # Returns a {PaneView} - getPaneView: -> - @parent('.item-views').parents('atom-pane').view() - getPane: -> - deprecate 'Use TextEditorView::getPaneView() instead' - @getPaneView() - - show: -> - super - @component?.checkForVisibilityChange() - - hide: -> - super - @component?.checkForVisibilityChange() - - pageDown: -> - deprecate('Use editorView.getModel().pageDown()') - @model.pageDown() - - pageUp: -> - deprecate('Use editorView.getModel().pageUp()') - @model.pageUp() - - getFirstVisibleScreenRow: -> - deprecate 'Use TextEditorElement::getFirstVisibleScreenRow instead.' - @model.getFirstVisibleScreenRow(true) - - getLastVisibleScreenRow: -> - deprecate 'Use TextEditor::getLastVisibleScreenRow instead. You can get the editor via editorView.getModel()' - @model.getLastVisibleScreenRow() - - getFontFamily: -> - deprecate 'This is going away. Use atom.config.get("editor.fontFamily") instead' - @component?.getFontFamily() - - setFontFamily: (fontFamily) -> - deprecate 'This is going away. Use atom.config.set("editor.fontFamily", "my-font") instead' - @component?.setFontFamily(fontFamily) - - getFontSize: -> - deprecate 'This is going away. Use atom.config.get("editor.fontSize") instead' - @component?.getFontSize() - - setFontSize: (fontSize) -> - deprecate 'This is going away. Use atom.config.set("editor.fontSize", 12) instead' - @component?.setFontSize(fontSize) - - setLineHeight: (lineHeight) -> - deprecate 'This is going away. Use atom.config.set("editor.lineHeight", 1.5) instead' - @component.setLineHeight(lineHeight) - - setWidthInChars: (widthInChars) -> - @component.getDOMNode().style.width = (@model.getDefaultCharWidth() * widthInChars) + 'px' - - setShowIndentGuide: (showIndentGuide) -> - deprecate 'This is going away. Use atom.config.set("editor.showIndentGuide", true|false) instead' - atom.config.set("editor.showIndentGuide", showIndentGuide) - - setSoftWrap: (softWrapped) -> - deprecate 'Use TextEditor::setSoftWrapped instead. You can get the editor via editorView.getModel()' - @model.setSoftWrapped(softWrapped) - - setShowInvisibles: (showInvisibles) -> - deprecate 'This is going away. Use atom.config.set("editor.showInvisibles", true|false) instead' - @component.setShowInvisibles(showInvisibles) - - getText: -> - @model.getText() - - setText: (text) -> - @model.setText(text) - - insertText: (text) -> - @model.insertText(text) - - isInputEnabled: -> - @component.isInputEnabled() - - setInputEnabled: (inputEnabled) -> - @component.setInputEnabled(inputEnabled) - - requestDisplayUpdate: -> - deprecate('Please remove from your code. ::requestDisplayUpdate no longer does anything') - - updateDisplay: -> - deprecate('Please remove from your code. ::updateDisplay no longer does anything') - - resetDisplay: -> - deprecate('Please remove from your code. ::resetDisplay no longer does anything') - - redraw: -> - deprecate('Please remove from your code. ::redraw no longer does anything') - - setPlaceholderText: (placeholderText) -> - deprecate('Use TextEditor::setPlaceholderText instead. eg. editorView.getModel().setPlaceholderText(text)') - @model.setPlaceholderText(placeholderText) - - lineElementForScreenRow: (screenRow) -> - $(@component.lineNodeForScreenRow(screenRow)) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index e1b379c39..08c9f4786 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -17,7 +17,8 @@ GutterContainer = require './gutter-container' # Essential: This class represents all essential editing state for a single # {TextBuffer}, including cursor and selection positions, folds, and soft wraps. # If you're manipulating the state of an editor, use this class. If you're -# interested in the visual appearance of editors, use {TextEditorView} instead. +# interested in the visual appearance of editors, use {TextEditorElement} +# instead. # # A single {TextBuffer} can belong to multiple editors. For example, if the # same file is open in two different panes, Atom creates a separate editor for @@ -545,8 +546,8 @@ class TextEditor extends Model # Set the number of characters that can be displayed horizontally in the # editor. # - # * `editorWidthInChars` A {Number} representing the width of the {TextEditorView} - # in characters. + # * `editorWidthInChars` A {Number} representing the width of the + # {TextEditorElement} in characters. setEditorWidthInChars: (editorWidthInChars) -> @displayBuffer.setEditorWidthInChars(editorWidthInChars) @@ -3051,9 +3052,6 @@ if includeDeprecatedAPIs '$verticalScrollbarWidth', '$horizontalScrollbarHeight', '$scrollTop', '$scrollLeft', toProperty: 'displayBuffer' - TextEditor::getViewClass = -> - require './text-editor-view' - TextEditor::joinLine = -> deprecate("Use TextEditor::joinLines() instead") @joinLines()