Skip to content

Commit 44f4e9a

Browse files
committed
Fix disabled state in management
1 parent 7a4e941 commit 44f4e9a

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

rdmo/core/assets/scss/_bs53/base/typography.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ button.unstyled {
108108
}
109109

110110
.bi {
111-
font-weight: bold;
112-
-webkit-text-stroke: 0.5px currentColor;
111+
font-weight: bold;
112+
-webkit-text-stroke: 0.5px currentColor;
113+
114+
&.disabled,
115+
&:disabled {
116+
color: var(--bs-secondary-color) !important;
117+
cursor: not-allowed !important;
118+
}
113119
}
114120

115121
.cursor-pointer {

rdmo/management/assets/js/components/common/DragAndDrop.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ const Drag = ({ element, show=true }) => {
1616

1717
drag(dragRef)
1818

19+
const className = classNames('bi bi-arrows-move drag', {
20+
'disabled': element.read_only
21+
})
22+
1923
return show && <span className="drag">
20-
<i className="bi bi-arrows-move drag" ref={dragRef} aria-hidden="true"></i>
24+
<i className={className} ref={dragRef} aria-hidden="true"></i>
2125
</span>
2226
}
2327

rdmo/management/assets/js/components/edit/common/CodeMirror.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import classNames from 'classnames'
55
import isEmpty from 'lodash/isEmpty'
66
import isNil from 'lodash/isNil'
77
import get from 'lodash/get'
8+
import { EditorView } from '@codemirror/view'
89
import ReactCodeMirror from '@uiw/react-codemirror'
910
import { html } from '@codemirror/lang-html'
1011

@@ -22,16 +23,23 @@ const CodeMirror = ({ element, field, onChange }) => {
2223
errors = get(element, ['errors', field])
2324

2425
const className = classNames('codemirror form-control', {
25-
'is-invalid': !isEmpty(errors)
26+
'is-invalid': !isEmpty(errors),
27+
'disabled': element.read_only
2628
})
2729

2830
const value = isNil(element[field]) ? '' : element[field]
2931

32+
const extensions = [html()]
33+
34+
if (element.read_only) {
35+
extensions.push(EditorView.editable.of(false))
36+
}
37+
3038
return (
3139
<div className="mb-3">
3240
<label className="control-label" htmlFor={id}>{label}</label>
3341

34-
<ReactCodeMirror className={className} id={id} value={value} extensions={[html()]}
42+
<ReactCodeMirror className={className} id={id} value={value} extensions={extensions}
3543
onChange={(value) => onChange(field, value)} disabled={element.read_only} />
3644

3745
<ErrorList errors={errors} />

rdmo/management/assets/scss/management.scss

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@
1818
padding: 0.3rem 0.75rem;
1919
}
2020

21-
// .pull-right {
22-
// .element-link,
23-
// .element-btn-link,
24-
// .element-button {
25-
// margin-left: 4px;
26-
27-
// &.disabled,
28-
// &:disabled {
29-
// color: #ccc !important;
30-
// cursor: not-allowed !important;
31-
// }
32-
// }
33-
// }
34-
3521
.drag {
3622
color: var(--rdmo-color-link);
3723

@@ -118,6 +104,12 @@
118104
outline: 0;
119105
box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
120106
}
107+
108+
&.disabled {
109+
.cm-scroller {
110+
background-color: var(--bs-secondary-bg);
111+
}
112+
}
121113
}
122114

123115
.field-diff {

0 commit comments

Comments
 (0)