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

Commit b7aa36d

Browse files
author
Michael Lehenbauer
committed
Fix for #348 (Indent broken with CodeMirror v5.48).
CodeMirror added line styles that conflict with ours. Added more specific CSS selectors as a workaround.
1 parent 5231f92 commit b7aa36d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1+
* Fix indentation issue with CodeMirror 5.48 or newer.

lib/firepad.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
.firepad-la-right { text-align: right; }
7777

7878
/** Line Styles */
79-
pre.firepad-lt-o, pre.firepad-lt-u, pre.firepad-lt-t, pre.firepad-lt-tc {
79+
pre.firepad-lt-o, pre.firepad-lt-u, pre.firepad-lt-t, pre.firepad-lt-tc,
80+
pre.CodeMirror-line.firepad-lt-o, pre.CodeMirror-line.firepad-lt-u, pre.CodeMirror-line.firepad-lt-t, pre.CodeMirror-line.firepad-lt-tc {
8081
padding-left: 40px;
8182
}
8283

lib/rich-text-codemirror.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@ firepad.RichTextCodeMirror = (function () {
420420
'.' + className;
421421

422422
this.addStyleWithCSS_(selector + ' { ' + css + ' }');
423+
424+
// As of v5.48, CodeMirror applies its own pre style which conflicts with ours, so we
425+
// need to make sure we add our styles with a more-specific css selector as well.
426+
if (attr === ATTR.LINE_INDENT) {
427+
var selector = 'pre.CodeMirror-line.' + className;
428+
this.addStyleWithCSS_(selector + ' { ' + css + ' }');
429+
}
423430
}
424431
}
425432
}

0 commit comments

Comments
 (0)