Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- `<ApplicationViewability />`
- component for hiding elements in specific media
- `<InlineText />`
- force children to get displayed as inline content
- force children to get displayed as inline content
- `<StringPreviewContentBlobToggler />`
- `useOnly` property: specify if only parts of the content should be used for the shortened preview, this property replaces `firstNonEmptyLineOnly`
- `useOnly` property: specify if only parts of the content should be used for the shortened preview, this property replaces `firstNonEmptyLineOnly`

### Fixed

- `<Tag />`
- create more whitespace inside `small` tag
- reduce visual impact of border
- `<StringPreviewContentBlobToggler />`
- take Markdown rendering into account before testing the maximum preview length
- take Markdown rendering into account before testing the maximum preview length
- `<NodeContent />`
- header-menu items are vertically centered now
- `Typography`
- adjust displaying fallback symbols in different browsers
- adjust displaying fallback symbols in different browsers
- `<CodeMirror />`
- Use the latest provided `onChange` function and `disabled` prop

### Changed

Expand All @@ -43,7 +45,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Deprecated

- `<StringPreviewContentBlobToggler />`
- `firstNonEmptyLineOnly` will be removed, is replaced by `useOnly="firstNonEmptyLine"`
- `firstNonEmptyLineOnly` will be removed, is replaced by `useOnly="firstNonEmptyLine"`

## [25.0.0] - 2025-12-01

Expand Down
10 changes: 7 additions & 3 deletions src/extensions/codemirror/CodeMirror.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ export const CodeEditor = ({
currentView.current = view
const currentReadOnly = React.useRef(readOnly)
currentReadOnly.current = readOnly
const currentOnChange = React.useRef(onChange)
currentOnChange.current = onChange
const currentDisabled = React.useRef(disabled)
currentDisabled.current = disabled
const [showPreview, setShowPreview] = React.useState<boolean>(false);
// CodeMirror Compartments in order to allow for re-configuration after initialization
const readOnlyCompartment = React.useRef<Compartment>(compartment())
Expand Down Expand Up @@ -319,11 +323,11 @@ export const CodeEditor = ({
disabledCompartment.current.of(EditorView?.editable.of(!disabled)),
AdaptedEditorViewDomEventHandlers(domEventHandlers) as Extension,
EditorView?.updateListener.of((v: ViewUpdate) => {
if (disabled) return;
if (currentDisabled.current) return;

if (onChange && v.docChanged) {
if (currentOnChange.current && v.docChanged) {
// Only fire if the text has actually been changed
onChange(v.state.doc.toString());
currentOnChange.current(v.state.doc.toString());
}

if (onSelection)
Expand Down