Changeset 157966 in webkit


Ignore:
Timestamp:
Oct 24, 2013 5:15:38 PM (10 years ago)
Author:
timothy@apple.com
Message:

Allow editing CSS resources after they have been pretty printed.

https://bugs.webkit.org/show_bug.cgi?id=123297

Reviewed by Joseph Pecoraro.

  • UserInterface/TextEditor.js:

(WebInspector.TextEditor): Remove the need for _readOnly.
(WebInspector.TextEditor.prototype.set readOnly): Set CodeMirror readOnly directly.
(WebInspector.TextEditor.prototype.set formatted): Don't call _updateCodeMirrorReadOnly.
(WebInspector.TextEditor.prototype._updateCodeMirrorReadOnly): Removed.
(WebInspector.TextEditor.prototype._contentChanged): Clear _formatted and _formatterSourceMap
on edit and notify the delegate and fire the FormattingDidChange event.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r157947 r157966  
     12013-10-24  Timothy Hatcher  <timothy@apple.com>
     2
     3        Allow editing CSS resources after they have been pretty printed.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=123297
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UserInterface/TextEditor.js:
     10        (WebInspector.TextEditor): Remove the need for _readOnly.
     11        (WebInspector.TextEditor.prototype.set readOnly): Set CodeMirror readOnly directly.
     12        (WebInspector.TextEditor.prototype.set formatted): Don't call _updateCodeMirrorReadOnly.
     13        (WebInspector.TextEditor.prototype._updateCodeMirrorReadOnly): Removed.
     14        (WebInspector.TextEditor.prototype._contentChanged): Clear _formatted and _formatterSourceMap
     15        on edit and notify the delegate and fire the FormattingDidChange event.
     16
    1172013-10-24  Timothy Hatcher  <timothy@apple.com>
    218
  • trunk/Source/WebInspectorUI/UserInterface/TextEditor.js

    r157601 r157966  
    3333    this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
    3434
    35     this._readOnly = true;
    36 
    3735    this._codeMirror = CodeMirror(this.element, {
    38         readOnly: this._readOnly,
     36        readOnly: true,
    3937        indentWithTabs: true,
    4038        indentUnit: 4,
     
    149147    set readOnly(readOnly)
    150148    {
    151         this._readOnly = readOnly;
    152         this._updateCodeMirrorReadOnly();
     149        this._codeMirror.setOption("readOnly", readOnly);
    153150    },
    154151
     
    172169
    173170        this._formatted = formatted;
    174         this._updateCodeMirrorReadOnly();
    175171
    176172        this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
     
    595591    // Private
    596592
    597     _updateCodeMirrorReadOnly: function()
    598     {
    599         this._codeMirror.setOption("readOnly", this._readOnly || this._formatted);
    600     },
    601 
    602593    _contentChanged: function(codeMirror, change)
    603594    {
    604595        if (this._ignoreCodeMirrorContentDidChangeEvent)
    605596            return;
     597
     598        if (this._formatted) {
     599            this._formatterSourceMap = null;
     600            this._formatted = false;
     601
     602            if (this._delegate && typeof this._delegate.textEditorUpdatedFormatting === "function")
     603                this._delegate.textEditorUpdatedFormatting(this);
     604
     605            this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
     606        }
     607
    606608        this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);
    607609    },
Note: See TracChangeset for help on using the changeset viewer.