Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Fix for #348 (Indent broken with CodeMirror v5.48).
Browse files Browse the repository at this point in the history
CodeMirror added line styles that conflict with ours.  Added more specific CSS selectors as a workaround.
  • Loading branch information
Michael Lehenbauer committed Jan 18, 2020
1 parent 5231f92 commit b7aa36d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@

* Fix indentation issue with CodeMirror 5.48 or newer.
3 changes: 2 additions & 1 deletion lib/firepad.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
.firepad-la-right { text-align: right; }

/** Line Styles */
pre.firepad-lt-o, pre.firepad-lt-u, pre.firepad-lt-t, pre.firepad-lt-tc {
pre.firepad-lt-o, pre.firepad-lt-u, pre.firepad-lt-t, pre.firepad-lt-tc,
pre.CodeMirror-line.firepad-lt-o, pre.CodeMirror-line.firepad-lt-u, pre.CodeMirror-line.firepad-lt-t, pre.CodeMirror-line.firepad-lt-tc {
padding-left: 40px;
}

Expand Down
7 changes: 7 additions & 0 deletions lib/rich-text-codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ firepad.RichTextCodeMirror = (function () {
'.' + className;

this.addStyleWithCSS_(selector + ' { ' + css + ' }');

// As of v5.48, CodeMirror applies its own pre style which conflicts with ours, so we
// need to make sure we add our styles with a more-specific css selector as well.
if (attr === ATTR.LINE_INDENT) {
var selector = 'pre.CodeMirror-line.' + className;
this.addStyleWithCSS_(selector + ' { ' + css + ' }');
}
}
}
}
Expand Down

0 comments on commit b7aa36d

Please sign in to comment.