Skip to content

Commit

Permalink
Text: Improve readonly mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-jaussaud committed Oct 30, 2024
1 parent b8e8b93 commit 0d95eb1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion assets/build/beaver-builder/index.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/default/index.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/elementor/index.min.css

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions assets/build/index.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/wp/index.min.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions assets/src/codemirror/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
placeholder
} from '@codemirror/view'

import { EditorState } from '@codemirror/state'
import { dynamicValueRegex } from '../dynamic-values'

/**
Expand Down Expand Up @@ -108,8 +109,10 @@ const createInput = (

/**
* Readonly mode
* @see https://codemirror.net/docs/ref/#state.EditorState.readOnly
* @see https://discuss.codemirror.net/t/codemirror-6-readonly-view/2333
*/
EditorState.readOnly.of(config.readOnly ?? false),
EditorView.contentAttributes.of({
contenteditable: ! (config.readOnly ?? false)
}),
Expand Down
1 change: 1 addition & 0 deletions assets/src/components/dynamic/text-input/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
border-color: rgba(black, 0.1);
color: rgba(black, 0.4);
background: rgba(white, 0.5);
pointer-events: none;

.tf-dynamic-text-input__affix {
border-color: rgba(black, 0.1);
Expand Down

0 comments on commit 0d95eb1

Please sign in to comment.