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 }