From b8f9fafed02d3120850fb07e1d91efe7ead40214 Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Sun, 21 Jul 2024 13:14:22 +0200 Subject: [PATCH] Add `code` to the default rich text configuration (#406) --- crates/loro-common/src/error.rs | 2 +- crates/loro-internal/src/container/richtext/config.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/loro-common/src/error.rs b/crates/loro-common/src/error.rs index f7e843bb..2b69f44c 100644 --- a/crates/loro-common/src/error.rs +++ b/crates/loro-common/src/error.rs @@ -46,7 +46,7 @@ pub enum LoroError { ArgErr(Box), #[error("Auto commit has not started. The doc is readonly when detached. You should ensure autocommit is on and the doc and the state is attached.")] AutoCommitNotStarted, - #[error("You need to specify the style flag for \"({0:?})\" before mark with this key")] + #[error("Style configuration missing for \"({0:?})\". Please provide the style configuration using `configTextStyle` on your Loro doc.")] StyleConfigMissing(InternalString), #[error("Unknown Error ({0})")] Unknown(Box), diff --git a/crates/loro-internal/src/container/richtext/config.rs b/crates/loro-internal/src/container/richtext/config.rs index 8a7a254a..5cb15cd5 100644 --- a/crates/loro-internal/src/container/richtext/config.rs +++ b/crates/loro-internal/src/container/richtext/config.rs @@ -93,6 +93,13 @@ impl StyleConfigMap { expand: ExpandType::None, }, ); + + map.map.insert( + "code".into(), + StyleConfig { + expand: ExpandType::None, + }, + ); map }