Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the unable to cast to JToken exception #40

Merged
merged 4 commits into from
Oct 23, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,26 @@ internal class TablePropertyIndexValueFactory : IPropertyIndexValueFactory {
}

private static IEnumerable<string?> ProcessRow(JArray row) {

foreach (JToken cell in row) {
yield return cell.Value<string>("value")?.StripHtml();

JToken? value = cell.Value<JToken>("value");

switch (value?.Type) {

case JTokenType.String:
yield return value.Value<string>()?.StripHtml();
break;

case JTokenType.Object:
string? markup = ((JObject) value).GetValue("markup")?.Value<string>();
yield return markup?.StripHtml();
break;

}

}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
value: cell.value
},
submit: function (model) {
cell.value = model.prop.value?.markup ? model.prop.value.markup : model.prop.value;
cell.value = typeof model.prop.value === "string" ? model.prop.value : model.prop.value?.markup ?? "";
editorService.close();
},
close: function () {
Expand Down