Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Enable rule switching and resize logic between rule list and displayed CSS rule #515

Merged
merged 13 commits into from
Apr 2, 2012

Conversation

tvoliter
Copy link
Contributor

  • renamed InlineEditor to InlineWidget
  • CSSInlineEditor.setSelectedRule() now removes the current rule editor and replaces it with a new one
  • added CSSInlineEditor.sizeInlineWidgetToContents to resize widget contents based on rule list and the displayed rule

@jasonsanjose
Copy link
Member

reviewing


// Add new editor
var rule = this.getSelectedRule();
this.createInlineEditorFromText(rule.document, rule.lineStart, rule.lineEnd, this.$editorsDiv.get(0), extraKeys);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to re-add change listeners "change.CSSInlineEditor". See load(), my previous impl was always installing this to the first editor. Also, I noticed that focus doesn't go to the new editor after pressing Alt-Up/Down.

var height = editor.totalHeight(true);
if (force || height !== this.editorHeight) {
$(editor.getScrollerElement()).height(height);
this.editorHeight = height;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editorHeight is only accounting for CodeMirror now. The previous height calc used scrollHeight to account for editorsDiv. Is that the intent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@jasonsanjose
Copy link
Member

Initial review complete

$(this.editors[0]).on("change.CSSInlineEditor", this.updateRelatedContainerProxy);
this.sizeInlineWidgetToContents(true);
this._updateRelatedContainer();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by comment: out of curiosity, how come the keyboard shortcuts and editor-switching code live in InlineTextEditor? I see that the rule list lives in CSSInlineProvider (seems reasonable for now), but since the notion of having multiple editors lives in the base class InlineTextEditor, shouldn't the API to let that UI code switch amongst those multiple editors live in the base class too?

@tvoliter
Copy link
Contributor Author

tvoliter commented Apr 2, 2012

Jason, I've addressed all your comments, but haven't gotten to Peter's regarding the shortcuts

*/
CSSInlineEditor.prototype.sizeInlineWidgetToContents = function (force) {
// Size the code mirror editors height to the editor content
this.parentClass.sizeInlineWidgetToContents.call(this, force);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused var?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@jasonsanjose
Copy link
Member

Thanks for the quick fixes. One last issue with the rule list scrolling in CSSInlineEditor lines 93 and 97.

jasonsanjose added a commit that referenced this pull request Apr 2, 2012
Enable rule switching and resize logic between rule list and displayed CSS rule
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants