diff --git a/plugins/english/fenrirrealm.ts b/plugins/english/fenrirrealm.ts
index 62a85de..291dc6c 100644
--- a/plugins/english/fenrirrealm.ts
+++ b/plugins/english/fenrirrealm.ts
@@ -75,7 +75,7 @@ class FenrirRealmPlugin implements Plugin.PluginBase {
name = 'Fenrir Realm';
icon = 'src/en/fenrirrealm/icon.png';
site = 'https://fenrirealm.com';
- version = '1.1.0';
+ version = '1.1.1';
imageRequestInit?: Plugin.ImageRequestInit | undefined = undefined;
hideLocked = storage.get('hideLocked');
@@ -221,44 +221,78 @@ class FenrirRealmPlugin implements Plugin.PluginBase {
const content = json.content;
if (content) {
- const parsedContent: Chapter = JSON.parse(content);
- if (parsedContent.type === 'doc') {
- return parsedContent.content
- .map(node => {
- if (node.type === 'paragraph') {
- const innerHtml =
- node.content
- ?.map(c => {
- if (c.type === 'text') {
- let text = c.text;
- if (c.marks) {
- for (const mark of c.marks) {
- if (mark.type === 'bold') text = `${text}`;
- if (mark.type === 'italic') text = `${text}`;
- if (mark.type === 'underline')
- text = `${text}`;
- if (mark.type === 'strike')
- text = `${text}`;
- if (mark.type === 'link')
- text = `${text}`;
+ try {
+ // Attempt 1: Handle legacy stringified TipTap JSON AST schema
+ const parsedContent: Chapter = JSON.parse(content);
+ if (parsedContent.type === 'doc') {
+ return parsedContent.content
+ .map(node => {
+ if (node.type === 'paragraph') {
+ const innerHtml =
+ node.content
+ ?.map(c => {
+ if (c.type === 'text') {
+ let text = c.text;
+ if (c.marks) {
+ for (const mark of c.marks) {
+ if (mark.type === 'bold') text = `${text}`;
+ if (mark.type === 'italic')
+ text = `${text}`;
+ if (mark.type === 'underline')
+ text = `${text}`;
+ if (mark.type === 'strike')
+ text = `${text}`;
+ if (mark.type === 'link')
+ text = `${text}`;
+ }
}
+ return text;
}
- return text;
- }
- if (c.type === 'hardBreak') return '
';
- return '';
- })
- .join('') || '';
- return `
${innerHtml}
`; - } - if (node.type === 'heading') { - const level = node.attrs?.level || 1; - const innerHtml = node.content?.map(c => c.text).join('') || ''; - return `${innerHtml}
`; + } + if (node.type === 'heading') { + const level = node.attrs?.level || 1; + const innerHtml = + node.content?.map(c => c.text).join('') || ''; + return `