Skip to content

Commit f59dac6

Browse files
committed
fix(json-crdt-extensions): 🐛 corrections after refactor
1 parent 2c491bb commit f59dac6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/json-crdt-extensions/peritext/registry/SliceRegistry.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class SliceRegistry {
101101
}
102102
const tagStr = CommonSliceType[tag as SliceTypeCon];
103103
if (tagStr && typeof tagStr === 'string')
104-
_fromHtml.set(tagStr, [[entry, () => [type, null]]]);
104+
_fromHtml.set(tagStr, [[entry, () => [tag, null]]]);
105105
}
106106

107107
public toHtml(el: PeritextMlElement): ReturnType<ToHtmlConverter<any>> | undefined {
@@ -116,9 +116,11 @@ export class SliceRegistry {
116116
for (const [entry, converter] of converters) {
117117
const result = converter(el);
118118
if (result) {
119-
const attr = result[1] ?? (result[1] = {});
120-
attr.inline = entry.isInline();
121-
attr.behavior = !attr.inline ? SliceBehavior.Marker : (entry.behavior ?? SliceBehavior.Many);
119+
if (entry.isInline()) {
120+
const attr = result[1] ?? (result[1] = {});
121+
attr.inline = entry.isInline();
122+
attr.behavior = !attr.inline ? SliceBehavior.Marker : (entry.behavior ?? SliceBehavior.Many);
123+
}
122124
return result;
123125
}
124126
}

src/json-crdt-extensions/peritext/slice/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export enum SliceTypeName {
8888
pre = SliceTypeCon.pre,
8989
ul = SliceTypeCon.ul,
9090
ol = SliceTypeCon.ol,
91-
tasklist = SliceTypeCon.tasklist,
91+
tl = SliceTypeCon.tl,
9292
h1 = SliceTypeCon.h1,
9393
h2 = SliceTypeCon.h2,
9494
h3 = SliceTypeCon.h3,

0 commit comments

Comments
 (0)