Fix smart cell editor when no language is specified

This commit is contained in:
Jonatan Kłosko 2023-07-22 00:23:14 +02:00
parent 790c41e096
commit 165eff6734
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,9 @@
import LiveEditor from "./cell_editor/live_editor";
import { getAttributeOrThrow, parseBoolean } from "../lib/attribute";
import {
getAttributeOrDefault,
getAttributeOrThrow,
parseBoolean,
} from "../lib/attribute";
const CellEditor = {
mounted() {
@ -70,7 +74,7 @@ const CellEditor = {
return {
cellId: getAttributeOrThrow(this.el, "data-cell-id"),
tag: getAttributeOrThrow(this.el, "data-tag"),
language: getAttributeOrThrow(this.el, "data-language"),
language: getAttributeOrDefault(this.el, "data-language", null),
intellisense: getAttributeOrThrow(
this.el,
"data-intellisense",

View file

@ -364,7 +364,7 @@ defprotocol Livebook.Runtime do
@typedoc """
Smart cell editor configuration.
"""
@type editor :: %{language: String.t(), placement: :bottom | :top, source: String.t()}
@type editor :: %{language: String.t() | nil, placement: :bottom | :top, source: String.t()}
@typedoc """
An opaque file reference.